Skip to content
Snippets Groups Projects
Commit d90125fe authored by dgelessus's avatar dgelessus
Browse files

Inline generated Lexer new methods

parent cc04f478
Branches
Tags
No related merge requests found
Pipeline #117568 passed
......@@ -169,27 +169,7 @@ public class GenLexer extends AnalysisAdapter
macros.apply(file, "LexerTokenTail", null);
}
macros.apply(file, "LexerBody1");
for(ListIterator<String> i = ids.tokenList.listIterator(); i.hasNext();)
{
String name = i.next();
ATokenDef node = ids.tokens.get(name);
boolean fixed = ids.fixedTokens.get(node);
if(fixed)
{
macros.apply(file, "LexerNewFixedToken",
new String[] {"" + i.previousIndex(), name});
}
else
{
macros.apply(file, "LexerNewVariableToken",
new String[] {"" + i.previousIndex(), name});
}
}
macros.apply(file, "LexerBody2");
macros.apply(file, "LexerBody");
DataOutputStream out = new DataOutputStream(
new BufferedOutputStream(
......
......@@ -188,7 +188,7 @@ public class Lexer
{
case 0:
{
Token token = new0(
Token token = new TPkgId(
getText(accept_length),
start_line + 1,
start_pos + 1);
......@@ -203,7 +203,7 @@ public class Lexer
}
case 1:
{
Token token = new1(
Token token = new TPackage(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -217,7 +217,7 @@ public class Lexer
}
case 2:
{
Token token = new2(
Token token = new TStates(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -227,7 +227,7 @@ public class Lexer
}
case 3:
{
Token token = new3(
Token token = new THelpers(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -237,7 +237,7 @@ public class Lexer
}
case 4:
{
Token token = new4(
Token token = new TTokens(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -247,7 +247,7 @@ public class Lexer
}
case 5:
{
Token token = new5(
Token token = new TIgnored(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -257,7 +257,7 @@ public class Lexer
}
case 6:
{
Token token = new6(
Token token = new TProductions(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -267,7 +267,7 @@ public class Lexer
}
case 7:
{
Token token = new7(
Token token = new TAbstract(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -277,7 +277,7 @@ public class Lexer
}
case 8:
{
Token token = new8(
Token token = new TSyntax(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -287,7 +287,7 @@ public class Lexer
}
case 9:
{
Token token = new9(
Token token = new TTree(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -297,7 +297,7 @@ public class Lexer
}
case 10:
{
Token token = new10(
Token token = new TNew(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -307,7 +307,7 @@ public class Lexer
}
case 11:
{
Token token = new11(
Token token = new TNull(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -317,7 +317,7 @@ public class Lexer
}
case 12:
{
Token token = new12(
Token token = new TTokenSpecifier(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -327,7 +327,7 @@ public class Lexer
}
case 13:
{
Token token = new13(
Token token = new TProductionSpecifier(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -337,7 +337,7 @@ public class Lexer
}
case 14:
{
Token token = new14(
Token token = new TDot(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -347,7 +347,7 @@ public class Lexer
}
case 15:
{
Token token = new15(
Token token = new TDDot(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -357,7 +357,7 @@ public class Lexer
}
case 16:
{
Token token = new16(
Token token = new TSemicolon(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -372,7 +372,7 @@ public class Lexer
}
case 17:
{
Token token = new17(
Token token = new TEqual(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -382,7 +382,7 @@ public class Lexer
}
case 18:
{
Token token = new18(
Token token = new TLBkt(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -392,7 +392,7 @@ public class Lexer
}
case 19:
{
Token token = new19(
Token token = new TRBkt(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -402,7 +402,7 @@ public class Lexer
}
case 20:
{
Token token = new20(
Token token = new TLPar(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -412,7 +412,7 @@ public class Lexer
}
case 21:
{
Token token = new21(
Token token = new TRPar(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -422,7 +422,7 @@ public class Lexer
}
case 22:
{
Token token = new22(
Token token = new TLBrace(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -432,7 +432,7 @@ public class Lexer
}
case 23:
{
Token token = new23(
Token token = new TRBrace(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -442,7 +442,7 @@ public class Lexer
}
case 24:
{
Token token = new24(
Token token = new TPlus(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -452,7 +452,7 @@ public class Lexer
}
case 25:
{
Token token = new25(
Token token = new TMinus(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -462,7 +462,7 @@ public class Lexer
}
case 26:
{
Token token = new26(
Token token = new TQMark(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -472,7 +472,7 @@ public class Lexer
}
case 27:
{
Token token = new27(
Token token = new TStar(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -482,7 +482,7 @@ public class Lexer
}
case 28:
{
Token token = new28(
Token token = new TBar(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -492,7 +492,7 @@ public class Lexer
}
case 29:
{
Token token = new29(
Token token = new TComma(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -502,7 +502,7 @@ public class Lexer
}
case 30:
{
Token token = new30(
Token token = new TSlash(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -512,7 +512,7 @@ public class Lexer
}
case 31:
{
Token token = new31(
Token token = new TArrow(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -522,7 +522,7 @@ public class Lexer
}
case 32:
{
Token token = new32(
Token token = new TColon(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -532,7 +532,7 @@ public class Lexer
}
case 33:
{
Token token = new33(
Token token = new TId(
getText(accept_length),
start_line + 1,
start_pos + 1);
......@@ -543,7 +543,7 @@ public class Lexer
}
case 34:
{
Token token = new34(
Token token = new TChar(
getText(accept_length),
start_line + 1,
start_pos + 1);
......@@ -554,7 +554,7 @@ public class Lexer
}
case 35:
{
Token token = new35(
Token token = new TDecChar(
getText(accept_length),
start_line + 1,
start_pos + 1);
......@@ -565,7 +565,7 @@ public class Lexer
}
case 36:
{
Token token = new36(
Token token = new THexChar(
getText(accept_length),
start_line + 1,
start_pos + 1);
......@@ -576,7 +576,7 @@ public class Lexer
}
case 37:
{
Token token = new37(
Token token = new TString(
getText(accept_length),
start_line + 1,
start_pos + 1);
......@@ -587,7 +587,7 @@ public class Lexer
}
case 38:
{
Token token = new38(
Token token = new TBlank(
getText(accept_length),
start_line + 1,
start_pos + 1);
......@@ -598,7 +598,7 @@ public class Lexer
}
case 39:
{
Token token = new39(
Token token = new TComment(
getText(accept_length),
start_line + 1,
start_pos + 1);
......@@ -627,47 +627,6 @@ public class Lexer
}
}
Token new0(String text, int line, int pos) { return new TPkgId(text, line, pos); }
Token new1(int line, int pos) { return new TPackage(line, pos); }
Token new2(int line, int pos) { return new TStates(line, pos); }
Token new3(int line, int pos) { return new THelpers(line, pos); }
Token new4(int line, int pos) { return new TTokens(line, pos); }
Token new5(int line, int pos) { return new TIgnored(line, pos); }
Token new6(int line, int pos) { return new TProductions(line, pos); }
Token new7(int line, int pos) { return new TAbstract(line, pos); }
Token new8(int line, int pos) { return new TSyntax(line, pos); }
Token new9(int line, int pos) { return new TTree(line, pos); }
Token new10(int line, int pos) { return new TNew(line, pos); }
Token new11(int line, int pos) { return new TNull(line, pos); }
Token new12(int line, int pos) { return new TTokenSpecifier(line, pos); }
Token new13(int line, int pos) { return new TProductionSpecifier(line, pos); }
Token new14(int line, int pos) { return new TDot(line, pos); }
Token new15(int line, int pos) { return new TDDot(line, pos); }
Token new16(int line, int pos) { return new TSemicolon(line, pos); }
Token new17(int line, int pos) { return new TEqual(line, pos); }
Token new18(int line, int pos) { return new TLBkt(line, pos); }
Token new19(int line, int pos) { return new TRBkt(line, pos); }
Token new20(int line, int pos) { return new TLPar(line, pos); }
Token new21(int line, int pos) { return new TRPar(line, pos); }
Token new22(int line, int pos) { return new TLBrace(line, pos); }
Token new23(int line, int pos) { return new TRBrace(line, pos); }
Token new24(int line, int pos) { return new TPlus(line, pos); }
Token new25(int line, int pos) { return new TMinus(line, pos); }
Token new26(int line, int pos) { return new TQMark(line, pos); }
Token new27(int line, int pos) { return new TStar(line, pos); }
Token new28(int line, int pos) { return new TBar(line, pos); }
Token new29(int line, int pos) { return new TComma(line, pos); }
Token new30(int line, int pos) { return new TSlash(line, pos); }
Token new31(int line, int pos) { return new TArrow(line, pos); }
Token new32(int line, int pos) { return new TColon(line, pos); }
Token new33(String text, int line, int pos) { return new TId(text, line, pos); }
Token new34(String text, int line, int pos) { return new TChar(text, line, pos); }
Token new35(String text, int line, int pos) { return new TDecChar(text, line, pos); }
Token new36(String text, int line, int pos) { return new THexChar(text, line, pos); }
Token new37(String text, int line, int pos) { return new TString(text, line, pos); }
Token new38(String text, int line, int pos) { return new TBlank(text, line, pos); }
Token new39(String text, int line, int pos) { return new TComment(text, line, pos); }
private int getChar() throws IOException
{
if(this.eof)
......
......@@ -216,7 +216,7 @@ $
Macro:LexerVariableToken
case $0$:
{
Token token = new$0$(
Token token = new $1$(
getText(accept_length),
start_line + 1,
start_pos + 1);
......@@ -229,7 +229,7 @@ $
Macro:LexerFixedToken
case $0$:
{
Token token = new$0$(
Token token = new $1$(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -260,7 +260,7 @@ Macro:LexerTokenTail
$
Macro:LexerBody1
Macro:LexerBody
}
}
else
......@@ -281,21 +281,6 @@ Macro:LexerBody1
}
}
$
Macro:LexerNewVariableToken
Token new$0$(String text, int line, int pos) { return new $1$(text, line, pos); }
$
Macro:LexerNewFixedToken
Token new$0$(int line, int pos) { return new $1$(line, pos); }
$
Macro:LexerBody2
private int getChar() throws IOException
{
if(this.eof)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment