Class JavaCCGlobals

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.List<NormalProduction> bnfproductions
      A list of all grammar productions - normal and JAVACODE - in the order they appear in the input file.
      protected static int ccol
      The character's column
      protected static int cline
      The character's line
      static java.util.List<Token> cu_from_insertion_point_2
      This is the list of all tokens that appear after the tokens in "cu_to_insertion_point_2" and until "PARSER_END(name)".
      static java.lang.String cu_name
      The name of the parser class (what appears in PARSER_BEGIN and PARSER_END).
      static java.util.List<Token> cu_to_insertion_point_1
      This is a list of tokens that appear after "PARSER_BEGIN(name)" all the way until (but not including) the opening brace "{" of the class "name".
      static java.util.List<Token> cu_to_insertion_point_2
      This is the list of all tokens that appear after the tokens in "cu_to_insertion_point_1" and until (but not including) the closing brace "}" of the class "name".
      static java.lang.String fileName
      The name of the grammar file being processed.
      protected static int jj2index
      jj2 methods calls index shared between ParseEngine and ParseGen
      static boolean jjtreeGenerated
      Set to true if this file has been processed by JJTree.
      static java.util.Hashtable<java.lang.Integer,​java.lang.String> lexstate_I2S
      A mapping of the internal integer representations of lexical states to their strings.
      static java.util.Map<java.lang.String,​java.lang.Integer> lexstate_S2I
      A mapping of lexical state strings to their integer internal representation.
      static boolean lookaheadNeeded
      True if lookahead needed, false otherwise
      protected static int maskindex
      Mask index shared between ParseEngine and ParseGen
      protected static java.util.List<int[]> maskVals
      Mask values shared between ParseEngine and ParseGen
      static java.util.Map<java.lang.String,​RegularExpression_> named_tokens_table
      This is a symbol table that contains all named tokens (those that are defined with a label).
      static java.util.Map<java.lang.Integer,​java.lang.String> names_of_tokens
      A mapping of ordinal values (represented as objects of type "Integer") to the corresponding labels (of type "String").
      static java.util.List<RegularExpression_> ordered_named_tokens
      Contains the same entries as "named_tokens_table", but this is an ordered list which is ordered by the order of appearance in the input file.
      static java.lang.String origFileName
      The name of the original file (before processing by JJTree).
      static java.util.Map<java.lang.String,​NormalProduction> production_table
      A symbol table of all grammar productions - normal and JAVACODE.
      static java.util.List<TokenProduction> rexprlist
      The list of all TokenProductions from the input file.
      static java.util.Map<java.lang.Integer,​RegularExpression_> rexps_of_tokens
      A mapping of ordinal values (represented as objects of type "Integer") to the corresponding RegularExpression_'s.
      static java.util.Map<java.lang.String,​java.util.Hashtable<java.lang.String,​java.util.Hashtable<java.lang.String,​RegularExpression_>>> simple_tokens_table
      This is a three-level symbol table that contains all simple tokens (those that are defined using a single string (with or without a label).
      static java.util.List<Token> token_mgr_decls
      The declarations to be inserted into the TokenManager class.
      static int tokenCount
      The total number of distinct tokens.
      protected static java.lang.String toolName
      String that identifies the JavaCC generated files.
      static java.util.List<java.lang.String> toolNames
      The list of tools that have participated in generating the input grammar file.
    • Constructor Summary

      Constructors 
      Constructor Description
      JavaCCGlobals()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String add_escapes​(java.lang.String str)  
      static java.lang.String addUnicodeEscapes​(java.lang.String str)  
      static void bannerLine​(java.lang.String fullName, java.lang.String ver)
      This prints the banner line when the various tools are invoked.
      static void createOutputDir​(java.io.File outputDir)
      Creates an output directory.
      static java.lang.String getIdString​(java.lang.String tn, java.lang.String fn)  
      static java.lang.String getIdString​(java.util.List<java.lang.String> tns, java.lang.String fn)  
      static java.util.List<java.lang.String> getToolNames​(java.lang.String fn)  
      static boolean isGeneratedBy​(java.lang.String tn, java.lang.String fn)  
      protected static java.lang.String printLeadingComments​(Token t)  
      protected static void printLeadingComments​(Token t, java.io.PrintWriter out)
      Prints the leading specials of a token on a PrintWriter.
      protected static java.lang.String printToken​(Token t)  
      protected static void printToken​(Token t, java.io.PrintWriter out)
      Prints a token on a PrintWriter including the specials.
      protected static void printTokenList​(java.util.List<Token> list, java.io.PrintWriter out)
      Prints a list of tokens on a PrintWriter without the specials.
      protected static java.lang.String printTokenOnly​(Token t)  
      protected static void printTokenOnly​(Token t, java.io.PrintWriter out)
      Prints a token on a PrintWriter without the specials.
      protected static void printTokenSetup​(Token t)
      Sets up line and column information for a given token.
      protected static java.lang.String printTrailingComments​(Token t)  
      protected static void printTrailingComments​(Token t, java.io.PrintWriter out)
      Prints the trailing specials of a token on a PrintWriter.
      static void reInit()
      Reinitializes
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • toolName

        protected static final java.lang.String toolName
        String that identifies the JavaCC generated files.
        See Also:
        Constant Field Values
      • fileName

        public static java.lang.String fileName
        The name of the grammar file being processed.
      • origFileName

        public static java.lang.String origFileName
        The name of the original file (before processing by JJTree). Currently this is the same as fileName.
      • jjtreeGenerated

        public static boolean jjtreeGenerated
        Set to true if this file has been processed by JJTree.
      • toolNames

        public static java.util.List<java.lang.String> toolNames
        The list of tools that have participated in generating the input grammar file.
      • cu_name

        public static java.lang.String cu_name
        The name of the parser class (what appears in PARSER_BEGIN and PARSER_END).
      • cu_to_insertion_point_1

        public static java.util.List<Token> cu_to_insertion_point_1
        This is a list of tokens that appear after "PARSER_BEGIN(name)" all the way until (but not including) the opening brace "{" of the class "name".
      • cu_to_insertion_point_2

        public static java.util.List<Token> cu_to_insertion_point_2
        This is the list of all tokens that appear after the tokens in "cu_to_insertion_point_1" and until (but not including) the closing brace "}" of the class "name".
      • cu_from_insertion_point_2

        public static java.util.List<Token> cu_from_insertion_point_2
        This is the list of all tokens that appear after the tokens in "cu_to_insertion_point_2" and until "PARSER_END(name)".
      • bnfproductions

        public static java.util.List<NormalProduction> bnfproductions
        A list of all grammar productions - normal and JAVACODE - in the order they appear in the input file. Each entry here will be a subclass of "NormalProduction".
      • production_table

        public static java.util.Map<java.lang.String,​NormalProduction> production_table
        A symbol table of all grammar productions - normal and JAVACODE. The symbol table is indexed by the name of the left hand side non-terminal. Its contents are of type "NormalProduction".
      • lexstate_S2I

        public static java.util.Map<java.lang.String,​java.lang.Integer> lexstate_S2I
        A mapping of lexical state strings to their integer internal representation. Integers are stored as java.lang.Integer's.
      • lexstate_I2S

        public static java.util.Hashtable<java.lang.Integer,​java.lang.String> lexstate_I2S
        A mapping of the internal integer representations of lexical states to their strings. Integers are stored as java.lang.Integer's.
      • token_mgr_decls

        public static java.util.List<Token> token_mgr_decls
        The declarations to be inserted into the TokenManager class.
      • rexprlist

        public static java.util.List<TokenProduction> rexprlist
        The list of all TokenProductions from the input file. This list includes implicit TokenProductions that are created for uses of regular expressions within BNF productions.
      • tokenCount

        public static int tokenCount
        The total number of distinct tokens. This is therefore one more than the largest assigned token ordinal.
      • named_tokens_table

        public static java.util.Map<java.lang.String,​RegularExpression_> named_tokens_table
        This is a symbol table that contains all named tokens (those that are defined with a label). The index to the table is the image of the label and the contents of the table are of type "RegularExpression_".
      • ordered_named_tokens

        public static java.util.List<RegularExpression_> ordered_named_tokens
        Contains the same entries as "named_tokens_table", but this is an ordered list which is ordered by the order of appearance in the input file.
      • names_of_tokens

        public static java.util.Map<java.lang.Integer,​java.lang.String> names_of_tokens
        A mapping of ordinal values (represented as objects of type "Integer") to the corresponding labels (of type "String"). An entry exists for an ordinal value only if there is a labeled token corresponding to this entry. If there are multiple labels representing the same ordinal value, then only one label is stored.
      • rexps_of_tokens

        public static java.util.Map<java.lang.Integer,​RegularExpression_> rexps_of_tokens
        A mapping of ordinal values (represented as objects of type "Integer") to the corresponding RegularExpression_'s.
      • simple_tokens_table

        public static java.util.Map<java.lang.String,​java.util.Hashtable<java.lang.String,​java.util.Hashtable<java.lang.String,​RegularExpression_>>> simple_tokens_table
        This is a three-level symbol table that contains all simple tokens (those that are defined using a single string (with or without a label). The index to the first level table is a lexical state which maps to a second level hashtable. The index to the second level hashtable is the string of the simple token converted to upper case, and this maps to a third level hashtable. This third level hashtable contains the actual string of the simple token and maps it to its RegularExpression_.
      • maskindex

        protected static int maskindex
        Mask index shared between ParseEngine and ParseGen
      • jj2index

        protected static int jj2index
        jj2 methods calls index shared between ParseEngine and ParseGen
      • lookaheadNeeded

        public static boolean lookaheadNeeded
        True if lookahead needed, false otherwise
      • maskVals

        protected static java.util.List<int[]> maskVals
        Mask values shared between ParseEngine and ParseGen
      • cline

        protected static int cline
        The character's line
      • ccol

        protected static int ccol
        The character's column
    • Constructor Detail

      • JavaCCGlobals

        public JavaCCGlobals()
    • Method Detail

      • bannerLine

        public static void bannerLine​(java.lang.String fullName,
                                      java.lang.String ver)
        This prints the banner line when the various tools are invoked.
        Parameters:
        fullName - - the tool full name
        ver - - the tool version
      • getIdString

        public static java.lang.String getIdString​(java.lang.String tn,
                                                   java.lang.String fn)
        Parameters:
        tn - - a toolname
        fn - - a file name
        Returns:
        the identifying string for the file name, given a toolname used to generate it
      • getIdString

        public static java.lang.String getIdString​(java.util.List<java.lang.String> tns,
                                                   java.lang.String fn)
        Parameters:
        tns - - a list of toolnames
        fn - - a file name
        Returns:
        the identifying string for the file name, given a set of tool names that are used to generate it
      • isGeneratedBy

        public static boolean isGeneratedBy​(java.lang.String tn,
                                            java.lang.String fn)
        Parameters:
        tn - - a toolname
        fn - - a file name
        Returns:
        true if tool name passed is one of the tool names returned by getToolNames(String)getToolNames
      • getToolNames

        public static java.util.List<java.lang.String> getToolNames​(java.lang.String fn)
        Parameters:
        fn - - a file name
        Returns:
        the list of names of the tools that have been used to generate the given file
      • createOutputDir

        public static void createOutputDir​(java.io.File outputDir)
        Creates an output directory.
        Parameters:
        outputDir - - the output directory to be created
      • add_escapes

        public static java.lang.String add_escapes​(java.lang.String str)
        Parameters:
        str - - a string
        Returns:
        the escaped string for common characters
      • addUnicodeEscapes

        public static java.lang.String addUnicodeEscapes​(java.lang.String str)
        Parameters:
        str - - a string
        Returns:
        the escaped string for unicode characters
      • printTokenSetup

        protected static void printTokenSetup​(Token t)
        Sets up line and column information for a given token.
        Parameters:
        t - - a token
      • printTokenOnly

        protected static void printTokenOnly​(Token t,
                                             java.io.PrintWriter out)
        Prints a token on a PrintWriter without the specials.
        Parameters:
        t - - a token
        out - - a PrintWriter
      • printToken

        protected static void printToken​(Token t,
                                         java.io.PrintWriter out)
        Prints a token on a PrintWriter including the specials.
        Parameters:
        t - - a token
        out - - a PrintWriter
      • printTokenList

        protected static void printTokenList​(java.util.List<Token> list,
                                             java.io.PrintWriter out)
        Prints a list of tokens on a PrintWriter without the specials.
        Parameters:
        list - - a tokens list
        out - - a PrintWriter
      • printLeadingComments

        protected static void printLeadingComments​(Token t,
                                                   java.io.PrintWriter out)
        Prints the leading specials of a token on a PrintWriter.
        Parameters:
        t - - a token
        out - - a PrintWriter
      • printTrailingComments

        protected static void printTrailingComments​(Token t,
                                                    java.io.PrintWriter out)
        Prints the trailing specials of a token on a PrintWriter.
        Parameters:
        t - - a token
        out - - a PrintWriter
      • printTokenOnly

        protected static java.lang.String printTokenOnly​(Token t)
        Parameters:
        t - - a token
        Returns:
        a printing of a token without the specials
      • printToken

        protected static java.lang.String printToken​(Token t)
        Parameters:
        t - - a token
        Returns:
        a printing of a token including the specials
      • printLeadingComments

        protected static java.lang.String printLeadingComments​(Token t)
        Parameters:
        t - - a token
        Returns:
        a printing of the leading specials of a token
      • printTrailingComments

        protected static java.lang.String printTrailingComments​(Token t)
        Parameters:
        t - - a token
        Returns:
        a printing of the trailing specials of a token
      • reInit

        public static void reInit()
        Reinitializes