diff options
| author | rillig <rillig@NetBSD.org> | 2021-10-24 22:28:06 +0000 |
|---|---|---|
| committer | rillig <rillig@NetBSD.org> | 2021-10-24 22:28:06 +0000 |
| commit | 8c144e5fa16627c181555ebc7627f2c70f67c31f (patch) | |
| tree | a3ec8e9fca2408f11dfbeed80627222b6906b635 /usr.bin/indent/parse.c | |
| parent | aece49766b7623a525e966bec9233727131192f0 (diff) | |
indent: split kw_do_or_else into separate constants
It was unnecessarily confusing to have the token types keyword_do_else,
keyword_do and keyword_else at the same time, without any hint in what
they differed.
Some of the token types seem to be used by the lexer while others are
used in the parse stack. Maybe all token types can be partitioned into
these groups, which would suggest to use two different types for them.
And if not, it's still clearer to have this distinction in the names of
the constants.
No functional change.
Diffstat (limited to 'usr.bin/indent/parse.c')
| -rw-r--r-- | usr.bin/indent/parse.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/indent/parse.c b/usr.bin/indent/parse.c index 735903e4b76..b2448dec960 100644 --- a/usr.bin/indent/parse.c +++ b/usr.bin/indent/parse.c @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.37 2021/10/24 19:14:33 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.38 2021/10/24 22:28:06 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -65,7 +65,7 @@ parse(token_type ttype) debug_println("parse token: '%s' \"%s\"", token_type_name(ttype), token.s); - if (ttype != keyword_else) { + if (ttype != tt_ps_else) { while (ps.s_ttype[ps.tos] == if_expr_stmt) { ps.s_ttype[ps.tos] = stmt; reduce(); @@ -105,7 +105,7 @@ parse(token_type ttype) ps.ind_level_follow = ps.s_ind_level[ps.tos--]; } /* FALLTHROUGH */ - case keyword_do: + case tt_ps_do: case for_exprs: /* 'for' (...) */ ps.s_ttype[++ps.tos] = ttype; ps.s_ind_level[ps.tos] = ps.ind_level = ps.ind_level_follow; @@ -155,7 +155,7 @@ parse(token_type ttype) break; - case keyword_else: + case tt_ps_else: if (ps.s_ttype[ps.tos] != if_expr_stmt) diag(1, "Unmatched 'else'"); else { @@ -235,7 +235,7 @@ reduce_stmt(void) ps.s_ttype[--ps.tos] = stmt_list; return true; - case keyword_do: /* 'do' <stmt> */ + case tt_ps_do: /* 'do' <stmt> */ ps.s_ttype[--ps.tos] = do_stmt; ps.ind_level_follow = ps.s_ind_level[ps.tos]; return true; |
