changeset 356:5e34702423a0

better parser error message
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 14 Apr 2015 09:44:07 -0600
parents 1bce334a816b
children 496d61b1fb5a
files core/src/luan/impl/LuanParser.java
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
diff -r 1bce334a816b -r 5e34702423a0 core/src/luan/impl/LuanParser.java
--- a/core/src/luan/impl/LuanParser.java	Tue Apr 14 09:33:34 2015 -0600
+++ b/core/src/luan/impl/LuanParser.java	Tue Apr 14 09:44:07 2015 -0600
@@ -386,8 +386,11 @@
 		if( !Keyword("local",In.NOTHING) )
 			return parser.failure();
 		List<String> names = NameList(In.NOTHING);
-		if( names==null )
-			return parser.failure();
+		if( names==null ) {
+			if( Keyword("function",In.NOTHING) )
+				return parser.failure();  // handled later
+			throw parser.exception("Invalid local statement");
+		}
 		if( parser.match( '=' ) ) {
 			Spaces(In.NOTHING);
 			Expressions values = ExpList(In.NOTHING);