Package org.apache.groovy.parser.antlr4
Class SemanticPredicates
java.lang.Object
org.apache.groovy.parser.antlr4.SemanticPredicates
public class SemanticPredicates
extends java.lang.Object
Some semantic predicates for altering the behaviour of the lexer and parser
-
Constructor Summary
Constructors Constructor Description SemanticPredicates() -
Method Summary
Modifier and Type Method Description static booleanisFollowedBy(org.antlr.v4.runtime.CharStream cs, char... chars)static booleanisFollowedByJavaLetterInGString(org.antlr.v4.runtime.CharStream cs)static booleanisFollowedByWhiteSpaces(org.antlr.v4.runtime.CharStream cs)static booleanisFollowingArgumentsOrClosure(GroovyParser.ExpressionContext context)Check whether following a method name of command expression.static booleanisInvalidLocalVariableDeclaration(org.antlr.v4.runtime.TokenStream ts)Distinguish between local variable declaration and method call, e.g.static booleanisInvalidMethodDeclaration(org.antlr.v4.runtime.TokenStream ts)Distinguish between method declaration and method call/constructor declarationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
SemanticPredicates
public SemanticPredicates()
-
-
Method Details
-
isFollowedByWhiteSpaces
public static boolean isFollowedByWhiteSpaces(org.antlr.v4.runtime.CharStream cs) -
isFollowedBy
public static boolean isFollowedBy(org.antlr.v4.runtime.CharStream cs, char... chars) -
isFollowedByJavaLetterInGString
public static boolean isFollowedByJavaLetterInGString(org.antlr.v4.runtime.CharStream cs) -
isFollowingArgumentsOrClosure
Check whether following a method name of command expression. Method name should not end with "2: arguments" and "3: closure"- Parameters:
context- the preceding expression
-
isInvalidMethodDeclaration
public static boolean isInvalidMethodDeclaration(org.antlr.v4.runtime.TokenStream ts)Distinguish between method declaration and method call/constructor declaration -
isInvalidLocalVariableDeclaration
public static boolean isInvalidLocalVariableDeclaration(org.antlr.v4.runtime.TokenStream ts)Distinguish between local variable declaration and method call, e.g. `a b`
-