Merge pull request #116 from tree-sitter/mb-remove-invented-character-class
Remove wrong handling of \a in a regex
This commit is contained in:
commit
e016561887
11 changed files with 21 additions and 20 deletions
|
|
@ -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()
|
||||
|
|
|
|||
2
test/fixtures/error_corpus/c_errors.txt
vendored
2
test/fixtures/error_corpus/c_errors.txt
vendored
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -66,6 +66,6 @@
|
|||
}
|
||||
},
|
||||
|
||||
"identifier": {"type": "PATTERN", "value": "\\a+"}
|
||||
"identifier": {"type": "PATTERN", "value": "[a-z]+"}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,6 +71,6 @@
|
|||
]
|
||||
},
|
||||
|
||||
"identifier": {"type": "PATTERN", "value": "\\a+"}
|
||||
"identifier": {"type": "PATTERN", "value": "[a-z]+"}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
]
|
||||
},
|
||||
|
||||
"variable": {"type": "PATTERN", "value": "\\a+"},
|
||||
"variable": {"type": "PATTERN", "value": "[a-z]+"},
|
||||
"number": {"type": "PATTERN", "value": "\\d+"}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,6 @@
|
|||
]
|
||||
},
|
||||
|
||||
"variable": {"type": "PATTERN", "value": "\\a+"}
|
||||
"variable": {"type": "PATTERN", "value": "[a-z]+"}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
|
||||
"identifier": {
|
||||
"type": "PATTERN",
|
||||
"value": "\\a+"
|
||||
"value": "[a-z]+"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,6 @@
|
|||
}
|
||||
},
|
||||
|
||||
"identifier": {"type": "PATTERN", "value": "\\a+"}
|
||||
"identifier": {"type": "PATTERN", "value": "[a-z]+"}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
|
||||
"identifier": {
|
||||
"type": "PATTERN",
|
||||
"value": "\\a+"
|
||||
"value": "[a-z]+"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
"identifier": {
|
||||
"type": "PATTERN",
|
||||
"value": "\\a+"
|
||||
"value": "[a-z]+"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue