|
| 1 | +# [PackageDev] target_format: plist, ext: tmLanguage |
| 2 | +comment: Matches Python's regular expression syntax. |
| 3 | +name: Regular Expressions (PythonImproved) |
| 4 | +scopeName: source.regex.python |
| 5 | +fileTypes: [re] |
| 6 | +uuid: DD867ABF-1EC6-415D-B047-687F550A1D51 |
| 7 | + |
| 8 | +patterns: |
| 9 | +- name: keyword.control.anchor.regex |
| 10 | + match: \\[bBAZzG]|\^|\$ |
| 11 | + |
| 12 | +- name: keyword.other.back-reference.regex |
| 13 | + match: \\[1-9][0-9]? |
| 14 | + |
| 15 | +- name: keyword.operator.quantifier.regex |
| 16 | + match: '[?+*][?+]?|\{(\d+,\d+|\d+,|,\d+|\d+)\}\??' |
| 17 | + |
| 18 | +- name: keyword.operator.or.regex |
| 19 | + match: \| |
| 20 | + |
| 21 | +- name: comment.block.regex |
| 22 | + begin: \(\?\# |
| 23 | + end: \) |
| 24 | + |
| 25 | +- comment: We are restrictive in what we allow to go after the comment character to |
| 26 | + avoid false positives, since the availability of comments depend on regex flags. |
| 27 | + name: comment.line.number-sign.regex |
| 28 | + match: (?<=^|\s)#\s[[a-zA-Z0-9,. \t?!-:][^\x{00}-\x{7F}]]*$ |
| 29 | + |
| 30 | +- name: keyword.other.option-toggle.regex |
| 31 | + match: \(\?[iLmsux]+\) |
| 32 | + |
| 33 | +- name: keyword.other.back-reference.named.regex |
| 34 | + match: (\()(\?P=([a-zA-Z_][a-zA-Z_0-9]*\w*))(\)) |
| 35 | + |
| 36 | +- name: meta.group.assertion.regex |
| 37 | + begin: (\()((\?=)|(\?!)|(\?<=)|(\?<!)) |
| 38 | + beginCaptures: |
| 39 | + '1': {name: punctuation.definition.group.regex} |
| 40 | + '2': {name: punctuation.definition.group.assertion.regex} |
| 41 | + '3': {name: meta.assertion.look-ahead.regex} |
| 42 | + '4': {name: meta.assertion.negative-look-ahead.regex} |
| 43 | + '5': {name: meta.assertion.look-behind.regex} |
| 44 | + '6': {name: meta.assertion.negative-look-behind.regex} |
| 45 | + end: (\)) |
| 46 | + endCaptures: |
| 47 | + '1': {name: punctuation.definition.group.regex} |
| 48 | + patterns: |
| 49 | + - include: $self |
| 50 | + |
| 51 | +- comment: we can make this more sophisticated to match the | character that separates |
| 52 | + yes-pattern from no-pattern, but it's not really necessary. |
| 53 | + name: meta.group.assertion.conditional.regex |
| 54 | + begin: (\()(\?\(([1-9][0-9]?|[a-zA-Z_][a-zA-Z_0-9]*)\)) |
| 55 | + beginCaptures: |
| 56 | + '1': {name: punctuation.definition.group.regex} |
| 57 | + '2': {name: punctuation.definition.group.assertion.conditional.regex} |
| 58 | + '3': {name: entity.name.section.back-reference.regex} |
| 59 | + end: (\)) |
| 60 | + patterns: |
| 61 | + - include: $self |
| 62 | + |
| 63 | +- name: meta.group.regex |
| 64 | + begin: (\()((\?P<)([a-z]\w*)(>)|(\?:))? |
| 65 | + beginCaptures: |
| 66 | + '1': {name: punctuation.definition.group.regex} |
| 67 | + '3': {name: punctuation.definition.group.capture.regex} |
| 68 | + '4': {name: entity.name.section.group.regex} |
| 69 | + '5': {name: punctuation.definition.group.capture.regex} |
| 70 | + '6': {name: punctuation.definition.group.no-capture.regex} |
| 71 | + end: (\)) |
| 72 | + endCaptures: |
| 73 | + '1': {name: punctuation.definition.group.regex} |
| 74 | + patterns: |
| 75 | + - include: $self |
| 76 | + |
| 77 | +- include: '#character-class' |
| 78 | + |
| 79 | +repository: |
| 80 | + character-class: |
| 81 | + patterns: |
| 82 | + - name: constant.character.character-class.regex |
| 83 | + match: \\[wWsSdDhH]|\. |
| 84 | + - name: constant.character.escape.backslash.regex |
| 85 | + match: \\. |
| 86 | + - name: constant.other.character-class.set.regex |
| 87 | + begin: (\[)(\^)? |
| 88 | + beginCaptures: |
| 89 | + '1': {name: punctuation.definition.character-class.regex} |
| 90 | + '2': {name: keyword.operator.negation.regex} |
| 91 | + end: (\]) |
| 92 | + endCaptures: |
| 93 | + '1': {name: punctuation.definition.character-class.regex} |
| 94 | + patterns: |
| 95 | + - include: '#character-class' |
| 96 | + - name: constant.other.character-class.range.regex |
| 97 | + match: ((\\.)|.)\-((\\.)|[^\]]) |
| 98 | + captures: |
| 99 | + '2': {name: constant.character.escape.backslash.regex} |
| 100 | + '4': {name: constant.character.escape.backslash.regex} |
| 101 | +foldingStartMarker: (/\*|\{|\() |
| 102 | +foldingStopMarker: (\*/|\}|\)) |
0 commit comments