Package org.commonmark.parser.beta
Class Scanner
java.lang.Object
org.commonmark.parser.beta.Scanner
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final char
Character representing the end of input source (or outside of the text in case of the "previous" methods).private int
private SourceLine
private int
private int
private final List
<SourceLine> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
checkPosition
(int lineIndex, int index) int
find
(char c) int
find
(CharMatcher matcher) boolean
hasNext()
int
match
(CharMatcher matcher) int
matchMultiple
(char c) void
next()
boolean
next
(char c) Check if the specified char is next and advance the position.boolean
Check if we have the specified content on the line and advanced the position.static Scanner
of
(SourceLines lines) char
peek()
int
int
position()
private void
setLine
(SourceLine line) void
setPosition
(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)
-