aboutsummaryrefslogtreecommitdiffstats
path: root/command.h
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>1998-04-17 19:52:44 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:51 +0000
commitcce855bc5b117cb7ae70064131120687bc69fac0 (patch)
tree39c7a4ec8f6d22ef03df74f2684e6a04fef10399 /command.h
parente8ce775db824de329b81293b4e5d8fbd65624528 (diff)
downloadandroid_external_bash-cce855bc5b117cb7ae70064131120687bc69fac0.tar.gz
android_external_bash-cce855bc5b117cb7ae70064131120687bc69fac0.tar.bz2
android_external_bash-cce855bc5b117cb7ae70064131120687bc69fac0.zip
Imported from ../bash-2.02.tar.gz.
Diffstat (limited to 'command.h')
-rw-r--r--command.h39
1 files changed, 37 insertions, 2 deletions
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. */
@@ -143,6 +144,12 @@ typedef struct command {
#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. */