-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support currently implemented sigils
At time of writing we have the default sigil (no prefix), 's', 'b', 'S' and 'B'. The way that the sigil is parsed depends on the sigil's prefix, so we can't generically parse all future sigils. For example the 'r' sigil for regular expressions is proposed to read the contents verbatim even though it's lowercase, breaking with the pattern defined in Elixir and carried forward with 's' and 'b'. So for now we follow upstream and only parse what they have implemented.
- Loading branch information
1 parent
9f08ab2
commit 1574248
Showing
4 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
================================================================================ | ||
Default sigil | ||
================================================================================ | ||
|
||
~"Hello UTF8!" | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
(source | ||
(sigil | ||
(quoted_content))) | ||
|
||
================================================================================ | ||
Empty default sigil | ||
================================================================================ | ||
|
||
~"" | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
(source | ||
(sigil)) | ||
|
||
================================================================================ | ||
Lowercase sigil allows escapes | ||
================================================================================ | ||
|
||
~b"Escapes\n" | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
(source | ||
(sigil | ||
(sigil_prefix) | ||
(quoted_content) | ||
(escape_sequence))) | ||
|
||
================================================================================ | ||
Uppercase sigil reads verbatim | ||
================================================================================ | ||
|
||
~B"Escapes\n" | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
(source | ||
(sigil | ||
(sigil_prefix) | ||
(quoted_content))) | ||
|
||
================================================================================ | ||
Triple quoted sigil | ||
================================================================================ | ||
|
||
~B""" | ||
This is a triple quoted string binary. | ||
All contents are verbatim, even this: ~r"abc\d+"i. | ||
""" | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
(source | ||
(sigil | ||
(sigil_prefix) | ||
(quoted_contents))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters