summaryrefslogtreecommitdiffstats
path: root/lib/command_lex.l
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-08-04 18:18:31 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-08-04 18:18:31 +0200
commit5a8bbed0b1e9b22526fd23946593f47487709497 (patch)
treed5ae90ecc60f95fc814d96e6326bab2a25cd6dd5 /lib/command_lex.l
parentlib: Refactor format parser (diff)
downloadfrr-5a8bbed0b1e9b22526fd23946593f47487709497.tar.xz
frr-5a8bbed0b1e9b22526fd23946593f47487709497.zip
lib: Add support for negative ranges
And convert range delimiters to signed int Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command_lex.l')
-rw-r--r--lib/command_lex.l6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/command_lex.l b/lib/command_lex.l
index ff951149b..0a997de8d 100644
--- a/lib/command_lex.l
+++ b/lib/command_lex.l
@@ -4,13 +4,13 @@
extern void set_buffer_string(const char *);
%}
-WORD [-+a-z\*][-+_a-zA-Z0-9\*]*
+WORD [-|+]?[a-z\*][-+_a-zA-Z0-9\*]*
IPV4 A\.B\.C\.D
IPV4_PREFIX A\.B\.C\.D\/M
IPV6 X:X::X:X
IPV6_PREFIX X:X::X:X\/M
VARIABLE [A-Z][-_a-zA-Z:0-9]+
-NUMBER [0-9]{1,20}
+NUMBER [-|+]?[0-9]{1,20}
RANGE \({NUMBER}\-{NUMBER}\)
/* yytext shall be a pointer */
@@ -30,7 +30,7 @@ RANGE \({NUMBER}\-{NUMBER}\)
{VARIABLE} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return VARIABLE;}
{NUMBER} {
char *endptr;
- yylval.integer = strtoll(yytext, &endptr, 10);
+ yylval.integer = strtoimax(yytext, &endptr, 10);
return NUMBER;
}
{RANGE} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return RANGE;}