Compare commits

...

2 Commits

Author SHA1 Message Date
Danila Fedorin 895fe86c09 Fix newline handling 2019-05-13 21:17:51 -07:00
Danila Fedorin 54f89e5dfb Add more lax newline handling 2019-05-13 17:32:27 -07:00
1 changed files with 9 additions and 4 deletions

View File

@ -107,11 +107,16 @@ stmts
| stmt { $$ = $1; } | stmt { $$ = $1; }
; ;
newlines
: newlines NEWLINE
|
;
stmt stmt
: expr NEWLINE { $$ = concatenate($1, ";"); } : expr NEWLINE newlines { $$ = concatenate($1, ";"); }
| if { $$ = $1; } | if newlines { $$ = $1; }
| while { $$ = $1; } | while newlines { $$ = $1; }
| BREAK NEWLINE { $$ = new std::string("break;"); } | BREAK newlines { $$ = new std::string("break;"); }
; ;
expr expr