summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2021-10-01 18:23:18 -0500
committerBjorn Andersson <bjorn.andersson@linaro.org>2021-10-04 12:22:21 -0500
commitdcec18722a968b662acf8cabb3a2ec87c031822e (patch)
tree0eed2d88873f76a5a906f0f10d3253ffd18766d4
parentf80136eb0873b6887527cd6104d9a0680c919306 (diff)
parser: use token_expect() instead of token_accept()
If parse_package() finds anything other than an identifier as the next token, it calls yyerror(). This is exactly what token_expect() does, so use that instead. Signed-off-by: Alex Elder <elder@linaro.org> Message-Id: <20211001232338.769309-15-elder@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
-rw-r--r--parser.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/parser.c b/parser.c
index 38e58d1..0ec8e97 100644
--- a/parser.c
+++ b/parser.c
@@ -238,9 +238,7 @@ static const char *parse_package()
{
struct token tok;
- if (!token_accept(TOK_ID, &tok))
- yyerror("expected identifier");
-
+ token_expect(TOK_ID, &tok);
token_expect(';', NULL);
return tok.str;
}