changeset 153:fa03671f59a0

replace ExpressionsStmt with FnCallStmt git-svn-id: https://luan-java.googlecode.com/svn/trunk@154 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Tue, 17 Jun 2014 02:57:14 +0000
parents a9391f914aba
children c2e5101682ae
files src/luan/interp/ExpressionsStmt.java src/luan/interp/FnCallStmt.java src/luan/interp/LuanParser.java
diffstat 3 files changed, 23 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
diff -r a9391f914aba -r fa03671f59a0 src/luan/interp/ExpressionsStmt.java
--- a/src/luan/interp/ExpressionsStmt.java	Mon Jun 16 10:50:40 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-package luan.interp;
-
-import luan.LuanException;
-
-
-final class ExpressionsStmt implements Stmt {
-	private final Expressions expressions;
-
-	ExpressionsStmt(Expressions expressions) {
-		this.expressions = expressions;
-	}
-
-	@Override public void eval(LuanStateImpl luan) throws LuanException {
-		expressions.eval(luan);
-	}
-
-}
diff -r a9391f914aba -r fa03671f59a0 src/luan/interp/FnCallStmt.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/luan/interp/FnCallStmt.java	Tue Jun 17 02:57:14 2014 +0000
@@ -0,0 +1,17 @@
+package luan.interp;
+
+import luan.LuanException;
+
+
+final class FnCallStmt implements Stmt {
+	private final FnCall fnCall;
+
+	FnCallStmt(FnCall fnCall) {
+		this.fnCall = fnCall;
+	}
+
+	@Override public void eval(LuanStateImpl luan) throws LuanException {
+		fnCall.eval(luan);
+	}
+
+}
diff -r a9391f914aba -r fa03671f59a0 src/luan/interp/LuanParser.java
--- a/src/luan/interp/LuanParser.java	Mon Jun 16 10:50:40 2014 +0000
+++ b/src/luan/interp/LuanParser.java	Tue Jun 17 02:57:14 2014 +0000
@@ -249,7 +249,7 @@
 			|| (stmt=RepeatStmt()) != null
 			|| (stmt=IfStmt()) != null
 			|| (stmt=SetStmt()) != null
-			|| (stmt=ExpressionsStmt()) != null
+			|| (stmt=FnCallStmt()) != null
 		) {
 			stmts.add(stmt);
 		}
@@ -523,12 +523,13 @@
 		return parser.success( new SetStmt( vars.toArray(new Settable[0]), values ) );
 	}
 
-	private Stmt ExpressionsStmt() throws ParseException {
+	private Stmt FnCallStmt() throws ParseException {
 		parser.begin();
-		Expressions exprs = ExpList(In.NOTHING);
-		if( exprs==null )
+		Code code = VarExp(In.NOTHING);
+		if( !(code instanceof FnCall) )
 			return parser.failure(null);
-		return parser.success( new ExpressionsStmt(exprs) );
+		FnCall fnCall = (FnCall)code;
+		return parser.success( new FnCallStmt(fnCall) );
 	}
 
 	private Settable SettableVar() throws ParseException {