diff options
author | Patrick McHardy <kaber@trash.net> | 2015-04-11 14:54:19 +0100 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2015-04-12 19:59:27 +0100 |
commit | 87908ff7a12c969ca21338ab7ed27ed93a9b09c3 (patch) | |
tree | 5ebdb13c778b3e65e3c6c256c5b05ed2b370f79d /src | |
parent | 3ed296118a065caff5600e60d4f7ef18e137f9a0 (diff) |
datatype: fix parsing of time type
Properly detect time strings in the lexer without quotation marks.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/datatype.c | 4 | ||||
-rw-r--r-- | src/scanner.l | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/datatype.c b/src/datatype.c index c93f76a3..0772b507 100644 --- a/src/datatype.c +++ b/src/datatype.c @@ -775,8 +775,6 @@ static void time_type_print(const struct expr *expr) minutes = seconds / 60; seconds %= 60; - printf("\""); - if (days > 0) printf("%"PRIu64"d", days); if (hours > 0) @@ -785,8 +783,6 @@ static void time_type_print(const struct expr *expr) printf("%"PRIu64"m", minutes); if (seconds > 0) printf("%"PRIu64"s", seconds); - - printf("\""); } enum { diff --git a/src/scanner.l b/src/scanner.l index 73c4f8b1..27d95bfc 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -117,6 +117,8 @@ quotedstring \"[^"]*\" comment #.*$ slash \/ +timestring ([0-9]+d)?([0-9]+h)?([0-9]+m)?([0-9]+s)? + hex4 ([[:xdigit:]]{1,4}) v680 (({hex4}:){7}{hex4}) v670 ((:)((:{hex4}){7})) @@ -457,6 +459,11 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) return STRING; } +{timestring} { + yylval->string = xstrdup(yytext); + return STRING; + } + {decstring} { errno = 0; yylval->val = strtoull(yytext, NULL, 0); |