diff --git a/build.xml b/build.xml
index 3219fe74..2727dbe6 100644
--- a/build.xml
+++ b/build.xml
@@ -56,8 +56,7 @@
-
-
+
diff --git a/grammar/LuaParser.jj b/grammar/LuaParser.jj
new file mode 100644
index 00000000..08f95c8f
--- /dev/null
+++ b/grammar/LuaParser.jj
@@ -0,0 +1,464 @@
+/*******************************************************************************
+* Copyright (c) 2010 Luaj.org. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+******************************************************************************/
+/**
+* Javacc grammar used to produce a parse tree.
+*
+*/
+
+options {
+ STATIC = false;
+ JDK_VERSION = "1.3";
+ ERROR_REPORTING = false;
+ DEBUG_LOOKAHEAD = false;
+ DEBUG_PARSER = false;
+ DEBUG_TOKEN_MANAGER = false;
+ OUTPUT_DIRECTORY = "src/jse/org/luaj/vm2/parser";
+}
+
+PARSER_BEGIN(LuaParser)
+package org.luaj.vm2.parser;
+import org.luaj.vm2.*;
+import org.luaj.vm2.ast.*;
+import java.util.*;
+
+public class LuaParser {
+
+ public static void main(String args[]) throws ParseException {
+ LuaParser parser = new LuaParser(System.in);
+ parser.Chunk();
+ }
+
+ private static VarExp assertvarexp(PrimaryExp pe) throws ParseException {
+ if (!pe.isvarexp())
+ throw new ParseException("exptected variable");
+ return (VarExp) pe;
+ }
+
+ private static FuncCall assertfunccall(PrimaryExp pe) throws ParseException {
+ if (!pe.isfunccall())
+ throw new ParseException("expected function call");
+ return (FuncCall) pe;
+ }
+}
+
+PARSER_END(LuaParser)
+
+/* WHITE SPACE */
+
+SKIP :
+{
+ " " | "\t" | "\n" | "\r" | "\f"
+}
+
+/* COMMENTS and LONG STRINGS */
+
+MORE :
+{
+ "--[[": IN_LC0
+| "--[=[": IN_LC1
+| "--[==[": IN_LC2
+| "--[===[": IN_LC3
+| < "--[====" ("=")* "[" > : IN_LCN
+| "[[" : IN_LS0
+| "[=[" : IN_LS1
+| "[==[" : IN_LS2
+| "[===[" : IN_LS3
+| < "[====" ("=")* "[" > : IN_LSN
+| "--" : IN_COMMENT
+}
+
+ SPECIAL_TOKEN :
+{
+ : DEFAULT
+}
+
+ SPECIAL_TOKEN : { : DEFAULT }
+ SPECIAL_TOKEN : { : DEFAULT }
+ SPECIAL_TOKEN : { : DEFAULT }
+ SPECIAL_TOKEN : { : DEFAULT }
+ SPECIAL_TOKEN : { : DEFAULT }
+
+ TOKEN : { : DEFAULT }
+ TOKEN : { : DEFAULT }
+ TOKEN : { : DEFAULT }
+ TOKEN : { : DEFAULT }
+ TOKEN : { : DEFAULT }
+
+ MORE :
+{
+ < ~[] >
+}
+
+
+/* RESERVED WORDS AND LITERALS */
+
+TOKEN :
+{
+
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+}
+
+/* LITERALS */
+
+TOKEN :
+{
+ < NAME: ["a"-"z", "A"-"Z", "_"] (["a"-"z", "A"-"Z", "_", "0"-"9"])* >
+| < NUMBER: | >
+| < #FLOAT: ()+ "." ()* ()? | "." ()+ ()? | ()+ ()? >
+| < #DIGIT: ["0"-"9"] >
+| < #EXP: ["e","E"] (["+","-"])? ()+ >
+| < #HEX: "0" ["x","X"] ()+ >
+| < #HEXDIGIT: ["0"-"9","a"-"f","A"-"F"] >
+| < STRING: "\"" ( | ~["\\","\""])* "\"" >
+| < CHARSTRING: "'" ( | ~["\\","'"])* "'" >
+| < #QUOTED: | | >
+| < #DECIMAL: "\\" ["0"-"9"] (["0"-"9"])? (["0"-"9"])? >
+| < #UNICODE: "\\" "u" >
+//| < #CHAR: "\\" ("a"|"b"|"f"|"n"|"r"|"t"|"v"|"["|"]"|"'"|"\""|"\\"|"0"|) >
+| < #CHAR: "\\" (~[]) >
+| < #LF: ("\n" | "\r" | "\r\n") >
+}
+
+/** Root production. */
+Chunk Chunk():
+{
+ Block b;
+}
+{
+ b=Block() { return new Chunk(b); }
+}
+
+Block Block():
+{
+ Block b = new Block();
+ Stat s;
+}
+{
+ (s=Stat() (";")? {b.add(s);} )* (s=LastStat() (";")? {b.add(s);} )? { return b; }
+}
+
+Stat Stat():
+{
+ Block b,b2;
+ Exp e,e2,e3=null;
+ Stat s;
+ FuncName fn;
+ FuncBody fb;
+ Token n;
+ List nl;
+ List el=null;
+}
+{
+ b=Block() { return Stat.block(b); }
+| e=Exp() b=Block() { return Stat.whiledo(e,b); }
+| b=Block() e=Exp() { return Stat.repeatuntil(b,e); }
+| s=IfThenElse() { return s; }
+| LOOKAHEAD(3) n= "=" e=Exp() "," e2=Exp() ( "," e3=Exp() )? b=Block() { return Stat.fornumeric(n.image,e,e2,e3,b); }
+| nl=NameList() el=ExpList() b=Block() { return Stat.forgeneric(nl,el,b); }
+| fn=FuncName() fb=FuncBody() { return Stat.functiondef(fn,fb); }
+| LOOKAHEAD(2) n= fb=FuncBody() { return Stat.localfunctiondef(n.image,fb); }
+| nl=NameList() ( "=" el=ExpList() )? { return Stat.localassignment(nl,el); }
+| s=ExprStat() { return s; }
+}
+
+Stat IfThenElse():
+{
+ Block b,b2,b3=null;
+ Exp e,e2;
+ List el=null;
+ List bl=null;
+}
+{
+ e=Exp()
+ b=Block()
+ ( e2=Exp() b2=Block() {
+ if (el==null) el=new ArrayList();
+ if (bl==null) bl=new ArrayList();
+ el.add(e2);
+ bl.add(b2);
+ } )*
+ ( b3=Block())?
+ { return Stat.ifthenelse(e,b,el,bl,b3); }
+}
+
+Stat LastStat():
+{
+ List el=null;
+}
+{
+ { return Stat.breakstat(); }
+| ( el=ExpList() )? { return Stat.returnstat(el); }
+}
+
+Stat ExprStat():
+{
+ PrimaryExp pe;
+ Assign as=null;
+}
+{
+ pe=PrimaryExp() ( as=Assign(assertvarexp(pe)) )?
+ { return as==null? Stat.functioncall(assertfunccall(pe)): Stat.assignment(as); }
+}
+
+Assign Assign(VarExp v0):
+{
+ List vl = new ArrayList();
+ vl.add(v0);
+ VarExp ve;
+ List el;
+}
+{
+ ( "," ve=VarExp() { vl.add(ve); } )* "=" el=ExpList() { return new Assign(vl,el); }
+}
+
+VarExp VarExp():
+{
+ PrimaryExp pe;
+}
+{
+ pe=PrimaryExp() { return assertvarexp(pe); }
+}
+
+FuncName FuncName():
+{
+ FuncName fn;
+ Token n;
+}
+{
+ n= {fn=new FuncName(n.image);}
+ ( "." n= {fn.adddot(n.image);} )*
+ ( ":" n= {fn.method=n.image;} )?
+ {return fn;}
+}
+
+PrimaryExp PrefixExp():
+{
+ Token n;
+ Exp e;
+}
+{
+ n= { return PrimaryExp.nameprefix(n.image); }
+| "(" e=Exp() ")" { return PrimaryExp.parensprefix(e); }
+}
+
+PrimaryExp PrimaryExp():
+{
+ PrimaryExp pe;
+ PostfixOp po;
+}
+{
+ pe=PrefixExp() ( LOOKAHEAD(2) po=PostfixOp() {pe=pe.append(po);} )* { return pe; }
+}
+
+PostfixOp PostfixOp():
+{
+ Token n;
+ Exp e;
+ FuncArgs a;
+}
+{
+ "." n= { return PostfixOp.fieldop(n.image); }
+| "[" e=Exp() "]" { return PostfixOp.indexop(e); }
+| ":" n= a=FuncArgs() { return PostfixOp.methodop(n.image,a); }
+| a=FuncArgs() { return PostfixOp.functionop(a); }
+}
+
+FuncArgs FuncArgs():
+{
+ List el=null;
+ TableConstructor tc;
+ LuaString s;
+}
+{
+ "(" ( el=ExpList() )? ")" { return FuncArgs.explist(el); }
+| tc=TableConstructor() { return FuncArgs.tableconstructor(tc); }
+| s=Str() { return FuncArgs.string(s); }
+}
+
+List NameList():
+{
+ List nl = new ArrayList();
+ Token name;
+}
+{
+ name= {nl.add(new Name(name.image));} ( LOOKAHEAD(2) "," name= {nl.add(new Name(name.image));} )* {return nl;}
+}
+
+List ExpList():
+{
+ List el = new ArrayList();
+ Exp e;
+}
+{
+ e=Exp() {el.add(e);} ( "," e=Exp() {el.add(e);} )* {return el;}
+}
+
+Exp SimpleExp():
+{
+ Token n;
+ LuaString s;
+ Exp e;
+ TableConstructor tc;
+}
+{
+ { return Exp.constant(LuaValue.NIL); }
+| { return Exp.constant(LuaValue.TRUE); }
+| { return Exp.constant(LuaValue.FALSE); }
+| n= { return Exp.constant(LuaValue.valueOf(Double.valueOf(n.image))); }
+| s=Str() { return Exp.constant(s); }
+| "..." { return Exp.varargs(); }
+| tc=TableConstructor() { return Exp.tableconstructor(tc); }
+| Function() { return null; }
+| e=PrimaryExp() { return e; }
+}
+
+LuaString Str():
+{}
+{
+ { return Str.quoteString(token.image); }
+| { return Str.charString(token.image); }
+| { return Str.longString(token.image); }
+| { return Str.longString(token.image); }
+| { return Str.longString(token.image); }
+| { return Str.longString(token.image); }
+| { return Str.longString(token.image); }
+}
+
+Exp Exp():
+{
+ Exp e,s;
+ int op;
+}
+{
+ ( e=SimpleExp() | op=Unop() s=Exp() {e=Exp.unaryexp(op,s);})
+ (LOOKAHEAD(2) op=Binop() s=Exp() {e=Exp.binaryexp(e,op,s);} )* { return e; }
+}
+
+FuncBody Function():
+{
+ FuncBody fb;
+}
+{
+ fb=FuncBody() { return fb; }
+}
+
+FuncBody FuncBody():
+{
+ FuncBody fb = new FuncBody();
+ ParList pl;
+ Block b;
+}
+{
+ "(" ( pl=ParList() { fb.parlist=pl; } )? ")" b=Block() { fb.block=b; } { return fb; }
+}
+
+ParList ParList():
+{
+ ParList pl = new ParList();
+ List nl;
+}
+{
+ nl=NameList() { pl.namelist=nl; } ( "," "..." { pl.isvararg=true; } )? { return pl; }
+| "..." { pl.isvararg=true; return pl; }
+}
+
+TableConstructor TableConstructor():
+{
+ TableConstructor tc = new TableConstructor();
+ List fl = null;
+}
+{
+ "{" ( fl=FieldList() {tc.fields=fl;} )? "}" { return tc; }
+}
+
+List FieldList():
+{
+ List fl = new ArrayList();
+ Field f;
+}
+{
+ f=Field() {fl.add(f);} (LOOKAHEAD(2) FieldSep() f=Field() {fl.add(f);})* (FieldSep())? { return fl; }
+}
+
+Field Field():
+{
+ Token name;
+ Exp exp,rhs;
+}
+{
+ "[" exp=Exp() "]" "=" rhs=Exp() { return Field.keyedField(exp,rhs); }
+| LOOKAHEAD(2) name= "=" rhs=Exp() { return Field.namedField(name.image,rhs); }
+| rhs=Exp() { return Field.listField(rhs); }
+}
+
+void FieldSep():
+{}
+{
+ "," | ";"
+}
+
+int Binop():
+{}
+{
+ "+" { return Lua.OP_ADD; }
+| "-" { return Lua.OP_SUB; }
+| "*" { return Lua.OP_MUL; }
+| "/" { return Lua.OP_DIV; }
+| "^" { return Lua.OP_POW; }
+| "%" { return Lua.OP_MOD; }
+| ".." { return Lua.OP_CONCAT; }
+| "<" { return Lua.OP_LT; }
+| "<=" { return Lua.OP_LE; }
+| ">" { return Lua.OP_GT; }
+| ">=" { return Lua.OP_GE; }
+| "==" { return Lua.OP_EQ; }
+| "~=" { return Lua.OP_NEQ; }
+| { return Lua.OP_AND; }
+| { return Lua.OP_OR; }
+}
+
+int Unop():
+{}
+{
+ "-" { return Lua.OP_UNM; }
+| { return Lua.OP_NOT; }
+| "#" { return Lua.OP_LEN; }
+}
diff --git a/src/core/org/luaj/vm2/Lua.java b/src/core/org/luaj/vm2/Lua.java
index 36fe191b..80c3cd66 100644
--- a/src/core/org/luaj/vm2/Lua.java
+++ b/src/core/org/luaj/vm2/Lua.java
@@ -229,6 +229,13 @@ public class Lua {
public static final int NUM_OPCODES = OP_VARARG + 1;
+ /* pseudo-opcodes used in parsing only. */
+ public static final int OP_GT = 63; // >
+ public static final int OP_GE = 62; // >=
+ public static final int OP_NEQ = 61; // ~=
+ public static final int OP_AND = 60; // and
+ public static final int OP_OR = 59; // or
+
/*===========================================================================
Notes:
(*) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1,
diff --git a/src/jse/org/luaj/vm2/ast/Assign.java b/src/jse/org/luaj/vm2/ast/Assign.java
new file mode 100644
index 00000000..6e07ed03
--- /dev/null
+++ b/src/jse/org/luaj/vm2/ast/Assign.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+* Copyright (c) 2010 Luaj.org. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+******************************************************************************/
+package org.luaj.vm2.ast;
+
+import java.util.List;
+
+public class Assign extends Exp {
+
+ public Assign(List vl, List el) {
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/src/jse/org/luaj/vm2/ast/Block.java b/src/jse/org/luaj/vm2/ast/Block.java
new file mode 100644
index 00000000..9bad9c08
--- /dev/null
+++ b/src/jse/org/luaj/vm2/ast/Block.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+* Copyright (c) 2010 Luaj.org. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+******************************************************************************/
+package org.luaj.vm2.ast;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Block {
+
+ public List stats;
+
+ public void add(Stat s) {
+ if ( stats == null )
+ stats = new ArrayList();
+ stats.add(s);
+
+ }
+}
diff --git a/src/jse/org/luaj/vm2/ast/Chunk.java b/src/jse/org/luaj/vm2/ast/Chunk.java
new file mode 100644
index 00000000..ccd27e24
--- /dev/null
+++ b/src/jse/org/luaj/vm2/ast/Chunk.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+* Copyright (c) 2010 Luaj.org. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+******************************************************************************/
+package org.luaj.vm2.ast;
+
+public class Chunk {
+ public final Block block;
+
+ public Chunk(Block b) {
+ this.block = b;
+ }
+}
diff --git a/src/jse/org/luaj/vm2/ast/Exp.java b/src/jse/org/luaj/vm2/ast/Exp.java
new file mode 100644
index 00000000..bbb0c8c8
--- /dev/null
+++ b/src/jse/org/luaj/vm2/ast/Exp.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+* Copyright (c) 2010 Luaj.org. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+******************************************************************************/
+package org.luaj.vm2.ast;
+
+import org.luaj.vm2.LuaValue;
+
+public class Exp {
+
+ public static Exp constant(LuaValue value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public static Exp varargs() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public static Exp tableconstructor(TableConstructor tc) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public static Exp unaryexp(int op, Exp s) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public static Exp binaryexp(Exp e, int op, Exp s) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/src/jse/org/luaj/vm2/ast/Field.java b/src/jse/org/luaj/vm2/ast/Field.java
new file mode 100644
index 00000000..58db4589
--- /dev/null
+++ b/src/jse/org/luaj/vm2/ast/Field.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+* Copyright (c) 2010 Luaj.org. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+******************************************************************************/
+package org.luaj.vm2.ast;
+
+public class Field {
+
+ public final Exp index;
+ public final String name;
+ public final Exp rhs;
+
+ public Field(Exp index, String name, Exp rhs) {
+ this.index = index;
+ this.name = name;
+ this.rhs = rhs;
+ }
+
+ public static Field keyedField(Exp index, Exp rhs) {
+ return new Field(index, null, rhs);
+ }
+
+ public static Field namedField(String name, Exp rhs) {
+ return new Field(null, name, rhs);
+ }
+
+ public static Field listField(Exp rhs) {
+ return new Field(null, null, rhs);
+ }
+}
diff --git a/src/jse/org/luaj/vm2/ast/FuncArgs.java b/src/jse/org/luaj/vm2/ast/FuncArgs.java
new file mode 100644
index 00000000..05926c12
--- /dev/null
+++ b/src/jse/org/luaj/vm2/ast/FuncArgs.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+* Copyright (c) 2010 Luaj.org. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+******************************************************************************/
+package org.luaj.vm2.ast;
+
+import java.util.List;
+
+import org.luaj.vm2.LuaString;
+
+public class FuncArgs {
+
+ /** exp1,exp2... */
+ public static FuncArgs explist(List explist) {
+ return null;
+ }
+
+ /** {...} */
+ public static FuncArgs tableconstructor(TableConstructor table) {
+ return null;
+ }
+
+ /** "mylib" */
+ public static FuncArgs string(LuaString s) {
+ return null;
+ }
+
+}
diff --git a/src/jse/org/luaj/vm2/ast/FuncBody.java b/src/jse/org/luaj/vm2/ast/FuncBody.java
new file mode 100644
index 00000000..3743ec55
--- /dev/null
+++ b/src/jse/org/luaj/vm2/ast/FuncBody.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+* Copyright (c) 2010 Luaj.org. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+******************************************************************************/
+package org.luaj.vm2.ast;
+
+public class FuncBody {
+ public ParList parlist;
+ public Block block;
+}
diff --git a/src/jse/org/luaj/vm2/ast/FuncCall.java b/src/jse/org/luaj/vm2/ast/FuncCall.java
new file mode 100644
index 00000000..3f19f7a0
--- /dev/null
+++ b/src/jse/org/luaj/vm2/ast/FuncCall.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+* Copyright (c) 2010 Luaj.org. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+******************************************************************************/
+package org.luaj.vm2.ast;
+
+public class FuncCall extends PrimaryExp {
+
+}
diff --git a/src/jse/org/luaj/vm2/ast/FuncName.java b/src/jse/org/luaj/vm2/ast/FuncName.java
new file mode 100644
index 00000000..cd6a424f
--- /dev/null
+++ b/src/jse/org/luaj/vm2/ast/FuncName.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+* Copyright (c) 2010 Luaj.org. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+******************************************************************************/
+package org.luaj.vm2.ast;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class FuncName {
+ // example: a.b.c.d:e
+
+ // initial base name: "a"
+ public final String base;
+
+ // intermediate field accesses: "b", "c", "d"
+ public List dots;
+
+ // optional final method name: "e"
+ public String method;
+
+ public FuncName( String base ) {
+ this.base = base;
+ }
+
+ public void adddot(String dot) {
+ if ( dots == null )
+ dots = new ArrayList();
+ dots.add(dot);
+ }
+
+}
diff --git a/src/jse/org/luaj/vm2/ast/Name.java b/src/jse/org/luaj/vm2/ast/Name.java
new file mode 100644
index 00000000..60d9099a
--- /dev/null
+++ b/src/jse/org/luaj/vm2/ast/Name.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+* Copyright (c) 2010 Luaj.org. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+******************************************************************************/
+package org.luaj.vm2.ast;
+
+public class Name {
+ public final String luaname;
+ public Name(String luaname) {
+ this.luaname = luaname;
+ }
+}
diff --git a/src/jse/org/luaj/vm2/ast/ParList.java b/src/jse/org/luaj/vm2/ast/ParList.java
new file mode 100644
index 00000000..3ed09024
--- /dev/null
+++ b/src/jse/org/luaj/vm2/ast/ParList.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+* Copyright (c) 2010 Luaj.org. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+******************************************************************************/
+package org.luaj.vm2.ast;
+
+import java.util.List;
+
+public class ParList {
+ public List namelist;
+ public boolean isvararg;
+}
diff --git a/src/jse/org/luaj/vm2/ast/PostfixOp.java b/src/jse/org/luaj/vm2/ast/PostfixOp.java
new file mode 100644
index 00000000..e32a8639
--- /dev/null
+++ b/src/jse/org/luaj/vm2/ast/PostfixOp.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+* Copyright (c) 2010 Luaj.org. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+******************************************************************************/
+package org.luaj.vm2.ast;
+
+public class PostfixOp {
+
+ /** foo[exp] */
+ public static PostfixOp indexop(Exp e) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /** foo.name */
+ public static PostfixOp fieldop(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /** foo:name(args) */
+ public static PostfixOp methodop(String name, FuncArgs args) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /** foo(args) */
+ public static PostfixOp functionop(FuncArgs a) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isvarop() {
+ return false;
+ }
+
+ public boolean isfunccall() {
+ return false;
+ }
+
+}
diff --git a/src/jse/org/luaj/vm2/ast/PrimaryExp.java b/src/jse/org/luaj/vm2/ast/PrimaryExp.java
new file mode 100644
index 00000000..85f8d9d2
--- /dev/null
+++ b/src/jse/org/luaj/vm2/ast/PrimaryExp.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+* Copyright (c) 2010 Luaj.org. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+******************************************************************************/
+package org.luaj.vm2.ast;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PrimaryExp extends Exp {
+
+ List ops;
+
+ public static PrimaryExp nameprefix(String image) {
+ return null;
+ }
+
+ public static PrimaryExp parensprefix(Exp e) {
+ return null;
+ }
+
+ public PrimaryExp append(PostfixOp op) {
+ if ( ops == null )
+ ops = new ArrayList();
+ ops.add( op );
+ return this;
+ }
+
+ public boolean isvarexp() {
+ return ops != null && ops.get(ops.size()-1).isvarop();
+ }
+
+ public boolean isfunccall() {
+ return ops != null && ops.get(ops.size()-1).isfunccall();
+ }
+
+}
diff --git a/src/jse/org/luaj/vm2/ast/Stat.java b/src/jse/org/luaj/vm2/ast/Stat.java
new file mode 100644
index 00000000..acbce199
--- /dev/null
+++ b/src/jse/org/luaj/vm2/ast/Stat.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+* Copyright (c) 2010 Luaj.org. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+******************************************************************************/
+package org.luaj.vm2.ast;
+
+import java.util.List;
+
+public class Stat {
+
+ public static Stat block(Block b) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public static Stat whiledo(Exp e, Block b) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public static Stat repeatuntil(Block b, Exp e) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public static Stat breakstat() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public static Stat returnstat(List el) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public static Stat assignment(Assign as) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public static Stat functioncall(PrimaryExp pe) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public static Stat localfunctiondef(String image, FuncBody fb) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public static Stat fornumeric(String image, Exp e, Exp e2, Exp e3, Block b) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public static Stat functiondef(FuncName fn, FuncBody fb) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public static Stat forgeneric(List nl, List el, Block b) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public static Stat localassignment(List nl, List el) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public static Stat ifthenelse(Exp e, Block b, List el, List bl,
+ Block b3) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/src/jse/org/luaj/vm2/ast/Str.java b/src/jse/org/luaj/vm2/ast/Str.java
new file mode 100644
index 00000000..54152d6e
--- /dev/null
+++ b/src/jse/org/luaj/vm2/ast/Str.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+* Copyright (c) 2010 Luaj.org. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+******************************************************************************/
+package org.luaj.vm2.ast;
+
+import org.luaj.vm2.LuaString;
+
+public class Str {
+
+ public final byte[] bytes;
+ public final boolean isutf8;
+
+ public Str(byte[] bytes) {
+ this.bytes = bytes;
+ this.isutf8 = true; // TODO: scan to see
+ }
+ public static LuaString quoteString(String image) {
+ String s = image.substring(1, image.length()-1);
+ byte[] bytes = unquote(s);
+ // TODO: check for non-utf8
+ return LuaString.valueOf(bytes);
+ }
+ public static LuaString charString(String image) {
+ String s = image.substring(1, image.length()-1);
+ byte[] bytes = unquote(s);
+ // TODO: check for non-utf8
+ return LuaString.valueOf(bytes);
+ }
+ public static LuaString longString(String image) {
+ int i = image.indexOf('[', image.indexOf('[')+1);
+ String s = image.substring(i,image.length()-i);
+ return LuaString.valueOf(s);
+ }
+ public static byte[] unquote(String s) {
+ // TODO: unquote string data
+ return utf8decode(s);
+ }
+ private static byte[] utf8decode(String s) {
+ try {
+ return s.getBytes("UTF8");
+ } catch ( Exception e ) {
+ throw new RuntimeException("utf8 nto found: "+e);
+ }
+ }
+}
diff --git a/src/jse/org/luaj/vm2/ast/TableConstructor.java b/src/jse/org/luaj/vm2/ast/TableConstructor.java
new file mode 100644
index 00000000..d0a3899c
--- /dev/null
+++ b/src/jse/org/luaj/vm2/ast/TableConstructor.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+* Copyright (c) 2010 Luaj.org. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+******************************************************************************/
+package org.luaj.vm2.ast;
+
+import java.util.List;
+
+public class TableConstructor {
+ public List fields;
+}
diff --git a/src/jse/org/luaj/vm2/ast/VarExp.java b/src/jse/org/luaj/vm2/ast/VarExp.java
new file mode 100644
index 00000000..f9775d18
--- /dev/null
+++ b/src/jse/org/luaj/vm2/ast/VarExp.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+* Copyright (c) 2010 Luaj.org. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+******************************************************************************/
+package org.luaj.vm2.ast;
+
+public class VarExp extends PrimaryExp {
+
+}