diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2021-08-26 11:43:08 +0200 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2021-08-26 21:03:44 +0200 |
| commit | 90c8406c209a698ecc28c80ad7ebced13a84e3e8 (patch) | |
| tree | 74bedac5f4d8c3bc5b1bdfb42e6eefaa001d714c /lib/command_lex.l | |
| parent | 3e324ff41921c719de3aabc4136546828416532f (diff) | |
lib: add `![...]` syntax for easy "no" forms
This allows defining a CLI command like this:
`[no] some setting ![VALUE]`
with VALUE being optional for the "no" form, but required for the
positive form. It's just a `[...]` where the empty branch can only be
taken for commands starting with `no`.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/command_lex.l')
| -rw-r--r-- | lib/command_lex.l | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/command_lex.l b/lib/command_lex.l index 9c096995f5..ec366ce7e1 100644 --- a/lib/command_lex.l +++ b/lib/command_lex.l @@ -82,6 +82,7 @@ RANGE \({NUMBER}[ ]?\-[ ]?{NUMBER}\) {VARIABLE} {yylval->string = XSTRDUP(MTYPE_LEX, yytext); return VARIABLE;} {WORD} {yylval->string = XSTRDUP(MTYPE_LEX, yytext); return WORD;} {RANGE} {yylval->string = XSTRDUP(MTYPE_LEX, yytext); return RANGE;} +!\[ {yylval->string = NULL; return EXCL_BRACKET;} . {return yytext[0];} %% |
