Class JavaCCGlobals
java.lang.Object
EDU.purdue.jtb.parser.JavaCCGlobals
- Direct Known Subclasses:
JavaCCParserInternals, LexGen, UnusedJavaFiles, UnusedLookaheadCalc, UnusedOtherFilesGen, UnusedParseEngine, UnusedParseGen, UnusedSemanticize
This package contains data created as a result of parsing and semanticizing a JavaCC input file. This data
is what is used by the back-ends of JavaCC as well as any other back-end of JavaCC related tools such as
JJTree.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic List<NormalProduction> A list of all grammar productions - normal and JAVACODE - in the order they appear in the input file.protected static intThe character's columnprotected static intThe character's lineThis is the list of all tokens that appear after the tokens in "cu_to_insertion_point_2" and until "PARSER_END(name)".static StringThe name of the parser class (what appears in PARSER_BEGIN and PARSER_END).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".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 StringThe name of the grammar file being processed.protected static intjj2 methods calls index shared between ParseEngine and ParseGenstatic booleanSet to true if this file has been processed by JJTree.A mapping of the internal integer representations of lexical states to their strings.A mapping of lexical state strings to their integer internal representation.static booleanTrue if lookahead needed, false otherwiseprotected static intMask index shared between ParseEngine and ParseGenprotected static List<int[]> Mask values shared between ParseEngine and ParseGenstatic Map<String, RegularExpression_> This is a symbol table that contains all named tokens (those that are defined with a label).A mapping of ordinal values (represented as objects of type "Integer") to the corresponding labels (of type "String").static List<RegularExpression_> 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 StringThe name of the original file (before processing by JJTree).static Map<String, NormalProduction> A symbol table of all grammar productions - normal and JAVACODE.static List<TokenProduction> The list of all TokenProductions from the input file.static Map<Integer, RegularExpression_> A mapping of ordinal values (represented as objects of type "Integer") to the corresponding RegularExpression_'s.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 declarations to be inserted into the TokenManager class.static intThe total number of distinct tokens.protected static final StringString that identifies the JavaCC generated files.The list of tools that have participated in generating the input grammar file. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringadd_escapes(String str) static StringaddUnicodeEscapes(String str) static voidbannerLine(String fullName, String ver) This prints the banner line when the various tools are invoked.static voidcreateOutputDir(File outputDir) Creates an output directory.static StringgetIdString(String tn, String fn) static StringgetIdString(List<String> tns, String fn) getToolNames(String fn) static booleanisGeneratedBy(String tn, String fn) protected static Stringprotected static voidprintLeadingComments(Token t, PrintWriter out) Prints the leading specials of a token on aPrintWriter.protected static StringprintToken(Token t) protected static voidprintToken(Token t, PrintWriter out) Prints a token on aPrintWriterincluding the specials.protected static voidprintTokenList(List<Token> list, PrintWriter out) Prints a list of tokens on aPrintWriterwithout the specials.protected static Stringprotected static voidprintTokenOnly(Token t, PrintWriter out) Prints a token on aPrintWriterwithout the specials.protected static voidSets up line and column information for a given token.protected static Stringprotected static voidprintTrailingComments(Token t, PrintWriter out) Prints the trailing specials of a token on aPrintWriter.static voidreInit()Reinitializes
-
Field Details
-
toolName
-
fileName
The name of the grammar file being processed. -
origFileName
The name of the original file (before processing by JJTree). Currently this is the same as fileName. -
jjtreeGenerated
public static boolean jjtreeGeneratedSet to true if this file has been processed by JJTree. -
toolNames
-
cu_name
The name of the parser class (what appears in PARSER_BEGIN and PARSER_END). -
cu_to_insertion_point_1
-
cu_to_insertion_point_2
-
cu_from_insertion_point_2
-
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
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
-
lexstate_I2S
-
token_mgr_decls
-
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 tokenCountThe total number of distinct tokens. This is therefore one more than the largest assigned token ordinal. -
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
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
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
A mapping of ordinal values (represented as objects of type "Integer") to the corresponding RegularExpression_'s. -
simple_tokens_table
public static Map<String, Hashtable<String, Hashtable<String, RegularExpression_>>> simple_tokens_tableThis 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 maskindexMask index shared between ParseEngine and ParseGen -
jj2index
protected static int jj2indexjj2 methods calls index shared between ParseEngine and ParseGen -
lookaheadNeeded
public static boolean lookaheadNeededTrue if lookahead needed, false otherwise -
maskVals
Mask values shared between ParseEngine and ParseGen -
cline
protected static int clineThe character's line -
ccol
protected static int ccolThe character's column
-
-
Constructor Details
-
JavaCCGlobals
public JavaCCGlobals()
-
-
Method Details
-
bannerLine
-
getIdString
-
getIdString
-
isGeneratedBy
- Parameters:
tn- - a toolnamefn- - a file name- Returns:
- true if tool name passed is one of the tool names returned by
getToolNames(String)getToolNames
-
getToolNames
-
createOutputDir
Creates an output directory.- Parameters:
outputDir- - the output directory to be created
-
add_escapes
-
addUnicodeEscapes
-
printTokenSetup
Sets up line and column information for a given token.- Parameters:
t- - a token
-
printTokenOnly
Prints a token on aPrintWriterwithout the specials.- Parameters:
t- - a tokenout- - aPrintWriter
-
printToken
Prints a token on aPrintWriterincluding the specials.- Parameters:
t- - a tokenout- - aPrintWriter
-
printTokenList
Prints a list of tokens on aPrintWriterwithout the specials.- Parameters:
list- - a tokens listout- - aPrintWriter
-
printLeadingComments
Prints the leading specials of a token on aPrintWriter.- Parameters:
t- - a tokenout- - aPrintWriter
-
printTrailingComments
Prints the trailing specials of a token on aPrintWriter.- Parameters:
t- - a tokenout- - aPrintWriter
-
printTokenOnly
-
printToken
-
printLeadingComments
-
printTrailingComments
-
reInit
public static void reInit()Reinitializes
-