changeset 708:77e0c859c8a3

fix luan_to_java and fix line numbers
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 18 May 2016 18:11:00 -0600
parents 1ed9e55f0be8
children 96a280ca32a2
files core/src/luan/impl/LuanCompiler.java core/src/luan/impl/LuanParser.java core/src/luan/modules/luan_to_java.luan
diffstat 3 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
diff -r 1ed9e55f0be8 -r 77e0c859c8a3 core/src/luan/impl/LuanCompiler.java
--- a/core/src/luan/impl/LuanCompiler.java	Wed May 18 15:46:51 2016 -0600
+++ b/core/src/luan/impl/LuanCompiler.java	Wed May 18 18:11:00 2016 -0600
@@ -72,8 +72,8 @@
 		}
 	}
 
-	public static String toJava(String sourceName,String sourceText) throws LuanException {
-		LuanParser parser = new LuanParser(sourceName,sourceText);
+	public static String toJava(String sourceText,String sourceName) throws LuanException {
+		LuanParser parser = new LuanParser(sourceText,sourceName);
 		parser.addVar( "java" );
 		parser.addVar( "require" );
 		try {
diff -r 1ed9e55f0be8 -r 77e0c859c8a3 core/src/luan/impl/LuanParser.java
--- a/core/src/luan/impl/LuanParser.java	Wed May 18 15:46:51 2016 -0600
+++ b/core/src/luan/impl/LuanParser.java	Wed May 18 18:11:00 2016 -0600
@@ -395,7 +395,9 @@
 		while(true) {
 			if( parser.match( "<%=" ) ) {
 				Spaces();
-				builder.add( RequiredExpr(inTemplate) );
+				Expr exp = new Expr(Val.SINGLE,false);
+				exp.addAll( RequiredExpr(inTemplate) );
+				builder.add(exp);
 				RequiredMatch( "%>" );
 			} else if( parser.match( "<%" ) ) {
 				Spaces();
diff -r 1ed9e55f0be8 -r 77e0c859c8a3 core/src/luan/modules/luan_to_java.luan
--- a/core/src/luan/modules/luan_to_java.luan	Wed May 18 15:46:51 2016 -0600
+++ b/core/src/luan/modules/luan_to_java.luan	Wed May 18 18:11:00 2016 -0600
@@ -2,4 +2,4 @@
 local LuanCompiler = require "java:luan.impl.LuanCompiler"
 local Io = require "luan:Io.luan"
 
-Io.stdout.write( LuanCompiler.toJava( "stdin", Io.stdin.read_text() ) )
+Io.stdout.write( LuanCompiler.toJava( Io.stdin.read_text(), "stdin" ) )