Class Scanner


  • public class Scanner
    extends java.lang.Object
    • Field Detail

      • END

        public static final char END
        Character 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:
        Constant Field Values
      • lines

        private final java.util.List<SourceLine> lines
      • lineIndex

        private int lineIndex
      • index

        private int index
      • lineLength

        private int lineLength
    • Constructor Detail

      • Scanner

        Scanner​(java.util.List<SourceLine> lines,
                int lineIndex,
                int index)
    • Method Detail

      • 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

        public boolean next​(java.lang.String content)
        Check if we have the specified content on the line and advanced the position. Note that if you want to match newline characters, use next(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)
      • whitespace

        public int whitespace()
      • find

        public int find​(char c)
      • setPosition

        public void setPosition​(Position position)
      • setLine

        private void setLine​(SourceLine line)
      • checkPosition

        private void checkPosition​(int lineIndex,
                                   int index)