Skip to content

Commit d302d1e

Browse files
azizkprincemaple
authored andcommitted
Elixir: allow multi-letter uppercase character sigils.
1 parent d176961 commit d302d1e

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

syntaxes/Elixir.sublime-syntax

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -978,12 +978,11 @@ contexts:
978978
- include: simple_string
979979
- include: binary_string
980980

981-
- match: (?x) (~[a-zA-Z])\n | ~[a-zA-Z]([^{\[<(/|"'])
981+
- match: (?x) ~ ([a-zA-Z]++ [^{\[<(/|"'] | [a-z]{2,})
982982
comment: catch invalid sigils first
983983
scope: meta.string.elixir storage.type.string.elixir
984984
captures:
985-
1: invalid.illegal.sigil-string.elixir
986-
2: invalid.illegal.string-delimiter.elixir
985+
1: invalid.illegal.sigil.elixir
987986

988987
# Look for 'a' behind the closing delimiter.
989988
# Bracket delimiters are not matched yet: <>, {}, [] and ()
@@ -1132,7 +1131,7 @@ contexts:
11321131
- match: (?=""")
11331132
pop: 1
11341133

1135-
- match: ~Y(?=""")
1134+
- match: ~Y(?:AML)?(?=""")
11361135
comment: YAML raw
11371136
scope: meta.string.elixir storage.type.string.elixir
11381137
push:
@@ -1182,7 +1181,7 @@ contexts:
11821181
- match: (?=")
11831182
pop: 1
11841183

1185-
- match: ~J(?=")
1184+
- match: ~J(?:SON)?(?=")
11861185
comment: JSON raw
11871186
scope: meta.string.elixir storage.type.string.elixir
11881187
push:
@@ -1477,7 +1476,7 @@ contexts:
14771476
- include: string_closing_round
14781477
- include: escaped_or_interpolated
14791478

1480-
- match: ~[A-Z]
1479+
- match: ~[A-Z]+
14811480
comment: with sigil and without interpolation
14821481
scope: meta.string.elixir storage.type.string.elixir
14831482
push:

tests/syntax_test_strings.ex

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,3 +691,16 @@ key: "#{value}\"""
691691
# ^^ constant.character.escape.char
692692
~S|\\\||
693693
# ^^ constant.character.escape.char
694+
695+
~sql""
696+
# ^ punctuation.definition.string.end
697+
# ^ punctuation.definition.string.begin
698+
# ^^ string.quoted.double
699+
# ^^^ meta.string.elixir storage.type.string.elixir invalid.illegal.sigil.elixir
700+
701+
~SQL'SELECT * FROM table'
702+
# ^ string.quoted.other.literal.upper punctuation.definition.string.end
703+
# ^ punctuation.definition.string.begin
704+
# ^^^^^^^^^^^^^^^^^^^^^ string.quoted.other.literal.upper
705+
#^^^^ storage.type.string
706+
#^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string

0 commit comments

Comments
 (0)