diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-07-30 15:26:27 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-08-02 17:18:26 -0400 |
commit | dd6869d9fdff585d54633690ec880e87ad1d6e62 (patch) | |
tree | 1898e07a50244da335c65ce76f1edd99dfedc211 /src/parse.c | |
parent | 708119de1cf9165d0cdfd3f3ba36be6672c42fdb (diff) | |
download | bfs-dd6869d9fdff585d54633690ec880e87ad1d6e62.tar.xz |
parse: Fix names in parse_mode()
Commit 9c6e4ce ("parse: s/parser_state/bfs_parser/") was a little to
overzealous in replacing "state" with "parser", resulting in the
tortured phrase "parser machine parser" instead of "state machine
state".
Diffstat (limited to 'src/parse.c')
-rw-r--r-- | src/parse.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/parse.c b/src/parse.c index b13d1f8..c6030e7 100644 --- a/src/parse.c +++ b/src/parse.c @@ -1921,7 +1921,7 @@ static int parse_mode(const struct bfs_parser *parser, const char *mode, struct // // PERMCOPY : "u" | "g" | "o" - // Parser machine parser + // State machine state enum { MODE_CLAUSE, MODE_WHO, @@ -1929,7 +1929,7 @@ static int parse_mode(const struct bfs_parser *parser, const char *mode, struct MODE_ACTION_APPLY, MODE_OP, MODE_PERM, - } mparser = MODE_CLAUSE; + } state = MODE_CLAUSE; enum { MODE_PLUS, @@ -1943,10 +1943,10 @@ static int parse_mode(const struct bfs_parser *parser, const char *mode, struct const char *i = mode; while (true) { - switch (mparser) { + switch (state) { case MODE_CLAUSE: who = 0; - mparser = MODE_WHO; + state = MODE_WHO; fallthru; case MODE_WHO: @@ -1964,7 +1964,7 @@ static int parse_mode(const struct bfs_parser *parser, const char *mode, struct who |= 0777; break; default: - mparser = MODE_ACTION; + state = MODE_ACTION; continue; } break; @@ -1994,27 +1994,27 @@ static int parse_mode(const struct bfs_parser *parser, const char *mode, struct switch (*i) { case '+': op = MODE_PLUS; - mparser = MODE_OP; + state = MODE_OP; break; case '-': op = MODE_MINUS; - mparser = MODE_OP; + state = MODE_OP; break; case '=': op = MODE_EQUALS; - mparser = MODE_OP; + state = MODE_OP; break; case ',': - if (mparser == MODE_ACTION_APPLY) { - mparser = MODE_CLAUSE; + if (state == MODE_ACTION_APPLY) { + state = MODE_CLAUSE; } else { goto fail; } break; case '\0': - if (mparser == MODE_ACTION_APPLY) { + if (state == MODE_ACTION_APPLY) { goto done; } else { goto fail; @@ -2043,7 +2043,7 @@ static int parse_mode(const struct bfs_parser *parser, const char *mode, struct default: file_change = 0; dir_change = 0; - mparser = MODE_PERM; + state = MODE_PERM; continue; } @@ -2051,7 +2051,7 @@ static int parse_mode(const struct bfs_parser *parser, const char *mode, struct file_change &= who; dir_change |= (dir_change << 6) | (dir_change << 3); dir_change &= who; - mparser = MODE_ACTION_APPLY; + state = MODE_ACTION_APPLY; break; case MODE_PERM: @@ -2087,7 +2087,7 @@ static int parse_mode(const struct bfs_parser *parser, const char *mode, struct } break; default: - mparser = MODE_ACTION_APPLY; + state = MODE_ACTION_APPLY; continue; } break; |