diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2018-10-09 22:50:25 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2018-10-09 22:50:25 +0300 |
commit | 8e09dc452d7d365e13db28d1c6ca2b392f6df6ce (patch) | |
tree | b5204624ced26d383d698a7d062d2302844ba50c /awkgram.y | |
parent | d8234e1784bfbfd4d72dccc1412b962d38fec549 (diff) | |
download | egawk-8e09dc452d7d365e13db28d1c6ca2b392f6df6ce.tar.gz egawk-8e09dc452d7d365e13db28d1c6ca2b392f6df6ce.tar.bz2 egawk-8e09dc452d7d365e13db28d1c6ca2b392f6df6ce.zip |
Fix empty statement handling.
Diffstat (limited to 'awkgram.y')
-rw-r--r-- | awkgram.y | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -1,3 +1,6 @@ +/* ALSO TODO: + * Fix debug.c + */ /* working on statement_term */ /* TODO: @@ -585,7 +588,16 @@ statement_term statement : semi opt_nls - { $$ = $2; } + { + if ($2 != NULL) { + INSTRUCTION *ip; + + merge_comments($2, NULL); + ip = list_create(instruction(Op_no_op)); + $$ = list_append(ip, $2); + } else + $$ = NULL; + } | l_brace statements r_brace { $$ = $2; } | if_statement @@ -6300,6 +6312,9 @@ merge_comments(INSTRUCTION *c1, INSTRUCTION *c2) { assert(c1->opcode == Op_comment); + if (c1->comment == NULL && c2 == NULL) // nothing to do + return; + size_t total = c1->memory->stlen; if (c1->comment != NULL) total += 1 /* \n */ + c1->comment->memory->stlen; |