aboutsummaryrefslogtreecommitdiffstats
path: root/awkgram.y
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2018-09-21 13:22:53 +0300
committerArnold D. Robbins <arnold@skeeve.com>2018-09-21 13:22:53 +0300
commit9bd846b32089bf025d0dc82b61a59e503ee1767c (patch)
tree8d65e08640652a58f1765081d71af6b41cc1e88c /awkgram.y
parente1be82e01980281819732b2c7012f6d331267cfd (diff)
downloadegawk-9bd846b32089bf025d0dc82b61a59e503ee1767c.tar.gz
egawk-9bd846b32089bf025d0dc82b61a59e503ee1767c.tar.bz2
egawk-9bd846b32089bf025d0dc82b61a59e503ee1767c.zip
Reset comment changes to be equal to master.
Diffstat (limited to 'awkgram.y')
-rw-r--r--awkgram.y45
1 files changed, 14 insertions, 31 deletions
diff --git a/awkgram.y b/awkgram.y
index 3ba0ed19..1afad27e 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -602,22 +602,6 @@ statement_term
| semi opt_nls
;
-switch_head
- : LEX_SWITCH '(' exp r_paren opt_nls
- {
- INSTRUCTION *ip;
-
- ip = $3;
- if (do_pretty_print) {
- (void) list_prepend(ip, $1);
- (void) list_prepend(ip, instruction(Op_exec_count));
- }
- /* else
- $1 is NULL */
- $$ = ip;
- }
- ;
-
statement
: semi opt_nls
{ $$ = NULL; }
@@ -630,7 +614,7 @@ statement
else
$$ = $1;
}
- | switch_head l_brace case_statements opt_nls r_brace
+ | LEX_SWITCH '(' exp r_paren opt_nls l_brace case_statements opt_nls r_brace
{
INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt;
INSTRUCTION *ip, *nextc, *tbreak;
@@ -645,12 +629,11 @@ statement
dflt = instruction(Op_jmp);
dflt->target_jmp = tbreak; /* if no case match and no explicit default */
- if ($3 != NULL) {
- curr = $3->nexti;
- bcfree($3); /* Op_list */
- }
- /* else
- curr = NULL; */
+ if ($7 != NULL) {
+ curr = $7->nexti;
+ bcfree($7); /* Op_list */
+ } /* else
+ curr = NULL; */
for (; curr != NULL; curr = nextc) {
INSTRUCTION *caseexp = curr->case_exp;
@@ -704,15 +687,15 @@ statement
if (case_values != NULL)
efree(case_values);
- ip = $1;
+ ip = $3;
if (do_pretty_print) {
- INSTRUCTION *exp = $1->nexti->nexti;
- exp->target_break = tbreak;
- (exp + 1)->switch_start = cexp->nexti;
- (exp + 1)->switch_end = cexp->lasti;
- }
- /* else
- $1 is NULL */
+ (void) list_prepend(ip, $1);
+ (void) list_prepend(ip, instruction(Op_exec_count));
+ $1->target_break = tbreak;
+ ($1 + 1)->switch_start = cexp->nexti;
+ ($1 + 1)->switch_end = cexp->lasti;
+ }/* else
+ $1 is NULL */
(void) list_append(cexp, dflt);
(void) list_merge(ip, cexp);