diff src/luan/impl/LuanParser.java @ 1335:e0cf0d108a77

major cleanup
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 14 Feb 2019 03:10:45 -0700
parents 25746915a241
children f5368cd8c056
line wrap: on
line diff
--- a/src/luan/impl/LuanParser.java	Tue Feb 12 22:53:57 2019 -0700
+++ b/src/luan/impl/LuanParser.java	Thu Feb 14 03:10:45 2019 -0700
@@ -366,7 +366,7 @@
 		Expr exp = new Expr(null,true);
 		exp.add( "Luan.checkFunction(" );
 		exp.addAll( fn.single() );
-		exp.add( ").call(luan," );
+		exp.add( ").call(" );
 		exp.addAll( args.array() );
 		exp.add( ")" );
 		return exp;
@@ -377,7 +377,7 @@
 		if( exprs == null )
 			return null;
 		Stmts stmt = new Stmts();
-		stmt.add( "Luan.checkFunction(luan.index(PackageLuan.require(luan,\"luan:Io.luan\"),\"template_write\")).call(luan," );
+		stmt.add( "Luan.checkFunction(luan.index(PackageLuan.require(luan,\"luan:Io.luan\"),\"template_write\")).call(" );
 		stmt.addAll( exprs.array() );
 		stmt.add( ");  " );
 		return stmt;
@@ -508,7 +508,7 @@
 
 		String fnVar = "fn"+ ++forCounter;
 		Expr fnExp = new Expr(null,false);
-		fnExp.add( fnVar + ".call(luan)" );
+		fnExp.add( fnVar + ".call()" );
 		Stmts stmt = new Stmts();
 		stmt.add( ""
 			+"LuanFunction "+fnVar+" = Luan.checkFunction("
@@ -828,7 +828,7 @@
 				exp = exp.single();
 				Expr exp2 = required(ConcatExpr(in)).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.eq(luan," );
+				newExp.add( "LuanImpl.eq(" );
 				newExp.addAll( exp );
 				newExp.add( "," );
 				newExp.addAll( exp2 );
@@ -839,7 +839,7 @@
 				exp = exp.single();
 				Expr exp2 = required(ConcatExpr(in)).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "!LuanImpl.eq(luan," );
+				newExp.add( "!LuanImpl.eq(" );
 				newExp.addAll( exp );
 				newExp.add( "," );
 				newExp.addAll( exp2 );
@@ -850,7 +850,7 @@
 				exp = exp.single();
 				Expr exp2 = required(ConcatExpr(in)).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.le(luan," );
+				newExp.add( "LuanImpl.le(" );
 				newExp.addAll( exp );
 				newExp.add( "," );
 				newExp.addAll( exp2 );
@@ -861,7 +861,7 @@
 				exp = exp.single();
 				Expr exp2 = required(ConcatExpr(in)).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.le(luan," );
+				newExp.add( "LuanImpl.le(" );
 				newExp.addAll( exp2 );
 				newExp.add( "," );
 				newExp.addAll( exp );
@@ -872,7 +872,7 @@
 				exp = exp.single();
 				Expr exp2 = required(ConcatExpr(in)).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.lt(luan," );
+				newExp.add( "LuanImpl.lt(" );
 				newExp.addAll( exp );
 				newExp.add( "," );
 				newExp.addAll( exp2 );
@@ -883,7 +883,7 @@
 				exp = exp.single();
 				Expr exp2 = required(ConcatExpr(in)).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.lt(luan," );
+				newExp.add( "LuanImpl.lt(" );
 				newExp.addAll( exp2 );
 				newExp.add( "," );
 				newExp.addAll( exp );
@@ -905,7 +905,7 @@
 			exp = exp.single();
 			Expr exp2 = required(ConcatExpr(in)).single();
 			Expr newExp = new Expr(Val.SINGLE,false);
-			newExp.add( "LuanImpl.concat(luan," );
+			newExp.add( "LuanImpl.concat(" );
 			newExp.addAll( exp );
 			newExp.add( "," );
 			newExp.addAll( exp2 );
@@ -926,7 +926,7 @@
 				exp = exp.single();
 				Expr exp2 = required(TermExpr(in)).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.add(luan," );
+				newExp.add( "LuanImpl.add(" );
 				newExp.addAll( exp );
 				newExp.add( "," );
 				newExp.addAll( exp2 );
@@ -937,7 +937,7 @@
 				exp = exp.single();
 				Expr exp2 = required(TermExpr(in)).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.sub(luan," );
+				newExp.add( "LuanImpl.sub(" );
 				newExp.addAll( exp );
 				newExp.add( "," );
 				newExp.addAll( exp2 );
@@ -965,7 +965,7 @@
 				exp = exp.single();
 				Expr exp2 = required(UnaryExpr(in)).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.mul(luan," );
+				newExp.add( "LuanImpl.mul(" );
 				newExp.addAll( exp );
 				newExp.add( "," );
 				newExp.addAll( exp2 );
@@ -976,7 +976,7 @@
 				exp = exp.single();
 				Expr exp2 = required(UnaryExpr(in)).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.div(luan," );
+				newExp.add( "LuanImpl.div(" );
 				newExp.addAll( exp );
 				newExp.add( "," );
 				newExp.addAll( exp2 );
@@ -987,7 +987,7 @@
 				exp = exp.single();
 				Expr exp2 = required(UnaryExpr(in)).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.mod(luan," );
+				newExp.add( "LuanImpl.mod(" );
 				newExp.addAll( exp );
 				newExp.add( "," );
 				newExp.addAll( exp2 );
@@ -1019,7 +1019,7 @@
 			Spaces();
 			Expr exp = required(UnaryExpr(in)).single();
 			Expr newExp = new Expr(Val.SINGLE,false);
-			newExp.add( "LuanImpl.unm(luan," );
+			newExp.add( "LuanImpl.unm(" );
 			newExp.addAll( exp );
 			newExp.add( ")" );
 			return parser.success(newExp);
@@ -1048,7 +1048,7 @@
 			Spaces();
 			Expr exp2 = required(PowExpr(in));
 			Expr newExp = new Expr(Val.SINGLE,false);
-			newExp.add( "LuanImpl.pow(luan," );
+			newExp.add( "LuanImpl.pow(" );
 			newExp.addAll( exp1.single() );
 			newExp.add( "," );
 			newExp.addAll( exp2.single() );
@@ -2015,8 +2015,8 @@
 			+"import luan.modules.PackageLuan;  "
 
 			+"public class " + className +" extends LuanClosure {  "
-				+"public "+className+"(boolean javaOk,String sourceName) throws LuanException {  "
-					+"super("+upValueSymbols.size()+",javaOk,sourceName);  "
+				+"public "+className+"(Luan luan,boolean javaOk,String sourceName) throws LuanException {  "
+					+"super(luan,"+upValueSymbols.size()+",javaOk,sourceName);  "
 					+ init(upValueSymbols)
 				+"}  "
 
@@ -2036,7 +2036,7 @@
 			stmt.add( "return LuanFunction.NOTHING;  " );
 		Expr exp = new Expr(Val.SINGLE,false);
 		exp.add( ""
-			+"new LuanClosure("+upValueSymbols.size()+",javaOk,sourceName) {  "
+			+"new LuanClosure(luan(),"+upValueSymbols.size()+",javaOk,sourceName) {  "
 				+"{  "
 				+ init(upValueSymbols)
 				+"}  "