Browse Source

[5036] Added \r as a valid whitespace (cf JSON standard)

Francis Dupont 8 years ago
parent
commit
546f87e5ad
2 changed files with 5 additions and 1 deletions
  1. 1 1
      src/bin/dhcp6/dhcp6_lexer.ll
  2. 4 0
      src/bin/dhcp6/tests/parser_unittest.cc

+ 1 - 1
src/bin/dhcp6/dhcp6_lexer.ll

@@ -66,7 +66,7 @@ unsigned int comment_start_line = 0;
    can be used during actual token definitions. Note some can match
    can be used during actual token definitions. Note some can match
    incorrect inputs (e.g., IP addresses) which must be checked. */
    incorrect inputs (e.g., IP addresses) which must be checked. */
 int   \-?[0-9]+
 int   \-?[0-9]+
-blank [ \t]
+blank [ \t\r]
 
 
 UnicodeEscapeSequence           u[0-9A-Fa-f]{4}
 UnicodeEscapeSequence           u[0-9A-Fa-f]{4}
 JSONEscapeCharacter             ["\\/bfnrt]
 JSONEscapeCharacter             ["\\/bfnrt]

+ 4 - 0
src/bin/dhcp6/tests/parser_unittest.cc

@@ -274,6 +274,10 @@ TEST(ParserTest, errors) {
               "<string>:1.2: syntax error, unexpected end of file");
               "<string>:1.2: syntax error, unexpected end of file");
     testError("\n", Parser6Context::PARSER_JSON,
     testError("\n", Parser6Context::PARSER_JSON,
               "<string>:2.1: syntax error, unexpected end of file");
               "<string>:2.1: syntax error, unexpected end of file");
+    testError("\t", Parser6Context::PARSER_JSON,
+              "<string>:1.2: syntax error, unexpected end of file");
+    testError("\r", Parser6Context::PARSER_JSON,
+              "<string>:1.2: syntax error, unexpected end of file");
 
 
     // comments
     // comments
     testError("# nothing\n",
     testError("# nothing\n",