Three classes are produced by this code:
Three parse tables are created as part of the parser class:
In addition to the method interface, this class maintains a series of public global variables and flags indicating how misc. parts of the code and other output is to be produced, and counting things such as number of conflicts detected (see the source code and public variables below for more details).
This class is "static" (contains only static data and methods).
java_cup.main
| Modifier and Type | Field and Description |
|---|---|
| protected static boolean | |
| public static String | action_code
User declarations for direct inclusion in user action class. |
| public static long | action_code_time
Time to produce action code class. |
| public static long | action_table_time
Time to produce the action table. |
| public static long | goto_table_time
Time to produce the reduce-goto table. |
| public static Stack | import_list
List of imports (Strings containing class names) to go with actions. |
| public static String | init_code
User code for user_init() which is called during parser initialization. |
| public static int | not_reduced
Count of the number on non-reduced productions found. |
| public static boolean | nowarn
Do we skip warnings? |
| public static int | num_conflicts
Number of conflict found while building tables. |
| public static String | package_name
Package that the resulting code goes into (null is used for unnamed). |
| public static String | parser_class_name
Name of the generated parser class. |
| public static String | parser_code
User declarations for direct inclusion in parser class. |
| public static long | parser_time
Time to produce parser class. |
| public static String | prefix
The prefix placed on names that pollute someone else's name space. |
| public static long | production_table_time
Time to produce the production table. |
| public static String | scan_code
User code for scan() which is called to get the next Symbol. |
| public static production | start_production
The start production of the grammar. |
| public static String | symbol_const_class_name
Name of the generated class for symbol constants. |
| public static long | symbols_time
Time to produce symbol constant class. |
| public static int | unused_non_term
Count of unused non terminals. |
| public static int | unused_term
Count of unused terminals. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| protected static void | do_action_table(PrintWriter
stream to produce output on. out, parse_action_table the internal representation of the action table. act_tab, boolean do we use the most frequent reduce as default? compact_reduces)Emit the action table. |
| protected static int | |
| protected static int | |
| protected static void | do_reduce_table(PrintWriter
stream to produce output on. out, parse_reduce_table the internal representation of the reduce-goto table. red_tab)Emit the reduce-goto table. |
| protected static void | |
| protected static void | emit_action_code(PrintWriter
stream to produce output on. out, production the start production of the grammar. start_prod)Emit code for the non-public class holding the actual action code. |
| protected static void | |
| protected static void | |
| public static boolean | |
| public static void | parser(PrintWriter
stream to produce output on. out, parse_action_table internal representation of the action table. action_table, parse_reduce_table internal representation of the reduce-goto table. reduce_table, int start state of the parse machine. start_st, production start production of the grammar. start_prod, boolean do we use most frequent reduce as default? compact_reduces, boolean should scanner be suppressed for compatibility? suppress_scanner)Emit the parser subclass with embedded tables. |
| protected static String | |
| protected static void | |
| public static void | symbols(PrintWriter
stream to produce output on. out, boolean do we emit constants for non terminals? emit_non_terms, boolean should we emit an interface, rather than a class? sym_interface)Emit code for the symbol constant class, optionally including non terms, if they have been requested. |
| _lr_values | back to summary |
|---|---|
| protected static boolean _lr_values | |
| action_code | back to summary |
|---|---|
| public static String action_code User declarations for direct inclusion in user action class. | |
| action_code_time | back to summary |
|---|---|
| public static long action_code_time Time to produce action code class. | |
| action_table_time | back to summary |
|---|---|
| public static long action_table_time Time to produce the action table. | |
| goto_table_time | back to summary |
|---|---|
| public static long goto_table_time Time to produce the reduce-goto table. | |
| import_list | back to summary |
|---|---|
| public static Stack<E> import_list List of imports (Strings containing class names) to go with actions. | |
| init_code | back to summary |
|---|---|
| public static String init_code User code for user_init() which is called during parser initialization. | |
| not_reduced | back to summary |
|---|---|
| public static int not_reduced Count of the number on non-reduced productions found. | |
| nowarn | back to summary |
|---|---|
| public static boolean nowarn Do we skip warnings? | |
| num_conflicts | back to summary |
|---|---|
| public static int num_conflicts Number of conflict found while building tables. | |
| package_name | back to summary |
|---|---|
| public static String package_name Package that the resulting code goes into (null is used for unnamed). | |
| parser_class_name | back to summary |
|---|---|
| public static String parser_class_name Name of the generated parser class. | |
| parser_code | back to summary |
|---|---|
| public static String parser_code User declarations for direct inclusion in parser class. | |
| parser_time | back to summary |
|---|---|
| public static long parser_time Time to produce parser class. | |
| prefix | back to summary |
|---|---|
| public static String prefix The prefix placed on names that pollute someone else's name space. | |
| production_table_time | back to summary |
|---|---|
| public static long production_table_time Time to produce the production table. | |
| scan_code | back to summary |
|---|---|
| public static String scan_code User code for scan() which is called to get the next Symbol. | |
| start_production | back to summary |
|---|---|
| public static production start_production The start production of the grammar. | |
| symbol_const_class_name | back to summary |
|---|---|
| public static String symbol_const_class_name Name of the generated class for symbol constants. | |
| symbols_time | back to summary |
|---|---|
| public static long symbols_time Time to produce symbol constant class. | |
| unused_non_term | back to summary |
|---|---|
| public static int unused_non_term Count of unused non terminals. | |
| unused_term | back to summary |
|---|---|
| public static int unused_term Count of unused terminals. | |
| emit | back to summary |
|---|---|
| private emit() Only constructor is private so no instances can be created. | |
| do_action_table | back to summary |
|---|---|
| protected static void do_action_table(PrintWriter out, parse_action_table act_tab, boolean compact_reduces) throws internal_error Emit the action table.
| |
| do_escaped | back to summary |
|---|---|
| protected static int do_escaped(PrintWriter out, char c) | |
| do_newline | back to summary |
|---|---|
| protected static int do_newline(PrintWriter out, int nchar, int nbytes) | |
| do_reduce_table | back to summary |
|---|---|
| protected static void do_reduce_table(PrintWriter out, parse_reduce_table red_tab) Emit the reduce-goto table.
| |
| do_table_as_string | back to summary |
|---|---|
| protected static void do_table_as_string(PrintWriter out, short[][] sa) | |
| emit_action_code | back to summary |
|---|---|
| protected static void emit_action_code(PrintWriter out, production start_prod) throws internal_error Emit code for the non-public class holding the actual action code.
| |
| emit_package | back to summary |
|---|---|
| protected static void emit_package(PrintWriter out) Emit a package spec if the user wants one.
| |
| emit_production_table | back to summary |
|---|---|
| protected static void emit_production_table(PrintWriter out) Emit the production table.
| |
| lr_values | back to summary |
|---|---|
| public static boolean lr_values() whether or not to emit code for left and right values | |
| parser | back to summary |
|---|---|
| public static void parser(PrintWriter out, parse_action_table action_table, parse_reduce_table reduce_table, int start_st, production start_prod, boolean compact_reduces, boolean suppress_scanner) throws internal_error Emit the parser subclass with embedded tables.
| |
| pre | back to summary |
|---|---|
| protected static String pre(String str) Build a string with the standard prefix.
| |
| set_lr_values | back to summary |
|---|---|
| protected static void set_lr_values(boolean b) | |
| symbols | back to summary |
|---|---|
| public static void symbols(PrintWriter out, boolean emit_non_terms, boolean sym_interface) Emit code for the symbol constant class, optionally including non terms, if they have been requested.
| |