Methods Summary |
---|
public final void | file(persistence.antlr.ImportVocabTokenManager tm)
Token name = null;
try { // for error handling
name = LT(1);
match(ID);
{
_loop225:
do {
if ((LA(1)==ID||LA(1)==STRING)) {
line(tm);
}
else {
break _loop225;
}
} while (true);
}
}
catch (RecognitionException ex) {
reportError(ex);
consume();
consumeUntil(_tokenSet_0);
}
|
protected persistence.antlr.Tool | getTool()
return antlrTool;
|
public final void | line(persistence.antlr.ImportVocabTokenManager tm)
Token s1 = null;
Token lab = null;
Token s2 = null;
Token id = null;
Token para = null;
Token id2 = null;
Token i = null;
Token t=null; Token s=null;
try { // for error handling
{
if ((LA(1)==STRING)) {
s1 = LT(1);
match(STRING);
s = s1;
}
else if ((LA(1)==ID) && (LA(2)==ASSIGN) && (LA(3)==STRING)) {
lab = LT(1);
match(ID);
t = lab;
match(ASSIGN);
s2 = LT(1);
match(STRING);
s = s2;
}
else if ((LA(1)==ID) && (LA(2)==LPAREN)) {
id = LT(1);
match(ID);
t=id;
match(LPAREN);
para = LT(1);
match(STRING);
match(RPAREN);
}
else if ((LA(1)==ID) && (LA(2)==ASSIGN) && (LA(3)==INT)) {
id2 = LT(1);
match(ID);
t=id2;
}
else {
throw new NoViableAltException(LT(1), getFilename());
}
}
match(ASSIGN);
i = LT(1);
match(INT);
Integer value = Integer.valueOf(i.getText());
// if literal found, define as a string literal
if ( s!=null ) {
tm.define(s.getText(), value.intValue());
// if label, then label the string and map label to token symbol also
if ( t!=null ) {
StringLiteralSymbol sl =
(StringLiteralSymbol) tm.getTokenSymbol(s.getText());
sl.setLabel(t.getText());
tm.mapToTokenSymbol(t.getText(), sl);
}
}
// define token (not a literal)
else if ( t!=null ) {
tm.define(t.getText(), value.intValue());
if ( para!=null ) {
TokenSymbol ts = tm.getTokenSymbol(t.getText());
ts.setParaphrase(
para.getText()
);
}
}
}
catch (RecognitionException ex) {
reportError(ex);
consume();
consumeUntil(_tokenSet_1);
}
|
private static final long[] | mk_tokenSet_0()
long[] data = { 2L, 0L};
return data;
|
private static final long[] | mk_tokenSet_1()
long[] data = { 50L, 0L};
return data;
|
public void | reportError(java.lang.String s)Delegates the error message to the tool if any was registered via
{@link #initTool(persistence.antlr.Tool)}
if (getTool() != null) {
getTool().error(s, getFilename(), -1, -1);
}
else {
super.reportError(s);
}
|
public void | reportError(persistence.antlr.RecognitionException e)Delegates the error message to the tool if any was registered via
{@link #initTool(persistence.antlr.Tool)}
if (getTool() != null) {
getTool().error(e.getErrorMessage(), e.getFilename(), e.getLine(), e.getColumn());
}
else {
super.reportError(e);
}
|
public void | reportWarning(java.lang.String s)Delegates the warning message to the tool if any was registered via
{@link #initTool(persistence.antlr.Tool)}
if (getTool() != null) {
getTool().warning(s, getFilename(), -1, -1);
}
else {
super.reportWarning(s);
}
|
public void | setTool(persistence.antlr.Tool tool)In order to make it so existing subclasses don't break, we won't require
that the persistence.antlr.Tool instance be passed as a constructor element. Instead,
the persistence.antlr.Tool instance should register itself via {@link #initTool(antlr.Tool)}
if (antlrTool == null) {
antlrTool = tool;
}
else {
throw new IllegalStateException("persistence.antlr.Tool already registered");
}
|