Package redempt.redlex.parser
Class Parser
java.lang.Object
redempt.redlex.parser.Parser
A parser which will parse an input string and convert it according to predefined rules
-
Method Summary
Modifier and TypeMethodDescriptionstatic Parser
create
(Lexer lexer, ParserComponent... components) Creates a parser from a lexer and componentsgetLexer()
Parses the input string and returns the resultParses the input string and returns the result
-
Method Details
-
create
Creates a parser from a lexer and components- Parameters:
lexer
- The Lexer used to tokenize inputcomponents
- The components used to parse tokens- Returns:
- A Parser using the given components and lexer
-
getLexer
- Returns:
- The Lexer this Parser wraps
-
parse
Parses the input string and returns the result- Parameters:
input
- The string to parseerrorOnFail
- Whether to throw a LexException for invalid format, returns null if false- Returns:
- The parsed object
-
parse
Parses the input string and returns the result- Parameters:
input
- The string to parse- Returns:
- The parsed object
-