Browse Source

advanced.json is now parsed properly again

Tomek Mrugalski 8 years ago
parent
commit
bfc64c5c1b
2 changed files with 14 additions and 6 deletions
  1. 1 1
      src/bin/dhcp6/Makefile.am
  2. 13 5
      src/bin/dhcp6/dhcp6_parser.yy

+ 1 - 1
src/bin/dhcp6/Makefile.am

@@ -122,7 +122,7 @@ parser: dhcp6_lexer.cc location.hh position.hh stack.hh dhcp6_parser.cc dhcp6_pa
 # This is especially useful if yydebug_ is set to 1 as that variable
 # will cause parser to print out its internal state.
 location.hh position.hh stack.hh dhcp6_parser.cc dhcp6_parser.h: dhcp6_parser.yy
-	$(YACC) --defines=dhcp6_parser.h -o dhcp6_parser.cc dhcp6_parser.yy
+	$(YACC) --defines=dhcp6_parser.h --report=all --report-file=dhcp6_parser.report -o dhcp6_parser.cc dhcp6_parser.yy
 
 dhcp6_lexer.cc: dhcp6_lexer.ll
 	$(LEX) --prefix parser6_ -o dhcp6_lexer.cc dhcp6_lexer.ll

+ 13 - 5
src/bin/dhcp6/dhcp6_parser.yy

@@ -284,10 +284,19 @@ mac_sources: MAC_SOURCES {
     ElementPtr l(new ListElement());
     ctx.stack_.back()->set("mac-sources", l);
     ctx.stack_.push_back(l);
-} COLON list {
+} COLON LSQUARE_BRACKET mac_sources_list RSQUARE_BRACKET {
     ctx.stack_.pop_back();
 };
 
+mac_sources_list: mac_sources_value
+| mac_sources_list COMMA mac_sources_value;
+
+mac_sources_value: DUID {
+    ElementPtr duid(new StringElement("duid")); ctx.stack_.back()->add(duid);
+}| STRING {
+    ElementPtr duid(new StringElement($1)); ctx.stack_.back()->add(duid);
+};
+
 host_reservation_identifiers: HOST_RESERVATION_IDENTIFIERS COLON LSQUARE_BRACKET {
     ElementPtr l(new ListElement());
     ctx.stack_.back()->set("host-reservation-identifiers", l);
@@ -401,8 +410,7 @@ option_data_entry: LCURLY_BRACKET {
 
 // This defines parameters specified inside the map that itself
 // is an entry in option-data list.
-option_data_params: {}
-| option_data_param
+option_data_params: option_data_param
 | option_data_params COMMA option_data_param;
 
 option_data_param:
@@ -550,7 +558,7 @@ ip_addresses: IP_ADDRESSES COLON {
     ElementPtr l(new ListElement());
     ctx.stack_.back()->set("ip-addresses", l);
     ctx.stack_.push_back(l);
-} list { 
+} list {
     ctx.stack_.pop_back();
 };
 
@@ -558,7 +566,7 @@ prefixes: PREFIXES COLON  {
     ElementPtr l(new ListElement());
     ctx.stack_.back()->set("prefixes", l);
     ctx.stack_.push_back(l);
-} list { 
+} list {
     ctx.stack_.pop_back();
 };