Skip to content

Commit 252efec

Browse files
committed
- change how it adds & replaces the injection points
1 parent e6f9c87 commit 252efec

4 files changed

Lines changed: 167 additions & 175 deletions

File tree

grammars/tree-sitter-regex-js.cson

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,93 @@
1-
name: 'JavaScript RegExp'
1+
name: 'Regular Expressions (JavaScript)'
22
scopeName: 'source.js.regexp'
33
type: 'tree-sitter'
44
parser: 'tree-sitter-regex-js'
55

6-
injectionRegex: '^regex-js$'
6+
injectionRegex: '^regex$'
77

88
scopes:
9-
'regex': 'meta.pattern.regexp'
9+
'regex': 'meta.pattern.regex'
1010

1111
'non_syntax': 'string.other.non-syntax'
1212
'invalid': 'invalid'
1313

14-
'disjunction_delimiter': 'keyword.operator.disjunction.regexp'
14+
'disjunction_delimiter': 'keyword.operator.disjunction.regex'
1515

1616
##### quantifiers #####
1717

1818
#'count_quantifier, one_or_more, zero_or_more, optional': 'storage.modifier'
19-
'zero_or_more, one_or_more, optional, count_quantifier': 'keyword.operator.quantifier.regexp'
20-
'count_quantifier > count_quantifier_value': 'constant.numeric.regexp'
21-
'count_quantifier > count_quantifier_delimiter': 'punctuation.definition.quantifier.count.delimiter.regexp'
19+
'zero_or_more, one_or_more, optional, count_quantifier': 'keyword.operator.quantifier.regex'
20+
'count_quantifier > count_quantifier_value': 'constant.numeric.regex'
21+
'count_quantifier > count_quantifier_delimiter': 'punctuation.definition.quantifier.count.delimiter.regex'
2222

2323
##### lookaround assertions #####
2424

25-
'lookahead_assertion': 'meta.group.assertion.look-ahead.regexp'
26-
'lookahead_assertion > lookahead_identifier': 'entity.name.type.look-ahead.regexp'
27-
'negative_lookahead_assertion': 'meta.group.assertion.negative-look-ahead.regexp'
28-
'negative_lookahead_assertion > negative_lookahead_identifier': 'entity.name.type.negative-look-ahead.regexp'
29-
'lookbehind_assertion': 'meta.group.assertion.look-behind.regexp'
30-
'lookbehind_assertion > lookbehind_identifier': 'entity.name.type.look-behind.regexp'
31-
'negative_lookbehind_assertion': 'meta.group.assertion.negative-look-behind.regexp'
32-
'negative_lookbehind_assertion > negative_lookbehind_identifier': 'entity.name.type.negative-look-behind.regexp'
25+
'lookahead_assertion': 'meta.group.assertion.look-ahead.regex'
26+
'lookahead_assertion > lookahead_identifier': 'entity.name.type.look-ahead.regex'
27+
'negative_lookahead_assertion': 'meta.group.assertion.negative-look-ahead.regex'
28+
'negative_lookahead_assertion > negative_lookahead_identifier': 'entity.name.type.negative-look-ahead.regex'
29+
'lookbehind_assertion': 'meta.group.assertion.look-behind.regex'
30+
'lookbehind_assertion > lookbehind_identifier': 'entity.name.type.look-behind.regex'
31+
'negative_lookbehind_assertion': 'meta.group.assertion.negative-look-behind.regex'
32+
'negative_lookbehind_assertion > negative_lookbehind_identifier': 'entity.name.type.negative-look-behind.regex'
3333

3434
##### groups and backreferences #####
3535

36-
'numeric_backreference': 'keyword.other.back-reference.numeric.regexp'
37-
'numeric_backreference > group_name': 'entity.name.tag.regexp'
38-
'named_backreference': 'keyword.other.back-reference.named.regexp'
39-
'named_backreference > group_name': 'entity.name.tag.regexp'
36+
'numeric_backreference': 'keyword.other.back-reference.numeric.regex'
37+
'numeric_backreference > group_name': 'entity.name.tag.regex'
38+
'named_backreference': 'keyword.other.back-reference.named.regex'
39+
'named_backreference > group_name': 'entity.name.tag.regex'
4040

41-
'named_capturing_group': 'meta.group.capturing.named.regexp'
42-
'named_capturing_group > named_capturing_group_identifier': 'entity.name.type.named.regexp'
43-
'named_capturing_group > named_capturing_group_identifier > group_name': 'entity.name.tag.regexp'
44-
'non_capturing_group': 'meta.group.non-capturing.regexp'
45-
'non_capturing_group > non_capturing_group_identifier': 'entity.name.type.non-capturing.regexp'
46-
'anonymous_capturing_group': 'meta.group.capturing.anonymous.regexp'
41+
'named_capturing_group': 'meta.group.capturing.named.regex'
42+
'named_capturing_group > named_capturing_group_identifier': 'entity.name.type.named.regex'
43+
'named_capturing_group > named_capturing_group_identifier > group_name': 'entity.name.tag.regex'
44+
'non_capturing_group': 'meta.group.non-capturing.regex'
45+
'non_capturing_group > non_capturing_group_identifier': 'entity.name.type.non-capturing.regex'
46+
'anonymous_capturing_group': 'meta.group.capturing.anonymous.regex'
4747

4848
#'group_name': 'variable.other.object.property'
4949

5050
#'"(", "(?", "(?:", "(?<"': 'punctuation.definition.parameters.begin.bracket.round'
51-
'group_begin': 'punctuation.definition.group.begin.bracket.round.regexp'
51+
'group_begin': 'punctuation.definition.group.begin.bracket.round.regex'
5252
#'">", ")"': 'punctuation.definition.parameters.end.bracket.round'
53-
'group_end': 'punctuation.definition.group.end.bracket.round.regexp'
53+
'group_end': 'punctuation.definition.group.end.bracket.round.regex'
5454

5555
##### character sets #####
5656

57-
'character_class': 'constant.other.character-class.set.regexp'
58-
'character_class > set_begin': 'punctuation.definition.character-class.set.begin.regexp'
59-
'character_class > set_end': 'punctuation.definition.character-class.set.end.regexp'
60-
'character_class > set_negation': 'keyword.operator.negation.regexp'
61-
'character_class > character_range': 'constant.other.character-class.range.regexp'
62-
'character_class > character_range > range_delimiter': 'punctuation.definition.character-class.range.hyphen.regexp'
57+
'character_class': 'constant.other.character-class.set.regex'
58+
'character_class > set_begin': 'punctuation.definition.character-class.set.begin.regex'
59+
'character_class > set_end': 'punctuation.definition.character-class.set.end.regex'
60+
'character_class > set_negation': 'keyword.operator.negation.regex'
61+
'character_class > character_range': 'constant.other.character-class.range.regex'
62+
'character_class > character_range > range_delimiter': 'punctuation.definition.character-class.range.hyphen.regex'
6363

6464
##### character classes #####
6565

66-
'character_class_escape': 'constant.other.character-class.escape.regexp'
67-
'any_character': 'constant.other.character-class.any.regexp'
66+
'character_class_escape': 'constant.other.character-class.escape.regex'
67+
'any_character': 'constant.other.character-class.any.regex'
6868

6969
##### character escapes #####
7070

71-
'null_character': 'constant.character.numeric.null.regexp'
72-
'identity_escape': 'constant.character.escape.backslash.regexp'
73-
'identity_escape > escape_operator': 'keyword.operator.escape-character.regexp'
74-
'unicode_escape': 'constant.character.numeric.unicode.regexp'
75-
'unicode_escape > unicode_code': 'constant.character.numeric.unicode.character-code.regexp'
76-
'octal_escape': 'constant.character.numeric.octal.regexp'
77-
'octal_escape > octal_code': 'constant.character.numeric.octal.character-code.regexp'
78-
'hexadecimal_escape': 'constant.character.numeric.hexadecimal.regexp'
79-
'hexadecimal_escape > hexadecimal_code': 'constant.character.numeric.hexadecimal.character-code.regexp'
80-
'control_letter_escape': 'constant.character.control.regexp'
81-
'control_letter_escape > control_letter_code': 'constant.character.control.character-code.regexp'
82-
'special_escape': 'constant.character.escape.special.regexp'
83-
84-
'invalid_unicode_escape': 'constant.character.escape.backslash.invalid.regexp'
85-
'invalid_unicode_escape > escape_operator': 'keyword.operator.escape-character.regexp'
86-
'invalid_hexadecimal_escape': 'constant.character.escape.backslash.invalid.regexp'
87-
'invalid_hexadecimal_escape > escape_operator': 'keyword.operator.escape-character.regexp'
88-
'invalid_control_letter_escape': 'constant.other.invalid.regexp'
71+
'null_character': 'constant.character.numeric.null.regex'
72+
'identity_escape': 'constant.character.escape.backslash.regex'
73+
'identity_escape > escape_operator': 'keyword.operator.escape-character.regex'
74+
'unicode_escape': 'constant.character.numeric.unicode.regex'
75+
'unicode_escape > unicode_code': 'constant.character.numeric.unicode.character-code.regex'
76+
'octal_escape': 'constant.character.numeric.octal.regex'
77+
'octal_escape > octal_code': 'constant.character.numeric.octal.character-code.regex'
78+
'hexadecimal_escape': 'constant.character.numeric.hexadecimal.regex'
79+
'hexadecimal_escape > hexadecimal_code': 'constant.character.numeric.hexadecimal.character-code.regex'
80+
'control_letter_escape': 'constant.character.control.regex'
81+
'control_letter_escape > control_letter_code': 'constant.character.control.character-code.regex'
82+
'special_escape': 'constant.character.escape.special.regex'
83+
84+
'invalid_unicode_escape': 'constant.character.escape.backslash.invalid.regex'
85+
'invalid_unicode_escape > escape_operator': 'keyword.operator.escape-character.regex'
86+
'invalid_hexadecimal_escape': 'constant.character.escape.backslash.invalid.regex'
87+
'invalid_hexadecimal_escape > escape_operator': 'keyword.operator.escape-character.regex'
88+
'invalid_control_letter_escape': 'constant.other.invalid.regex'
8989

9090
##### boundary assertions #####
9191

92-
#'start_assertion, end_assertion, boundary_assertion, non_boundary_assertion': 'constant.character.character-class.regexp'
93-
'start_assertion, end_assertion, boundary_assertion, non_boundary_assertion': 'keyword.control.anchor.regexp'
92+
#'start_assertion, end_assertion, boundary_assertion, non_boundary_assertion': 'constant.character.character-class.regex'
93+
'start_assertion, end_assertion, boundary_assertion, non_boundary_assertion': 'keyword.control.anchor.regex'
Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,98 @@
1-
name: 'JavaScript RegExp (Unicode)'
1+
name: 'Regular Expressions (JavaScript)'
22
scopeName: 'source.js.regexp.unicode'
33
type: 'tree-sitter'
44
parser: 'tree-sitter-regex-unicode-js'
55

6-
injectionRegex: '^_$'
6+
injectionRegex: '^regex_u$'
77

88
scopes:
9-
'regex': 'meta.pattern.regexp'
9+
'regex': 'meta.pattern.regex'
1010

1111
'non_syntax': 'string.other.non-syntax'
1212
'invalid': 'invalid'
1313

14-
'disjunction_delimiter': 'keyword.operator.disjunction.regexp'
14+
'disjunction_delimiter': 'keyword.operator.disjunction.regex'
1515

1616
##### quantifiers #####
1717

1818
#'count_quantifier, one_or_more, zero_or_more, optional': 'storage.modifier'
19-
'zero_or_more, one_or_more, optional, count_quantifier': 'keyword.operator.quantifier.regexp'
20-
'count_quantifier > count_quantifier_value': 'constant.numeric.regexp'
21-
'count_quantifier > count_quantifier_delimiter': 'punctuation.definition.quantifier.count.delimiter.regexp'
19+
'zero_or_more, one_or_more, optional, count_quantifier': 'keyword.operator.quantifier.regex'
20+
'count_quantifier > count_quantifier_value': 'constant.numeric.regex'
21+
'count_quantifier > count_quantifier_delimiter': 'punctuation.definition.quantifier.count.delimiter.regex'
2222

2323
##### lookaround assertions #####
2424

25-
'lookahead_assertion': 'meta.group.assertion.look-ahead.regexp'
26-
'lookahead_assertion > lookahead_identifier': 'entity.name.type.look-ahead.regexp'
27-
'negative_lookahead_assertion': 'meta.group.assertion.negative-look-ahead.regexp'
28-
'negative_lookahead_assertion > negative_lookahead_identifier': 'entity.name.type.negative-look-ahead.regexp'
29-
'lookbehind_assertion': 'meta.group.assertion.look-behind.regexp'
30-
'lookbehind_assertion > lookbehind_identifier': 'entity.name.type.look-behind.regexp'
31-
'negative_lookbehind_assertion': 'meta.group.assertion.negative-look-behind.regexp'
32-
'negative_lookbehind_assertion > negative_lookbehind_identifier': 'entity.name.type.negative-look-behind.regexp'
25+
'lookahead_assertion': 'meta.group.assertion.look-ahead.regex'
26+
'lookahead_assertion > lookahead_identifier': 'entity.name.type.look-ahead.regex'
27+
'negative_lookahead_assertion': 'meta.group.assertion.negative-look-ahead.regex'
28+
'negative_lookahead_assertion > negative_lookahead_identifier': 'entity.name.type.negative-look-ahead.regex'
29+
'lookbehind_assertion': 'meta.group.assertion.look-behind.regex'
30+
'lookbehind_assertion > lookbehind_identifier': 'entity.name.type.look-behind.regex'
31+
'negative_lookbehind_assertion': 'meta.group.assertion.negative-look-behind.regex'
32+
'negative_lookbehind_assertion > negative_lookbehind_identifier': 'entity.name.type.negative-look-behind.regex'
3333

