Skip to content

Commit b289118

Browse files
author
MattDMo
committed
Add Unicode support, first stab at solving #34
1 parent e4dde33 commit b289118

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Regular Expressions (PythonImproved).YAML-tmLanguage

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ fileTypes: [re]
66
uuid: DD867ABF-1EC6-415D-B047-687F550A1D51
77

88
patterns:
9+
- match: \(.*$
10+
911
- name: keyword.control.anchor.regexp
1012
match: \\[bBAZzG]|\^|\$
1113

@@ -25,13 +27,13 @@ patterns:
2527
- comment: We are restrictive in what we allow to go after the comment character to
2628
avoid false positives, since the availability of comments depend on regexp flags.
2729
name: comment.line.number-sign.regexp
28-
match: (?<=^|\s)#\s[[a-zA-Z0-9,. \t?!-:][^\x{00}-\x{7F}]]*$
30+
match: (?<=^|\s)#\s[[\p{Alnum},. \t?!-:][^\x{00}-\x{7F}]]*$
2931

3032
- name: keyword.other.option-toggle.regexp
3133
match: \(\?[iLmsux]+\)
3234

3335
- name: keyword.other.back-reference.named.regexp
34-
match: (\()(\?P=([a-zA-Z_][a-zA-Z_0-9]*\w*))(\))
36+
match: (\()(\?P=([\p{Alpha}_][\p{Alnum}_]*\w*))(\))
3537

3638
- name: meta.group.assertion.regexp
3739
begin: (\()((\?=)|(\?!)|(\?<=)|(\?<!))
@@ -51,7 +53,7 @@ patterns:
5153
- comment: we can make this more sophisticated to match the | character that separates
5254
yes-pattern from no-pattern, but it's not really necessary.
5355
name: meta.group.assertion.conditional.regexp
54-
begin: (\()(\?\(([1-9][0-9]?|[a-zA-Z_][a-zA-Z_0-9]*)\))
56+
begin: (\()(\?\(([1-9][0-9]?|[\p{Alpha}_][\p{Alnum}_]*)\))
5557
beginCaptures:
5658
'1': {name: punctuation.definition.group.regexp}
5759
'2': {name: punctuation.definition.group.assertion.conditional.regexp}
@@ -61,7 +63,7 @@ patterns:
6163
- include: $self
6264

6365
- name: meta.group.regexp
64-
begin: (\()((\?P<)([A-Za-z]\w*)(>)|(\?:))?
66+
begin: (\()((\?P<)([\p{Alpha}]\w*)(>)|(\?:))?
6567
beginCaptures:
6668
'1': {name: punctuation.definition.group.regexp}
6769
'3': {name: punctuation.definition.group.capture.regexp}

0 commit comments

Comments
 (0)