Skip to content

Commit 9c45f8b

Browse files
azizkprincemaple
authored andcommitted
Elixir: quick fix for if a == nil, where the , was seen as invalid.
* Optimized matching optional parenthesized name after `iex` or `...`.
1 parent bf83441 commit 9c45f8b

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

Elixir.sublime-syntax

+14-9
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,13 @@ contexts:
6464
prototype:
6565
# NB: rules in the prototype context will always match before any other.
6666
- include: merge_conflict # Merge conflict markers can occur anywhere.
67-
- match: ^(\s*)(\.{3}).*?(>)
67+
- match: ^(\s*)(\.{3})(?:\((.*?)\))?(>)
6868
comment: iex prompt continuation
6969
captures:
7070
1: meta.string.elixir
7171
2: keyword.other.iex-dots.elixir
72-
3: keyword.other.iex-angle.elixir punctuation.definition.iex.begin.elixir
72+
3: constant.other.elixir
73+
4: keyword.other.iex-angle.elixir punctuation.definition.iex.begin.elixir
7374

7475
core_syntax:
7576
# The rules are approximately ordered by their likeliness of occurrence
@@ -1868,10 +1869,11 @@ contexts:
18681869
escape: (?=^\s*'''|{{is_markdown_elixir}})
18691870

18701871
elixir_in_markdown:
1871-
- match: (?<=\s{4})(iex).*?(>)
1872+
- match: (?<=\s{4})(iex)(?:\((.*?)\))?(>)
18721873
captures:
18731874
1: keyword.other.iex.elixir
1874-
2: keyword.other.iex-angle.elixir punctuation.definition.iex.begin.elixir
1875+
2: constant.other.elixir
1876+
3: keyword.other.iex-angle.elixir punctuation.definition.iex.begin.elixir
18751877
push:
18761878
- clear_scopes: true
18771879
- meta_scope: meta.interpolation.elixir markup.raw.block.markdown markup.raw.block.elixir
@@ -2411,15 +2413,18 @@ contexts:
24112413
- include: char_literal
24122414
- include: if_ws_closing_token_or_eol_pop
24132415
- include: atom_keyword
2414-
- match: |
2415-
(?x)
2416-
(?=[-+*/=!|;] | && | \\\\ | ~(?![a-zA-Z]) | <(?!<(?!<)) | >(?!>(?!>)) | \.\.(?!\.) | ::(?!:))
2417-
| (?=(?>when|and|in|or|not){{no_id_key_suffix}})
2416+
- match: (?=(?>when|and|in|or|not){{no_id_key_suffix}})
24182417
push:
24192418
- include: if_closing_token_pop
2420-
- include: operator
2419+
- match: (?!(?>when|and|in|or|not){{no_id_key_suffix}}|[,\s]|(?<!,))
2420+
pop: true
24212421
- include: elixir_keywords
24222422
- include: invalid_comma_or_non_space_pop
2423+
- match: (?x) (?=[-+*/=!|;] | && | \\\\ | ~(?![a-zA-Z]) | <(?!<(?!<)) | >(?!>(?!>)) | \.\.(?!\.) | ::(?!:))
2424+
push:
2425+
- include: if_closing_token_pop
2426+
- include: operator
2427+
- include: invalid_comma_or_non_space_pop
24232428
- match: (?<=[^:]:)\s
24242429
push: invalid_comma_or_non_space_pop
24252430
- include: do_block_pop

0 commit comments

Comments
 (0)