Package org.commonmark.parser.beta
Class Scanner
java.lang.Object
org.commonmark.parser.beta.Scanner
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charCharacter representing the end of input source (or outside of the text in case of the "previous" methods).private intprivate SourceLineprivate intprivate intprivate final List<SourceLine> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcheckPosition(int lineIndex, int index) intfind(char c) intfind(CharMatcher matcher) booleanhasNext()intmatch(CharMatcher matcher) intmatchMultiple(char c) voidnext()booleannext(char c) Check if the specified char is next and advance the position.booleanCheck if we have the specified content on the line and advanced the position.static Scannerof(SourceLines lines) charpeek()intintposition()private voidsetLine(SourceLine line) voidsetPosition(Position position) int
-
Field Details
-
END
public static final char ENDCharacter representing the end of input source (or outside of the text in case of the "previous" methods).Note that we can use NULL to represent this because CommonMark does not allow those in the input (we replace them in the beginning of parsing).
- See Also:
-
lines
-
lineIndex
private int lineIndex -
index
private int index -
line
-
lineLength
private int lineLength
-
-
Constructor Details
-
Scanner
Scanner(List<SourceLine> lines, int lineIndex, int index)
-
-
Method Details
-
of
-
peek
public char peek() -
peekCodePoint
public int peekCodePoint() -
peekPreviousCodePoint
public int peekPreviousCodePoint() -
hasNext
public boolean hasNext() -
next
public void next() -
next
public boolean next(char c) Check if the specified char is next and advance the position.- Parameters:
c- the char to check (including newline characters)- Returns:
- true if matched and position was advanced, false otherwise
-
next
Check if we have the specified content on the line and advanced the position. Note that if you want to match newline characters, usenext(char).- Parameters:
content- the text content to match on a single line (excluding newline characters)- Returns:
- true if matched and position was advanced, false otherwise
-
matchMultiple
public int matchMultiple(char c) -
match
-
whitespace
public int whitespace() -
find
public int find(char c) -
find
-
position
-
setPosition
-
getSource
-
setLine
-
checkPosition
private void checkPosition(int lineIndex, int index)
-