Class Parser
java.lang.Object
com.inductiveautomation.snap.parse.Parser
- Direct Known Subclasses:
- JavaParser,- ParseUtils.DebugParser
A class to parse a given input (string) using given rule(s).
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected ParseNodecreateNode(ParseRule aRule, Token aStartToken, Token anEndToken) Creates a node for given rule and start/end tokens (returns a shared node by default).protected ParseRuleCreates the top level rule.protected TokenizerCreates the tokenizer instance and initializes patters from rule.protected TokenizerCreates the tokenizer instance.getInput()Returns the current parse character input.protected TokengetLookAheadToken(int anIndex) Returns the look ahead token at given index.protected TokenFetches and returns the next token.getRule()Returns the top level rule.getToken()Returns the current token.Returns the tokenizer.protected intReturns a parse node if this rule matches string.parse()Parses input and returns ParseNode.protected ParseNodeparse(ParseRule aRule, ParseHandler aHandler) Returns a parse node if this rule matches string.parse(CharSequence anInput) Parses a given input and returns ParseNode (convenience).<T> TparseCustom(CharSequence anInput, Class<T> aClass) Parses given input and returns custom parse tree node (convenience).<T> TparseCustom(Class<T> aClass) Parses input and returns custom parse tree node.protected voidparseFailed(ParseRule aRule, ParseHandler aHandler, ParseRule.Count aCount) Called when parse fails.setInput(CharSequence aSequence) Sets the current parse string.voidSets the top level rule.protected voidsetTokenizer(Tokenizer aTokenizer) Sets the tokenizer.
- 
Constructor Details- 
Parserpublic Parser()Creates a new Parser.
- 
ParserCreates a new Parser for given rule.
 
- 
- 
Method Details- 
getRuleReturns the top level rule.
- 
setRuleSets the top level rule.
- 
createRuleCreates the top level rule.
- 
getInputReturns the current parse character input.
- 
setInputSets the current parse string.
- 
getTokenizerReturns the tokenizer.
- 
createTokenizerCreates the tokenizer instance and initializes patters from rule.
- 
createTokenizerImplCreates the tokenizer instance.
- 
setTokenizerSets the tokenizer.
- 
getTokenReturns the current token.
- 
getNextTokenFetches and returns the next token.
- 
getLookAheadTokenReturns the look ahead token at given index.
- 
parseParses input and returns ParseNode.
- 
parseCustomParses input and returns custom parse tree node.
- 
parseReturns a parse node if this rule matches string.
- 
createNodeCreates a node for given rule and start/end tokens (returns a shared node by default).
- 
lookAheadprotected int lookAhead(ParseRule aRule, int aLookAhead, int aTokenIndex, int aPathIndex, int aRuleIndex) Returns a parse node if this rule matches string.
- 
parseFailedCalled when parse fails.
- 
parseParses a given input and returns ParseNode (convenience).
- 
parseCustomParses given input and returns custom parse tree node (convenience).
 
-