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 boolean isFollowedBy​(org.antlr.v4.runtime.CharStream cs, char... chars)  
    static boolean isFollowedByJavaLetterInGString​(org.antlr.v4.runtime.CharStream cs)  
    static boolean isFollowedByWhiteSpaces​(org.antlr.v4.runtime.CharStream cs)  
    static boolean isFollowingArgumentsOrClosure​(GroovyParser.ExpressionContext context)
    Check whether following a method name of command expression.
    static boolean isInvalidLocalVariableDeclaration​(org.antlr.v4.runtime.TokenStream ts)
    Distinguish between local variable declaration and method call, e.g.
    static boolean isInvalidMethodDeclaration​(org.antlr.v4.runtime.TokenStream ts)
    Distinguish between method declaration and method call/constructor declaration

    Methods 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

      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`