diff src/luan/impl/LuanParser.java @ 1563:8fbcc4747091

remove LuanFunction.luan
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 09 Nov 2020 01:37:57 -0700
parents b89212fd04b5
children 2975c932864d
line wrap: on
line diff
--- a/src/luan/impl/LuanParser.java	Sun Nov 08 16:50:59 2020 -0700
+++ b/src/luan/impl/LuanParser.java	Mon Nov 09 01:37:57 2020 -0700
@@ -376,7 +376,7 @@
 		Expr exp = new Expr(null,true);
 		exp.add( "Luan.checkFunction(" );
 		exp.addAll( fn.single() );
-		exp.add( ").call(" );
+		exp.add( ").call(luan," );
 		exp.addAll( args.array() );
 		exp.add( ")" );
 		return exp;
@@ -387,7 +387,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(" );
+		stmt.add( "Luan.checkFunction(luan.index(PackageLuan.require(luan,\"luan:Io.luan\"),\"template_write\")).call(luan," );
 		stmt.addAll( exprs.array() );
 		stmt.add( ");  " );
 		return stmt;
@@ -515,7 +515,7 @@
 
 		String fnVar = "fn" + ++forCounter;
 		Expr fnExp = new Expr(null,false);
-		fnExp.add( fnVar + ".call()" );
+		fnExp.add( fnVar + ".call(luan)" );
 		Stmts stmt = new Stmts();
 		stmt.add( ""
 			+"LuanFunction "+fnVar+" = Luan.checkFunction("
@@ -871,7 +871,7 @@
 				exp = exp.single();
 				Expr exp2 = required(ConcatExpr()).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.eq(" );
+				newExp.add( "LuanImpl.eq(luan," );
 				newExp.addAll( exp );
 				newExp.add( "," );
 				newExp.addAll( exp2 );
@@ -882,7 +882,7 @@
 				exp = exp.single();
 				Expr exp2 = required(ConcatExpr()).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "!LuanImpl.eq(" );
+				newExp.add( "!LuanImpl.eq(luan," );
 				newExp.addAll( exp );
 				newExp.add( "," );
 				newExp.addAll( exp2 );
@@ -893,7 +893,7 @@
 				exp = exp.single();
 				Expr exp2 = required(ConcatExpr()).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.le(" );
+				newExp.add( "LuanImpl.le(luan," );
 				newExp.addAll( exp );
 				newExp.add( "," );
 				newExp.addAll( exp2 );
@@ -904,7 +904,7 @@
 				exp = exp.single();
 				Expr exp2 = required(ConcatExpr()).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.le(" );
+				newExp.add( "LuanImpl.le(luan," );
 				newExp.addAll( exp2 );
 				newExp.add( "," );
 				newExp.addAll( exp );
@@ -915,7 +915,7 @@
 				exp = exp.single();
 				Expr exp2 = required(ConcatExpr()).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.lt(" );
+				newExp.add( "LuanImpl.lt(luan," );
 				newExp.addAll( exp );
 				newExp.add( "," );
 				newExp.addAll( exp2 );
@@ -926,7 +926,7 @@
 				exp = exp.single();
 				Expr exp2 = required(ConcatExpr()).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.lt(" );
+				newExp.add( "LuanImpl.lt(luan," );
 				newExp.addAll( exp2 );
 				newExp.add( "," );
 				newExp.addAll( exp );
@@ -948,7 +948,7 @@
 			exp = exp.single();
 			Expr exp2 = required(ConcatExpr()).single();
 			Expr newExp = new Expr(Val.SINGLE,false);
-			newExp.add( "LuanImpl.concat(" );
+			newExp.add( "LuanImpl.concat(luan," );
 			newExp.addAll( exp );
 			newExp.add( "," );
 			newExp.addAll( exp2 );
@@ -969,7 +969,7 @@
 				exp = exp.single();
 				Expr exp2 = required(TermExpr()).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.add(" );
+				newExp.add( "LuanImpl.add(luan," );
 				newExp.addAll( exp );
 				newExp.add( "," );
 				newExp.addAll( exp2 );
@@ -980,7 +980,7 @@
 				exp = exp.single();
 				Expr exp2 = required(TermExpr()).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.sub(" );
+				newExp.add( "LuanImpl.sub(luan," );
 				newExp.addAll( exp );
 				newExp.add( "," );
 				newExp.addAll( exp2 );
@@ -1008,7 +1008,7 @@
 				exp = exp.single();
 				Expr exp2 = required(UnaryExpr()).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.mul(" );
+				newExp.add( "LuanImpl.mul(luan," );
 				newExp.addAll( exp );
 				newExp.add( "," );
 				newExp.addAll( exp2 );
@@ -1019,7 +1019,7 @@
 				exp = exp.single();
 				Expr exp2 = required(UnaryExpr()).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.div(" );
+				newExp.add( "LuanImpl.div(luan," );
 				newExp.addAll( exp );
 				newExp.add( "," );
 				newExp.addAll( exp2 );
@@ -1030,7 +1030,7 @@
 				exp = exp.single();
 				Expr exp2 = required(UnaryExpr()).single();
 				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.mod(" );
+				newExp.add( "LuanImpl.mod(luan," );
 				newExp.addAll( exp );
 				newExp.add( "," );
 				newExp.addAll( exp2 );
@@ -1053,7 +1053,7 @@
 			Spaces();
 			Expr exp = required(UnaryExpr()).single();
 			Expr newExp = new Expr(Val.SINGLE,false);
-			newExp.add( "LuanImpl.len(" );
+			newExp.add( "LuanImpl.len(luan," );
 			newExp.addAll( exp );
 			newExp.add( ")" );
 			return parser.success(newExp);
@@ -1062,7 +1062,7 @@
 			Spaces();
 			Expr exp = required(UnaryExpr()).single();
 			Expr newExp = new Expr(Val.SINGLE,false);
-			newExp.add( "LuanImpl.unm(" );
+			newExp.add( "LuanImpl.unm(luan," );
 			newExp.addAll( exp );
 			newExp.add( ")" );
 			return parser.success(newExp);
@@ -1091,7 +1091,7 @@
 			Spaces();
 			Expr exp2 = required(UnaryExpr());
 			Expr newExp = new Expr(Val.SINGLE,false);
-			newExp.add( "LuanImpl.pow(" );
+			newExp.add( "LuanImpl.pow(luan," );
 			newExp.addAll( exp1.single() );
 			newExp.add( "," );
 			newExp.addAll( exp2.single() );
@@ -2023,8 +2023,8 @@
 			+"import luan.modules.PackageLuan;  "
 
 			+"public class " + className +" extends LuanClosure {  "
-				+"public "+className+"(Luan luan,boolean javaOk,String sourceName) throws LuanException {  "
-					+"super(luan,"+toUpValues(upValueSymbols)+",javaOk,sourceName);  "
+				+"public "+className+"(boolean javaOk,String sourceName) throws LuanException {  "
+					+"super("+toUpValues(upValueSymbols)+",javaOk,sourceName);  "
 				+"}  "
 
 				+"@Override public Object doCall(Luan luan,Object[] args) throws LuanException {  "
@@ -2066,7 +2066,7 @@
 		Expr toInnerFnExp(List<UpSym> upValueSymbols) {
 			StringBuilder sb = new StringBuilder();
 			sb.append(
-				"new "+className+"(luan(),"+toUpValues(upValueSymbols)+",javaOk,sourceName)"
+				"new "+className+"("+toUpValues(upValueSymbols)+",javaOk,sourceName)"
 			);
 			for( int i=0; i<lines; i++ ) {
 				sb.append('\n');
@@ -2085,8 +2085,8 @@
 			StringBuilder sb = new StringBuilder();
 			sb.append( ""
 				+"private static class " + className +" extends LuanClosure {  "
-					+className+"(Luan luan,Pointer[] upValues,boolean javaOk,String sourceName) throws LuanException {  "
-						+"super(luan,upValues,javaOk,sourceName);  "
+					+className+"(Pointer[] upValues,boolean javaOk,String sourceName) throws LuanException {  "
+						+"super(upValues,javaOk,sourceName);  "
 					+"}  "
 					+"@Override public Object doCall(Luan luan,Object[] args) throws LuanException {  "
 						+"return _" + name + "(luan,args);  "