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 |
arrayPattern
Matches an array access
|
protected static Pattern |
dotPattern
Matches a field access
|
protected static Pattern |
identifierPattern
Matches an identifier
|
protected static String |
identifierRegex
Regular expression for an identifier
|
protected static Pattern |
intPattern
Matches integer literals
|
protected static Pattern |
itselfPattern
Matches 'itself' - it refers to the variable that is annotated, which is different from 'this'
|
protected static Pattern |
longPattern
Matches long literals
|
protected static Pattern |
methodPattern
Matches a method call
|
protected static Pattern |
nullPattern
Matches the null literal
|
protected static Pattern |
parameterPattern
Matches a parameter
|
protected static Pattern |
parametersPattern
Finds all parameters
|
protected static Pattern |
selfPattern
Matches the self reference.
|
protected static Pattern |
stringPattern
Matches string literals
|
protected static Pattern |
superPattern
Matches 'super'
|
Constructor and Description |
---|
FlowExpressionParseUtil() |
protected static final String identifierRegex
protected static final Pattern parameterPattern
protected static final Pattern parametersPattern
protected static final Pattern selfPattern
protected static final Pattern itselfPattern
protected static final Pattern superPattern
protected static final Pattern identifierPattern
protected static final Pattern methodPattern
protected static final Pattern arrayPattern
protected static final Pattern dotPattern
protected static final Pattern intPattern
protected static final Pattern longPattern
protected static final Pattern stringPattern
protected static final Pattern nullPattern
public static FlowExpressions.Receiver parse(String s, FlowExpressionParseUtil.FlowExpressionContext context, TreePath path) throws FlowExpressionParseUtil.FlowExpressionParseException
FlowExpressions.Receiver
, or
throw an FlowExpressionParseUtil.FlowExpressionParseException
. The expression is assumed
to be used in the context of a method.
Returns null if 'itself' is passed in as the string to parse
and no receiver named 'itself' could be found.s
- The string to parse.context
- information about any receiver and argumentspath
- The current tree path.FlowExpressionParseUtil.FlowExpressionParseException
public static List<Integer> parameterIndices(String s)
s
, identified by the
number of the parameter (starting at 1).public static FlowExpressionParseUtil.FlowExpressionContext buildFlowExprContextForDeclaration(MethodTree node, Tree classTree, BaseContext checkerContext)
FlowExpressionParseUtil.FlowExpressionContext
for the method node
as
seen at the method declaration.public static FlowExpressionParseUtil.FlowExpressionContext buildFlowExprContextForDeclaration(MethodTree node, TypeMirror classType, BaseContext checkerContext)
FlowExpressionParseUtil.FlowExpressionContext
for the method node
as
seen at the method declaration.public static FlowExpressionParseUtil.FlowExpressionContext buildFlowExprContextForDeclaration(MethodTree node, TreePath currentPath, BaseContext checkerContext)
FlowExpressionParseUtil.FlowExpressionContext
for the method node
as
seen at the method declaration.public static FlowExpressionParseUtil.FlowExpressionContext buildFlowExprContextForUse(MethodInvocationNode n, BaseContext checkerContext)
FlowExpressionParseUtil.FlowExpressionContext
for the method n
(represented as a Node
as seen at the method use (i.e.,
at a method call site).public static FlowExpressionParseUtil.FlowExpressionContext buildFlowExprContextForUse(ObjectCreationNode n, TreePath currentPath, BaseContext checkerContext)
FlowExpressionParseUtil.FlowExpressionContext
for the constructor n
(represented as a Node
as seen at the method use (i.e.,
at a method call site).public static FlowExpressionParseUtil.FlowExpressionContext buildFlowExprContextForViewpointUse(Node node, TreePath pathToInvocation, TreePath enclosingMethodPath, BaseContext checkerContext)
IllegalArgumentException
- if node is not a MethodInvocationNode or ObjectCreationNodepublic static FlowExpressionParseUtil.FlowExpressionContext buildFlowExprContextForViewpointUse(MethodInvocationNode n, TreePath enclosingMethodPath, BaseContext checkerContext)
public static FlowExpressionParseUtil.FlowExpressionContext buildFlowExprContextForViewpointUse(ObjectCreationNode n, TreePath currentPath, TreePath enclosingMethodPath, BaseContext checkerContext)