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 . |
static String |
parseIdentifier(String text)
Deprecated.
|
protected String |
parseIdentifier(org.antlr.runtime.tree.Tree tree)
Deprecated.
|
protected ParsedExpression |
parseInNamespace(org.antlr.runtime.tree.Tree tree,
Type expectedType,
NamespaceModel namespace) |
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 ParsedExpression |
parseInNewNamespace(org.antlr.runtime.tree.Tree tree,
Type expectedType,
com.whitestein.lsps.lang.parser.ParserWorker worker) |
protected abstract ParsedExpression |
parseNoCheck(org.antlr.runtime.tree.Tree tree,
Type expectedType)
Parse expression.
|
QID |
parseQID(org.antlr.runtime.tree.Tree tree)
Deprecated.
Use
QID.parse(Tree) |
static void |
transform(org.antlr.runtime.tree.CommonTree tree)
Deprecated.
|
protected ParsedExpression |
validateOrConvert(ParsedExpression expr,
Type expectedType)
Provides some validation and conversion
|
begin, end, getASTNode, getFullText, getText, line, parseQIDAst, setFullText
public AbstractParser(NamespaceModel namespace)
namespace
- protected NamespaceModel getNamespace()
@Deprecated public static void transform(org.antlr.runtime.tree.CommonTree tree)
ParserUtil.transform(CommonTree)
tree
- 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(org.antlr.runtime.tree.Tree tree, Type expectedType, com.whitestein.lsps.lang.parser.ParserWorker 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 types@Deprecated public QID parseQID(org.antlr.runtime.tree.Tree tree)
QID.parse(Tree)
tree
- NullPointerException
- if the tree
is nullIllegalArgumentException
- if the tree
is not a valid qualified identifier tree@Deprecated protected String parseIdentifier(org.antlr.runtime.tree.Tree tree)
ParserUtil.parseIdentifier(Tree)
tree
- @Deprecated public static String parseIdentifier(String text)
ParserUtil.parseIdentifier(String)
text
- Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.