public class Parser extends AbstractParser
Expression which
can be interpreted using Interpreter.
Each expression is parsed in context of NamespaceModel which provides variables,
functions, etc.| Modifier and Type | Field and Description |
|---|---|
static String |
DEBUG
A debug expression keyword.
|
static String |
DEBUG_ELEMENT_ID
A debug expression element id attribute key.
|
static String |
DEBUG_PROPERTY
A debug expression property attribute key.
|
static String |
DEREFERENCE_OP
Deprecated.
|
static String |
REFERENCE_OP
Deprecated.
|
| Constructor and Description |
|---|
Parser()
Creates a new parser.
|
Parser(NamespaceModel namespace)
Creates a new parser.
|
Parser(NamespaceModel namespace,
Collection<String> freeTypes)
Creates a new parser with a collection of free type names that can be used in the expression.
|
Parser(NamespaceModel namespace,
Collection<String> freeTypes,
FreeTypeMapping freeTypeMapping)
Creates a new parser with a collection of free type names that can be used in the expression.
|
Parser(NamespaceModel namespace,
Collection<String> freeTypes,
FreeTypeMapping freeTypeMapping,
ParserVariableHelper variableHelper)
Creates a new parser with a collection of free type names that can be used in the expression.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkNamespace() |
static String |
createDateLiteral(Date date)
Creates a date literal.
|
static String |
createStringLiteral(String string)
Deprecated.
|
static String |
createSymbolLiteral(String string)
Deprecated.
|
protected TypeParser |
createTypeParser() |
protected int |
debugLine(org.antlr.runtime.tree.Tree tree) |
static String |
encodeIdentifier(String id)
Deprecated.
|
protected ValidationException |
error(String message,
org.antlr.runtime.tree.Tree tree) |
Type |
findNamedType(QID qid)
Finds a named type.
|
protected Visibility |
getAccessiblePropertyVisibility(Expression primaryExpression,
RecordType declarationType) |
protected Set<String> |
getFreeTypes() |
static Set<String> |
getLanguageKeywords()
Deprecated.
|
static Set<String> |
getReservedKeywords()
Deprecated.
|
ParserVariableHelper |
getVariableHelper() |
static boolean |
isEmptyExpression(String source)
Deprecated.
|
static boolean |
isLanguageIdentifier(String id)
Deprecated.
|
protected boolean |
isPropertyReadonly(PropertyExpression pe) |
Expression |
parse(AntlrExpressionTree expressionTree,
Type expectedType)
Parses an expression from a pre-parsed antlr tree for the given expected type.
|
Expression |
parse(String source,
Type expectedType)
Parses an expression from a string source for the given expected type.
|
static Date |
parseDateLiteral(String text)
Parses a given date literal.
|
protected IdentifierAst |
parseIdentifierAst(org.antlr.runtime.tree.Tree tree) |
ParsedExpression |
parseLax(AntlrExpressionTree expressionTree,
Type expectedType)
Parses an expression from a pre-parsed antlr tree for the given expected type.
|
protected ParsedExpression |
parseNoCheck(org.antlr.runtime.tree.Tree tree,
Type expectedType)
Parse expression.
|
QID |
parseQID(String string)
Deprecated.
|
static String |
parseStringLiteral(String text)
Deprecated.
|
protected Type |
parseType(org.antlr.runtime.tree.Tree tree) |
void |
setDebugLineOffset(int debugLineOffset)
Sets the debug line offset that will be applied to parsed
expressions.
|
protected void |
setFreeTypes(Set<String> freeTypes) |
protected Errors |
validateControlExpressions(Expression expression) |
protected ParsedExpression |
validateOrConvert(ParsedExpression expr,
Type expectedType)
Provides some validation and conversion
|
checkTreeType, createConstant, createConstant, getAstInfo, getNamespace, parse, parseIdentifier, parseIdentifier, parseInNamespace, parseInNewNamespace, parseInNewNamespace, parseQID, transformbegin, end, getASTNode, getFullText, getText, line, parseQIDAst, setFullTextpublic static final String DEBUG
public static final String DEBUG_ELEMENT_ID
public static final String DEBUG_PROPERTY
@Deprecated public static final String REFERENCE_OP
ParserUtil.REFERENCE_OP@Deprecated public static final String DEREFERENCE_OP
ParserUtil.DEREFERENCE_OPpublic Parser()
public Parser(NamespaceModel namespace)
namespace - public Parser(NamespaceModel namespace, Collection<String> freeTypes)
namespace - freeTypes - public Parser(NamespaceModel namespace, Collection<String> freeTypes, FreeTypeMapping freeTypeMapping)
namespace - freeTypes - freeTypeMapping - public Parser(NamespaceModel namespace, Collection<String> freeTypes, FreeTypeMapping freeTypeMapping, ParserVariableHelper variableHelper)
namespace - freeTypes - freeTypeMapping - variableHelper - protected TypeParser createTypeParser()
public ParserVariableHelper getVariableHelper()
protected ValidationException error(String message, org.antlr.runtime.tree.Tree tree)
@Deprecated public static boolean isEmptyExpression(String source)
ParserUtil.isEmptyExpression(String)true if the given expression is null,
or an empty string, or a string containing only whitespaces or comments.source - true if the given expression is emptypublic Expression parse(String source, Type expectedType) throws ValidationException
Returns null if the source string is null or empty or contains
only whitespaces or comments.
source - expectedType - NullPointerException - if expectedType is nullValidationException - if the source is not a valid expression or it is not of the
expectedTypepublic Expression parse(AntlrExpressionTree expressionTree, Type expectedType) throws ValidationException
Returns null if the source string is null or empty or contains
only whitespaces or comments.
expressionTree - expectedType - NullPointerException - if expectedType is nullValidationException - if the source is not a valid expression or it is not of the
expectedTypepublic ParsedExpression parseLax(AntlrExpressionTree expressionTree, Type expectedType)
Returns null if the source string is null or empty or contains
only whitespaces or comments.
expressionTree - expectedType - NullPointerException - if expectedType is nullprotected final void checkNamespace()
protected Type parseType(org.antlr.runtime.tree.Tree tree) throws ValidationException
ValidationException@Deprecated public QID parseQID(String string) throws ValidationException
QID.parse(String)string - ValidationException - if the string is not a valid qualified identifierNullPointerException - if the string is null@Deprecated public static boolean isLanguageIdentifier(String id)
ParserUtil.isLanguageIdentifier(String)id - @Deprecated public static Set<String> getLanguageKeywords()
ParserUtil.getLanguageKeywords()@Deprecated public static Set<String> getReservedKeywords()
ParserUtil.getReservedKeywords()@Deprecated public static String encodeIdentifier(String id)
ParserUtil.encodeIdentifier(String)id - NullPointerException - if the id is null@Deprecated public static String createStringLiteral(String string)
ParserUtil.createStringLiteral(String)string - @Deprecated public static String createSymbolLiteral(String string)
ParserUtil.createSymbolLiteral(String)string - public final Type findNamedType(QID qid) throws AmbiguousTypeException
qid - AmbiguousTypeExceptionprotected ParsedExpression parseNoCheck(org.antlr.runtime.tree.Tree tree, Type expectedType)
AbstractParserparseNoCheck in class AbstractParserpublic void setDebugLineOffset(int debugLineOffset)
debugLineOffset - protected int debugLine(org.antlr.runtime.tree.Tree tree)
debugLine in class AbstractParserprotected Visibility getAccessiblePropertyVisibility(Expression primaryExpression, RecordType declarationType)
protected ParsedExpression validateOrConvert(ParsedExpression expr, Type expectedType)
AbstractParservalidateOrConvert in class AbstractParserprotected boolean isPropertyReadonly(PropertyExpression pe)
@Deprecated public static String parseStringLiteral(String text)
ParserUtil.parseStringLiteral(String)text - public static Date parseDateLiteral(String text) throws ValidationException
text - ValidationExceptionpublic static String createDateLiteral(Date date)
date - protected IdentifierAst parseIdentifierAst(org.antlr.runtime.tree.Tree tree)
protected Errors validateControlExpressions(Expression expression)
Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.