3434
##### groups and backreferences #####
3535

36-
'numeric_backreference': 'keyword.other.back-reference.numeric.regexp'
37-
'numeric_backreference > group_name': 'entity.name.tag.regexp'
38-
'named_backreference': 'keyword.other.back-reference.named.regexp'
39-
'named_backreference > group_name': 'entity.name.tag.regexp'
36+
'numeric_backreference': 'keyword.other.back-reference.numeric.regex'
37+
'numeric_backreference > group_name': 'entity.name.tag.regex'
38+
'named_backreference': 'keyword.other.back-reference.named.regex'
39+
'named_backreference > group_name': 'entity.name.tag.regex'
4040

41-
'named_capturing_group': 'meta.group.capturing.named.regexp'
42-
'named_capturing_group > named_capturing_group_identifier': 'entity.name.type.named.regexp'
43-
'named_capturing_group > named_capturing_group_identifier > group_name': 'entity.name.tag.regexp'
44-
'non_capturing_group': 'meta.group.non-capturing.regexp'
45-
'non_capturing_group > non_capturing_group_identifier': 'entity.name.type.non-capturing.regexp'
46-
'anonymous_capturing_group': 'meta.group.capturing.anonymous.regexp'
41+
'named_capturing_group': 'meta.group.capturing.named.regex'
42+
'named_capturing_group > named_capturing_group_identifier': 'entity.name.type.named.regex'
43+
'named_capturing_group > named_capturing_group_identifier > group_name': 'entity.name.tag.regex'
44+
'non_capturing_group': 'meta.group.non-capturing.regex'
45+
'non_capturing_group > non_capturing_group_identifier': 'entity.name.type.non-capturing.regex'
46+
'anonymous_capturing_group': 'meta.group.capturing.anonymous.regex'
4747

4848
#'group_name': 'variable.other.object.property'
4949

5050
#'"(", "(?", "(?:", "(?<"': 'punctuation.definition.parameters.begin.bracket.round'
51-
'group_begin': 'punctuation.definition.group.begin.bracket.round.regexp'
51+
'group_begin': 'punctuation.definition.group.begin.bracket.round.regex'
5252
#'">", ")"': 'punctuation.definition.parameters.end.bracket.round'
53-
'group_end': 'punctuation.definition.group.end.bracket.round.regexp'
53+
'group_end': 'punctuation.definition.group.end.bracket.round.regex'
5454

5555
##### character sets #####
5656

57-
'character_class': 'constant.other.character-class.set.regexp'
58-
'character_class > set_begin': 'punctuation.definition.character-class.set.begin.regexp'
59-
'character_class > set_end': 'punctuation.definition.character-class.set.end.regexp'
60-
'character_class > set_negation': 'keyword.operator.negation.regexp'
61-
'character_class > character_range': 'constant.other.character-class.range.regexp'
62-
'character_class > character_range > range_delimiter': 'punctuation.definition.character-class.range.hyphen.regexp'
57+
'character_class': 'constant.other.character-class.set.regex'
58+
'character_class > set_begin': 'punctuation.definition.character-class.set.begin.regex'
59+
'character_class > set_end': 'punctuation.definition.character-class.set.end.regex'
60+
'character_class > set_negation': 'keyword.operator.negation.regex'
61+
'character_class > character_range': 'constant.other.character-class.range.regex'
62+
'character_class > character_range > range_delimiter': 'punctuation.definition.character-class.range.hyphen.regex'
6363

6464
##### character classes #####
6565

