Mercurial Hosting > luan
diff src/luan/interp/LuanParser.java @ 109:219e05867366
remove NumericForStmt;
add BasicLib.range();
git-svn-id: https://luan-java.googlecode.com/svn/trunk@110 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Fri, 23 May 2014 04:30:29 +0000 |
parents | 3c404a296995 |
children | 7afa6df829f3 |
line wrap: on
line diff
--- a/src/luan/interp/LuanParser.java Fri May 23 03:21:54 2014 +0000 +++ b/src/luan/interp/LuanParser.java Fri May 23 04:30:29 2014 +0000 @@ -223,7 +223,6 @@ || (stmt=ImportStmt()) != null || (stmt=BreakStmt()) != null || (stmt=GenericForStmt()) != null - || (stmt=NumericForStmt()) != null || (stmt=TryStmt()) != null || (stmt=DoStmt()) != null || (stmt=WhileStmt()) != null @@ -350,39 +349,6 @@ return parser.success(stmt); } - private Stmt NumericForStmt() throws ParseException { - int start = parser.begin(); - if( !Keyword("for") ) - return parser.failure(null); - String name = RequiredName(); - RequiredMatch( "=" ); - Spaces(); - Expr from = expr(RequiredExpr()); - Expr to; - Expr step; - if( parser.match(',') ) { - Spaces(); - to = expr(RequiredExpr()); - if( parser.match(',') ) { - Spaces(); - step = expr(RequiredExpr()); - } else { - step = new ConstExpr(1); - } - } else { - RequiredKeyword("to"); - to = expr(RequiredExpr()); - step = Keyword("step") ? expr(RequiredExpr()) : new ConstExpr(1); - } - addSymbol(name); // add "for" var to symbols - RequiredKeyword("do"); - Stmt loop = RequiredLoopBlock(); - RequiredKeyword("end"); - Stmt stmt = new NumericForStmt( se(start), symbolsSize()-1, from, to, step, loop ); - popSymbols(1); - return parser.success(stmt); - } - private Stmt TryStmt() throws ParseException { parser.begin(); if( !Keyword("try") )