changeset 190:04b86428dc50

minor git-svn-id: https://luan-java.googlecode.com/svn/trunk@191 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Thu, 26 Jun 2014 18:20:54 +0000
parents fb3993431f76
children 2456ef7ada02
files core/src/luan/LuanSource.java core/src/luan/impl/LuanParser.java dist/luan-core-trunk.jar dist/luan-web-trunk.jar web/src/luan/modules/web/Web_server.luan web/src/luan/modules/web/web_run.luan web/src/luan/modules/web/web_shell.luan
diffstat 7 files changed, 19 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/core/src/luan/LuanSource.java	Thu Jun 26 16:44:42 2014 +0000
+++ b/core/src/luan/LuanSource.java	Thu Jun 26 18:20:54 2014 +0000
@@ -28,8 +28,13 @@
 		public final LuanSource source;
 		public final int start;
 		public final int end;
+		private final String text;
 
 		public Element(LuanSource source,int start,int end) {
+			this(source,start,end,null);
+		}
+
+		public Element(LuanSource source,int start,int end,String text) {
 			if( source==null )
 				throw new NullPointerException("source is null");
 			this.source = source;
@@ -38,10 +43,11 @@
 				end--;
 			}
 			this.end = end;
+			this.text = text;
 		}
 
 		public String text() {
-			return source.text.substring(start,end);
+			return text!=null ? text : source.text.substring(start,end);
 		}
 
 		@Override String location() {
--- a/core/src/luan/impl/LuanParser.java	Thu Jun 26 16:44:42 2014 +0000
+++ b/core/src/luan/impl/LuanParser.java	Thu Jun 26 18:20:54 2014 +0000
@@ -111,7 +111,11 @@
 	}
 
 	private LuanSource.Element se(int start) {
-		return new LuanSource.Element(source,start,parser.currentIndex());
+		return se(start,null);
+	}
+
+	private LuanSource.Element se(int start,String text) {
+		return new LuanSource.Element(source,start,parser.currentIndex(),text);
 	}
 
 	private List<String> symbols() {
@@ -268,8 +272,8 @@
 		if( exp == null )
 			return null;
 		Expr fnExp = (Expr)nameVar(start,"Io").expr();
-		fnExp = new IndexExpr( se(start), fnExp, new ConstExpr("stdout") );
-		fnExp = new IndexExpr( se(start), fnExp, new ConstExpr("write") );
+		fnExp = new IndexExpr( se(start,"stdout"), fnExp, new ConstExpr("stdout") );
+		fnExp = new IndexExpr( se(start,"write"), fnExp, new ConstExpr("write") );
 		FnCall fnCall = new FnCall( se(start), fnExp, exp );
 		return new ExpressionsStmt(fnCall);
 	}
@@ -928,7 +932,7 @@
 	}
 
 	private Var nameVar(final int start,final String name) {
-		return nameVar(se(start),name);
+		return nameVar(se(start,name),name);
 	}
 
 	private Var nameVar(final LuanSource.Element se,final String name) {
Binary file dist/luan-core-trunk.jar has changed
Binary file dist/luan-web-trunk.jar has changed
--- a/web/src/luan/modules/web/Web_server.luan	Thu Jun 26 16:44:42 2014 +0000
+++ b/web/src/luan/modules/web/Web_server.luan	Thu Jun 26 18:20:54 2014 +0000
@@ -1,4 +1,5 @@
 import "Java"
+import "Io"
 import "Package"
 import "web/Http"
 
@@ -63,7 +64,7 @@
 	dir = dir.gsub("/$","")  -- remove trailing '/' if any
 	Package.path = dir.."?.luan;java:luan/modules/?.luan"
 	authentication_handler.setPassword(private_password)
-	resource_handler.setResourceBase(dir)
+	resource_handler.setResourceBase(Io.File(dir).to_string())
 	resource_handler.setWelcomeFiles {welcome_file}
 	luan_handler.setWelcomeFile(welcome_file)
 	local server = Server.new(port)
--- a/web/src/luan/modules/web/web_run.luan	Thu Jun 26 16:44:42 2014 +0000
+++ b/web/src/luan/modules/web/web_run.luan	Thu Jun 26 18:20:54 2014 +0000
@@ -1,3 +1,4 @@
+import "Io"
 import "web/Http"
 
 local function lines(s)
--- a/web/src/luan/modules/web/web_shell.luan	Thu Jun 26 16:44:42 2014 +0000
+++ b/web/src/luan/modules/web/web_shell.luan	Thu Jun 26 18:20:54 2014 +0000
@@ -1,3 +1,4 @@
+import "Basic"
 import "Io"
 import "web/Http"