66-
'character_class_escape': 'constant.other.character-class.escape.regexp'
67-
'character_class_escape > unicode_property_name': 'constant.other.character-class.unicode-property.name.regexp'
68-
'character_class_escape > unicode_property_operator': 'keyword.operator.character-class.unicode-property.regexp'
69-
'character_class_escape > unicode_property_value': 'constant.other.character-class.unicode-property.value.regexp'
70-
'any_character': 'constant.other.character-class.any.regexp'
66+
'character_class_escape': 'constant.other.character-class.escape.regex'
67+
'character_class_escape > unicode_property_name': 'constant.other.character-class.unicode-property.name.regex'
68+
'character_class_escape > unicode_property_operator': 'keyword.operator.character-class.unicode-property.regex'
69+
'character_class_escape > unicode_property_value': 'constant.other.character-class.unicode-property.value.regex'
70+
'any_character': 'constant.other.character-class.any.regex'
7171

7272
##### character escapes #####
7373

74-
'null_character': 'constant.character.numeric.null.regexp'
75-
'identity_escape': 'constant.character.escape.backslash.regexp'
76-
'identity_escape > escape_operator': 'keyword.operator.escape-character.regexp'
77-
'unicode_escape': 'constant.character.numeric.unicode.regexp'
78-
'unicode_escape > unicode_code': 'constant.character.numeric.unicode.character-code.regexp'
79-
'unicode_codepoint_escape': 'constant.character.numeric.unicode.regexp'
80-
'unicode_codepoint_escape > unicode_code': 'constant.character.numeric.unicode.character-code.regexp'
81-
'octal_escape': 'constant.character.numeric.octal.regexp'
82-
'octal_escape > octal_code': 'constant.character.numeric.octal.character-code.regexp'
83-
'hexadecimal_escape': 'constant.character.numeric.hexadecimal.regexp'
84-
'hexadecimal_escape > hexadecimal_code': 'constant.character.numeric.hexadecimal.character-code.regexp'
85-
'control_letter_escape': 'constant.character.control.regexp'
86-
'control_letter_escape > control_letter_code': 'constant.character.control.character-code.regexp'
87-
'special_escape': 'constant.character.escape.special.regexp'
88-
89-
'invalid_unicode_escape': 'constant.character.escape.backslash.invalid.regexp'
90-
'invalid_unicode_escape > escape_operator': 'keyword.operator.escape-character.regexp'
91-
'invalid_hexadecimal_escape': 'constant.character.escape.backslash.invalid.regexp'
92-
'invalid_hexadecimal_escape > escape_operator': 'keyword.operator.escape-character.regexp'
93-
'invalid_control_letter_escape': 'constant.other.invalid.regexp'
74+
'null_character': 'constant.character.numeric.null.regex'
75+
'identity_escape': 'constant.character.escape.backslash.regex'
76+
'identity_escape > escape_operator': 'keyword.operator.escape-character.regex'
77+
'unicode_escape': 'constant.character.numeric.unicode.regex'
78+
'unicode_escape > unicode_code': 'constant.character.numeric.unicode.character-code.regex'
79+
'unicode_codepoint_escape': 'constant.character.numeric.unicode.regex'
80+
'unicode_codepoint_escape > unicode_code': 'constant.character.numeric.unicode.character-code.regex'
81+
'octal_escape': 'constant.character.numeric.octal.regex'
82+
'octal_escape > octal_code': 'constant.character.numeric.octal.character-code.regex'
83+
'hexadecimal_escape': 'constant.character.numeric.hexadecimal.regex'
84+
'hexadecimal_escape > hexadecimal_code': 'constant.character.numeric.hexadecimal.character-code.regex'
85+
'control_letter_escape': 'constant.character.control.regex'
86+
'control_letter_escape > control_letter_code': 'constant.character.control.character-code.regex'
87+
'special_escape': 'constant.character.escape.special.regex'
88+
89+
'invalid_unicode_escape': 'constant.character.escape.backslash.invalid.regex'
90+
'invalid_unicode_escape > escape_operator': 'keyword.operator.escape-character.regex'
91+
'invalid_hexadecimal_escape': 'constant.character.escape.backslash.invalid.regex'
92+
'invalid_hexadecimal_escape > escape_operator': 'keyword.operator.escape-character.regex'
93+
'invalid_control_letter_escape': 'constant.other.invalid.regex'
9494

9595
##### boundary assertions #####
9696

97-
#'start_assertion, end_assertion, boundary_assertion, non_boundary_assertion': 'constant.character.character-class.regexp'
98-
'start_assertion, end_assertion, boundary_assertion, non_boundary_assertion': 'keyword.control.anchor.regexp'
97+
#'start_assertion, end_assertion, boundary_assertion, non_boundary_assertion': 'constant.character.character-class.regex'
98+
'start_assertion, end_assertion, boundary_assertion, non_boundary_assertion': 'keyword.control.anchor.regex'

0 commit comments

Comments
 (0)