diff options
author | Nicholas <nbnoll@eml.cc> | 2021-11-15 15:08:03 -0800 |
---|---|---|
committer | Nicholas <nbnoll@eml.cc> | 2021-11-15 15:08:14 -0800 |
commit | e9ff1c6fbbbac9ece2604876ab589ac282360446 (patch) | |
tree | 1e1378a1cb37ca4e751d8140eeed99db7ccc4ce7 /src/cmd/rc/parse.h | |
parent | 27d656be97f1544d7535d8c144ff28b9214aed97 (diff) |
Feat: added if/else branching and switch statement
Unsure about my modification to the language. I found the parsing of the
case body within switches to be odd - specifically that it parses
liberally and then checks that it has case -> cmd structuring while it
walks the code. This means the language is more permissive than the
semantics. I modified it to be more explicit, but at the cost of having
to end each case statement with a semicolon. I wanted a colon, but this
is a valid word character and thus will be lexed as part of the word.
Diffstat (limited to 'src/cmd/rc/parse.h')
-rw-r--r-- | src/cmd/rc/parse.h | 47 |
1 files changed, 7 insertions, 40 deletions
diff --git a/src/cmd/rc/parse.h b/src/cmd/rc/parse.h index 64ee07b..a99e118 100644 --- a/src/cmd/rc/parse.h +++ b/src/cmd/rc/parse.h @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.8.2. */ +/* A Bison parser, made by GNU Bison 3.7.6. */ /* Bison interface for Yacc-like parsers in C @@ -35,11 +35,11 @@ especially those whose name start with YY_ or yy_. They are private implementation details that can be changed or removed. */ -#ifndef YY_YY_SYS_CMD_RC_PARSE_H_INCLUDED -# define YY_YY_SYS_CMD_RC_PARSE_H_INCLUDED +#ifndef YY_YY_SRC_CMD_RC_PARSE_H_INCLUDED +# define YY_YY_SRC_CMD_RC_PARSE_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG -# define YYDEBUG 0 +# define YYDEBUG 1 #endif #if YYDEBUG extern int yydebug; @@ -83,47 +83,16 @@ extern int yydebug; }; typedef enum yytokentype yytoken_kind_t; #endif -/* Token kinds. */ -#define YYEMPTY -2 -#define YYEOF 0 -#define YYerror 256 -#define YYUNDEF 257 -#define Tfor 258 -#define Tin 259 -#define Twhile 260 -#define Tif 261 -#define Telse 262 -#define Tswitch 263 -#define Tcase 264 -#define Tcasebody 265 -#define Ttwiddle 266 -#define Tbang 267 -#define Tsubshell 268 -#define Tfunc 269 -#define Tredir 270 -#define Tdup 271 -#define Tpipe 272 -#define Tindex 273 -#define Tbasic 274 -#define Targs 275 -#define Tword 276 -#define Twords 277 -#define Tparen 278 -#define Tblock 279 -#define Tandand 280 -#define Toror 281 -#define Tcount 282 -#define Tjoin 283 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { -#line 24 "sys/cmd/rc/syntax.y" +#line 24 "src/cmd/rc/syntax.y" struct Tree *tree; -#line 127 "sys/cmd/rc/parse.h" +#line 96 "src/cmd/rc/parse.h" }; typedef union YYSTYPE YYSTYPE; @@ -134,8 +103,6 @@ typedef union YYSTYPE YYSTYPE; extern YYSTYPE yylval; - int yyparse (void); - -#endif /* !YY_YY_SYS_CMD_RC_PARSE_H_INCLUDED */ +#endif /* !YY_YY_SRC_CMD_RC_PARSE_H_INCLUDED */ |