public enum ParserState extends Enum<ParserState>
| Enum Constant and Description |
|---|
END
The parser is in this state if it is currently parsing a line that is the delimiter between two Diffs.
|
FROM_FILE
The parser is in this state if it is currently parsing the line containing the "from" file.
|
FROM_LINE
The parser is in this state if it is currently parsing a line containing a line that is in the first file,
but not the second (a "from" line).
|
HEADER
The parser is in this state if it is currently parsing a header line.
|
HUNK_START
The parser is in this state if it is currently parsing a line containing the header of a hunk.
|
INITIAL
This is the initial state of the parser.
|
NEUTRAL_LINE
The parser is in this state if it is currently parsing a line that is contained in both files (a "neutral" line).
|
TO_FILE
The parser is in this state if it is currently parsing the line containing the "to" file.
|
TO_LINE
The parser is in this state if it is currently parsing a line containing a line that is in the second file,
but not the first (a "to" line).
|
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
logger |
| Modifier and Type | Method and Description |
|---|---|
protected void |
logTransition(String currentLine,
ParserState fromState,
ParserState toState) |
protected boolean |
matchesEndPattern(String line,
ParseWindow window) |
protected boolean |
matchesFromFilePattern(String line) |
protected boolean |
matchesFromLinePattern(String line) |
protected boolean |
matchesHunkStartPattern(String line) |
protected boolean |
matchesToFilePattern(String line) |
protected boolean |
matchesToLinePattern(String line) |
abstract ParserState |
nextState(ParseWindow window)
Returns the next state of the state machine depending on the current state and the content of a window of lines around the line
that is currently being parsed.
|
static ParserState |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static ParserState[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ParserState INITIAL
public static final ParserState HEADER
public static final ParserState FROM_FILE
--- /path/to/file.txtpublic static final ParserState TO_FILE
+++ /path/to/file.txtpublic static final ParserState HUNK_START
@@ -1,5 +2,6 @@public static final ParserState FROM_LINE
- only the dash at the start is importantpublic static final ParserState TO_LINE
+ only the plus at the start is importantpublic static final ParserState NEUTRAL_LINE
public static final ParserState END
public static ParserState[] values()
for (ParserState c : ParserState.values()) System.out.println(c);
public static ParserState valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant
with the specified nameNullPointerException - if the argument is nullpublic abstract ParserState nextState(ParseWindow window)
window - the window around the line currently being parsed.protected void logTransition(String currentLine, ParserState fromState, ParserState toState)
protected boolean matchesFromFilePattern(String line)
protected boolean matchesToFilePattern(String line)
protected boolean matchesFromLinePattern(String line)
protected boolean matchesToLinePattern(String line)
protected boolean matchesHunkStartPattern(String line)
protected boolean matchesEndPattern(String line, ParseWindow window)
Copyright © 2016. All rights reserved.