public class emit extends Object
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 |
_lr_values |
static String |
action_code
User declarations for direct inclusion in user action class.
|
static long |
action_code_time
Time to produce action code class.
|
static long |
action_table_time
Time to produce the action table.
|
static String |
class_type_argument
TUM changes; proposed by Henning Niss 20050628: Type arguments for class
declaration
|
static boolean |
external_tables
User option -- output parser tables to external files, which are loaded
during runtime? If the tables are too large, they are output to external
file anyway.
|
static long |
goto_table_time
Time to produce the reduce-goto table.
|
static Stack<String> |
import_list
List of imports (Strings containing class names) to go with actions.
|
static String |
init_code
User code for user_init() which is called during parser initialization.
|
static int |
not_reduced
Count of the number on non-reduced productions found.
|
static boolean |
nowarn
Do we skip warnings?
|
static int |
num_conflicts
Number of conflict found while building tables.
|
static String |
package_name
Package that the resulting code goes into (null is used for unnamed).
|
static String |
parser_class_name
Name of the generated parser class.
|
static String |
parser_code
User declarations for direct inclusion in parser class.
|
static long |
parser_time
Time to produce parser class.
|
static String |
prefix
The prefix placed on names that pollute someone else's name space.
|
static long |
production_table_time
Time to produce the production table.
|
static String |
scan_code
User code for scan() which is called to get the next Symbol.
|
static production |
start_production
The start production of the grammar.
|
static boolean |
suppress_generated_java_warnings_unchecked
User option -- output parser tables to external files, which are loaded
during runtime? If the tables are too large, they are output to external
file anyway.
|
static boolean |
suppress_generated_java_warnings_unused |
static String |
symbol_const_class_name
Name of the generated class for symbol constants.
|
static long |
symbols_time
Time to produce symbol constant class.
|
static int |
unused_non_term
Count of unused non terminals.
|
static int |
unused_term
Count of unused terminals.
|
Modifier and Type | Method and Description |
---|---|
static void |
clear() |
protected static boolean |
do_action_table(PrintWriter out,
parse_action_table act_tab,
boolean compact_reduces)
Emit the action table.
|
protected static int |
do_escaped(PrintWriter out,
char c) |
protected static int |
do_newline(PrintWriter out,
int nchar,
int nbytes) |
protected static boolean |
do_reduce_table(PrintWriter out,
parse_reduce_table red_tab)
Emit the reduce-goto table.
|
protected static void |
do_table_as_string(PrintWriter out,
short[][] sa) |
protected static void |
emit_action_code(PrintWriter out,
production start_prod)
Emit code for the non-public class holding the actual action code.
|
protected static void |
emit_package(PrintWriter out)
Emit a package spec if the user wants one.
|
protected static boolean |
emit_production_table(PrintWriter out)
Emit the production table.
|
static boolean |
lr_values()
whether or not to emit code for left and right values
|
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)
Emit the parser subclass with embedded tables.
|
protected static String |
pre(String str)
Build a string with the standard prefix.
|
protected static void |
set_lr_values(boolean b) |
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.
|
protected static String |
typeArgument()
TUM changes; proposed by Henning Niss 20050628 Build a string with the
specified type arguments, if present, otherwise an empty string.
|
public static String prefix
public static String package_name
public static String symbol_const_class_name
public static String parser_class_name
public static String class_type_argument
public static boolean external_tables
public static boolean suppress_generated_java_warnings_unchecked
public static boolean suppress_generated_java_warnings_unused
public static String action_code
public static String parser_code
public static String init_code
public static String scan_code
public static production start_production
public static Stack<String> import_list
public static int num_conflicts
public static boolean nowarn
public static int not_reduced
public static int unused_term
public static int unused_non_term
public static long symbols_time
public static long parser_time
public static long action_code_time
public static long production_table_time
public static long action_table_time
public static long goto_table_time
protected static boolean _lr_values
public static boolean lr_values()
protected static void set_lr_values(boolean b)
public static void clear()
protected static String pre(String str)
str
- string to prefix.protected static String typeArgument()
protected static void emit_package(PrintWriter out)
out
- stream to produce output on.public static void symbols(PrintWriter out, boolean emit_non_terms, boolean sym_interface)
out
- stream to produce output on.emit_non_terms
- do we emit constants for non terminals?sym_interface
- should we emit an interface, rather than a class?protected static void emit_action_code(PrintWriter out, production start_prod) throws internal_error
out
- stream to produce output on.start_prod
- the start production of the grammar.internal_error
protected static boolean emit_production_table(PrintWriter out)
out
- stream to produce output on.true
if external file was used to store parser tableprotected static boolean do_action_table(PrintWriter out, parse_action_table act_tab, boolean compact_reduces) throws internal_error
out
- stream to produce output on.act_tab
- the internal representation of the action table.compact_reduces
- do we use the most frequent reduce as default?true
if external file was used to store parser tableinternal_error
protected static boolean do_reduce_table(PrintWriter out, parse_reduce_table red_tab)
out
- stream to produce output on.red_tab
- the internal representation of the reduce-goto table.true
if external file was used to store parser tableprotected static void do_table_as_string(PrintWriter out, short[][] sa)
protected static int do_newline(PrintWriter out, int nchar, int nbytes)
protected static int do_escaped(PrintWriter out, char c)
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
out
- stream to produce output on.action_table
- internal representation of the action table.reduce_table
- internal representation of the reduce-goto table.start_st
- start state of the parse machine.start_prod
- start production of the grammar.compact_reduces
- do we use most frequent reduce as default?suppress_scanner
- should scanner be suppressed for compatibility?internal_error
Copyright © 2003–2016 Community Z Tools Project. All rights reserved.