Class SemanticPredicates

java.lang.Object
org.apache.groovy.parser.antlr4.SemanticPredicates

public class SemanticPredicates extends Object
Some semantic predicates for altering the behaviour of the lexer and parser
  • 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

      public static boolean isFollowingArgumentsOrClosure(GroovyParser.ExpressionContext context)
      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`