@@ -5,11 +5,12 @@ name: Elixir
55file_extensions :
66 - ex
77 - exs
8- first_line_match : ^#!/.*\belixir
8+ first_line_match : ^#!/.*\b(?:elixirc?|iex)
99scope : source.elixir
1010
1111variables :
12- module_name : ' \b[A-Z]\w*\b'
12+ module_name : ' \b[A-Z][a-zA-Z0-9_]*\b'
13+ id_begin : ' [[:alpha:]_]'
1314
1415contexts :
1516 main :
@@ -59,7 +60,7 @@ contexts:
5960 - match : ' ,|\)|$'
6061 pop : true
6162 - include : main
62- - match : \b(is_atom|is_binary|is_bitstring|is_boolean|is_float|is_function|is_integer|is_list|is_map|is_nil|is_number|is_pid|is_port|is_record|is_reference|is_tuple|is_exception |abs|bit_size|byte_size|div|elem|hd|length|map_size|node|rem|round|tl|trunc|tuple_size)\b
63+ - match : \b(is_(?:atom|binary|bitstring|boolean|float|function|integer|list|map|nil|number|pid|port|record|reference|tuple|exception) |abs|bit_size|byte_size|div|elem|hd|length|map_size|node|rem|round|tl|trunc|tuple_size)\b
6364 scope : keyword.guard.elixir
6465
6566 numeric :
@@ -335,13 +336,13 @@ contexts:
335336 pop : true
336337 - match : ' {{module_name}}'
337338 scope : entity.name.protocol.elixir
338- - match : ' ^\s*(def|defmacro)\s+([a-zA-Z_] \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+([a-zA-Z_] \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
@@ -440,7 +441,7 @@ contexts:
440441 - match : (?<!\.)\b(and|not|or|when|xor|in)\b
441442 comment : as above, just doesn't need a 'end' and does a logic operation
442443 scope : keyword.operator.elixir
443- - match : ' {{module_name}}'
444+ - match : ' {{module_name}}(?!:) '
444445 scope : entity.name.class.elixir
445446 - match : ' \b(nil|true|false)\b(?![?!])'
446447 scope : constant.language.elixir
@@ -480,12 +481,12 @@ contexts:
480481 pop : true
481482 - include : interpolated_elixir
482483 - include : escaped_char
483- - match : ' (?<!:)(:)(?>[a-zA-Z_] [\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 : ' (?>[a-zA-Z_] [\w@]*(?>[?!])?)(:)(?!:)'
489+ - match : ' (?>{{id_begin}} [\w@]*(?>[?!])?)(:)(?!:)'
489490 comment : symbols
490491 scope : constant.other.keywords.elixir
491492 captures :
0 commit comments