Package org.nineml.coffeegrinder.parser
Class ParserInput
- java.lang.Object
-
- org.nineml.coffeegrinder.parser.ParserInput
-
public class ParserInput extends java.lang.ObjectParser input.The parser input class represents input to the parser.
-
-
Field Summary
Fields Modifier and Type Field Description static intCRA carriage return character.static intLFA line feed characterstatic intLINE_SEPARATORA line separator character.static intNELA new line (NEL) character.
-
Constructor Summary
Constructors Constructor Description ParserInput(ParserOptions options)Create a new parser input.ParserInput(ParserOptions options, boolean usesRegex)Creates a new parser input.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfrom(java.lang.String input)Constructs parser input from a string.voidfrom(java.util.Iterator<Token> input)Constructs parser input from a token iterator.voidfrom(Token[] input)Constructs parser input from an array of tokens.java.lang.StringgetString()The input (string) that was parsed.Token[]tokens()The input tokens that were parsed.
-
-
-
Field Detail
-
CR
public static final int CR
A carriage return character.- See Also:
- Constant Field Values
-
LF
public static final int LF
A line feed character- See Also:
- Constant Field Values
-
NEL
public static final int NEL
A new line (NEL) character.- See Also:
- Constant Field Values
-
LINE_SEPARATOR
public static final int LINE_SEPARATOR
A line separator character.- See Also:
- Constant Field Values
-
-
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 optionsusesRegex- 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.
-
-