From b9035928d16d032db1882d54ecb481352bd56047 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Thu, 20 Jul 2023 23:23:00 -0400 Subject: [PATCH] libcdecl: Remove magic T_ENGLISH token. This token is pointless, all english syntax is already sufficiently distinguished by the T_DECLARE and T_TYPE tokens, which are only returned by the scanner in english mode. --- src/parse.y | 5 ++--- src/scan.l | 5 ----- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/parse.y b/src/parse.y index f507d5b..fd5776e 100644 --- a/src/parse.y +++ b/src/parse.y @@ -188,7 +188,6 @@ static struct cdecl *insert_identifier(struct cdecl *decl, char *ident) /* Magic tokens */ %token T_LEX_ERROR -%token T_ENGLISH %token T_IDENT "identifier" %token T_UINT "integer constant" @@ -274,8 +273,8 @@ static struct cdecl *insert_identifier(struct cdecl *decl, char *ident) %% -input: T_ENGLISH english { - *out = $2; +input: english { + *out = $1; } | declaration { *out = $1; }; diff --git a/src/scan.l b/src/scan.l index 767ba22..8a6572e 100644 --- a/src/scan.l +++ b/src/scan.l @@ -124,11 +124,6 @@ INTEGER 0x[[:xdigit:]]+|0[0-7]+|[[:digit:]]+ %{ char *c; - - if (yyextra > 0) { - yyextra = -yyextra; - return T_ENGLISH; - } %} "..."|[][;*(),] { -- 2.43.2