summaryrefslogtreecommitdiff
path: root/src/cli_parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli_parse.y')
-rw-r--r--src/cli_parse.y47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/cli_parse.y b/src/cli_parse.y
index 318394b..47ba0e5 100644
--- a/src/cli_parse.y
+++ b/src/cli_parse.y
@@ -35,6 +35,10 @@ static void cli_deferror(const char *);
%token HELP
%token DEFAULT
%token PRIORITY
+%token ENUMERATION
+%token CHELP
+%token ALLOWED
+%token VHELP
%token PATTERN
%token EXEC
%token SYNTAX
@@ -150,6 +154,10 @@ type: TYPE TYPE_DEF
cause: help_cause
| default_cause
| priority_stmt
+ | enumeration_stmt
+ | chelp_stmt
+ | allowed_stmt
+ | vhelp_stmt
| syntax_cause
| ACTION action { append(parse_defp->actions + $1, $2, 0);}
| dummy_stmt
@@ -191,6 +199,45 @@ priority_stmt: PRIORITY VALUE
}
}
+enumeration_stmt: ENUMERATION STRING
+ {
+ parse_defp->def_enumeration = $2;
+ }
+
+chelp_stmt: CHELP STRING
+ {
+ parse_defp->def_comp_help = $2;
+ }
+
+allowed_stmt: ALLOWED STRING
+ {
+ parse_defp->def_allowed = $2;
+ }
+
+vhelp_stmt: VHELP STRING
+ {
+ if (!(parse_defp->def_val_help)) {
+ /* first string */
+ parse_defp->def_val_help = $2;
+ } else {
+ /* subsequent strings */
+ char *optr = parse_defp->def_val_help;
+ int olen = strlen(parse_defp->def_val_help);
+ char *nptr = $2;
+ int nlen = strlen(nptr);
+ int len = olen + 1 /* "\n" */ + nlen + 1 /* 0 */;
+ char *mptr = (char *) malloc(len);
+ memcpy(mptr, optr, olen);
+ mptr[olen] = '\n';
+ memcpy(&(mptr[olen + 1]), nptr, nlen);
+ mptr[len - 1] = 0;
+ parse_defp->def_val_help = mptr;
+ free(optr);
+ free(nptr);
+ }
+ /* result is a '\n'-delimited string for val_help */
+ }
+
syntax_cause: SYNTAX exp {append(parse_defp->actions + syntax_act, $2, 0);}
;