next up previous
Next: Identifiers Up: Lexical Structure Previous: Comments


Most of the Java keywords appear as literals in the grammar, and therefore do not need additional specifications. The keywords const and goto are reserved by Java, even though they are not currently used. This allows the processor to give a very specific error report if these C++ keywords are incorrectly used in Java programs.


        $const          [KeyErr]
        $goto           [KeyErr]
This macro is invoked in definition 6.

Here the token processor KeyErr makes the error report:

Report a keyword error[10]:

Token processor[1](`KeyErr')
{ message(ERROR, "Illegal keyword - ignored", 0, &curpos); }
This macro is invoked in definition 37.

When scanning of a character sequence begins, the scanner sets the variable curpos (exported by the error module) to the coordinates of the first character of the sequence. By using the address of this variable in the message call, KeyErr places the report at the start of the incorrect keyword.