Class ParserInput


  • public class ParserInput
    extends java.lang.Object
    Parser input.

    The parser input class represents input to the parser.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int CR
      A carriage return character.
      static int LF
      A line feed character
      static int LINE_SEPARATOR
      A line separator character.
      static int NEL
      A new line (NEL) character.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void from​(java.lang.String input)
      Constructs parser input from a string.
      void from​(java.util.Iterator<Token> input)
      Constructs parser input from a token iterator.
      void from​(Token[] input)
      Constructs parser input from an array of tokens.
      java.lang.String getString()
      The input (string) that was parsed.
      Token[] tokens()
      The input tokens that were parsed.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ParserInput

        public ParserInput​(ParserOptions options)
        Create a new parser input.

        By default, regular expressions are not used.

        Parameters:
        options - the parser options.
      • ParserInput

        public ParserInput​(ParserOptions options,
                           boolean usesRegex)
        Creates a new parser input.
        Parameters:
        options - the parser options
        usesRegex - true if regular expressions are allowed.
    • Method Detail

      • getString

        public java.lang.String getString()
        The input (string) that was parsed.
        Returns:
        the string.
        Throws:
        java.lang.IllegalStateException - if the input has not been parsed.
      • tokens

        public Token[] tokens()
        The input tokens that were parsed.
        Returns:
        the tokens.
        Throws:
        java.lang.IllegalStateException - if the input has not been parsed.
      • from

        public void from​(java.lang.String input)
        Constructs parser input from a string.
        Parameters:
        input - the string.
      • from

        public void from​(Token[] input)
        Constructs parser input from an array of tokens.
        Parameters:
        input - the tokens.
      • from

        public void from​(java.util.Iterator<Token> input)
        Constructs parser input from a token iterator.
        Parameters:
        input - the iterator.