public abstract class AbstractParser extends ParserBase
Constructor and Description |
---|
AbstractParser(NamespaceModel namespace)
Creates new parser.
|
Modifier and Type | Method and Description |
---|---|
protected org.antlr.runtime.tree.Tree |
checkTreeType(org.antlr.runtime.tree.Tree tree,
int type)
Check whether the given tree node has any of the given types.
|
protected Expression |
createConstant(org.antlr.runtime.tree.Tree tree,
Object constant)
Creates constant with the given value
|
protected ParsedExpression |
createConstant(org.antlr.runtime.tree.Tree tree,
Object constant,
Type type)
Creates constant of the given type, with the given value
|
protected int |
debugLine(org.antlr.runtime.tree.Tree tree) |
protected ASTInfo |
getAstInfo(org.antlr.runtime.tree.Tree tree) |
protected NamespaceModel |
getNamespace() |
protected ParsedExpression |
parse(org.antlr.runtime.tree.Tree tree,
Type expectedType)
Parse an expression from a tree for the given
expectedType . |
protected ParsedExpression |
parseInNamespace(org.antlr.runtime.tree.Tree tree,
Type expectedType,
NamespaceModel namespace) |
protected ParsedExpression |
parseInNewNamespace(java.util.function.Supplier<ParsedExpression> worker) |
protected ParsedExpression |
parseInNewNamespace(org.antlr.runtime.tree.Tree tree,
Type expectedType)
Parses a given tree in a new namespace to provide a correct separation of
local variables.
|
protected abstract ParsedExpression |
parseNoCheck(org.antlr.runtime.tree.Tree tree,
Type expectedType)
Parse expression.
|
protected ParsedExpression |
validateOrConvert(ParsedExpression expr,
Type expectedType)
Provides some validation and conversion
|
begin, end, getASTNode, getFullText, getText, line, parseIdentifierAst, parseQIDAst, setFullText
public AbstractParser(NamespaceModel namespace)
namespace
- protected NamespaceModel getNamespace()
protected ASTInfo getAstInfo(org.antlr.runtime.tree.Tree tree)
protected int debugLine(org.antlr.runtime.tree.Tree tree)
protected Expression createConstant(org.antlr.runtime.tree.Tree tree, Object constant)
tree
- constant
- protected ParsedExpression createConstant(org.antlr.runtime.tree.Tree tree, Object constant, Type type)
tree
- constant
- type
- protected ParsedExpression parse(org.antlr.runtime.tree.Tree tree, Type expectedType)
expectedType
.
Before a tree is parsed it must be transformed using
ParserUtil.transform(CommonTree)
.tree
- expectedType
- NullPointerException
- if the tree
or the expectedType
is nullIllegalArgumentException
- if the tree
is not a valid expression treeprotected ParsedExpression parseInNamespace(org.antlr.runtime.tree.Tree tree, Type expectedType, NamespaceModel namespace)
tree
- expectedType
- namespace
- protected ParsedExpression parseInNewNamespace(org.antlr.runtime.tree.Tree tree, Type expectedType)
tree
- expectedType
- protected ParsedExpression parseInNewNamespace(java.util.function.Supplier<ParsedExpression> worker)
protected ParsedExpression validateOrConvert(ParsedExpression expr, Type expectedType)
expr
- expectedType
- protected abstract ParsedExpression parseNoCheck(org.antlr.runtime.tree.Tree tree, Type expectedType)
tree
- expectedType
- protected org.antlr.runtime.tree.Tree checkTreeType(org.antlr.runtime.tree.Tree tree, int type)
tree
- type
- IllegalArgumentException
- if the tree node type does not match any of the given typesCopyright © 2007-2020 Whitestein Technologies. All Rights Reserved.