From 532bbeca0d208bb9105a02e32676649ff03f99fd Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 12 Dec 2017 16:50:53 -0800 Subject: [PATCH 1/3] Remove wrong handling of \a in a regex --- src/compiler/prepare_grammar/parse_regex.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/compiler/prepare_grammar/parse_regex.cc b/src/compiler/prepare_grammar/parse_regex.cc index cab76443..021b7e4d 100644 --- a/src/compiler/prepare_grammar/parse_regex.cc +++ b/src/compiler/prepare_grammar/parse_regex.cc @@ -190,8 +190,6 @@ class PatternParser { CharacterSet escaped_char(uint32_t value) { switch (value) { - case 'a': - return CharacterSet().include('a', 'z').include('A', 'Z'); case 'w': return CharacterSet() .include('a', 'z') @@ -210,8 +208,11 @@ class PatternParser { case 'D': return CharacterSet().include_all().exclude('0', '9'); case 's': - return CharacterSet().include(' ').include('\t').include('\n').include( - '\r'); + return CharacterSet() + .include(' ') + .include('\t') + .include('\n') + .include('\r'); case 'S': return CharacterSet() .include_all() From f426b61e7c439a1c5b1fbdd8ad9809d206ce1916 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 13 Dec 2017 12:21:13 -0800 Subject: [PATCH 2/3] Fix expectation around preproc directive in C error test --- test/fixtures/error_corpus/c_errors.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures/error_corpus/c_errors.txt b/test/fixtures/error_corpus/c_errors.txt index 25d819d1..1b31c4ae 100644 --- a/test/fixtures/error_corpus/c_errors.txt +++ b/test/fixtures/error_corpus/c_errors.txt @@ -35,7 +35,7 @@ int c; (linkage_specification (string_literal) (declaration_list - (ERROR) + (preproc_call (preproc_directive)) (function_definition (primitive_type) (function_declarator (identifier) (parameter_list)) From e5851fd9b9714aa7ed768cd2f8c662b1ad0704f1 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 13 Dec 2017 12:21:28 -0800 Subject: [PATCH 3/3] Don't use non-existent \a syntax in test grammars --- test/fixtures/test_grammars/aliased_rules/grammar.json | 2 +- .../test_grammars/conflict_in_repeat_rule/grammar.json | 4 ++-- .../external_and_internal_anonymous_tokens/grammar.json | 4 ++-- .../test_grammars/external_and_internal_tokens/grammar.json | 4 ++-- .../fixtures/test_grammars/external_extra_tokens/grammar.json | 4 ++-- test/fixtures/test_grammars/external_tokens/grammar.json | 4 ++-- .../fixtures/test_grammars/inlined_aliased_rules/grammar.json | 2 +- .../test_grammars/inverted_external_token/grammar.json | 2 +- .../test_grammars/partially_resolved_conflict/grammar.json | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/test/fixtures/test_grammars/aliased_rules/grammar.json b/test/fixtures/test_grammars/aliased_rules/grammar.json index 289fd0ea..391f780f 100644 --- a/test/fixtures/test_grammars/aliased_rules/grammar.json +++ b/test/fixtures/test_grammars/aliased_rules/grammar.json @@ -66,6 +66,6 @@ } }, - "identifier": {"type": "PATTERN", "value": "\\a+"} + "identifier": {"type": "PATTERN", "value": "[a-z]+"} } } diff --git a/test/fixtures/test_grammars/conflict_in_repeat_rule/grammar.json b/test/fixtures/test_grammars/conflict_in_repeat_rule/grammar.json index 67c05355..45d0922a 100644 --- a/test/fixtures/test_grammars/conflict_in_repeat_rule/grammar.json +++ b/test/fixtures/test_grammars/conflict_in_repeat_rule/grammar.json @@ -71,6 +71,6 @@ ] }, - "identifier": {"type": "PATTERN", "value": "\\a+"} + "identifier": {"type": "PATTERN", "value": "[a-z]+"} } -} \ No newline at end of file +} diff --git a/test/fixtures/test_grammars/external_and_internal_anonymous_tokens/grammar.json b/test/fixtures/test_grammars/external_and_internal_anonymous_tokens/grammar.json index e62c5b7c..057bdbf0 100644 --- a/test/fixtures/test_grammars/external_and_internal_anonymous_tokens/grammar.json +++ b/test/fixtures/test_grammars/external_and_internal_anonymous_tokens/grammar.json @@ -29,7 +29,7 @@ ] }, - "variable": {"type": "PATTERN", "value": "\\a+"}, + "variable": {"type": "PATTERN", "value": "[a-z]+"}, "number": {"type": "PATTERN", "value": "\\d+"} } -} \ No newline at end of file +} diff --git a/test/fixtures/test_grammars/external_and_internal_tokens/grammar.json b/test/fixtures/test_grammars/external_and_internal_tokens/grammar.json index 63ce1c33..62d77383 100644 --- a/test/fixtures/test_grammars/external_and_internal_tokens/grammar.json +++ b/test/fixtures/test_grammars/external_and_internal_tokens/grammar.json @@ -29,8 +29,8 @@ ] }, - "variable": {"type": "PATTERN", "value": "\\a+"}, + "variable": {"type": "PATTERN", "value": "[a-z]+"}, "number": {"type": "PATTERN", "value": "\\d+"}, "line_break": {"type": "STRING", "value": "\n"} } -} \ No newline at end of file +} diff --git a/test/fixtures/test_grammars/external_extra_tokens/grammar.json b/test/fixtures/test_grammars/external_extra_tokens/grammar.json index a836b289..1f57d593 100644 --- a/test/fixtures/test_grammars/external_extra_tokens/grammar.json +++ b/test/fixtures/test_grammars/external_extra_tokens/grammar.json @@ -20,6 +20,6 @@ ] }, - "variable": {"type": "PATTERN", "value": "\\a+"} + "variable": {"type": "PATTERN", "value": "[a-z]+"} } -} \ No newline at end of file +} diff --git a/test/fixtures/test_grammars/external_tokens/grammar.json b/test/fixtures/test_grammars/external_tokens/grammar.json index 1d64915b..d61a978f 100644 --- a/test/fixtures/test_grammars/external_tokens/grammar.json +++ b/test/fixtures/test_grammars/external_tokens/grammar.json @@ -51,7 +51,7 @@ "identifier": { "type": "PATTERN", - "value": "\\a+" + "value": "[a-z]+" } } -} \ No newline at end of file +} diff --git a/test/fixtures/test_grammars/inlined_aliased_rules/grammar.json b/test/fixtures/test_grammars/inlined_aliased_rules/grammar.json index b0c121c0..bdf01789 100644 --- a/test/fixtures/test_grammars/inlined_aliased_rules/grammar.json +++ b/test/fixtures/test_grammars/inlined_aliased_rules/grammar.json @@ -70,6 +70,6 @@ } }, - "identifier": {"type": "PATTERN", "value": "\\a+"} + "identifier": {"type": "PATTERN", "value": "[a-z]+"} } } diff --git a/test/fixtures/test_grammars/inverted_external_token/grammar.json b/test/fixtures/test_grammars/inverted_external_token/grammar.json index dc837948..a43cedcc 100644 --- a/test/fixtures/test_grammars/inverted_external_token/grammar.json +++ b/test/fixtures/test_grammars/inverted_external_token/grammar.json @@ -49,7 +49,7 @@ "identifier": { "type": "PATTERN", - "value": "\\a+" + "value": "[a-z]+" } } } diff --git a/test/fixtures/test_grammars/partially_resolved_conflict/grammar.json b/test/fixtures/test_grammars/partially_resolved_conflict/grammar.json index 4d64b4eb..adca84d9 100644 --- a/test/fixtures/test_grammars/partially_resolved_conflict/grammar.json +++ b/test/fixtures/test_grammars/partially_resolved_conflict/grammar.json @@ -52,7 +52,7 @@ "identifier": { "type": "PATTERN", - "value": "\\a+" + "value": "[a-z]+" } } -} \ No newline at end of file +}