Skip to content

Commit 94e8dd9

Browse files
committed
Elixir: added id_begin variable; fixed matching function names.
1 parent 781e17f commit 94e8dd9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Elixir.sublime-syntax

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ scope: source.elixir
1010

1111
variables:
1212
module_name: '\b[A-Z][a-zA-Z0-9_]*\b'
13+
id_begin: '[[:alpha:]_]'
1314

1415
contexts:
1516
main:
@@ -335,13 +336,13 @@ contexts:
335336
pop: true
336337
- match: '{{module_name}}'
337338
scope: entity.name.protocol.elixir
338-
- match: '^\s*(def|defmacro)\s+(\w+(?:!|\?)?)(?:(\()|\s*)'
339+
- match: '^\s*(def|defmacro)\s+({{id_begin}}\w*(?:!|\?)?)(?:(\()|\s*)'
339340
captures:
340341
1: keyword.control.module.elixir
341342
2: entity.name.function.public.elixir
342343
3: punctuation.definition.parameters.elixir
343344
push: function_body
344-
- match: '^\s*(defp|defmacrop)\s+(\w+(?:!|\?)?)(?:(\()|\s*)'
345+
- match: '^\s*(defp|defmacrop)\s+({{id_begin}}\w*(?:!|\?)?)(?:(\()|\s*)'
345346
captures:
346347
1: keyword.control.module.elixir
347348
2: entity.name.function.private.elixir
@@ -480,12 +481,12 @@ contexts:
480481
pop: true
481482
- include: interpolated_elixir
482483
- include: escaped_char
483-
- match: '(?<!:)(:)(?>[_[:alpha:]][\w@]*(?>[?!]|=(?![>=]))?|\<\>|===?|!==?|<<>>|<<<|>>>|~~~|::|<\-|\|>|=>|=~|=|/|\\\\|\*\*?|\.\.?\.?|>=?|<=?|&&?&?|\+\+?|\-\-?|\|\|?\|?|\!|@|\%?\{\}|%|\[\]|\^(\^\^)?)'
484+
- match: '(?<!:)(:)(?>{{id_begin}}[\w@]*(?>[?!]|=(?![>=]))?|\<\>|===?|!==?|<<>>|<<<|>>>|~~~|::|<\-|\|>|=>|=~|=|/|\\\\|\*\*?|\.\.?\.?|>=?|<=?|&&?&?|\+\+?|\-\-?|\|\|?\|?|\!|@|\%?\{\}|%|\[\]|\^(\^\^)?)'
484485
comment: symbols
485486
scope: constant.other.symbol.elixir
486487
captures:
487488
1: punctuation.definition.constant.elixir
488-
- match: '(?>[_[:alpha:]][\w@]*(?>[?!])?)(:)(?!:)'
489+
- match: '(?>{{id_begin}}[\w@]*(?>[?!])?)(:)(?!:)'
489490
comment: symbols
490491
scope: constant.other.keywords.elixir
491492
captures:

0 commit comments

Comments
 (0)