comparison src/luan/interp/LuanParser.java @ 127:bcb3a09d0caf

minor git-svn-id: https://luan-java.googlecode.com/svn/trunk@128 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Sat, 07 Jun 2014 01:47:00 +0000
parents f537ff5e511d
children f0a4abe58593
comparison
equal deleted inserted replaced
126:0149bdf98fd8 127:bcb3a09d0caf
219 if( (stmt=ReturnStmt()) != null 219 if( (stmt=ReturnStmt()) != null
220 || (stmt=FunctionStmt()) != null 220 || (stmt=FunctionStmt()) != null
221 || (stmt=LocalFunctionStmt()) != null 221 || (stmt=LocalFunctionStmt()) != null
222 || (stmt=ImportStmt()) != null 222 || (stmt=ImportStmt()) != null
223 || (stmt=BreakStmt()) != null 223 || (stmt=BreakStmt()) != null
224 || (stmt=GenericForStmt()) != null 224 || (stmt=ForStmt()) != null
225 || (stmt=TryStmt()) != null 225 || (stmt=TryStmt()) != null
226 || (stmt=DoStmt()) != null 226 || (stmt=DoStmt()) != null
227 || (stmt=WhileStmt()) != null 227 || (stmt=WhileStmt()) != null
228 || (stmt=FunctionStmt()) != null 228 || (stmt=FunctionStmt()) != null
229 || (stmt=RepeatStmt()) != null 229 || (stmt=RepeatStmt()) != null
328 if( frame.loops <= 0 ) 328 if( frame.loops <= 0 )
329 throw parser.exception("'break' outside of loop"); 329 throw parser.exception("'break' outside of loop");
330 return parser.success( new BreakStmt() ); 330 return parser.success( new BreakStmt() );
331 } 331 }
332 332
333 private Stmt GenericForStmt() throws ParseException { 333 private Stmt ForStmt() throws ParseException {
334 int start = parser.begin(); 334 int start = parser.begin();
335 int stackStart = symbolsSize(); 335 int stackStart = symbolsSize();
336 if( !Keyword("for") ) 336 if( !Keyword("for") )
337 return parser.failure(null); 337 return parser.failure(null);
338 List<String> names = RequiredNameList(false); 338 List<String> names = RequiredNameList(false);
341 Expr expr = expr(RequiredExpr()); 341 Expr expr = expr(RequiredExpr());
342 RequiredKeyword("do"); 342 RequiredKeyword("do");
343 addSymbols(names); 343 addSymbols(names);
344 Stmt loop = RequiredLoopBlock(); 344 Stmt loop = RequiredLoopBlock();
345 RequiredKeyword("end"); 345 RequiredKeyword("end");
346 Stmt stmt = new GenericForStmt( se(start), stackStart, symbolsSize() - stackStart, expr, loop ); 346 Stmt stmt = new ForStmt( se(start), stackStart, symbolsSize() - stackStart, expr, loop );
347 popSymbols( symbolsSize() - stackStart ); 347 popSymbols( symbolsSize() - stackStart );
348 return parser.success(stmt); 348 return parser.success(stmt);
349 } 349 }
350 350
351 private Stmt TryStmt() throws ParseException { 351 private Stmt TryStmt() throws ParseException {