Class Scanner

java.lang.Object
org.commonmark.parser.beta.Scanner

public class Scanner extends Object
  • Field Details

    • 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:
    • lines

      private final List<SourceLine> lines
    • lineIndex

      private int lineIndex
    • index

      private int index
    • line

      private SourceLine line
    • lineLength

      private int lineLength
  • Constructor Details

    • Scanner

      Scanner(List<SourceLine> lines, int lineIndex, int index)
  • Method Details

    • of

      public static Scanner of(SourceLines lines)
    • 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(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)
    • match

      public int match(CharMatcher matcher)
    • whitespace

      public int whitespace()
    • find

      public int find(char c)
    • find

      public int find(CharMatcher matcher)
    • position

      public Position position()
    • setPosition

      public void setPosition(Position position)
    • getSource

      public SourceLines getSource(Position begin, Position end)
    • setLine

      private void setLine(SourceLine line)
    • checkPosition

      private void checkPosition(int lineIndex, int index)