From e9ff1c6fbbbac9ece2604876ab589ac282360446 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Mon, 15 Nov 2021 15:08:03 -0800 Subject: 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. --- src/cmd/rc/rc.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/cmd/rc/rc.h') diff --git a/src/cmd/rc/rc.h b/src/cmd/rc/rc.h index 9b415fc..f7533a0 100644 --- a/src/cmd/rc/rc.h +++ b/src/cmd/rc/rc.h @@ -139,7 +139,8 @@ struct Thread struct WaitItem *on; } wait; - int pid, pgid, status; + int pid, pgid; + int status; long line; Thread *caller; // process we return to @@ -261,3 +262,7 @@ char **mkenv(void); int compile(Tree *); Code *copycode(Code *c); void freecode(Code *c); + +/* glob.c */ +#define GLOB ((char)(0x01)) +int match(char *, char *, int); -- cgit v1.2.1