public class FlowExpressionParseUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
FlowExpressionParseUtil.FlowExpressionContext
Context used to parse a flow expression.
|
static class |
FlowExpressionParseUtil.FlowExpressionParseException
An exception that indicates a parse error.
|
| Modifier and Type | Field and Description |
|---|---|
protected static Pattern |
FLOAT_PATTERN
Matches (some) floating-point and double literals.
|
protected static Pattern |
IDENTIFIER_PATTERN
Matches an identifier.
|
protected static String |
IDENTIFIER_REGEX
Regular expression for an identifier.
|
protected static Pattern |
INT_PATTERN
Matches integer literals.
|
protected static Pattern |
LONG_PATTERN
Matches long literals.
|
protected static Pattern |
PARAMETER_PATTERN
Matches a parameter.
|
protected static String |
PARAMETER_REGEX
Regular expression for a formal parameter use.
|
protected static Pattern |
PARENTHESES_PATTERN
Matches an expression contained in matching start and end parentheses.
|
protected static Pattern |
STARTS_WITH_IDENTIFIER_PATTERN
Matches a string starting with an identifier.
|
protected static Pattern |
STARTS_WITH_STRING_PATTERN
Matches an expression that starts with a string.
|
protected static Pattern |
STRING_PATTERN
Matches string literals.
|
protected static String |
STRING_REGEX
Regular expression for a string literal.
|
protected static Pattern |
STRING_SELECT_PATTERN
Matches member select on a string, such as
"hello".length. |
protected static Pattern |
UNANCHORED_PARAMETER_PATTERN
Unanchored; can be used to find all formal parameter uses.
|
| Constructor and Description |
|---|
FlowExpressionParseUtil() |
| Modifier and Type | Method and Description |
|---|---|
static FlowExpressions.Receiver |
internalReprOfVariable(AnnotatedTypeFactory provider,
VariableTree tree) |
static List<Integer> |
parameterIndices(String s) |
static FlowExpressions.Receiver |
parse(String expression,
FlowExpressionParseUtil.FlowExpressionContext context,
TreePath localScope,
boolean useLocalScope)
Parse a string and return its representation as a
FlowExpressions.Receiver, or throw an FlowExpressionParseUtil.FlowExpressionParseException. |
protected static final String IDENTIFIER_REGEX
protected static final String PARAMETER_REGEX
protected static final String STRING_REGEX
protected static final Pattern UNANCHORED_PARAMETER_PATTERN
protected static final Pattern PARAMETER_PATTERN
protected static final Pattern IDENTIFIER_PATTERN
protected static final Pattern STARTS_WITH_IDENTIFIER_PATTERN
protected static final Pattern INT_PATTERN
protected static final Pattern LONG_PATTERN
protected static final Pattern FLOAT_PATTERN
protected static final Pattern STRING_PATTERN
protected static final Pattern PARENTHESES_PATTERN
protected static final Pattern STARTS_WITH_STRING_PATTERN
protected static final Pattern STRING_SELECT_PATTERN
"hello".length.public static FlowExpressions.Receiver parse(String expression, FlowExpressionParseUtil.FlowExpressionContext context, TreePath localScope, boolean useLocalScope) throws FlowExpressionParseUtil.FlowExpressionParseException
FlowExpressions.Receiver, or throw an FlowExpressionParseUtil.FlowExpressionParseException.expression - flow expression to parsecontext - information about any receiver and argumentslocalScope - path to local scope to useuseLocalScope - whether localScope should be used to resolve identifiersFlowExpressionParseUtil.FlowExpressionParseExceptionpublic static List<Integer> parameterIndices(String s)
s. Each
formal parameter occurs in s as a string like "#1" or "#4". This routine does not do
proper parsing; for instance, if "#2" appears within a string in s, then 2 would still be
in the result list.public static FlowExpressions.Receiver internalReprOfVariable(AnnotatedTypeFactory provider, VariableTree tree) throws FlowExpressionParseUtil.FlowExpressionParseException