Added modeNames to gen'd lexers
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9878]
This commit is contained in:
parent
dc82edad02
commit
6013c4c97d
16
CHANGES.txt
16
CHANGES.txt
|
@ -1,5 +1,21 @@
|
||||||
ANTLR v4 Honey Badger early access
|
ANTLR v4 Honey Badger early access
|
||||||
|
|
||||||
|
Jan 21, 2012
|
||||||
|
|
||||||
|
* Added modeNames to gen'd lexers
|
||||||
|
* added lexer commands
|
||||||
|
skip
|
||||||
|
more
|
||||||
|
popMode
|
||||||
|
mode(x)
|
||||||
|
pushMode(x)
|
||||||
|
type(x)
|
||||||
|
channel(x)
|
||||||
|
|
||||||
|
WS : (' '|'\n')+ -> skip ;
|
||||||
|
|
||||||
|
use commas to separate commands: "-> skip, mode(FOO)"
|
||||||
|
|
||||||
Jan 14, 2012
|
Jan 14, 2012
|
||||||
|
|
||||||
* labels on tokens in left-recursive rules caused codegen exception.
|
* labels on tokens in left-recursive rules caused codegen exception.
|
||||||
|
|
|
@ -291,19 +291,8 @@ public abstract class Lexer extends Recognizer<Integer, LexerATNSimulator>
|
||||||
this.text = text;
|
this.text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reportError(RecognitionException e) {
|
public String[] getModeNames() {
|
||||||
/** TODO: not thought about recovery in lexer yet.
|
return null;
|
||||||
*
|
|
||||||
// if we've already reported an error and have not matched a token
|
|
||||||
// yet successfully, don't report any errors.
|
|
||||||
if ( errorRecovery ) {
|
|
||||||
//System.err.print("[SPURIOUS] ");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
errorRecovery = true;
|
|
||||||
*/
|
|
||||||
|
|
||||||
//displayRecognitionError(this.getTokenNames(), e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Used to print out token names like ID during debugging and
|
/** Used to print out token names like ID during debugging and
|
||||||
|
|
|
@ -603,6 +603,9 @@ public class <lexer.name> extends Lexer {
|
||||||
public static final int
|
public static final int
|
||||||
<lexer.tokens:{k | <k>=<lexer.tokens.(k)>}; separator=", ", wrap, anchor>;
|
<lexer.tokens:{k | <k>=<lexer.tokens.(k)>}; separator=", ", wrap, anchor>;
|
||||||
<rest(lexer.modes):{m| public static final int <m> = <i>;}; separator="\n">
|
<rest(lexer.modes):{m| public static final int <m> = <i>;}; separator="\n">
|
||||||
|
public static String[] modeNames = {
|
||||||
|
<lexer.modes:{m| "<m>"}; separator=", ", wrap, anchor>
|
||||||
|
};
|
||||||
|
|
||||||
public static final String[] tokenNames = {
|
public static final String[] tokenNames = {
|
||||||
"\<INVALID>", "\<INVALID>", "\<INVALID>",
|
"\<INVALID>", "\<INVALID>", "\<INVALID>",
|
||||||
|
@ -627,6 +630,9 @@ public class <lexer.name> extends Lexer {
|
||||||
@Override
|
@Override
|
||||||
public String[] getRuleNames() { return ruleNames; }
|
public String[] getRuleNames() { return ruleNames; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getModeNames() { return modeNames; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ATN getATN() { return _ATN; }
|
public ATN getATN() { return _ATN; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue