diff core/src/luan/impl/LuanParser.java @ 326:db37d6aee4db

remove try-catch statement; add Luan.try() and Luan.pcall(); git-svn-id: https://luan-java.googlecode.com/svn/trunk@327 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Thu, 19 Mar 2015 00:01:57 +0000
parents b24a35612947
children 5e34702423a0
line wrap: on
line diff
--- a/core/src/luan/impl/LuanParser.java	Tue Mar 03 06:00:59 2015 +0000
+++ b/core/src/luan/impl/LuanParser.java	Thu Mar 19 00:01:57 2015 +0000
@@ -251,7 +251,6 @@
 			|| (stmt=LocalFunctionStmt()) != null
 			|| (stmt=BreakStmt()) != null
 			|| (stmt=ForStmt()) != null
-			|| (stmt=TryStmt()) != null
 			|| (stmt=DoStmt()) != null
 			|| (stmt=WhileStmt()) != null
 			|| (stmt=FunctionStmt()) != null
@@ -373,22 +372,6 @@
 		return parser.success(stmt);
 	}
 
-	private Stmt TryStmt() throws ParseException {
-		parser.begin();
-		if( !Keyword("try",In.NOTHING) )
-			return parser.failure(null);
-		Stmt tryBlock = RequiredBlock();
-		RequiredKeyword("catch",In.NOTHING);
-		String name = RequiredName(In.NOTHING);
-		addSymbol(name);
-		RequiredKeyword("do",In.NOTHING);
-		Stmt catchBlock = RequiredBlock();
-		RequiredKeyword("end",In.NOTHING);
-		Stmt stmt = new TryStmt( tryBlock, symbolsSize()-1, catchBlock );
-		popSymbols(1);
-		return parser.success(stmt);
-	}
-
 	private Stmt DoStmt() throws ParseException {
 		parser.begin();
 		if( !Keyword("do",In.NOTHING) )
@@ -1095,7 +1078,6 @@
 	private static final Set<String> keywords = new HashSet<String>(Arrays.asList(
 		"and",
 		"break",
-		"catch",
 		"do",
 		"else",
 		"elseif",
@@ -1114,7 +1096,6 @@
 		"return",
 		"then",
 		"true",
-		"try",
 		"until",
 		"while"
 	));