From 3c266bcc98f30fb58ceac4cd06fb44cce7a815d8 Mon Sep 17 00:00:00 2001 From: Enrico Horn Date: Sat, 3 Jul 2021 22:19:30 +0200 Subject: [PATCH] Move Lua5x.jj to lua-jse and customize package name --- luaj-core/pom.xml | 43 - .../java/org/luaj/vm2/parser/LuaParser.java | 1914 --------------- .../luaj/vm2/parser/LuaParserConstants.java | 240 -- .../vm2/parser/LuaParserTokenManager.java | 2102 ----------------- .../org/luaj/vm2/parser/ParseException.java | 187 -- .../org/luaj/vm2/parser/SimpleCharStream.java | 469 ---- .../main/java/org/luaj/vm2/parser/Token.java | 131 - .../org/luaj/vm2/parser/TokenMgrError.java | 147 -- .../src/main/javacc/Lua51.jj | 4 +- .../src/main/javacc/Lua52.jj | 4 +- 10 files changed, 4 insertions(+), 5237 deletions(-) delete mode 100644 luaj-jse/src/main/java/org/luaj/vm2/parser/LuaParser.java delete mode 100644 luaj-jse/src/main/java/org/luaj/vm2/parser/LuaParserConstants.java delete mode 100644 luaj-jse/src/main/java/org/luaj/vm2/parser/LuaParserTokenManager.java delete mode 100644 luaj-jse/src/main/java/org/luaj/vm2/parser/ParseException.java delete mode 100644 luaj-jse/src/main/java/org/luaj/vm2/parser/SimpleCharStream.java delete mode 100644 luaj-jse/src/main/java/org/luaj/vm2/parser/Token.java delete mode 100644 luaj-jse/src/main/java/org/luaj/vm2/parser/TokenMgrError.java rename {luaj-core => luaj-jse}/src/main/javacc/Lua51.jj (98%) rename {luaj-core => luaj-jse}/src/main/javacc/Lua52.jj (98%) diff --git a/luaj-core/pom.xml b/luaj-core/pom.xml index da0aa4ad..a51d671d 100644 --- a/luaj-core/pom.xml +++ b/luaj-core/pom.xml @@ -14,47 +14,4 @@ luaj-core Core code for LuaJ - - - - com.helger.maven - ph-javacc-maven-plugin - - - generate-grammar - generate-sources - - javacc - - - 1.8 - true - org.luaj.vm2.parser - src/main/javacc - ${project.build.directory}/generated-sources/javacc - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/javacc - - - - - - - - diff --git a/luaj-jse/src/main/java/org/luaj/vm2/parser/LuaParser.java b/luaj-jse/src/main/java/org/luaj/vm2/parser/LuaParser.java deleted file mode 100644 index d7e254fd..00000000 --- a/luaj-jse/src/main/java/org/luaj/vm2/parser/LuaParser.java +++ /dev/null @@ -1,1914 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. LuaParser.java */ -package org.luaj.vm2.parser; -import org.luaj.vm2.*; -import org.luaj.vm2.ast.*; -import java.util.*; - -public class LuaParser implements LuaParserConstants { - static { - LuaValue.valueOf(true); - } - - public static void main(String args[]) throws ParseException { - LuaParser parser = new LuaParser(System.in); - parser.Chunk(); - } - - private static Exp.VarExp assertvarexp(Exp.PrimaryExp pe) throws ParseException { - if (!pe.isvarexp()) - throw new ParseException("expected variable"); - return (Exp.VarExp) pe; - } - - private static Exp.FuncCall assertfunccall(Exp.PrimaryExp pe) throws ParseException { - if (!pe.isfunccall()) - throw new ParseException("expected function call"); - return (Exp.FuncCall) pe; - } - - public SimpleCharStream getCharStream() { - return jj_input_stream; - } - - private long LineInfo() { - return ((long) jj_input_stream.getBeginLine() << 32) | jj_input_stream.getBeginColumn(); - } - - private void L(SyntaxElement e, long startinfo) { - e.beginLine = (int) (startinfo >> 32); - e.beginColumn = (short) startinfo; - e.endLine = token.endLine; - e.endColumn = (short) token.endColumn; - } - - private void L(SyntaxElement e, Token starttoken) { - e.beginLine = starttoken.beginLine; - e.beginColumn = (short) starttoken.beginColumn; - e.endLine = token.endLine; - e.endColumn = (short) token.endColumn; - } - -/** Root production. */ - final public Chunk Chunk() throws ParseException { - Block b; - Chunk c; - long i = LineInfo(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 69: - jj_consume_token(69); - token_source.SwitchTo(IN_COMMENT); - break; - default: - jj_la1[0] = jj_gen; - ; - } - b = Block(); - jj_consume_token(0); - c=new Chunk(b); L(c,i); {if (true) return c;} - throw new Error("Missing return statement in function"); - } - - final public Block Block() throws ParseException { - Block b = new Block(); - Stat s; - long i = LineInfo(); - label_1: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case BREAK: - case DO: - case FOR: - case FUNCTION: - case GOTO: - case IF: - case LOCAL: - case REPEAT: - case WHILE: - case NAME: - case DBCOLON: - case 70: - case 75: - ; - break; - default: - jj_la1[1] = jj_gen; - break label_1; - } - s = Stat(); - b.add(s); - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case RETURN: - s = ReturnStat(); - b.add(s); - break; - default: - jj_la1[2] = jj_gen; - ; - } - L(b,i); {if (true) return b;} - throw new Error("Missing return statement in function"); - } - - final public Stat Stat() throws ParseException { - Block b,b2; - Exp e,e2,e3=null; - Stat s; - FuncName fn; - FuncBody fb; - Token n; - List nl; - List el=null; - long i = LineInfo(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 70: - jj_consume_token(70); - {if (true) return null;} - break; - case DBCOLON: - s = Label(); - L(s,i); {if (true) return s;} - break; - case BREAK: - jj_consume_token(BREAK); - s=Stat.breakstat(); L(s,i); {if (true) return s;} - break; - case GOTO: - jj_consume_token(GOTO); - n = jj_consume_token(NAME); - s=Stat.gotostat(n.image); L(s,i); {if (true) return s;} - break; - case DO: - jj_consume_token(DO); - b = Block(); - jj_consume_token(END); - s=Stat.block(b); L(s,i); {if (true) return s;} - break; - case WHILE: - jj_consume_token(WHILE); - e = Exp(); - jj_consume_token(DO); - b = Block(); - jj_consume_token(END); - s=Stat.whiledo(e,b); L(s,i); {if (true) return s;} - break; - case REPEAT: - jj_consume_token(REPEAT); - b = Block(); - jj_consume_token(UNTIL); - e = Exp(); - s=Stat.repeatuntil(b,e); L(s,i); {if (true) return s;} - break; - case IF: - s = IfThenElse(); - L(s,i); {if (true) return s;} - break; - default: - jj_la1[5] = jj_gen; - if (jj_2_1(3)) { - jj_consume_token(FOR); - n = jj_consume_token(NAME); - jj_consume_token(71); - e = Exp(); - jj_consume_token(72); - e2 = Exp(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 72: - jj_consume_token(72); - e3 = Exp(); - break; - default: - jj_la1[3] = jj_gen; - ; - } - jj_consume_token(DO); - b = Block(); - jj_consume_token(END); - s=Stat.fornumeric(n.image,e,e2,e3,b); L(s,i); {if (true) return s;} - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case FOR: - jj_consume_token(FOR); - nl = NameList(); - jj_consume_token(IN); - el = ExpList(); - jj_consume_token(DO); - b = Block(); - jj_consume_token(END); - s=Stat.forgeneric(nl,el,b); L(s,i); {if (true) return s;} - break; - case FUNCTION: - jj_consume_token(FUNCTION); - fn = FuncName(); - fb = FuncBody(); - s=Stat.functiondef(fn,fb); L(s,i); {if (true) return s;} - break; - default: - jj_la1[6] = jj_gen; - if (jj_2_2(2)) { - jj_consume_token(LOCAL); - jj_consume_token(FUNCTION); - n = jj_consume_token(NAME); - fb = FuncBody(); - s=Stat.localfunctiondef(n.image,fb); L(s,i); {if (true) return s;} - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LOCAL: - jj_consume_token(LOCAL); - nl = NameList(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 71: - jj_consume_token(71); - el = ExpList(); - break; - default: - jj_la1[4] = jj_gen; - ; - } - s=Stat.localassignment(nl,el); L(s,i); {if (true) return s;} - break; - case NAME: - case 75: - s = ExprStat(); - L(s,i); {if (true) return s;} - break; - default: - jj_la1[7] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } - } - } - throw new Error("Missing return statement in function"); - } - - final public Stat IfThenElse() throws ParseException { - Block b,b2,b3=null; - Exp e,e2; - List el=null; - List bl=null; - jj_consume_token(IF); - e = Exp(); - jj_consume_token(THEN); - b = Block(); - label_2: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ELSEIF: - ; - break; - default: - jj_la1[8] = jj_gen; - break label_2; - } - jj_consume_token(ELSEIF); - e2 = Exp(); - jj_consume_token(THEN); - b2 = Block(); - if (el==null) el=new ArrayList(); - if (bl==null) bl=new ArrayList(); - el.add(e2); - bl.add(b2); - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ELSE: - jj_consume_token(ELSE); - b3 = Block(); - break; - default: - jj_la1[9] = jj_gen; - ; - } - jj_consume_token(END); - {if (true) return Stat.ifthenelse(e,b,el,bl,b3);} - throw new Error("Missing return statement in function"); - } - - final public Stat ReturnStat() throws ParseException { - List el=null; - Stat s; - long i = LineInfo(); - jj_consume_token(RETURN); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LONGSTRING0: - case LONGSTRING1: - case LONGSTRING2: - case LONGSTRING3: - case LONGSTRINGN: - case FALSE: - case FUNCTION: - case NIL: - case NOT: - case TRUE: - case NAME: - case NUMBER: - case STRING: - case CHARSTRING: - case 69: - case 75: - case 79: - case 80: - case 83: - el = ExpList(); - break; - default: - jj_la1[10] = jj_gen; - ; - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 70: - jj_consume_token(70); - break; - default: - jj_la1[11] = jj_gen; - ; - } - s=Stat.returnstat(el); L(s,i); {if (true) return s;} - throw new Error("Missing return statement in function"); - } - - final public Stat Label() throws ParseException { - Token n; - jj_consume_token(DBCOLON); - n = jj_consume_token(NAME); - jj_consume_token(DBCOLON); - {if (true) return Stat.labelstat(n.image);} - throw new Error("Missing return statement in function"); - } - - final public Stat ExprStat() throws ParseException { - Exp.PrimaryExp p; - Stat s=null; - long i = LineInfo(); - p = PrimaryExp(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 71: - case 72: - s = Assign(assertvarexp(p)); - break; - default: - jj_la1[12] = jj_gen; - ; - } - if (s==null) { s=Stat.functioncall(assertfunccall(p)); } L(s,i); {if (true) return s;} - throw new Error("Missing return statement in function"); - } - - final public Stat Assign(Exp.VarExp v0) throws ParseException { - List vl = new ArrayList(); - vl.add(v0); - Exp.VarExp ve; - List el; - Stat s; - long i = LineInfo(); - label_3: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 72: - ; - break; - default: - jj_la1[13] = jj_gen; - break label_3; - } - jj_consume_token(72); - ve = VarExp(); - vl.add(ve); - } - jj_consume_token(71); - el = ExpList(); - s=Stat.assignment(vl,el); L(s,i); {if (true) return s;} - throw new Error("Missing return statement in function"); - } - - final public Exp.VarExp VarExp() throws ParseException { - Exp.PrimaryExp p; - p = PrimaryExp(); - {if (true) return assertvarexp(p);} - throw new Error("Missing return statement in function"); - } - - final public FuncName FuncName() throws ParseException { - Token n; - FuncName f; - n = jj_consume_token(NAME); - f=new FuncName(n.image); - label_4: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 73: - ; - break; - default: - jj_la1[14] = jj_gen; - break label_4; - } - jj_consume_token(73); - n = jj_consume_token(NAME); - f.adddot(n.image); - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 74: - jj_consume_token(74); - n = jj_consume_token(NAME); - f.method=n.image; - break; - default: - jj_la1[15] = jj_gen; - ; - } - L(f,n); {if (true) return f;} - throw new Error("Missing return statement in function"); - } - - final public Exp.PrimaryExp PrefixExp() throws ParseException { - Token n; - Exp e; - Exp.PrimaryExp p; - long i = LineInfo(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case NAME: - n = jj_consume_token(NAME); - p=Exp.nameprefix(n.image); L(p,i); {if (true) return p;} - break; - case 75: - jj_consume_token(75); - e = Exp(); - jj_consume_token(76); - p=Exp.parensprefix(e); L(p,i); {if (true) return p;} - break; - default: - jj_la1[16] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - throw new Error("Missing return statement in function"); - } - - final public Exp.PrimaryExp PrimaryExp() throws ParseException { - Exp.PrimaryExp p; - long i = LineInfo(); - p = PrefixExp(); - label_5: - while (true) { - if (jj_2_3(2)) { - ; - } else { - break label_5; - } - p = PostfixOp(p); - } - L(p,i); {if (true) return p;} - throw new Error("Missing return statement in function"); - } - - final public Exp.PrimaryExp PostfixOp(Exp.PrimaryExp lhs) throws ParseException { - Token n; - Exp e; - FuncArgs a; - Exp.PrimaryExp p; - long i = LineInfo(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 73: - jj_consume_token(73); - n = jj_consume_token(NAME); - p=Exp.fieldop(lhs, n.image); L(p,i); {if (true) return p;} - break; - case 77: - jj_consume_token(77); - e = Exp(); - jj_consume_token(78); - p=Exp.indexop(lhs, e); L(p,i); {if (true) return p;} - break; - case 74: - jj_consume_token(74); - n = jj_consume_token(NAME); - a = FuncArgs(); - p=Exp.methodop(lhs, n.image,a); L(p,i); {if (true) return p;} - break; - case LONGSTRING0: - case LONGSTRING1: - case LONGSTRING2: - case LONGSTRING3: - case LONGSTRINGN: - case STRING: - case CHARSTRING: - case 75: - case 80: - a = FuncArgs(); - p=Exp.functionop(lhs, a); L(p,i); {if (true) return p;} - break; - default: - jj_la1[17] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - throw new Error("Missing return statement in function"); - } - - final public FuncArgs FuncArgs() throws ParseException { - List el=null; - TableConstructor tc; - LuaString s; - FuncArgs a; - long i = LineInfo(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 75: - jj_consume_token(75); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LONGSTRING0: - case LONGSTRING1: - case LONGSTRING2: - case LONGSTRING3: - case LONGSTRINGN: - case FALSE: - case FUNCTION: - case NIL: - case NOT: - case TRUE: - case NAME: - case NUMBER: - case STRING: - case CHARSTRING: - case 69: - case 75: - case 79: - case 80: - case 83: - el = ExpList(); - break; - default: - jj_la1[18] = jj_gen; - ; - } - jj_consume_token(76); - a=FuncArgs.explist(el); L(a,i); {if (true) return a;} - break; - case 80: - tc = TableConstructor(); - a=FuncArgs.tableconstructor(tc); L(a,i); {if (true) return a;} - break; - case LONGSTRING0: - case LONGSTRING1: - case LONGSTRING2: - case LONGSTRING3: - case LONGSTRINGN: - case STRING: - case CHARSTRING: - s = Str(); - a=FuncArgs.string(s); L(a,i); {if (true) return a;} - break; - default: - jj_la1[19] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - throw new Error("Missing return statement in function"); - } - - final public List NameList() throws ParseException { - List l = new ArrayList(); - Token name; - name = jj_consume_token(NAME); - l.add(new Name(name.image)); - label_6: - while (true) { - if (jj_2_4(2)) { - ; - } else { - break label_6; - } - jj_consume_token(72); - name = jj_consume_token(NAME); - l.add(new Name(name.image)); - } - {if (true) return l;} - throw new Error("Missing return statement in function"); - } - - final public List ExpList() throws ParseException { - List l = new ArrayList(); - Exp e; - e = Exp(); - l.add(e); - label_7: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 72: - ; - break; - default: - jj_la1[20] = jj_gen; - break label_7; - } - jj_consume_token(72); - e = Exp(); - l.add(e); - } - {if (true) return l;} - throw new Error("Missing return statement in function"); - } - - final public Exp SimpleExp() throws ParseException { - Token n; - LuaString s; - Exp e; - TableConstructor c; - FuncBody b; - long i = LineInfo(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case NIL: - jj_consume_token(NIL); - e=Exp.constant(LuaValue.NIL); L(e,i); {if (true) return e;} - break; - case TRUE: - jj_consume_token(TRUE); - e=Exp.constant(LuaValue.TRUE); L(e,i); {if (true) return e;} - break; - case FALSE: - jj_consume_token(FALSE); - e=Exp.constant(LuaValue.FALSE); L(e,i); {if (true) return e;} - break; - case NUMBER: - n = jj_consume_token(NUMBER); - e=Exp.numberconstant(n.image); L(e,i); {if (true) return e;} - break; - case LONGSTRING0: - case LONGSTRING1: - case LONGSTRING2: - case LONGSTRING3: - case LONGSTRINGN: - case STRING: - case CHARSTRING: - s = Str(); - e=Exp.constant(s); L(e,i); {if (true) return e;} - break; - case 79: - jj_consume_token(79); - e=Exp.varargs(); L(e,i); {if (true) return e;} - break; - case 80: - c = TableConstructor(); - e=Exp.tableconstructor(c); L(e,i); {if (true) return e;} - break; - case FUNCTION: - b = FunctionCall(); - e=Exp.anonymousfunction(b); L(e,i); {if (true) return e;} - break; - case NAME: - case 75: - e = PrimaryExp(); - {if (true) return e;} - break; - default: - jj_la1[21] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - throw new Error("Missing return statement in function"); - } - - final public LuaString Str() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case STRING: - jj_consume_token(STRING); - {if (true) return Str.quoteString(token.image);} - break; - case CHARSTRING: - jj_consume_token(CHARSTRING); - {if (true) return Str.charString(token.image);} - break; - case LONGSTRING0: - jj_consume_token(LONGSTRING0); - {if (true) return Str.longString(token.image);} - break; - case LONGSTRING1: - jj_consume_token(LONGSTRING1); - {if (true) return Str.longString(token.image);} - break; - case LONGSTRING2: - jj_consume_token(LONGSTRING2); - {if (true) return Str.longString(token.image);} - break; - case LONGSTRING3: - jj_consume_token(LONGSTRING3); - {if (true) return Str.longString(token.image);} - break; - case LONGSTRINGN: - jj_consume_token(LONGSTRINGN); - {if (true) return Str.longString(token.image);} - break; - default: - jj_la1[22] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - throw new Error("Missing return statement in function"); - } - - final public Exp Exp() throws ParseException { - Exp e,s; - int op; - long i = LineInfo(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LONGSTRING0: - case LONGSTRING1: - case LONGSTRING2: - case LONGSTRING3: - case LONGSTRINGN: - case FALSE: - case FUNCTION: - case NIL: - case TRUE: - case NAME: - case NUMBER: - case STRING: - case CHARSTRING: - case 75: - case 79: - case 80: - e = SimpleExp(); - break; - case NOT: - case 69: - case 83: - op = Unop(); - s = Exp(); - e=Exp.unaryexp(op,s); - break; - default: - jj_la1[23] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - label_8: - while (true) { - if (jj_2_5(2)) { - ; - } else { - break label_8; - } - op = Binop(); - s = Exp(); - e=Exp.binaryexp(e,op,s); - } - L(e,i); {if (true) return e;} - throw new Error("Missing return statement in function"); - } - - final public FuncBody FunctionCall() throws ParseException { - FuncBody b; - long i = LineInfo(); - jj_consume_token(FUNCTION); - b = FuncBody(); - L(b,i); {if (true) return b;} - throw new Error("Missing return statement in function"); - } - - final public FuncBody FuncBody() throws ParseException { - ParList pl=null; - Block b; - FuncBody f; - long i = LineInfo(); - jj_consume_token(75); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case NAME: - case 79: - pl = ParList(); - break; - default: - jj_la1[24] = jj_gen; - ; - } - jj_consume_token(76); - b = Block(); - jj_consume_token(END); - f=new FuncBody(pl,b); L(f,i); {if (true) return f;} - throw new Error("Missing return statement in function"); - } - - final public ParList ParList() throws ParseException { - List l=null; - boolean v=false; - ParList p; - long i = LineInfo(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case NAME: - l = NameList(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 72: - jj_consume_token(72); - jj_consume_token(79); - v=true; - break; - default: - jj_la1[25] = jj_gen; - ; - } - p=new ParList(l,v); L(p,i); {if (true) return p;} - break; - case 79: - jj_consume_token(79); - p=new ParList(null,true); L(p,i); {if (true) return p;} - break; - default: - jj_la1[26] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - throw new Error("Missing return statement in function"); - } - - final public TableConstructor TableConstructor() throws ParseException { - TableConstructor c = new TableConstructor(); - List l = null; - long i = LineInfo(); - jj_consume_token(80); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LONGSTRING0: - case LONGSTRING1: - case LONGSTRING2: - case LONGSTRING3: - case LONGSTRINGN: - case FALSE: - case FUNCTION: - case NIL: - case NOT: - case TRUE: - case NAME: - case NUMBER: - case STRING: - case CHARSTRING: - case 69: - case 75: - case 77: - case 79: - case 80: - case 83: - l = FieldList(); - c.fields=l; - break; - default: - jj_la1[27] = jj_gen; - ; - } - jj_consume_token(81); - L(c,i); {if (true) return c;} - throw new Error("Missing return statement in function"); - } - - final public List FieldList() throws ParseException { - List l = new ArrayList(); - TableField f; - f = Field(); - l.add(f); - label_9: - while (true) { - if (jj_2_6(2)) { - ; - } else { - break label_9; - } - FieldSep(); - f = Field(); - l.add(f); - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 70: - case 72: - FieldSep(); - break; - default: - jj_la1[28] = jj_gen; - ; - } - {if (true) return l;} - throw new Error("Missing return statement in function"); - } - - final public TableField Field() throws ParseException { - Token name; - Exp exp,rhs; - TableField f; - long i = LineInfo(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 77: - jj_consume_token(77); - exp = Exp(); - jj_consume_token(78); - jj_consume_token(71); - rhs = Exp(); - f=TableField.keyedField(exp,rhs); L(f,i); {if (true) return f;} - break; - default: - jj_la1[29] = jj_gen; - if (jj_2_7(2)) { - name = jj_consume_token(NAME); - jj_consume_token(71); - rhs = Exp(); - f=TableField.namedField(name.image,rhs); L(f,i); {if (true) return f;} - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LONGSTRING0: - case LONGSTRING1: - case LONGSTRING2: - case LONGSTRING3: - case LONGSTRINGN: - case FALSE: - case FUNCTION: - case NIL: - case NOT: - case TRUE: - case NAME: - case NUMBER: - case STRING: - case CHARSTRING: - case 69: - case 75: - case 79: - case 80: - case 83: - rhs = Exp(); - f=TableField.listField(rhs); L(f,i); {if (true) return f;} - break; - default: - jj_la1[30] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } - throw new Error("Missing return statement in function"); - } - - final public void FieldSep() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 72: - jj_consume_token(72); - break; - case 70: - jj_consume_token(70); - break; - default: - jj_la1[31] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - - final public int Binop() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 82: - jj_consume_token(82); - {if (true) return Lua.OP_ADD;} - break; - case 83: - jj_consume_token(83); - {if (true) return Lua.OP_SUB;} - break; - case 84: - jj_consume_token(84); - {if (true) return Lua.OP_MUL;} - break; - case 85: - jj_consume_token(85); - {if (true) return Lua.OP_DIV;} - break; - case 86: - jj_consume_token(86); - {if (true) return Lua.OP_POW;} - break; - case 87: - jj_consume_token(87); - {if (true) return Lua.OP_MOD;} - break; - case 88: - jj_consume_token(88); - {if (true) return Lua.OP_CONCAT;} - break; - case 89: - jj_consume_token(89); - {if (true) return Lua.OP_LT;} - break; - case 90: - jj_consume_token(90); - {if (true) return Lua.OP_LE;} - break; - case 91: - jj_consume_token(91); - {if (true) return Lua.OP_GT;} - break; - case 92: - jj_consume_token(92); - {if (true) return Lua.OP_GE;} - break; - case 93: - jj_consume_token(93); - {if (true) return Lua.OP_EQ;} - break; - case 94: - jj_consume_token(94); - {if (true) return Lua.OP_NEQ;} - break; - case AND: - jj_consume_token(AND); - {if (true) return Lua.OP_AND;} - break; - case OR: - jj_consume_token(OR); - {if (true) return Lua.OP_OR;} - break; - default: - jj_la1[32] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - throw new Error("Missing return statement in function"); - } - - final public int Unop() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 83: - jj_consume_token(83); - {if (true) return Lua.OP_UNM;} - break; - case NOT: - jj_consume_token(NOT); - {if (true) return Lua.OP_NOT;} - break; - case 69: - jj_consume_token(69); - {if (true) return Lua.OP_LEN;} - break; - default: - jj_la1[33] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - throw new Error("Missing return statement in function"); - } - - private boolean jj_2_1(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_1(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(0, xla); } - } - - private boolean jj_2_2(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_2(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(1, xla); } - } - - private boolean jj_2_3(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_3(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(2, xla); } - } - - private boolean jj_2_4(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_4(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(3, xla); } - } - - private boolean jj_2_5(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_5(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(4, xla); } - } - - private boolean jj_2_6(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_6(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(5, xla); } - } - - private boolean jj_2_7(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_7(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(6, xla); } - } - - private boolean jj_3R_43() { - if (jj_3R_58()) return true; - return false; - } - - private boolean jj_3R_42() { - if (jj_3R_57()) return true; - return false; - } - - private boolean jj_3R_41() { - if (jj_scan_token(75)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_56()) jj_scanpos = xsp; - if (jj_scan_token(76)) return true; - return false; - } - - private boolean jj_3R_38() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_41()) { - jj_scanpos = xsp; - if (jj_3R_42()) { - jj_scanpos = xsp; - if (jj_3R_43()) return true; - } - } - return false; - } - - private boolean jj_3_3() { - if (jj_3R_10()) return true; - return false; - } - - private boolean jj_3R_18() { - if (jj_3R_38()) return true; - return false; - } - - private boolean jj_3R_17() { - if (jj_scan_token(74)) return true; - if (jj_scan_token(NAME)) return true; - return false; - } - - private boolean jj_3R_16() { - if (jj_scan_token(77)) return true; - if (jj_3R_12()) return true; - return false; - } - - private boolean jj_3R_35() { - if (jj_3R_40()) return true; - return false; - } - - private boolean jj_3R_15() { - if (jj_scan_token(73)) return true; - if (jj_scan_token(NAME)) return true; - return false; - } - - private boolean jj_3R_10() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_15()) { - jj_scanpos = xsp; - if (jj_3R_16()) { - jj_scanpos = xsp; - if (jj_3R_17()) { - jj_scanpos = xsp; - if (jj_3R_18()) return true; - } - } - } - return false; - } - - private boolean jj_3R_59() { - if (jj_scan_token(FUNCTION)) return true; - return false; - } - - private boolean jj_3_5() { - if (jj_3R_11()) return true; - if (jj_3R_12()) return true; - return false; - } - - private boolean jj_3R_60() { - if (jj_3R_70()) return true; - return false; - } - - private boolean jj_3R_55() { - if (jj_scan_token(69)) return true; - return false; - } - - private boolean jj_3R_54() { - if (jj_scan_token(NOT)) return true; - return false; - } - - private boolean jj_3R_53() { - if (jj_scan_token(83)) return true; - return false; - } - - private boolean jj_3R_40() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_53()) { - jj_scanpos = xsp; - if (jj_3R_54()) { - jj_scanpos = xsp; - if (jj_3R_55()) return true; - } - } - return false; - } - - private boolean jj_3R_34() { - if (jj_3R_39()) return true; - return false; - } - - private boolean jj_3R_12() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_34()) { - jj_scanpos = xsp; - if (jj_3R_35()) return true; - } - return false; - } - - private boolean jj_3R_73() { - if (jj_scan_token(75)) return true; - return false; - } - - private boolean jj_3R_33() { - if (jj_scan_token(OR)) return true; - return false; - } - - private boolean jj_3R_72() { - if (jj_scan_token(NAME)) return true; - return false; - } - - private boolean jj_3R_70() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_72()) { - jj_scanpos = xsp; - if (jj_3R_73()) return true; - } - return false; - } - - private boolean jj_3_2() { - if (jj_scan_token(LOCAL)) return true; - if (jj_scan_token(FUNCTION)) return true; - return false; - } - - private boolean jj_3R_32() { - if (jj_scan_token(AND)) return true; - return false; - } - - private boolean jj_3R_31() { - if (jj_scan_token(94)) return true; - return false; - } - - private boolean jj_3_4() { - if (jj_scan_token(72)) return true; - if (jj_scan_token(NAME)) return true; - return false; - } - - private boolean jj_3R_30() { - if (jj_scan_token(93)) return true; - return false; - } - - private boolean jj_3_1() { - if (jj_scan_token(FOR)) return true; - if (jj_scan_token(NAME)) return true; - if (jj_scan_token(71)) return true; - return false; - } - - private boolean jj_3R_29() { - if (jj_scan_token(92)) return true; - return false; - } - - private boolean jj_3R_28() { - if (jj_scan_token(91)) return true; - return false; - } - - private boolean jj_3R_69() { - if (jj_scan_token(LONGSTRINGN)) return true; - return false; - } - - private boolean jj_3R_27() { - if (jj_scan_token(90)) return true; - return false; - } - - private boolean jj_3R_68() { - if (jj_scan_token(LONGSTRING3)) return true; - return false; - } - - private boolean jj_3R_26() { - if (jj_scan_token(89)) return true; - return false; - } - - private boolean jj_3R_67() { - if (jj_scan_token(LONGSTRING2)) return true; - return false; - } - - private boolean jj_3R_25() { - if (jj_scan_token(88)) return true; - return false; - } - - private boolean jj_3R_66() { - if (jj_scan_token(LONGSTRING1)) return true; - return false; - } - - private boolean jj_3R_24() { - if (jj_scan_token(87)) return true; - return false; - } - - private boolean jj_3R_65() { - if (jj_scan_token(LONGSTRING0)) return true; - return false; - } - - private boolean jj_3R_23() { - if (jj_scan_token(86)) return true; - return false; - } - - private boolean jj_3R_64() { - if (jj_scan_token(CHARSTRING)) return true; - return false; - } - - private boolean jj_3R_22() { - if (jj_scan_token(85)) return true; - return false; - } - - private boolean jj_3R_63() { - if (jj_scan_token(STRING)) return true; - return false; - } - - private boolean jj_3R_58() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_63()) { - jj_scanpos = xsp; - if (jj_3R_64()) { - jj_scanpos = xsp; - if (jj_3R_65()) { - jj_scanpos = xsp; - if (jj_3R_66()) { - jj_scanpos = xsp; - if (jj_3R_67()) { - jj_scanpos = xsp; - if (jj_3R_68()) { - jj_scanpos = xsp; - if (jj_3R_69()) return true; - } - } - } - } - } - } - return false; - } - - private boolean jj_3R_21() { - if (jj_scan_token(84)) return true; - return false; - } - - private boolean jj_3R_20() { - if (jj_scan_token(83)) return true; - return false; - } - - private boolean jj_3R_19() { - if (jj_scan_token(82)) return true; - return false; - } - - private boolean jj_3R_11() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_19()) { - jj_scanpos = xsp; - if (jj_3R_20()) { - jj_scanpos = xsp; - if (jj_3R_21()) { - jj_scanpos = xsp; - if (jj_3R_22()) { - jj_scanpos = xsp; - if (jj_3R_23()) { - jj_scanpos = xsp; - if (jj_3R_24()) { - jj_scanpos = xsp; - if (jj_3R_25()) { - jj_scanpos = xsp; - if (jj_3R_26()) { - jj_scanpos = xsp; - if (jj_3R_27()) { - jj_scanpos = xsp; - if (jj_3R_28()) { - jj_scanpos = xsp; - if (jj_3R_29()) { - jj_scanpos = xsp; - if (jj_3R_30()) { - jj_scanpos = xsp; - if (jj_3R_31()) { - jj_scanpos = xsp; - if (jj_3R_32()) { - jj_scanpos = xsp; - if (jj_3R_33()) return true; - } - } - } - } - } - } - } - } - } - } - } - } - } - } - return false; - } - - private boolean jj_3_6() { - if (jj_3R_13()) return true; - if (jj_3R_14()) return true; - return false; - } - - private boolean jj_3R_52() { - if (jj_3R_60()) return true; - return false; - } - - private boolean jj_3R_51() { - if (jj_3R_59()) return true; - return false; - } - - private boolean jj_3R_50() { - if (jj_3R_57()) return true; - return false; - } - - private boolean jj_3R_13() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(72)) { - jj_scanpos = xsp; - if (jj_scan_token(70)) return true; - } - return false; - } - - private boolean jj_3R_49() { - if (jj_scan_token(79)) return true; - return false; - } - - private boolean jj_3R_48() { - if (jj_3R_58()) return true; - return false; - } - - private boolean jj_3R_47() { - if (jj_scan_token(NUMBER)) return true; - return false; - } - - private boolean jj_3R_46() { - if (jj_scan_token(FALSE)) return true; - return false; - } - - private boolean jj_3R_45() { - if (jj_scan_token(TRUE)) return true; - return false; - } - - private boolean jj_3R_44() { - if (jj_scan_token(NIL)) return true; - return false; - } - - private boolean jj_3R_39() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_44()) { - jj_scanpos = xsp; - if (jj_3R_45()) { - jj_scanpos = xsp; - if (jj_3R_46()) { - jj_scanpos = xsp; - if (jj_3R_47()) { - jj_scanpos = xsp; - if (jj_3R_48()) { - jj_scanpos = xsp; - if (jj_3R_49()) { - jj_scanpos = xsp; - if (jj_3R_50()) { - jj_scanpos = xsp; - if (jj_3R_51()) { - jj_scanpos = xsp; - if (jj_3R_52()) return true; - } - } - } - } - } - } - } - } - return false; - } - - private boolean jj_3R_37() { - if (jj_3R_12()) return true; - return false; - } - - private boolean jj_3_7() { - if (jj_scan_token(NAME)) return true; - if (jj_scan_token(71)) return true; - return false; - } - - private boolean jj_3R_14() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_36()) { - jj_scanpos = xsp; - if (jj_3_7()) { - jj_scanpos = xsp; - if (jj_3R_37()) return true; - } - } - return false; - } - - private boolean jj_3R_36() { - if (jj_scan_token(77)) return true; - return false; - } - - private boolean jj_3R_71() { - if (jj_3R_14()) return true; - return false; - } - - private boolean jj_3R_61() { - if (jj_3R_12()) return true; - return false; - } - - private boolean jj_3R_62() { - if (jj_3R_71()) return true; - return false; - } - - private boolean jj_3R_57() { - if (jj_scan_token(80)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_62()) jj_scanpos = xsp; - if (jj_scan_token(81)) return true; - return false; - } - - private boolean jj_3R_56() { - if (jj_3R_61()) return true; - return false; - } - - /** Generated Token Manager. */ - public LuaParserTokenManager token_source; - SimpleCharStream jj_input_stream; - /** Current token. */ - public Token token; - /** Next token. */ - public Token jj_nt; - private int jj_ntk; - private Token jj_scanpos, jj_lastpos; - private int jj_la; - private int jj_gen; - final private int[] jj_la1 = new int[34]; - static private int[] jj_la1_0; - static private int[] jj_la1_1; - static private int[] jj_la1_2; - static { - jj_la1_init_0(); - jj_la1_init_1(); - jj_la1_init_2(); - } - private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0x0,0xc0000000,0x0,0x0,0x0,0xc0000000,0x0,0x0,0x0,0x0,0xf800000,0x0,0x0,0x0,0x0,0x0,0x0,0xf800000,0xf800000,0xf800000,0x0,0xf800000,0xf800000,0xf800000,0x0,0x0,0x0,0xf800000,0x0,0x0,0xf800000,0x0,0x20000000,0x0,}; - } - private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x0,0xc42f0,0x2000,0x0,0x0,0x440c0,0x30,0x80200,0x2,0x1,0x60190c28,0x0,0x0,0x0,0x0,0x0,0x80000,0x60000000,0x60190c28,0x60000000,0x0,0x60190428,0x60000000,0x60190c28,0x80000,0x0,0x80000,0x60190c28,0x0,0x0,0x60190c28,0x0,0x1000,0x800,}; - } - private static void jj_la1_init_2() { - jj_la1_2 = new int[] {0x20,0x842,0x0,0x100,0x80,0x42,0x0,0x800,0x0,0x0,0x98820,0x40,0x180,0x100,0x200,0x400,0x800,0x12e00,0x98820,0x10800,0x100,0x18800,0x0,0x98820,0x8000,0x100,0x8000,0x9a820,0x140,0x2000,0x98820,0x140,0x7ffc0000,0x80020,}; - } - final private JJCalls[] jj_2_rtns = new JJCalls[7]; - private boolean jj_rescan = false; - private int jj_gc = 0; - - /** Constructor with InputStream. */ - public LuaParser(java.io.InputStream stream) { - this(stream, null); - } - /** Constructor with InputStream and supplied encoding */ - public LuaParser(java.io.InputStream stream, String encoding) { - try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e.getMessage()); } - token_source = new LuaParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 34; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Reinitialise. */ - public void ReInit(java.io.InputStream stream) { - ReInit(stream, null); - } - /** Reinitialise. */ - public void ReInit(java.io.InputStream stream, String encoding) { - try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e.getMessage()); } - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 34; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Constructor. */ - public LuaParser(java.io.Reader stream) { - jj_input_stream = new SimpleCharStream(stream, 1, 1); - token_source = new LuaParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 34; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Reinitialise. */ - public void ReInit(java.io.Reader stream) { - jj_input_stream.ReInit(stream, 1, 1); - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 34; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Constructor with generated Token Manager. */ - public LuaParser(LuaParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 34; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Reinitialise. */ - public void ReInit(LuaParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 34; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - if (token.kind == kind) { - jj_gen++; - if (++jj_gc > 100) { - jj_gc = 0; - for (int i = 0; i < jj_2_rtns.length; i++) { - JJCalls c = jj_2_rtns[i]; - while (c != null) { - if (c.gen < jj_gen) c.first = null; - c = c.next; - } - } - } - return token; - } - token = oldToken; - jj_kind = kind; - throw generateParseException(); - } - - static private final class LookaheadSuccess extends java.lang.Error { } - final private LookaheadSuccess jj_ls = new LookaheadSuccess(); - private boolean jj_scan_token(int kind) { - if (jj_scanpos == jj_lastpos) { - jj_la--; - if (jj_scanpos.next == null) { - jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); - } else { - jj_lastpos = jj_scanpos = jj_scanpos.next; - } - } else { - jj_scanpos = jj_scanpos.next; - } - if (jj_rescan) { - int i = 0; Token tok = token; - while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } - if (tok != null) jj_add_error_token(kind, i); - } - if (jj_scanpos.kind != kind) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; - return false; - } - - -/** Get the next Token. */ - final public Token getNextToken() { - if (token.next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - jj_gen++; - return token; - } - -/** Get the specific Token. */ - final public Token getToken(int index) { - Token t = token; - for (int i = 0; i < index; i++) { - if (t.next != null) t = t.next; - else t = t.next = token_source.getNextToken(); - } - return t; - } - - private int jj_ntk() { - if ((jj_nt=token.next) == null) - return (jj_ntk = (token.next=token_source.getNextToken()).kind); - else - return (jj_ntk = jj_nt.kind); - } - - private java.util.List jj_expentries = new java.util.ArrayList(); - private int[] jj_expentry; - private int jj_kind = -1; - private int[] jj_lasttokens = new int[100]; - private int jj_endpos; - - private void jj_add_error_token(int kind, int pos) { - if (pos >= 100) return; - if (pos == jj_endpos + 1) { - jj_lasttokens[jj_endpos++] = kind; - } else if (jj_endpos != 0) { - jj_expentry = new int[jj_endpos]; - for (int i = 0; i < jj_endpos; i++) { - jj_expentry[i] = jj_lasttokens[i]; - } - jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) { - int[] oldentry = (int[])(it.next()); - if (oldentry.length == jj_expentry.length) { - for (int i = 0; i < jj_expentry.length; i++) { - if (oldentry[i] != jj_expentry[i]) { - continue jj_entries_loop; - } - } - jj_expentries.add(jj_expentry); - break jj_entries_loop; - } - } - if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; - } - } - - /** Generate ParseException. */ - public ParseException generateParseException() { - jj_expentries.clear(); - boolean[] la1tokens = new boolean[95]; - if (jj_kind >= 0) { - la1tokens[jj_kind] = true; - jj_kind = -1; - } - for (int i = 0; i < 34; i++) { - if (jj_la1[i] == jj_gen) { - for (int j = 0; j < 32; j++) { - if ((jj_la1_0[i] & (1< jj_gen) { - jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; - switch (i) { - case 0: jj_3_1(); break; - case 1: jj_3_2(); break; - case 2: jj_3_3(); break; - case 3: jj_3_4(); break; - case 4: jj_3_5(); break; - case 5: jj_3_6(); break; - case 6: jj_3_7(); break; - } - } - p = p.next; - } while (p != null); - } catch(LookaheadSuccess ls) { } - } - jj_rescan = false; - } - - private void jj_save(int index, int xla) { - JJCalls p = jj_2_rtns[index]; - while (p.gen > jj_gen) { - if (p.next == null) { p = p.next = new JJCalls(); break; } - p = p.next; - } - p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; - } - - static final class JJCalls { - int gen; - Token first; - int arg; - JJCalls next; - } - -} diff --git a/luaj-jse/src/main/java/org/luaj/vm2/parser/LuaParserConstants.java b/luaj-jse/src/main/java/org/luaj/vm2/parser/LuaParserConstants.java deleted file mode 100644 index fbab92e7..00000000 --- a/luaj-jse/src/main/java/org/luaj/vm2/parser/LuaParserConstants.java +++ /dev/null @@ -1,240 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. LuaParserConstants.java */ -package org.luaj.vm2.parser; - - -/** - * Token literal values and constants. - * Generated by org.javacc.parser.OtherFilesGen#start() - */ -public interface LuaParserConstants { - - /** End of File. */ - int EOF = 0; - /** RegularExpression Id. */ - int COMMENT = 17; - /** RegularExpression Id. */ - int LONGCOMMENT0 = 18; - /** RegularExpression Id. */ - int LONGCOMMENT1 = 19; - /** RegularExpression Id. */ - int LONGCOMMENT2 = 20; - /** RegularExpression Id. */ - int LONGCOMMENT3 = 21; - /** RegularExpression Id. */ - int LONGCOMMENTN = 22; - /** RegularExpression Id. */ - int LONGSTRING0 = 23; - /** RegularExpression Id. */ - int LONGSTRING1 = 24; - /** RegularExpression Id. */ - int LONGSTRING2 = 25; - /** RegularExpression Id. */ - int LONGSTRING3 = 26; - /** RegularExpression Id. */ - int LONGSTRINGN = 27; - /** RegularExpression Id. */ - int AND = 29; - /** RegularExpression Id. */ - int BREAK = 30; - /** RegularExpression Id. */ - int DO = 31; - /** RegularExpression Id. */ - int ELSE = 32; - /** RegularExpression Id. */ - int ELSEIF = 33; - /** RegularExpression Id. */ - int END = 34; - /** RegularExpression Id. */ - int FALSE = 35; - /** RegularExpression Id. */ - int FOR = 36; - /** RegularExpression Id. */ - int FUNCTION = 37; - /** RegularExpression Id. */ - int GOTO = 38; - /** RegularExpression Id. */ - int IF = 39; - /** RegularExpression Id. */ - int IN = 40; - /** RegularExpression Id. */ - int LOCAL = 41; - /** RegularExpression Id. */ - int NIL = 42; - /** RegularExpression Id. */ - int NOT = 43; - /** RegularExpression Id. */ - int OR = 44; - /** RegularExpression Id. */ - int RETURN = 45; - /** RegularExpression Id. */ - int REPEAT = 46; - /** RegularExpression Id. */ - int THEN = 47; - /** RegularExpression Id. */ - int TRUE = 48; - /** RegularExpression Id. */ - int UNTIL = 49; - /** RegularExpression Id. */ - int WHILE = 50; - /** RegularExpression Id. */ - int NAME = 51; - /** RegularExpression Id. */ - int NUMBER = 52; - /** RegularExpression Id. */ - int FLOAT = 53; - /** RegularExpression Id. */ - int FNUM = 54; - /** RegularExpression Id. */ - int DIGIT = 55; - /** RegularExpression Id. */ - int EXP = 56; - /** RegularExpression Id. */ - int HEX = 57; - /** RegularExpression Id. */ - int HEXNUM = 58; - /** RegularExpression Id. */ - int HEXDIGIT = 59; - /** RegularExpression Id. */ - int HEXEXP = 60; - /** RegularExpression Id. */ - int STRING = 61; - /** RegularExpression Id. */ - int CHARSTRING = 62; - /** RegularExpression Id. */ - int QUOTED = 63; - /** RegularExpression Id. */ - int DECIMAL = 64; - /** RegularExpression Id. */ - int DBCOLON = 65; - /** RegularExpression Id. */ - int UNICODE = 66; - /** RegularExpression Id. */ - int CHAR = 67; - /** RegularExpression Id. */ - int LF = 68; - - /** Lexical state. */ - int DEFAULT = 0; - /** Lexical state. */ - int IN_COMMENT = 1; - /** Lexical state. */ - int IN_LC0 = 2; - /** Lexical state. */ - int IN_LC1 = 3; - /** Lexical state. */ - int IN_LC2 = 4; - /** Lexical state. */ - int IN_LC3 = 5; - /** Lexical state. */ - int IN_LCN = 6; - /** Lexical state. */ - int IN_LS0 = 7; - /** Lexical state. */ - int IN_LS1 = 8; - /** Lexical state. */ - int IN_LS2 = 9; - /** Lexical state. */ - int IN_LS3 = 10; - /** Lexical state. */ - int IN_LSN = 11; - - /** Literal token values. */ - String[] tokenImage = { - "", - "\" \"", - "\"\\t\"", - "\"\\n\"", - "\"\\r\"", - "\"\\f\"", - "\"--[[\"", - "\"--[=[\"", - "\"--[==[\"", - "\"--[===[\"", - "", - "\"[[\"", - "\"[=[\"", - "\"[==[\"", - "\"[===[\"", - "", - "\"--\"", - "", - "\"]]\"", - "\"]=]\"", - "\"]==]\"", - "\"]===]\"", - "", - "\"]]\"", - "\"]=]\"", - "\"]==]\"", - "\"]===]\"", - "", - "", - "\"and\"", - "\"break\"", - "\"do\"", - "\"else\"", - "\"elseif\"", - "\"end\"", - "\"false\"", - "\"for\"", - "\"function\"", - "\"goto\"", - "\"if\"", - "\"in\"", - "\"local\"", - "\"nil\"", - "\"not\"", - "\"or\"", - "\"return\"", - "\"repeat\"", - "\"then\"", - "\"true\"", - "\"until\"", - "\"while\"", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "\"::\"", - "", - "", - "", - "\"#\"", - "\";\"", - "\"=\"", - "\",\"", - "\".\"", - "\":\"", - "\"(\"", - "\")\"", - "\"[\"", - "\"]\"", - "\"...\"", - "\"{\"", - "\"}\"", - "\"+\"", - "\"-\"", - "\"*\"", - "\"/\"", - "\"^\"", - "\"%\"", - "\"..\"", - "\"<\"", - "\"<=\"", - "\">\"", - "\">=\"", - "\"==\"", - "\"~=\"", - }; - -} diff --git a/luaj-jse/src/main/java/org/luaj/vm2/parser/LuaParserTokenManager.java b/luaj-jse/src/main/java/org/luaj/vm2/parser/LuaParserTokenManager.java deleted file mode 100644 index 3b3dc0c2..00000000 --- a/luaj-jse/src/main/java/org/luaj/vm2/parser/LuaParserTokenManager.java +++ /dev/null @@ -1,2102 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. LuaParserTokenManager.java */ -package org.luaj.vm2.parser; -import org.luaj.vm2.*; -import org.luaj.vm2.ast.*; -import java.util.*; - -/** Token Manager. */ -public class LuaParserTokenManager implements LuaParserConstants -{ - - /** Debug output. */ - public java.io.PrintStream debugStream = System.out; - /** Set debug output. */ - public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } -private int jjStopAtPos(int pos, int kind) -{ - jjmatchedKind = kind; - jjmatchedPos = pos; - return pos + 1; -} -private int jjMoveStringLiteralDfa0_2() -{ - switch(curChar) - { - case 93: - return jjMoveStringLiteralDfa1_2(0x40000L); - default : - return 1; - } -} -private int jjMoveStringLiteralDfa1_2(long active0) -{ - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 1; - } - switch(curChar) - { - case 93: - if ((active0 & 0x40000L) != 0L) - return jjStopAtPos(1, 18); - break; - default : - return 2; - } - return 2; -} -private int jjMoveStringLiteralDfa0_11() -{ - return jjMoveNfa_11(6, 0); -} -private int jjMoveNfa_11(int startState, int curPos) -{ - int startsAt = 0; - jjnewStateCnt = 7; - int i = 1; - jjstateSet[0] = startState; - int kind = 0x7fffffff; - for (;;) - { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) - { - long l = 1L << curChar; - do - { - switch(jjstateSet[--i]) - { - case 0: - case 1: - if (curChar == 61) - jjCheckNAddTwoStates(1, 2); - break; - case 3: - if (curChar == 61) - jjstateSet[jjnewStateCnt++] = 0; - break; - case 4: - if (curChar == 61) - jjstateSet[jjnewStateCnt++] = 3; - break; - case 5: - if (curChar == 61) - jjstateSet[jjnewStateCnt++] = 4; - break; - default : break; - } - } while(i != startsAt); - } - else if (curChar < 128) - { - long l = 1L << (curChar & 077); - do - { - switch(jjstateSet[--i]) - { - case 2: - if (curChar == 93 && kind > 27) - kind = 27; - break; - case 6: - if (curChar == 93) - jjstateSet[jjnewStateCnt++] = 5; - break; - default : break; - } - } while(i != startsAt); - } - else - { - int hiByte = (int)(curChar >> 8); - int i1 = hiByte >> 6; - long l1 = 1L << (hiByte & 077); - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - do - { - switch(jjstateSet[--i]) - { - default : break; - } - } while(i != startsAt); - } - if (kind != 0x7fffffff) - { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt))) - return curPos; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { return curPos; } - } -} -private int jjMoveStringLiteralDfa0_10() -{ - switch(curChar) - { - case 93: - return jjMoveStringLiteralDfa1_10(0x4000000L); - default : - return 1; - } -} -private int jjMoveStringLiteralDfa1_10(long active0) -{ - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 1; - } - switch(curChar) - { - case 61: - return jjMoveStringLiteralDfa2_10(active0, 0x4000000L); - default : - return 2; - } -} -private int jjMoveStringLiteralDfa2_10(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return 2; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 2; - } - switch(curChar) - { - case 61: - return jjMoveStringLiteralDfa3_10(active0, 0x4000000L); - default : - return 3; - } -} -private int jjMoveStringLiteralDfa3_10(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return 3; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 3; - } - switch(curChar) - { - case 61: - return jjMoveStringLiteralDfa4_10(active0, 0x4000000L); - default : - return 4; - } -} -private int jjMoveStringLiteralDfa4_10(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return 4; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 4; - } - switch(curChar) - { - case 93: - if ((active0 & 0x4000000L) != 0L) - return jjStopAtPos(4, 26); - break; - default : - return 5; - } - return 5; -} -private int jjMoveStringLiteralDfa0_9() -{ - switch(curChar) - { - case 93: - return jjMoveStringLiteralDfa1_9(0x2000000L); - default : - return 1; - } -} -private int jjMoveStringLiteralDfa1_9(long active0) -{ - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 1; - } - switch(curChar) - { - case 61: - return jjMoveStringLiteralDfa2_9(active0, 0x2000000L); - default : - return 2; - } -} -private int jjMoveStringLiteralDfa2_9(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return 2; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 2; - } - switch(curChar) - { - case 61: - return jjMoveStringLiteralDfa3_9(active0, 0x2000000L); - default : - return 3; - } -} -private int jjMoveStringLiteralDfa3_9(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return 3; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 3; - } - switch(curChar) - { - case 93: - if ((active0 & 0x2000000L) != 0L) - return jjStopAtPos(3, 25); - break; - default : - return 4; - } - return 4; -} -private int jjMoveStringLiteralDfa0_8() -{ - switch(curChar) - { - case 93: - return jjMoveStringLiteralDfa1_8(0x1000000L); - default : - return 1; - } -} -private int jjMoveStringLiteralDfa1_8(long active0) -{ - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 1; - } - switch(curChar) - { - case 61: - return jjMoveStringLiteralDfa2_8(active0, 0x1000000L); - default : - return 2; - } -} -private int jjMoveStringLiteralDfa2_8(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return 2; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 2; - } - switch(curChar) - { - case 93: - if ((active0 & 0x1000000L) != 0L) - return jjStopAtPos(2, 24); - break; - default : - return 3; - } - return 3; -} -private int jjMoveStringLiteralDfa0_7() -{ - switch(curChar) - { - case 93: - return jjMoveStringLiteralDfa1_7(0x800000L); - default : - return 1; - } -} -private int jjMoveStringLiteralDfa1_7(long active0) -{ - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 1; - } - switch(curChar) - { - case 93: - if ((active0 & 0x800000L) != 0L) - return jjStopAtPos(1, 23); - break; - default : - return 2; - } - return 2; -} -private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) -{ - switch (pos) - { - case 0: - if ((active0 & 0x7800L) != 0L || (active1 & 0x2000L) != 0L) - return 14; - if ((active1 & 0x1008200L) != 0L) - return 31; - if ((active0 & 0x7ffffe0000000L) != 0L) - { - jjmatchedKind = 51; - return 17; - } - if ((active0 & 0x103c0L) != 0L || (active1 & 0x80000L) != 0L) - return 7; - return -1; - case 1: - if ((active0 & 0x103c0L) != 0L) - return 6; - if ((active0 & 0x7000L) != 0L) - return 13; - if ((active0 & 0x118080000000L) != 0L) - return 17; - if ((active0 & 0x7ee7f60000000L) != 0L) - { - if (jjmatchedPos != 1) - { - jjmatchedKind = 51; - jjmatchedPos = 1; - } - return 17; - } - return -1; - case 2: - if ((active0 & 0x7e26b40000000L) != 0L) - { - jjmatchedKind = 51; - jjmatchedPos = 2; - return 17; - } - if ((active0 & 0x6000L) != 0L) - return 12; - if ((active0 & 0x3c0L) != 0L) - return 5; - if ((active0 & 0xc1420000000L) != 0L) - return 17; - return -1; - case 3: - if ((active0 & 0x380L) != 0L) - return 4; - if ((active0 & 0x6622840000000L) != 0L) - { - if (jjmatchedPos != 3) - { - jjmatchedKind = 51; - jjmatchedPos = 3; - } - return 17; - } - if ((active0 & 0x1804300000000L) != 0L) - return 17; - if ((active0 & 0x4000L) != 0L) - return 9; - return -1; - case 4: - if ((active0 & 0x602200000000L) != 0L) - { - jjmatchedKind = 51; - jjmatchedPos = 4; - return 17; - } - if ((active0 & 0x300L) != 0L) - return 3; - if ((active0 & 0x6020840000000L) != 0L) - return 17; - return -1; - case 5: - if ((active0 & 0x200L) != 0L) - return 0; - if ((active0 & 0x600200000000L) != 0L) - return 17; - if ((active0 & 0x2000000000L) != 0L) - { - jjmatchedKind = 51; - jjmatchedPos = 5; - return 17; - } - return -1; - case 6: - if ((active0 & 0x2000000000L) != 0L) - { - jjmatchedKind = 51; - jjmatchedPos = 6; - return 17; - } - return -1; - default : - return -1; - } -} -private final int jjStartNfa_0(int pos, long active0, long active1) -{ - return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0, active1), pos + 1); -} -private int jjMoveStringLiteralDfa0_0() -{ - switch(curChar) - { - case 35: - return jjStopAtPos(0, 69); - case 37: - return jjStopAtPos(0, 87); - case 40: - return jjStopAtPos(0, 75); - case 41: - return jjStopAtPos(0, 76); - case 42: - return jjStopAtPos(0, 84); - case 43: - return jjStopAtPos(0, 82); - case 44: - return jjStopAtPos(0, 72); - case 45: - jjmatchedKind = 83; - return jjMoveStringLiteralDfa1_0(0x103c0L, 0x0L); - case 46: - jjmatchedKind = 73; - return jjMoveStringLiteralDfa1_0(0x0L, 0x1008000L); - case 47: - return jjStopAtPos(0, 85); - case 58: - jjmatchedKind = 74; - return jjMoveStringLiteralDfa1_0(0x0L, 0x2L); - case 59: - return jjStopAtPos(0, 70); - case 60: - jjmatchedKind = 89; - return jjMoveStringLiteralDfa1_0(0x0L, 0x4000000L); - case 61: - jjmatchedKind = 71; - return jjMoveStringLiteralDfa1_0(0x0L, 0x20000000L); - case 62: - jjmatchedKind = 91; - return jjMoveStringLiteralDfa1_0(0x0L, 0x10000000L); - case 91: - jjmatchedKind = 77; - return jjMoveStringLiteralDfa1_0(0x7800L, 0x0L); - case 93: - return jjStopAtPos(0, 78); - case 94: - return jjStopAtPos(0, 86); - case 97: - return jjMoveStringLiteralDfa1_0(0x20000000L, 0x0L); - case 98: - return jjMoveStringLiteralDfa1_0(0x40000000L, 0x0L); - case 100: - return jjMoveStringLiteralDfa1_0(0x80000000L, 0x0L); - case 101: - return jjMoveStringLiteralDfa1_0(0x700000000L, 0x0L); - case 102: - return jjMoveStringLiteralDfa1_0(0x3800000000L, 0x0L); - case 103: - return jjMoveStringLiteralDfa1_0(0x4000000000L, 0x0L); - case 105: - return jjMoveStringLiteralDfa1_0(0x18000000000L, 0x0L); - case 108: - return jjMoveStringLiteralDfa1_0(0x20000000000L, 0x0L); - case 110: - return jjMoveStringLiteralDfa1_0(0xc0000000000L, 0x0L); - case 111: - return jjMoveStringLiteralDfa1_0(0x100000000000L, 0x0L); - case 114: - return jjMoveStringLiteralDfa1_0(0x600000000000L, 0x0L); - case 116: - return jjMoveStringLiteralDfa1_0(0x1800000000000L, 0x0L); - case 117: - return jjMoveStringLiteralDfa1_0(0x2000000000000L, 0x0L); - case 119: - return jjMoveStringLiteralDfa1_0(0x4000000000000L, 0x0L); - case 123: - return jjStopAtPos(0, 80); - case 125: - return jjStopAtPos(0, 81); - case 126: - return jjMoveStringLiteralDfa1_0(0x0L, 0x40000000L); - default : - return jjMoveNfa_0(8, 0); - } -} -private int jjMoveStringLiteralDfa1_0(long active0, long active1) -{ - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(0, active0, active1); - return 1; - } - switch(curChar) - { - case 45: - if ((active0 & 0x10000L) != 0L) - { - jjmatchedKind = 16; - jjmatchedPos = 1; - } - return jjMoveStringLiteralDfa2_0(active0, 0x3c0L, active1, 0L); - case 46: - if ((active1 & 0x1000000L) != 0L) - { - jjmatchedKind = 88; - jjmatchedPos = 1; - } - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x8000L); - case 58: - if ((active1 & 0x2L) != 0L) - return jjStopAtPos(1, 65); - break; - case 61: - if ((active1 & 0x4000000L) != 0L) - return jjStopAtPos(1, 90); - else if ((active1 & 0x10000000L) != 0L) - return jjStopAtPos(1, 92); - else if ((active1 & 0x20000000L) != 0L) - return jjStopAtPos(1, 93); - else if ((active1 & 0x40000000L) != 0L) - return jjStopAtPos(1, 94); - return jjMoveStringLiteralDfa2_0(active0, 0x7000L, active1, 0L); - case 91: - if ((active0 & 0x800L) != 0L) - return jjStopAtPos(1, 11); - break; - case 97: - return jjMoveStringLiteralDfa2_0(active0, 0x800000000L, active1, 0L); - case 101: - return jjMoveStringLiteralDfa2_0(active0, 0x600000000000L, active1, 0L); - case 102: - if ((active0 & 0x8000000000L) != 0L) - return jjStartNfaWithStates_0(1, 39, 17); - break; - case 104: - return jjMoveStringLiteralDfa2_0(active0, 0x4800000000000L, active1, 0L); - case 105: - return jjMoveStringLiteralDfa2_0(active0, 0x40000000000L, active1, 0L); - case 108: - return jjMoveStringLiteralDfa2_0(active0, 0x300000000L, active1, 0L); - case 110: - if ((active0 & 0x10000000000L) != 0L) - return jjStartNfaWithStates_0(1, 40, 17); - return jjMoveStringLiteralDfa2_0(active0, 0x2000420000000L, active1, 0L); - case 111: - if ((active0 & 0x80000000L) != 0L) - return jjStartNfaWithStates_0(1, 31, 17); - return jjMoveStringLiteralDfa2_0(active0, 0xa5000000000L, active1, 0L); - case 114: - if ((active0 & 0x100000000000L) != 0L) - return jjStartNfaWithStates_0(1, 44, 17); - return jjMoveStringLiteralDfa2_0(active0, 0x1000040000000L, active1, 0L); - case 117: - return jjMoveStringLiteralDfa2_0(active0, 0x2000000000L, active1, 0L); - default : - break; - } - return jjStartNfa_0(0, active0, active1); -} -private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1) -{ - if (((active0 &= old0) | (active1 &= old1)) == 0L) - return jjStartNfa_0(0, old0, old1); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(1, active0, active1); - return 2; - } - switch(curChar) - { - case 46: - if ((active1 & 0x8000L) != 0L) - return jjStopAtPos(2, 79); - break; - case 61: - return jjMoveStringLiteralDfa3_0(active0, 0x6000L, active1, 0L); - case 91: - if ((active0 & 0x1000L) != 0L) - return jjStopAtPos(2, 12); - return jjMoveStringLiteralDfa3_0(active0, 0x3c0L, active1, 0L); - case 99: - return jjMoveStringLiteralDfa3_0(active0, 0x20000000000L, active1, 0L); - case 100: - if ((active0 & 0x20000000L) != 0L) - return jjStartNfaWithStates_0(2, 29, 17); - else if ((active0 & 0x400000000L) != 0L) - return jjStartNfaWithStates_0(2, 34, 17); - break; - case 101: - return jjMoveStringLiteralDfa3_0(active0, 0x800040000000L, active1, 0L); - case 105: - return jjMoveStringLiteralDfa3_0(active0, 0x4000000000000L, active1, 0L); - case 108: - if ((active0 & 0x40000000000L) != 0L) - return jjStartNfaWithStates_0(2, 42, 17); - return jjMoveStringLiteralDfa3_0(active0, 0x800000000L, active1, 0L); - case 110: - return jjMoveStringLiteralDfa3_0(active0, 0x2000000000L, active1, 0L); - case 112: - return jjMoveStringLiteralDfa3_0(active0, 0x400000000000L, active1, 0L); - case 114: - if ((active0 & 0x1000000000L) != 0L) - return jjStartNfaWithStates_0(2, 36, 17); - break; - case 115: - return jjMoveStringLiteralDfa3_0(active0, 0x300000000L, active1, 0L); - case 116: - if ((active0 & 0x80000000000L) != 0L) - return jjStartNfaWithStates_0(2, 43, 17); - return jjMoveStringLiteralDfa3_0(active0, 0x2204000000000L, active1, 0L); - case 117: - return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000L, active1, 0L); - default : - break; - } - return jjStartNfa_0(1, active0, active1); -} -private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1) -{ - if (((active0 &= old0) | (active1 &= old1)) == 0L) - return jjStartNfa_0(1, old0, old1); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(2, active0, 0L); - return 3; - } - switch(curChar) - { - case 61: - return jjMoveStringLiteralDfa4_0(active0, 0x4380L); - case 91: - if ((active0 & 0x40L) != 0L) - return jjStopAtPos(3, 6); - else if ((active0 & 0x2000L) != 0L) - return jjStopAtPos(3, 13); - break; - case 97: - return jjMoveStringLiteralDfa4_0(active0, 0x20040000000L); - case 99: - return jjMoveStringLiteralDfa4_0(active0, 0x2000000000L); - case 101: - if ((active0 & 0x100000000L) != 0L) - { - jjmatchedKind = 32; - jjmatchedPos = 3; - } - else if ((active0 & 0x1000000000000L) != 0L) - return jjStartNfaWithStates_0(3, 48, 17); - return jjMoveStringLiteralDfa4_0(active0, 0x400200000000L); - case 105: - return jjMoveStringLiteralDfa4_0(active0, 0x2000000000000L); - case 108: - return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000L); - case 110: - if ((active0 & 0x800000000000L) != 0L) - return jjStartNfaWithStates_0(3, 47, 17); - break; - case 111: - if ((active0 & 0x4000000000L) != 0L) - return jjStartNfaWithStates_0(3, 38, 17); - break; - case 115: - return jjMoveStringLiteralDfa4_0(active0, 0x800000000L); - case 117: - return jjMoveStringLiteralDfa4_0(active0, 0x200000000000L); - default : - break; - } - return jjStartNfa_0(2, active0, 0L); -} -private int jjMoveStringLiteralDfa4_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(2, old0, 0L); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(3, active0, 0L); - return 4; - } - switch(curChar) - { - case 61: - return jjMoveStringLiteralDfa5_0(active0, 0x300L); - case 91: - if ((active0 & 0x80L) != 0L) - return jjStopAtPos(4, 7); - else if ((active0 & 0x4000L) != 0L) - return jjStopAtPos(4, 14); - break; - case 97: - return jjMoveStringLiteralDfa5_0(active0, 0x400000000000L); - case 101: - if ((active0 & 0x800000000L) != 0L) - return jjStartNfaWithStates_0(4, 35, 17); - else if ((active0 & 0x4000000000000L) != 0L) - return jjStartNfaWithStates_0(4, 50, 17); - break; - case 105: - return jjMoveStringLiteralDfa5_0(active0, 0x200000000L); - case 107: - if ((active0 & 0x40000000L) != 0L) - return jjStartNfaWithStates_0(4, 30, 17); - break; - case 108: - if ((active0 & 0x20000000000L) != 0L) - return jjStartNfaWithStates_0(4, 41, 17); - else if ((active0 & 0x2000000000000L) != 0L) - return jjStartNfaWithStates_0(4, 49, 17); - break; - case 114: - return jjMoveStringLiteralDfa5_0(active0, 0x200000000000L); - case 116: - return jjMoveStringLiteralDfa5_0(active0, 0x2000000000L); - default : - break; - } - return jjStartNfa_0(3, active0, 0L); -} -private int jjMoveStringLiteralDfa5_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(3, old0, 0L); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(4, active0, 0L); - return 5; - } - switch(curChar) - { - case 61: - return jjMoveStringLiteralDfa6_0(active0, 0x200L); - case 91: - if ((active0 & 0x100L) != 0L) - return jjStopAtPos(5, 8); - break; - case 102: - if ((active0 & 0x200000000L) != 0L) - return jjStartNfaWithStates_0(5, 33, 17); - break; - case 105: - return jjMoveStringLiteralDfa6_0(active0, 0x2000000000L); - case 110: - if ((active0 & 0x200000000000L) != 0L) - return jjStartNfaWithStates_0(5, 45, 17); - break; - case 116: - if ((active0 & 0x400000000000L) != 0L) - return jjStartNfaWithStates_0(5, 46, 17); - break; - default : - break; - } - return jjStartNfa_0(4, active0, 0L); -} -private int jjMoveStringLiteralDfa6_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(4, old0, 0L); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(5, active0, 0L); - return 6; - } - switch(curChar) - { - case 91: - if ((active0 & 0x200L) != 0L) - return jjStopAtPos(6, 9); - break; - case 111: - return jjMoveStringLiteralDfa7_0(active0, 0x2000000000L); - default : - break; - } - return jjStartNfa_0(5, active0, 0L); -} -private int jjMoveStringLiteralDfa7_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(5, old0, 0L); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(6, active0, 0L); - return 7; - } - switch(curChar) - { - case 110: - if ((active0 & 0x2000000000L) != 0L) - return jjStartNfaWithStates_0(7, 37, 17); - break; - default : - break; - } - return jjStartNfa_0(6, active0, 0L); -} -private int jjStartNfaWithStates_0(int pos, int kind, int state) -{ - jjmatchedKind = kind; - jjmatchedPos = pos; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { return pos + 1; } - return jjMoveNfa_0(state, pos + 1); -} -static final long[] jjbitVec0 = { - 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL -}; -static final long[] jjbitVec2 = { - 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL -}; -private int jjMoveNfa_0(int startState, int curPos) -{ - int startsAt = 0; - jjnewStateCnt = 66; - int i = 1; - jjstateSet[0] = startState; - int kind = 0x7fffffff; - for (;;) - { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) - { - long l = 1L << curChar; - do - { - switch(jjstateSet[--i]) - { - case 8: - if ((0x3ff000000000000L & l) != 0L) - { - if (kind > 52) - kind = 52; - jjCheckNAddStates(0, 3); - } - else if (curChar == 39) - jjCheckNAddStates(4, 6); - else if (curChar == 34) - jjCheckNAddStates(7, 9); - else if (curChar == 46) - jjCheckNAdd(31); - else if (curChar == 45) - jjstateSet[jjnewStateCnt++] = 7; - if (curChar == 48) - jjstateSet[jjnewStateCnt++] = 19; - break; - case 0: - case 1: - if (curChar == 61) - jjCheckNAddTwoStates(1, 2); - break; - case 3: - if (curChar == 61) - jjstateSet[jjnewStateCnt++] = 0; - break; - case 4: - if (curChar == 61) - jjstateSet[jjnewStateCnt++] = 3; - break; - case 5: - if (curChar == 61) - jjstateSet[jjnewStateCnt++] = 4; - break; - case 7: - if (curChar == 45) - jjstateSet[jjnewStateCnt++] = 6; - break; - case 9: - case 10: - if (curChar == 61) - jjCheckNAddTwoStates(10, 11); - break; - case 12: - if (curChar == 61) - jjstateSet[jjnewStateCnt++] = 9; - break; - case 13: - if (curChar == 61) - jjstateSet[jjnewStateCnt++] = 12; - break; - case 14: - if (curChar == 61) - jjstateSet[jjnewStateCnt++] = 13; - break; - case 17: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 51) - kind = 51; - jjstateSet[jjnewStateCnt++] = 17; - break; - case 18: - if (curChar == 48) - jjstateSet[jjnewStateCnt++] = 19; - break; - case 20: - if (curChar == 46) - jjCheckNAdd(21); - break; - case 21: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 52) - kind = 52; - jjCheckNAddTwoStates(21, 22); - break; - case 23: - if ((0x280000000000L & l) != 0L) - jjCheckNAdd(24); - break; - case 24: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 52) - kind = 52; - jjCheckNAdd(24); - break; - case 25: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 52) - kind = 52; - jjCheckNAddStates(10, 13); - break; - case 26: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(26, 27); - break; - case 27: - if (curChar != 46) - break; - if (kind > 52) - kind = 52; - jjCheckNAddTwoStates(28, 22); - break; - case 28: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 52) - kind = 52; - jjCheckNAddTwoStates(28, 22); - break; - case 29: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 52) - kind = 52; - jjCheckNAddTwoStates(29, 22); - break; - case 30: - if (curChar == 46) - jjCheckNAdd(31); - break; - case 31: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 52) - kind = 52; - jjCheckNAddTwoStates(31, 32); - break; - case 33: - if ((0x280000000000L & l) != 0L) - jjCheckNAdd(34); - break; - case 34: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 52) - kind = 52; - jjCheckNAdd(34); - break; - case 35: - if (curChar == 34) - jjCheckNAddStates(7, 9); - break; - case 36: - if ((0xfffffffbffffffffL & l) != 0L) - jjCheckNAddStates(7, 9); - break; - case 37: - if (curChar == 34 && kind > 61) - kind = 61; - break; - case 39: - jjCheckNAddStates(7, 9); - break; - case 41: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 42; - break; - case 42: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 43; - break; - case 43: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 44; - break; - case 44: - case 47: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(7, 9); - break; - case 45: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(14, 17); - break; - case 46: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(18, 21); - break; - case 48: - if (curChar == 39) - jjCheckNAddStates(4, 6); - break; - case 49: - if ((0xffffff7fffffffffL & l) != 0L) - jjCheckNAddStates(4, 6); - break; - case 50: - if (curChar == 39 && kind > 62) - kind = 62; - break; - case 52: - jjCheckNAddStates(4, 6); - break; - case 54: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 55; - break; - case 55: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 56; - break; - case 56: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 57; - break; - case 57: - case 60: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(4, 6); - break; - case 58: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(22, 25); - break; - case 59: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(26, 29); - break; - case 61: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 52) - kind = 52; - jjCheckNAddStates(0, 3); - break; - case 62: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(62, 63); - break; - case 63: - if (curChar != 46) - break; - if (kind > 52) - kind = 52; - jjCheckNAddTwoStates(64, 32); - break; - case 64: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 52) - kind = 52; - jjCheckNAddTwoStates(64, 32); - break; - case 65: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 52) - kind = 52; - jjCheckNAddTwoStates(65, 32); - break; - default : break; - } - } while(i != startsAt); - } - else if (curChar < 128) - { - long l = 1L << (curChar & 077); - do - { - switch(jjstateSet[--i]) - { - case 8: - if ((0x7fffffe87fffffeL & l) != 0L) - { - if (kind > 51) - kind = 51; - jjCheckNAdd(17); - } - else if (curChar == 91) - jjstateSet[jjnewStateCnt++] = 14; - break; - case 2: - if (curChar == 91 && kind > 10) - kind = 10; - break; - case 6: - if (curChar == 91) - jjstateSet[jjnewStateCnt++] = 5; - break; - case 11: - if (curChar == 91 && kind > 15) - kind = 15; - break; - case 15: - if (curChar == 91) - jjstateSet[jjnewStateCnt++] = 14; - break; - case 16: - case 17: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 51) - kind = 51; - jjCheckNAdd(17); - break; - case 19: - if ((0x100000001000000L & l) != 0L) - jjAddStates(30, 31); - break; - case 21: - if ((0x7e0000007eL & l) == 0L) - break; - if (kind > 52) - kind = 52; - jjCheckNAddTwoStates(21, 22); - break; - case 22: - if ((0x1002000010020L & l) != 0L) - jjAddStates(32, 33); - break; - case 25: - if ((0x7e0000007eL & l) == 0L) - break; - if (kind > 52) - kind = 52; - jjCheckNAddStates(10, 13); - break; - case 26: - if ((0x7e0000007eL & l) != 0L) - jjCheckNAddTwoStates(26, 27); - break; - case 28: - if ((0x7e0000007eL & l) == 0L) - break; - if (kind > 52) - kind = 52; - jjCheckNAddTwoStates(28, 22); - break; - case 29: - if ((0x7e0000007eL & l) == 0L) - break; - if (kind > 52) - kind = 52; - jjCheckNAddTwoStates(29, 22); - break; - case 32: - if ((0x2000000020L & l) != 0L) - jjAddStates(34, 35); - break; - case 36: - if ((0xffffffffefffffffL & l) != 0L) - jjCheckNAddStates(7, 9); - break; - case 38: - if (curChar == 92) - jjAddStates(36, 38); - break; - case 39: - jjCheckNAddStates(7, 9); - break; - case 40: - if (curChar == 117) - jjstateSet[jjnewStateCnt++] = 41; - break; - case 41: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 42; - break; - case 42: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 43; - break; - case 43: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 44; - break; - case 44: - if ((0x7e0000007eL & l) != 0L) - jjCheckNAddStates(7, 9); - break; - case 49: - if ((0xffffffffefffffffL & l) != 0L) - jjCheckNAddStates(4, 6); - break; - case 51: - if (curChar == 92) - jjAddStates(39, 41); - break; - case 52: - jjCheckNAddStates(4, 6); - break; - case 53: - if (curChar == 117) - jjstateSet[jjnewStateCnt++] = 54; - break; - case 54: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 55; - break; - case 55: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 56; - break; - case 56: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 57; - break; - case 57: - if ((0x7e0000007eL & l) != 0L) - jjCheckNAddStates(4, 6); - break; - default : break; - } - } while(i != startsAt); - } - else - { - int hiByte = (int)(curChar >> 8); - int i1 = hiByte >> 6; - long l1 = 1L << (hiByte & 077); - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - do - { - switch(jjstateSet[--i]) - { - case 36: - case 39: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - jjCheckNAddStates(7, 9); - break; - case 49: - case 52: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - jjCheckNAddStates(4, 6); - break; - default : break; - } - } while(i != startsAt); - } - if (kind != 0x7fffffff) - { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 66 - (jjnewStateCnt = startsAt))) - return curPos; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { return curPos; } - } -} -private int jjMoveStringLiteralDfa0_1() -{ - return jjMoveNfa_1(4, 0); -} -private int jjMoveNfa_1(int startState, int curPos) -{ - int startsAt = 0; - jjnewStateCnt = 4; - int i = 1; - jjstateSet[0] = startState; - int kind = 0x7fffffff; - for (;;) - { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) - { - long l = 1L << curChar; - do - { - switch(jjstateSet[--i]) - { - case 4: - if ((0xffffffffffffdbffL & l) != 0L) - { - if (kind > 17) - kind = 17; - jjCheckNAddStates(42, 44); - } - else if ((0x2400L & l) != 0L) - { - if (kind > 17) - kind = 17; - } - if (curChar == 13) - jjstateSet[jjnewStateCnt++] = 2; - break; - case 0: - if ((0xffffffffffffdbffL & l) == 0L) - break; - kind = 17; - jjCheckNAddStates(42, 44); - break; - case 1: - if ((0x2400L & l) != 0L && kind > 17) - kind = 17; - break; - case 2: - if (curChar == 10 && kind > 17) - kind = 17; - break; - case 3: - if (curChar == 13) - jjstateSet[jjnewStateCnt++] = 2; - break; - default : break; - } - } while(i != startsAt); - } - else if (curChar < 128) - { - long l = 1L << (curChar & 077); - do - { - switch(jjstateSet[--i]) - { - case 4: - case 0: - kind = 17; - jjCheckNAddStates(42, 44); - break; - default : break; - } - } while(i != startsAt); - } - else - { - int hiByte = (int)(curChar >> 8); - int i1 = hiByte >> 6; - long l1 = 1L << (hiByte & 077); - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - do - { - switch(jjstateSet[--i]) - { - case 4: - case 0: - if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) - break; - if (kind > 17) - kind = 17; - jjCheckNAddStates(42, 44); - break; - default : break; - } - } while(i != startsAt); - } - if (kind != 0x7fffffff) - { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 4 - (jjnewStateCnt = startsAt))) - return curPos; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { return curPos; } - } -} -private int jjMoveStringLiteralDfa0_6() -{ - return jjMoveNfa_6(6, 0); -} -private int jjMoveNfa_6(int startState, int curPos) -{ - int startsAt = 0; - jjnewStateCnt = 7; - int i = 1; - jjstateSet[0] = startState; - int kind = 0x7fffffff; - for (;;) - { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) - { - long l = 1L << curChar; - do - { - switch(jjstateSet[--i]) - { - case 0: - case 1: - if (curChar == 61) - jjCheckNAddTwoStates(1, 2); - break; - case 3: - if (curChar == 61) - jjstateSet[jjnewStateCnt++] = 0; - break; - case 4: - if (curChar == 61) - jjstateSet[jjnewStateCnt++] = 3; - break; - case 5: - if (curChar == 61) - jjstateSet[jjnewStateCnt++] = 4; - break; - default : break; - } - } while(i != startsAt); - } - else if (curChar < 128) - { - long l = 1L << (curChar & 077); - do - { - switch(jjstateSet[--i]) - { - case 2: - if (curChar == 93 && kind > 22) - kind = 22; - break; - case 6: - if (curChar == 93) - jjstateSet[jjnewStateCnt++] = 5; - break; - default : break; - } - } while(i != startsAt); - } - else - { - int hiByte = (int)(curChar >> 8); - int i1 = hiByte >> 6; - long l1 = 1L << (hiByte & 077); - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - do - { - switch(jjstateSet[--i]) - { - default : break; - } - } while(i != startsAt); - } - if (kind != 0x7fffffff) - { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt))) - return curPos; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { return curPos; } - } -} -private int jjMoveStringLiteralDfa0_5() -{ - switch(curChar) - { - case 93: - return jjMoveStringLiteralDfa1_5(0x200000L); - default : - return 1; - } -} -private int jjMoveStringLiteralDfa1_5(long active0) -{ - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 1; - } - switch(curChar) - { - case 61: - return jjMoveStringLiteralDfa2_5(active0, 0x200000L); - default : - return 2; - } -} -private int jjMoveStringLiteralDfa2_5(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return 2; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 2; - } - switch(curChar) - { - case 61: - return jjMoveStringLiteralDfa3_5(active0, 0x200000L); - default : - return 3; - } -} -private int jjMoveStringLiteralDfa3_5(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return 3; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 3; - } - switch(curChar) - { - case 61: - return jjMoveStringLiteralDfa4_5(active0, 0x200000L); - default : - return 4; - } -} -private int jjMoveStringLiteralDfa4_5(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return 4; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 4; - } - switch(curChar) - { - case 93: - if ((active0 & 0x200000L) != 0L) - return jjStopAtPos(4, 21); - break; - default : - return 5; - } - return 5; -} -private int jjMoveStringLiteralDfa0_4() -{ - switch(curChar) - { - case 93: - return jjMoveStringLiteralDfa1_4(0x100000L); - default : - return 1; - } -} -private int jjMoveStringLiteralDfa1_4(long active0) -{ - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 1; - } - switch(curChar) - { - case 61: - return jjMoveStringLiteralDfa2_4(active0, 0x100000L); - default : - return 2; - } -} -private int jjMoveStringLiteralDfa2_4(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return 2; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 2; - } - switch(curChar) - { - case 61: - return jjMoveStringLiteralDfa3_4(active0, 0x100000L); - default : - return 3; - } -} -private int jjMoveStringLiteralDfa3_4(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return 3; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 3; - } - switch(curChar) - { - case 93: - if ((active0 & 0x100000L) != 0L) - return jjStopAtPos(3, 20); - break; - default : - return 4; - } - return 4; -} -private int jjMoveStringLiteralDfa0_3() -{ - switch(curChar) - { - case 93: - return jjMoveStringLiteralDfa1_3(0x80000L); - default : - return 1; - } -} -private int jjMoveStringLiteralDfa1_3(long active0) -{ - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 1; - } - switch(curChar) - { - case 61: - return jjMoveStringLiteralDfa2_3(active0, 0x80000L); - default : - return 2; - } -} -private int jjMoveStringLiteralDfa2_3(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return 2; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 2; - } - switch(curChar) - { - case 93: - if ((active0 & 0x80000L) != 0L) - return jjStopAtPos(2, 19); - break; - default : - return 3; - } - return 3; -} -static final int[] jjnextStates = { - 62, 63, 65, 32, 49, 50, 51, 36, 37, 38, 26, 27, 29, 22, 36, 37, - 38, 46, 36, 47, 37, 38, 49, 50, 51, 59, 49, 60, 50, 51, 20, 25, - 23, 24, 33, 34, 39, 40, 45, 52, 53, 58, 0, 1, 3, -}; -private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) -{ - switch(hiByte) - { - case 0: - return ((jjbitVec2[i2] & l2) != 0L); - default : - if ((jjbitVec0[i1] & l1) != 0L) - return true; - return false; - } -} - -/** Token literal values. */ -public static final String[] jjstrLiteralImages = { -"", null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, "\141\156\144", "\142\162\145\141\153", "\144\157", "\145\154\163\145", -"\145\154\163\145\151\146", "\145\156\144", "\146\141\154\163\145", "\146\157\162", -"\146\165\156\143\164\151\157\156", "\147\157\164\157", "\151\146", "\151\156", "\154\157\143\141\154", -"\156\151\154", "\156\157\164", "\157\162", "\162\145\164\165\162\156", -"\162\145\160\145\141\164", "\164\150\145\156", "\164\162\165\145", "\165\156\164\151\154", -"\167\150\151\154\145", null, null, null, null, null, null, null, null, null, null, null, null, null, -null, "\72\72", null, null, null, "\43", "\73", "\75", "\54", "\56", "\72", "\50", -"\51", "\133", "\135", "\56\56\56", "\173", "\175", "\53", "\55", "\52", "\57", -"\136", "\45", "\56\56", "\74", "\74\75", "\76", "\76\75", "\75\75", "\176\75", }; - -/** Lexer state names. */ -public static final String[] lexStateNames = { - "DEFAULT", - "IN_COMMENT", - "IN_LC0", - "IN_LC1", - "IN_LC2", - "IN_LC3", - "IN_LCN", - "IN_LS0", - "IN_LS1", - "IN_LS2", - "IN_LS3", - "IN_LSN", -}; - -/** Lex State array. */ -public static final int[] jjnewLexState = { - -1, -1, -1, -1, -1, -1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -}; -static final long[] jjtoToken = { - 0x601fffffef800001L, 0x7fffffe2L, -}; -static final long[] jjtoSkip = { - 0x7e003eL, 0x0L, -}; -static final long[] jjtoSpecial = { - 0x7e0000L, 0x0L, -}; -static final long[] jjtoMore = { - 0x1001ffc0L, 0x0L, -}; -protected SimpleCharStream input_stream; -private final int[] jjrounds = new int[66]; -private final int[] jjstateSet = new int[132]; -private final StringBuffer jjimage = new StringBuffer(); -private StringBuffer image = jjimage; -private int jjimageLen; -private int lengthOfMatch; -protected char curChar; -/** Constructor. */ -public LuaParserTokenManager(SimpleCharStream stream){ - if (SimpleCharStream.staticFlag) - throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); - input_stream = stream; -} - -/** Constructor. */ -public LuaParserTokenManager(SimpleCharStream stream, int lexState){ - this(stream); - SwitchTo(lexState); -} - -/** Reinitialise parser. */ -public void ReInit(SimpleCharStream stream) -{ - jjmatchedPos = jjnewStateCnt = 0; - curLexState = defaultLexState; - input_stream = stream; - ReInitRounds(); -} -private void ReInitRounds() -{ - int i; - jjround = 0x80000001; - for (i = 66; i-- > 0;) - jjrounds[i] = 0x80000000; -} - -/** Reinitialise parser. */ -public void ReInit(SimpleCharStream stream, int lexState) -{ - ReInit(stream); - SwitchTo(lexState); -} - -/** Switch to specified lex state. */ -public void SwitchTo(int lexState) -{ - if (lexState >= 12 || lexState < 0) - throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else - curLexState = lexState; -} - -protected Token jjFillToken() -{ - final Token t; - final String curTokenImage; - final int beginLine; - final int endLine; - final int beginColumn; - final int endColumn; - if (jjmatchedPos < 0) - { - if (image == null) - curTokenImage = ""; - else - curTokenImage = image.toString(); - beginLine = endLine = input_stream.getBeginLine(); - beginColumn = endColumn = input_stream.getBeginColumn(); - } - else - { - String im = jjstrLiteralImages[jjmatchedKind]; - curTokenImage = (im == null) ? input_stream.GetImage() : im; - beginLine = input_stream.getBeginLine(); - beginColumn = input_stream.getBeginColumn(); - endLine = input_stream.getEndLine(); - endColumn = input_stream.getEndColumn(); - } - t = Token.newToken(jjmatchedKind, curTokenImage); - - t.beginLine = beginLine; - t.endLine = endLine; - t.beginColumn = beginColumn; - t.endColumn = endColumn; - - return t; -} - -int curLexState = 0; -int defaultLexState = 0; -int jjnewStateCnt; -int jjround; -int jjmatchedPos; -int jjmatchedKind; - -/** Get the next Token. */ -public Token getNextToken() -{ - Token specialToken = null; - Token matchedToken; - int curPos = 0; - - EOFLoop : - for (;;) - { - try - { - curChar = input_stream.BeginToken(); - } - catch(java.io.IOException e) - { - jjmatchedKind = 0; - matchedToken = jjFillToken(); - matchedToken.specialToken = specialToken; - return matchedToken; - } - image = jjimage; - image.setLength(0); - jjimageLen = 0; - - for (;;) - { - switch(curLexState) - { - case 0: - try { input_stream.backup(0); - while (curChar <= 32 && (0x100003600L & (1L << curChar)) != 0L) - curChar = input_stream.BeginToken(); - } - catch (java.io.IOException e1) { continue EOFLoop; } - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_0(); - break; - case 1: - jjmatchedKind = 17; - jjmatchedPos = -1; - curPos = 0; - curPos = jjMoveStringLiteralDfa0_1(); - break; - case 2: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_2(); - if (jjmatchedPos == 0 && jjmatchedKind > 28) - { - jjmatchedKind = 28; - } - break; - case 3: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_3(); - if (jjmatchedPos == 0 && jjmatchedKind > 28) - { - jjmatchedKind = 28; - } - break; - case 4: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_4(); - if (jjmatchedPos == 0 && jjmatchedKind > 28) - { - jjmatchedKind = 28; - } - break; - case 5: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_5(); - if (jjmatchedPos == 0 && jjmatchedKind > 28) - { - jjmatchedKind = 28; - } - break; - case 6: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_6(); - if (jjmatchedPos == 0 && jjmatchedKind > 28) - { - jjmatchedKind = 28; - } - break; - case 7: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_7(); - if (jjmatchedPos == 0 && jjmatchedKind > 28) - { - jjmatchedKind = 28; - } - break; - case 8: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_8(); - if (jjmatchedPos == 0 && jjmatchedKind > 28) - { - jjmatchedKind = 28; - } - break; - case 9: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_9(); - if (jjmatchedPos == 0 && jjmatchedKind > 28) - { - jjmatchedKind = 28; - } - break; - case 10: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_10(); - if (jjmatchedPos == 0 && jjmatchedKind > 28) - { - jjmatchedKind = 28; - } - break; - case 11: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_11(); - if (jjmatchedPos == 0 && jjmatchedKind > 28) - { - jjmatchedKind = 28; - } - break; - } - if (jjmatchedKind != 0x7fffffff) - { - if (jjmatchedPos + 1 < curPos) - input_stream.backup(curPos - jjmatchedPos - 1); - if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) - { - matchedToken = jjFillToken(); - matchedToken.specialToken = specialToken; - if (jjnewLexState[jjmatchedKind] != -1) - curLexState = jjnewLexState[jjmatchedKind]; - return matchedToken; - } - else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) - { - if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) - { - matchedToken = jjFillToken(); - if (specialToken == null) - specialToken = matchedToken; - else - { - matchedToken.specialToken = specialToken; - specialToken = (specialToken.next = matchedToken); - } - SkipLexicalActions(matchedToken); - } - else - SkipLexicalActions(null); - if (jjnewLexState[jjmatchedKind] != -1) - curLexState = jjnewLexState[jjmatchedKind]; - continue EOFLoop; - } - jjimageLen += jjmatchedPos + 1; - if (jjnewLexState[jjmatchedKind] != -1) - curLexState = jjnewLexState[jjmatchedKind]; - curPos = 0; - jjmatchedKind = 0x7fffffff; - try { - curChar = input_stream.readChar(); - continue; - } - catch (java.io.IOException e1) { } - } - int error_line = input_stream.getEndLine(); - int error_column = input_stream.getEndColumn(); - String error_after = null; - boolean EOFSeen = false; - try { input_stream.readChar(); input_stream.backup(1); } - catch (java.io.IOException e1) { - EOFSeen = true; - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - if (curChar == '\n' || curChar == '\r') { - error_line++; - error_column = 0; - } - else - error_column++; - } - if (!EOFSeen) { - input_stream.backup(1); - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - } - throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); - } - } -} - -void SkipLexicalActions(Token matchedToken) -{ - switch(jjmatchedKind) - { - default : - break; - } -} -private void jjCheckNAdd(int state) -{ - if (jjrounds[state] != jjround) - { - jjstateSet[jjnewStateCnt++] = state; - jjrounds[state] = jjround; - } -} -private void jjAddStates(int start, int end) -{ - do { - jjstateSet[jjnewStateCnt++] = jjnextStates[start]; - } while (start++ != end); -} -private void jjCheckNAddTwoStates(int state1, int state2) -{ - jjCheckNAdd(state1); - jjCheckNAdd(state2); -} - -private void jjCheckNAddStates(int start, int end) -{ - do { - jjCheckNAdd(jjnextStates[start]); - } while (start++ != end); -} - -} diff --git a/luaj-jse/src/main/java/org/luaj/vm2/parser/ParseException.java b/luaj-jse/src/main/java/org/luaj/vm2/parser/ParseException.java deleted file mode 100644 index b59d68ca..00000000 --- a/luaj-jse/src/main/java/org/luaj/vm2/parser/ParseException.java +++ /dev/null @@ -1,187 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */ -/* JavaCCOptions:KEEP_LINE_COL=null */ -package org.luaj.vm2.parser; - -/** - * This exception is thrown when parse errors are encountered. - * You can explicitly create objects of this exception type by - * calling the method generateParseException in the generated - * parser. - * - * You can modify this class to customize your error reporting - * mechanisms so long as you retain the public fields. - */ -public class ParseException extends Exception { - - /** - * The version identifier for this Serializable class. - * Increment only if the serialized form of the - * class changes. - */ - private static final long serialVersionUID = 1L; - - /** - * This constructor is used by the method "generateParseException" - * in the generated parser. Calling this constructor generates - * a new object of this type with the fields "currentToken", - * "expectedTokenSequences", and "tokenImage" set. - */ - public ParseException(Token currentTokenVal, - int[][] expectedTokenSequencesVal, - String[] tokenImageVal - ) - { - super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal)); - currentToken = currentTokenVal; - expectedTokenSequences = expectedTokenSequencesVal; - tokenImage = tokenImageVal; - } - - /** - * The following constructors are for use by you for whatever - * purpose you can think of. Constructing the exception in this - * manner makes the exception behave in the normal way - i.e., as - * documented in the class "Throwable". The fields "errorToken", - * "expectedTokenSequences", and "tokenImage" do not contain - * relevant information. The JavaCC generated code does not use - * these constructors. - */ - - public ParseException() { - super(); - } - - /** Constructor with message. */ - public ParseException(String message) { - super(message); - } - - - /** - * This is the last token that has been consumed successfully. If - * this object has been created due to a parse error, the token - * followng this token will (therefore) be the first error token. - */ - public Token currentToken; - - /** - * Each entry in this array is an array of integers. Each array - * of integers represents a sequence of tokens (by their ordinal - * values) that is expected at this point of the parse. - */ - public int[][] expectedTokenSequences; - - /** - * This is a reference to the "tokenImage" array of the generated - * parser within which the parse error occurred. This array is - * defined in the generated ...Constants interface. - */ - public String[] tokenImage; - - /** - * It uses "currentToken" and "expectedTokenSequences" to generate a parse - * error message and returns it. If this object has been created - * due to a parse error, and you do not catch it (it gets thrown - * from the parser) the correct error message - * gets displayed. - */ - private static String initialise(Token currentToken, - int[][] expectedTokenSequences, - String[] tokenImage) { - String eol = System.getProperty("line.separator", "\n"); - StringBuffer expected = new StringBuffer(); - int maxSize = 0; - for (int i = 0; i < expectedTokenSequences.length; i++) { - if (maxSize < expectedTokenSequences[i].length) { - maxSize = expectedTokenSequences[i].length; - } - for (int j = 0; j < expectedTokenSequences[i].length; j++) { - expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); - } - if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { - expected.append("..."); - } - expected.append(eol).append(" "); - } - String retval = "Encountered \""; - Token tok = currentToken.next; - for (int i = 0; i < maxSize; i++) { - if (i != 0) retval += " "; - if (tok.kind == 0) { - retval += tokenImage[0]; - break; - } - retval += " " + tokenImage[tok.kind]; - retval += " \""; - retval += add_escapes(tok.image); - retval += " \""; - tok = tok.next; - } - retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; - retval += "." + eol; - if (expectedTokenSequences.length == 1) { - retval += "Was expecting:" + eol + " "; - } else { - retval += "Was expecting one of:" + eol + " "; - } - retval += expected.toString(); - return retval; - } - - /** - * The end of line string for this machine. - */ - protected String eol = System.getProperty("line.separator", "\n"); - - /** - * Used to convert raw characters to their escaped version - * when these raw version cannot be used as part of an ASCII - * string literal. - */ - static String add_escapes(String str) { - StringBuffer retval = new StringBuffer(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) - { - case 0 : - continue; - case '\b': - retval.append("\\b"); - continue; - case '\t': - retval.append("\\t"); - continue; - case '\n': - retval.append("\\n"); - continue; - case '\f': - retval.append("\\f"); - continue; - case '\r': - retval.append("\\r"); - continue; - case '\"': - retval.append("\\\""); - continue; - case '\'': - retval.append("\\\'"); - continue; - case '\\': - retval.append("\\\\"); - continue; - default: - if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { - String s = "0000" + Integer.toString(ch, 16); - retval.append("\\u" + s.substring(s.length() - 4, s.length())); - } else { - retval.append(ch); - } - continue; - } - } - return retval.toString(); - } - -} -/* JavaCC - OriginalChecksum=ef246095a930e4915c0d4bbf4c9880ad (do not edit this line) */ diff --git a/luaj-jse/src/main/java/org/luaj/vm2/parser/SimpleCharStream.java b/luaj-jse/src/main/java/org/luaj/vm2/parser/SimpleCharStream.java deleted file mode 100644 index 68e5932c..00000000 --- a/luaj-jse/src/main/java/org/luaj/vm2/parser/SimpleCharStream.java +++ /dev/null @@ -1,469 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */ -/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ -package org.luaj.vm2.parser; - -/** - * An implementation of interface CharStream, where the stream is assumed to - * contain only ASCII characters (without unicode processing). - */ - -public class SimpleCharStream -{ -/** Whether parser is static. */ - public static final boolean staticFlag = false; - int bufsize; - int available; - int tokenBegin; -/** Position in buffer. */ - public int bufpos = -1; - protected int bufline[]; - protected int bufcolumn[]; - - protected int column = 0; - protected int line = 1; - - protected boolean prevCharIsCR = false; - protected boolean prevCharIsLF = false; - - protected java.io.Reader inputStream; - - protected char[] buffer; - protected int maxNextCharInd = 0; - protected int inBuf = 0; - protected int tabSize = 1; - - public void setTabSize(int i) { tabSize = i; } - public int getTabSize(int i) { return tabSize; } - - - protected void ExpandBuff(boolean wrapAround) - { - char[] newbuffer = new char[bufsize + 2048]; - int newbufline[] = new int[bufsize + 2048]; - int newbufcolumn[] = new int[bufsize + 2048]; - - try - { - if (wrapAround) - { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); - bufcolumn = newbufcolumn; - - maxNextCharInd = (bufpos += (bufsize - tokenBegin)); - } - else - { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - bufcolumn = newbufcolumn; - - maxNextCharInd = (bufpos -= tokenBegin); - } - } - catch (Throwable t) - { - throw new Error(t.getMessage()); - } - - - bufsize += 2048; - available = bufsize; - tokenBegin = 0; - } - - protected void FillBuff() throws java.io.IOException - { - if (maxNextCharInd == available) - { - if (available == bufsize) - { - if (tokenBegin > 2048) - { - bufpos = maxNextCharInd = 0; - available = tokenBegin; - } - else if (tokenBegin < 0) - bufpos = maxNextCharInd = 0; - else - ExpandBuff(false); - } - else if (available > tokenBegin) - available = bufsize; - else if ((tokenBegin - available) < 2048) - ExpandBuff(true); - else - available = tokenBegin; - } - - int i; - try { - if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) - { - inputStream.close(); - throw new java.io.IOException(); - } - else - maxNextCharInd += i; - return; - } - catch(java.io.IOException e) { - --bufpos; - backup(0); - if (tokenBegin == -1) - tokenBegin = bufpos; - throw e; - } - } - -/** Start. */ - public char BeginToken() throws java.io.IOException - { - tokenBegin = -1; - char c = readChar(); - tokenBegin = bufpos; - - return c; - } - - protected void UpdateLineColumn(char c) - { - column++; - - if (prevCharIsLF) - { - prevCharIsLF = false; - line += (column = 1); - } - else if (prevCharIsCR) - { - prevCharIsCR = false; - if (c == '\n') - { - prevCharIsLF = true; - } - else - line += (column = 1); - } - - switch (c) - { - case '\r' : - prevCharIsCR = true; - break; - case '\n' : - prevCharIsLF = true; - break; - case '\t' : - column--; - column += (tabSize - (column % tabSize)); - break; - default : - break; - } - - bufline[bufpos] = line; - bufcolumn[bufpos] = column; - } - -/** Read a character. */ - public char readChar() throws java.io.IOException - { - if (inBuf > 0) - { - --inBuf; - - if (++bufpos == bufsize) - bufpos = 0; - - return buffer[bufpos]; - } - - if (++bufpos >= maxNextCharInd) - FillBuff(); - - char c = buffer[bufpos]; - - UpdateLineColumn(c); - return c; - } - - /** - * @deprecated - * @see #getEndColumn - */ - - public int getColumn() { - return bufcolumn[bufpos]; - } - - /** - * @deprecated - * @see #getEndLine - */ - - public int getLine() { - return bufline[bufpos]; - } - - /** Get token end column number. */ - public int getEndColumn() { - return bufcolumn[bufpos]; - } - - /** Get token end line number. */ - public int getEndLine() { - return bufline[bufpos]; - } - - /** Get token beginning column number. */ - public int getBeginColumn() { - return bufcolumn[tokenBegin]; - } - - /** Get token beginning line number. */ - public int getBeginLine() { - return bufline[tokenBegin]; - } - -/** Backup a number of characters. */ - public void backup(int amount) { - - inBuf += amount; - if ((bufpos -= amount) < 0) - bufpos += bufsize; - } - - /** Constructor. */ - public SimpleCharStream(java.io.Reader dstream, int startline, - int startcolumn, int buffersize) - { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - } - - /** Constructor. */ - public SimpleCharStream(java.io.Reader dstream, int startline, - int startcolumn) - { - this(dstream, startline, startcolumn, 4096); - } - - /** Constructor. */ - public SimpleCharStream(java.io.Reader dstream) - { - this(dstream, 1, 1, 4096); - } - - /** Reinitialise. */ - public void ReInit(java.io.Reader dstream, int startline, - int startcolumn, int buffersize) - { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - if (buffer == null || buffersize != buffer.length) - { - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - } - prevCharIsLF = prevCharIsCR = false; - tokenBegin = inBuf = maxNextCharInd = 0; - bufpos = -1; - } - - /** Reinitialise. */ - public void ReInit(java.io.Reader dstream, int startline, - int startcolumn) - { - ReInit(dstream, startline, startcolumn, 4096); - } - - /** Reinitialise. */ - public void ReInit(java.io.Reader dstream) - { - ReInit(dstream, 1, 1, 4096); - } - /** Constructor. */ - public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, - int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException - { - this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); - } - - /** Constructor. */ - public SimpleCharStream(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) - { - this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); - } - - /** Constructor. */ - public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, - int startcolumn) throws java.io.UnsupportedEncodingException - { - this(dstream, encoding, startline, startcolumn, 4096); - } - - /** Constructor. */ - public SimpleCharStream(java.io.InputStream dstream, int startline, - int startcolumn) - { - this(dstream, startline, startcolumn, 4096); - } - - /** Constructor. */ - public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException - { - this(dstream, encoding, 1, 1, 4096); - } - - /** Constructor. */ - public SimpleCharStream(java.io.InputStream dstream) - { - this(dstream, 1, 1, 4096); - } - - /** Reinitialise. */ - public void ReInit(java.io.InputStream dstream, String encoding, int startline, - int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException - { - ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); - } - - /** Reinitialise. */ - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) - { - ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); - } - - /** Reinitialise. */ - public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException - { - ReInit(dstream, encoding, 1, 1, 4096); - } - - /** Reinitialise. */ - public void ReInit(java.io.InputStream dstream) - { - ReInit(dstream, 1, 1, 4096); - } - /** Reinitialise. */ - public void ReInit(java.io.InputStream dstream, String encoding, int startline, - int startcolumn) throws java.io.UnsupportedEncodingException - { - ReInit(dstream, encoding, startline, startcolumn, 4096); - } - /** Reinitialise. */ - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn) - { - ReInit(dstream, startline, startcolumn, 4096); - } - /** Get token literal value. */ - public String GetImage() - { - if (bufpos >= tokenBegin) - return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); - else - return new String(buffer, tokenBegin, bufsize - tokenBegin) + - new String(buffer, 0, bufpos + 1); - } - - /** Get the suffix. */ - public char[] GetSuffix(int len) - { - char[] ret = new char[len]; - - if ((bufpos + 1) >= len) - System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); - else - { - System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, - len - bufpos - 1); - System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); - } - - return ret; - } - - /** Reset buffer when finished. */ - public void Done() - { - buffer = null; - bufline = null; - bufcolumn = null; - } - - /** - * Method to adjust line and column numbers for the start of a token. - */ - public void adjustBeginLineColumn(int newLine, int newCol) - { - int start = tokenBegin; - int len; - - if (bufpos >= tokenBegin) - { - len = bufpos - tokenBegin + inBuf + 1; - } - else - { - len = bufsize - tokenBegin + bufpos + 1 + inBuf; - } - - int i = 0, j = 0, k = 0; - int nextColDiff = 0, columnDiff = 0; - - while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) - { - bufline[j] = newLine; - nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; - bufcolumn[j] = newCol + columnDiff; - columnDiff = nextColDiff; - i++; - } - - if (i < len) - { - bufline[j] = newLine++; - bufcolumn[j] = newCol + columnDiff; - - while (i++ < len) - { - if (bufline[j = start % bufsize] != bufline[++start % bufsize]) - bufline[j] = newLine++; - else - bufline[j] = newLine; - } - } - - line = bufline[j]; - column = bufcolumn[j]; - } - -} -/* JavaCC - OriginalChecksum=ab0c629eabd887d4c88cec51eb5e6477 (do not edit this line) */ diff --git a/luaj-jse/src/main/java/org/luaj/vm2/parser/Token.java b/luaj-jse/src/main/java/org/luaj/vm2/parser/Token.java deleted file mode 100644 index d3eec17c..00000000 --- a/luaj-jse/src/main/java/org/luaj/vm2/parser/Token.java +++ /dev/null @@ -1,131 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ -/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ -package org.luaj.vm2.parser; - -/** - * Describes the input token stream. - */ - -public class Token implements java.io.Serializable { - - /** - * The version identifier for this Serializable class. - * Increment only if the serialized form of the - * class changes. - */ - private static final long serialVersionUID = 1L; - - /** - * An integer that describes the kind of this token. This numbering - * system is determined by JavaCCParser, and a table of these numbers is - * stored in the file ...Constants.java. - */ - public int kind; - - /** The line number of the first character of this Token. */ - public int beginLine; - /** The column number of the first character of this Token. */ - public int beginColumn; - /** The line number of the last character of this Token. */ - public int endLine; - /** The column number of the last character of this Token. */ - public int endColumn; - - /** - * The string image of the token. - */ - public String image; - - /** - * A reference to the next regular (non-special) token from the input - * stream. If this is the last token from the input stream, or if the - * token manager has not read tokens beyond this one, this field is - * set to null. This is true only if this token is also a regular - * token. Otherwise, see below for a description of the contents of - * this field. - */ - public Token next; - - /** - * This field is used to access special tokens that occur prior to this - * token, but after the immediately preceding regular (non-special) token. - * If there are no such special tokens, this field is set to null. - * When there are more than one such special token, this field refers - * to the last of these special tokens, which in turn refers to the next - * previous special token through its specialToken field, and so on - * until the first special token (whose specialToken field is null). - * The next fields of special tokens refer to other special tokens that - * immediately follow it (without an intervening regular token). If there - * is no such token, this field is null. - */ - public Token specialToken; - - /** - * An optional attribute value of the Token. - * Tokens which are not used as syntactic sugar will often contain - * meaningful values that will be used later on by the compiler or - * interpreter. This attribute value is often different from the image. - * Any subclass of Token that actually wants to return a non-null value can - * override this method as appropriate. - */ - public Object getValue() { - return null; - } - - /** - * No-argument constructor - */ - public Token() {} - - /** - * Constructs a new token for the specified Image. - */ - public Token(int kind) - { - this(kind, null); - } - - /** - * Constructs a new token for the specified Image and Kind. - */ - public Token(int kind, String image) - { - this.kind = kind; - this.image = image; - } - - /** - * Returns the image. - */ - public String toString() - { - return image; - } - - /** - * Returns a new Token object, by default. However, if you want, you - * can create and return subclass objects based on the value of ofKind. - * Simply add the cases to the switch for all those special cases. - * For example, if you have a subclass of Token called IDToken that - * you want to create if ofKind is ID, simply add something like : - * - * case MyParserConstants.ID : return new IDToken(ofKind, image); - * - * to the following switch statement. Then you can cast matchedToken - * variable to the appropriate type and use sit in your lexical actions. - */ - public static Token newToken(int ofKind, String image) - { - switch(ofKind) - { - default : return new Token(ofKind, image); - } - } - - public static Token newToken(int ofKind) - { - return newToken(ofKind, null); - } - -} -/* JavaCC - OriginalChecksum=70d73add5771158f10d1ae81755e7cfc (do not edit this line) */ diff --git a/luaj-jse/src/main/java/org/luaj/vm2/parser/TokenMgrError.java b/luaj-jse/src/main/java/org/luaj/vm2/parser/TokenMgrError.java deleted file mode 100644 index 37a7f55b..00000000 --- a/luaj-jse/src/main/java/org/luaj/vm2/parser/TokenMgrError.java +++ /dev/null @@ -1,147 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ -/* JavaCCOptions: */ -package org.luaj.vm2.parser; - -/** Token Manager Error. */ -public class TokenMgrError extends Error -{ - - /** - * The version identifier for this Serializable class. - * Increment only if the serialized form of the - * class changes. - */ - private static final long serialVersionUID = 1L; - - /* - * Ordinals for various reasons why an Error of this type can be thrown. - */ - - /** - * Lexical error occurred. - */ - static final int LEXICAL_ERROR = 0; - - /** - * An attempt was made to create a second instance of a static token manager. - */ - static final int STATIC_LEXER_ERROR = 1; - - /** - * Tried to change to an invalid lexical state. - */ - static final int INVALID_LEXICAL_STATE = 2; - - /** - * Detected (and bailed out of) an infinite loop in the token manager. - */ - static final int LOOP_DETECTED = 3; - - /** - * Indicates the reason why the exception is thrown. It will have - * one of the above 4 values. - */ - int errorCode; - - /** - * Replaces unprintable characters by their escaped (or unicode escaped) - * equivalents in the given string - */ - protected static final String addEscapes(String str) { - StringBuffer retval = new StringBuffer(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) - { - case 0 : - continue; - case '\b': - retval.append("\\b"); - continue; - case '\t': - retval.append("\\t"); - continue; - case '\n': - retval.append("\\n"); - continue; - case '\f': - retval.append("\\f"); - continue; - case '\r': - retval.append("\\r"); - continue; - case '\"': - retval.append("\\\""); - continue; - case '\'': - retval.append("\\\'"); - continue; - case '\\': - retval.append("\\\\"); - continue; - default: - if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { - String s = "0000" + Integer.toString(ch, 16); - retval.append("\\u" + s.substring(s.length() - 4, s.length())); - } else { - retval.append(ch); - } - continue; - } - } - return retval.toString(); - } - - /** - * Returns a detailed message for the Error when it is thrown by the - * token manager to indicate a lexical error. - * Parameters : - * EOFSeen : indicates if EOF caused the lexical error - * curLexState : lexical state in which this error occurred - * errorLine : line number when the error occurred - * errorColumn : column number when the error occurred - * errorAfter : prefix that was seen before this error occurred - * curchar : the offending character - * Note: You can customize the lexical error message by modifying this method. - */ - protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { - return("Lexical error at line " + - errorLine + ", column " + - errorColumn + ". Encountered: " + - (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + - "after : \"" + addEscapes(errorAfter) + "\""); - } - - /** - * You can also modify the body of this method to customize your error messages. - * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not - * of end-users concern, so you can return something like : - * - * "Internal Error : Please file a bug report .... " - * - * from this method for such cases in the release version of your parser. - */ - public String getMessage() { - return super.getMessage(); - } - - /* - * Constructors of various flavors follow. - */ - - /** No arg constructor. */ - public TokenMgrError() { - } - - /** Constructor with message and reason. */ - public TokenMgrError(String message, int reason) { - super(message); - errorCode = reason; - } - - /** Full Constructor. */ - public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { - this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); - } -} -/* JavaCC - OriginalChecksum=bd3720425dc7b44a5223b12676db358c (do not edit this line) */ diff --git a/luaj-core/src/main/javacc/Lua51.jj b/luaj-jse/src/main/javacc/Lua51.jj similarity index 98% rename from luaj-core/src/main/javacc/Lua51.jj rename to luaj-jse/src/main/javacc/Lua51.jj index 9f09de3a..7febeaa6 100644 --- a/luaj-core/src/main/javacc/Lua51.jj +++ b/luaj-jse/src/main/javacc/Lua51.jj @@ -20,11 +20,11 @@ options { DEBUG_LOOKAHEAD = false; DEBUG_PARSER = false; DEBUG_TOKEN_MANAGER = false; - OUTPUT_DIRECTORY = "org/luaj/vm2/parser"; + OUTPUT_DIRECTORY = "org/luaj/vm2/parser/lua51"; } PARSER_BEGIN(LuaParser) -package org.luaj.vm2.parser; +package org.luaj.vm2.parser.lua51; public class LuaParser { diff --git a/luaj-core/src/main/javacc/Lua52.jj b/luaj-jse/src/main/javacc/Lua52.jj similarity index 98% rename from luaj-core/src/main/javacc/Lua52.jj rename to luaj-jse/src/main/javacc/Lua52.jj index d84f4c6f..a8f5c239 100644 --- a/luaj-core/src/main/javacc/Lua52.jj +++ b/luaj-jse/src/main/javacc/Lua52.jj @@ -20,11 +20,11 @@ options { DEBUG_LOOKAHEAD = false; DEBUG_PARSER = false; DEBUG_TOKEN_MANAGER = false; - OUTPUT_DIRECTORY = "org/luaj/vm2/parser"; + OUTPUT_DIRECTORY = "org/luaj/vm2/parser/lua52"; } PARSER_BEGIN(LuaParser) -package org.luaj.vm2.parser; +package org.luaj.vm2.parser.lua52; public class LuaParser {