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:
Max Brunsfeld 2017-12-13 12:34:45 -08:00 committed by GitHub
commit e016561887
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 21 additions and 20 deletions

View file

@ -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()

View file

@ -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))

View file

@ -66,6 +66,6 @@
}
},
"identifier": {"type": "PATTERN", "value": "\\a+"}
"identifier": {"type": "PATTERN", "value": "[a-z]+"}
}
}

View file

@ -71,6 +71,6 @@
]
},
"identifier": {"type": "PATTERN", "value": "\\a+"}
"identifier": {"type": "PATTERN", "value": "[a-z]+"}
}
}
}

View file

@ -29,7 +29,7 @@
]
},
"variable": {"type": "PATTERN", "value": "\\a+"},
"variable": {"type": "PATTERN", "value": "[a-z]+"},
"number": {"type": "PATTERN", "value": "\\d+"}
}
}
}

View file

@ -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"}
}
}
}

View file

@ -20,6 +20,6 @@
]
},
"variable": {"type": "PATTERN", "value": "\\a+"}
"variable": {"type": "PATTERN", "value": "[a-z]+"}
}
}
}

View file

@ -51,7 +51,7 @@
"identifier": {
"type": "PATTERN",
"value": "\\a+"
"value": "[a-z]+"
}
}
}
}

View file

@ -70,6 +70,6 @@
}
},
"identifier": {"type": "PATTERN", "value": "\\a+"}
"identifier": {"type": "PATTERN", "value": "[a-z]+"}
}
}

View file

@ -49,7 +49,7 @@
"identifier": {
"type": "PATTERN",
"value": "\\a+"
"value": "[a-z]+"
}
}
}

View file

@ -52,7 +52,7 @@
"identifier": {
"type": "PATTERN",
"value": "\\a+"
"value": "[a-z]+"
}
}
}
}