From cce855bc5b117cb7ae70064131120687bc69fac0 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Fri, 17 Apr 1998 19:52:44 +0000 Subject: Imported from ../bash-2.02.tar.gz. --- command.h | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'command.h') diff --git a/command.h b/command.h index 92c7fb4..8278aac 100644 --- a/command.h +++ b/command.h @@ -54,7 +54,8 @@ enum r_instruction { /* Command Types: */ enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select, - cm_connection, cm_function_def, cm_until, cm_group }; + cm_connection, cm_function_def, cm_until, cm_group, + cm_arith, cm_cond }; /* Possible values for the `flags' field of a WORD_DESC. */ #define W_HASDOLLAR 0x01 /* Dollar sign present. */ @@ -142,6 +143,12 @@ typedef struct command { struct group_com *Group; #if defined (SELECT_COMMAND) struct select_com *Select; +#endif +#if defined (DPAREN_ARITHMETIC) + struct arith_com *Arith; +#endif +#if defined (COND_COMMAND) + struct cond_com *Cond; #endif } value; } COMMAND; @@ -207,6 +214,34 @@ typedef struct while_com { COMMAND *action; /* Thing to do while test is non-zero. */ } WHILE_COM; +#if defined (DPAREN_ARITHMETIC) +/* The arithmetic evaluation command, ((...)). Just a set of flags and + a WORD_LIST, of which the first element is the only one used, for the + time being. */ +typedef struct arith_com { + int flags; + WORD_LIST *exp; + int line; +} ARITH_COM; +#endif /* DPAREN_ARITHMETIC */ + +/* The conditional command, [[...]]. This is a binary tree -- we slippped + a recursive-descent parser into the YACC grammar to parse it. */ +#define COND_AND 1 +#define COND_OR 2 +#define COND_UNARY 3 +#define COND_BINARY 4 +#define COND_TERM 5 +#define COND_EXPR 6 + +typedef struct cond_com { + int flags; + int line; + int type; + WORD_DESC *op; + struct cond_com *left, *right; +} COND_COM; + /* The "simple" command. Just a collection of words and redirects. */ typedef struct simple_com { int flags; /* See description of CMD flags. */ @@ -218,7 +253,7 @@ typedef struct simple_com { /* The "function definition" command. */ typedef struct function_def { - int ignore; /* See description of CMD flags. */ + int flags; /* See description of CMD flags. */ WORD_DESC *name; /* The name of the function. */ COMMAND *command; /* The parsed execution tree. */ int line; /* Line number the function def starts on. */ -- cgit v1.2.3