Mercurial Hosting > luan
diff core/src/luan/impl/LuanParser.java @ 682:0c334975d526
finish stack trace
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 14 Apr 2016 21:41:40 -0600 |
parents | f1c935be546d |
children | 41f791e4206d |
line wrap: on
line diff
--- a/core/src/luan/impl/LuanParser.java Thu Apr 14 20:10:38 2016 -0600 +++ b/core/src/luan/impl/LuanParser.java Thu Apr 14 21:41:40 2016 -0600 @@ -1098,31 +1098,44 @@ parser.begin(); if( !parser.match('{') ) return parser.failure(null); + Expr tblExp = new Expr(Val.SINGLE,false); + tblExp.add( "LuanImpl.table(" ); + Expr lastExp = tblExp; + List<Expr> builder = new ArrayList<Expr>(); +/* Spaces(); - List<Expr> builder = new ArrayList<Expr>(); Field(builder); while( FieldSep() ) { Spaces(); Field(builder); } +*/ + do { + Spaces(); lastExp.addNewLines(); + Expr exp = Field(); + if( exp != null ) { + builder.add(exp); + lastExp = exp; + Spaces(); lastExp.addNewLines(); + } + } while( FieldSep() ); Expr exp = TemplateExpressions(In.NOTHING); if( exp != null ) builder.add(exp); if( !parser.match('}') ) throw parser.exception("Expected table element or '}'"); + tblExp.addAll( expString(builder).array() ); + tblExp.add( ")" ); Spaces(); - exp = new Expr(Val.SINGLE,false); - exp.add( "LuanImpl.table(" ); - exp.addAll( expString(builder).array() ); - exp.add( ")" ); - return parser.success( exp ); + tblExp.addNewLines(); + return parser.success( tblExp ); } private boolean FieldSep() throws ParseException { return parser.anyOf(",;") || EndOfLine(); } - private boolean Field(List<Expr> builder) throws ParseException { + private Expr Field() throws ParseException { parser.begin(); Expr exp = SubExpr(In.NOTHING); if( exp==null ) @@ -1136,16 +1149,14 @@ newExp.add( "," ); newExp.addAll( val ); newExp.add( ")" ); - builder.add( newExp ); - return parser.success(); + return parser.success(newExp); } parser.rollback(); Expr exprs = ExprZ(In.NOTHING); if( exprs != null ) { - builder.add(exprs); - return parser.success(); + return parser.success(exprs); } - return parser.failure(); + return parser.failure(null); } private Expr VarExp(In in) throws ParseException {