Class StructuredGrammarParser
java.lang.Object
com.singularsys.extensions.structure.StructuredGrammarParser
- All Implemented Interfaces:
GrammarParser,Serializable
A grammar parser which works with structured programming.
- Author:
- Richard Morris
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstruct the parser -
Method Summary
Modifier and TypeMethodDescriptionMain entry point used by the ConfigurableParserCallback function used by GrammarMatchers where the matcher expects a simple number, variable, or function call with optional, prefix or suffix operator.Calls the parseSubExpression method of the ShuntingYardvoidSet the iterator used by theGrammarParser.parseSubExpression()
-
Field Details
-
it
-
-
Constructor Details
-
StructuredGrammarParser
Construct the parser- Parameters:
head- root of the rules for parsing the structured grammarsy- base parser for expressions
-
-
Method Details
-
parse
Description copied from interface:GrammarParserMain entry point used by the ConfigurableParser- Specified by:
parsein interfaceGrammarParser- Parameters:
input- iterator with the list of tokens- Returns:
- the generated parser tree
- Throws:
ParseException- if the input cannot be parsed
-
setIterator
Description copied from interface:GrammarParserSet the iterator used by theGrammarParser.parseSubExpression()- Specified by:
setIteratorin interfaceGrammarParser- Parameters:
it- the iterator
-
parseSubExpression
Calls the parseSubExpression method of the ShuntingYard- Specified by:
parseSubExpressionin interfaceGrammarParser- Returns:
- the root node of the matched sub expression.
- Throws:
ParseException- if the input cannot be parsed
-
parsePrefixSuffix
Description copied from interface:GrammarParserCallback function used by GrammarMatchers where the matcher expects a simple number, variable, or function call with optional, prefix or suffix operator.- Specified by:
parsePrefixSuffixin interfaceGrammarParser- Returns:
- the root node of the matched sub expression.
- Throws:
ParseException- if the input cannot be parsed
-