diff mbox

[04/10] parser: add a time_spec rule

Message ID 1428840978-27226-5-git-send-email-kaber@trash.net
State Accepted
Delegated to: Pablo Neira
Headers show

Commit Message

Patrick McHardy April 12, 2015, 12:16 p.m. UTC
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
 src/parser_bison.y | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox

Patch

diff --git a/src/parser_bison.y b/src/parser_bison.y
index b86381d..cd4e096 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -396,6 +396,8 @@  static void location_update(struct location *loc, struct location *rhs, int n)
 %type <string>			identifier string comment_spec
 %destructor { xfree($$); }	identifier string comment_spec
 
+%type <val>			time_spec
+
 %type <val>			type_identifier
 %type <datatype>		data_type
 
@@ -1093,6 +1095,20 @@  string			:	STRING
 			|	QUOTED_STRING
 			;
 
+time_spec		:	STRING
+			{
+				struct error_record *erec;
+				uint64_t res;
+
+				erec = time_parse(&@1, $1, &res);
+				if (erec != NULL) {
+					erec_queue(erec, state->msgs);
+					YYERROR;
+				}
+				$$ = res;
+			}
+			;
+
 family_spec		:	/* empty */		{ $$ = NFPROTO_IPV4; }
 			|	family_spec_explicit
 			;