Mercurial Hosting > luan
changeset 83:b84f66704026
treat OutputStmt as statement separator
git-svn-id: https://luan-java.googlecode.com/svn/trunk@84 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Mon, 18 Feb 2013 22:07:40 +0000 |
parents | 8ea2e94f3318 |
children | cca4f8522893 |
files | src/luan/interp/LuanParser.java |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/luan/interp/LuanParser.java Mon Feb 18 06:29:50 2013 +0000 +++ b/src/luan/interp/LuanParser.java Mon Feb 18 22:07:40 2013 +0000 @@ -172,7 +172,7 @@ return Sequence( Optional( Stmt(stmts) ), ZeroOrMore( - StmtSep(), + StmtSep(stmts), Optional( Stmt(stmts) ) ), push( newBlock(stmts.get(),stackStart.get()) ) @@ -189,13 +189,17 @@ return new Block( stmts.toArray(new Stmt[0]), stackStart, stackEnd ); } - Rule StmtSep() { + Rule StmtSep(Var<List<Stmt>> stmts) { return Sequence( FirstOf( ';', Sequence( Optional( "--", ZeroOrMore(NoneOf("\r\n")) ), EndOfLine() + ), + Sequence( + OutputStmt(), + stmts.get().add( (Stmt)pop() ) ) ), Spaces(false) @@ -211,7 +215,6 @@ LocalStmt(stmts), Sequence( FirstOf( - OutputStmt(), ReturnStmt(), FunctionStmt(), LocalFunctionStmt(), @@ -828,6 +831,7 @@ ), Sequence( StringLiteral(inParens), + push(new ConstExpr(pop())), addToExpList(builder.get()) ) ),