changeset 206:77365c9fdfe4

remove -> operator git-svn-id: https://luan-java.googlecode.com/svn/trunk@207 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Mon, 07 Jul 2014 23:55:52 +0000
parents 3918f92de5fe
children 5aafb5b9f70f
files core/src/luan/impl/LuanParser.java
diffstat 1 files changed, 23 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
diff -r 3918f92de5fe -r 77365c9fdfe4 core/src/luan/impl/LuanParser.java
--- a/core/src/luan/impl/LuanParser.java	Mon Jul 07 09:37:02 2014 +0000
+++ b/core/src/luan/impl/LuanParser.java	Mon Jul 07 23:55:52 2014 +0000
@@ -873,7 +873,7 @@
 
 	private Var VarZ(In in) throws ParseException {
 		int start = parser.begin();
-		Var var = VarStart(in);
+		Var var = VarStart(in,start);
 		if( var==null )
 			return parser.failure(null);
 		Var var2;
@@ -883,36 +883,29 @@
 		return parser.success(var);
 	}
 
-	private Var Var2(In in,int start,Expressions exp1) throws ParseException {
-		parser.begin();
-		Var var = VarExt(in,start,exp1);
-		if( var != null )
-			return parser.success(var);
-		if( parser.match("->") ) {
+	private Var VarStart(In in,int start) throws ParseException {
+		if( parser.match('(') ) {
+			In inParens = in.parens();
+			Spaces(inParens);
+			Expr exp = expr(RequiredExpr(inParens));
+			RequiredMatch(')');
 			Spaces(in);
-			List<Expressions> builder = new ArrayList<Expressions>();
-			builder.add(exp1);
-			Expr exp2 = expr(RequiredVarExpB(in));
-			FnCall fnCall = required(Args( in, start, exp2, builder ));
-			return parser.success(exprVar(fnCall));
+			return exprVar(exp);
 		}
-		FnCall fnCall = Args( in, start, expr(exp1), new ArrayList<Expressions>() );
-		if( fnCall != null )
-			return parser.success(exprVar(fnCall));
-		return parser.failure(null);
+		String name = Name(in);
+		if( name != null )
+			return nameVar(start,name);
+		Expressions exp;
+		exp = TableExpr(in);
+		if( exp != null )
+			return exprVar(exp);
+		exp = Literal(in);
+		if( exp != null )
+			return exprVar(exp);
+		return null;
 	}
 
-	private Expressions RequiredVarExpB(In in) throws ParseException {
-		int start = parser.begin();
-		Var var = required(VarStart(in));
-		Var var2;
-		while( (var2=VarExt(in,start,var.expr())) != null ) {
-			var = var2;
-		}
-		return parser.success(var.expr());
-	}
-
-	private Var VarExt(In in,int start,Expressions exp1) throws ParseException {
+	private Var Var2(In in,int start,Expressions exp1) throws ParseException {
 		parser.begin();
 		Expr exp2 = SubExpr(in);
 		if( exp2 != null )
@@ -923,29 +916,9 @@
 			if( exp2!=null )
 				return parser.success(indexVar(start,expr(exp1),exp2));
 		}
-		return parser.failure(null);
-	}
-
-	private Var VarStart(In in) throws ParseException {
-		int start = parser.begin();
-		if( parser.match('(') ) {
-			In inParens = in.parens();
-			Spaces(inParens);
-			Expr exp = expr(RequiredExpr(inParens));
-			RequiredMatch(')');
-			Spaces(in);
-			return parser.success(exprVar(exp));
-		}
-		String name = Name(in);
-		if( name != null )
-			return parser.success(nameVar(start,name));
-		Expressions exp;
-		exp = TableExpr(in);
-		if( exp != null )
-			return parser.success(exprVar(exp));
-		exp = Literal(in);
-		if( exp != null )
-			return parser.success(exprVar(exp));
+		FnCall fnCall = Args( in, start, expr(exp1), new ArrayList<Expressions>() );
+		if( fnCall != null )
+			return parser.success(exprVar(fnCall));
 		return parser.failure(null);
 	}