|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava_cup.lexer
public class lexer
This class implements a small scanner (aka lexical analyzer or lexer) for the JavaCup specification. This scanner reads characters from standard input (System.in) and returns integers corresponding to the terminal number of the next Symbol. Once end of input is reached the EOF Symbol is returned on every subsequent call.
Symbols currently returned include:
Symbol Constant Returned Symbol Constant Returned ------ ----------------- ------ ----------------- "package" PACKAGE "import" IMPORT "code" CODE "action" ACTION "parser" PARSER "terminal" TERMINAL "non" NON "init" INIT "scan" SCAN "with" WITH "start" START "precedence" PRECEDENCE "left" LEFT "right" RIGHT "nonassoc" NONASSOC "%prec PRECENT_PREC [ LBRACK ] RBRACK ; SEMI , COMMA * STAR . DOT : COLON ::= COLON_COLON_EQUALS | BAR identifier ID {:...:} CODE_STRING "nonterminal" NONTERMINALAll symbol constants are defined in sym.java which is generated by JavaCup from parser.cup.
In addition to the scanner proper (called first via init() then with next_token() to get each Symbol) this class provides simple error and warning routines and keeps a count of errors and warnings that is publicly accessible.
This class is "static" (i.e., it has only static members and methods).
Field Summary | |
---|---|
static int |
error_count
Count of total errors detected so far. |
static int |
warning_count
Count of warnings issued so far |
Method Summary | |
---|---|
static Symbol |
debug_next_token()
Debugging version of next_token(). |
static void |
emit_error(java.lang.String message)
Emit an error message. |
static void |
emit_warn(java.lang.String message)
Emit a warning message. |
static void |
init()
Initialize the scanner. |
static Symbol |
next_token()
Return one Symbol. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int error_count
public static int warning_count
Method Detail |
---|
public static void init() throws java.io.IOException
java.io.IOException
public static void emit_error(java.lang.String message)
message
- the message to print.public static void emit_warn(java.lang.String message)
message
- the message to print.public static Symbol next_token() throws java.io.IOException
java.io.IOException
public static Symbol debug_next_token() throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |