-
Notifications
You must be signed in to change notification settings - Fork 3.7k
enh(elixir) improve heredoc and sigil support #2257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
253f31e
Added markup test for uppercase string sigil with heredoc
Sannis 15745c5
enh(elixir) improve heredoc and sigil support
joshgoebel 3387c84
add sigil tests
joshgoebel bad5844
remove returnBegin
joshgoebel eccc895
tighten rules
joshgoebel 45cbe68
escaping not necessary?
joshgoebel 9a0879a
Merge branch 'master' into some_elixir_fixes
joshgoebel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,23 @@ | ||
<span class="hljs-string">~R'this + i\s "a" regex too'</span> | ||
<span class="hljs-string">~w(hello <span class="hljs-subst">#{ [<span class="hljs-string">"has"</span> <> <span class="hljs-string">"123"</span>, <span class="hljs-string">'\c\d'</span>, <span class="hljs-string">"\123 interpol"</span> | []] }</span> world)</span>s | ||
<span class="hljs-string">~W(hello #{no "123" \c\d \123 interpol} world)</span>s | ||
<span class="hljs-string">~s{Escapes terminators \{ and \}, but no {balancing}</span> <span class="hljs-comment"># outside of sigil here }</span> | ||
<span class="hljs-string">~S"No escapes \s\t\n and no #{interpolation}"</span> | ||
|
||
<span class="hljs-string">~S/hello/</span> | ||
<span class="hljs-string">~S|hello|</span> | ||
<span class="hljs-string">~S"hello"</span> | ||
<span class="hljs-string">~S'hello'</span> | ||
<span class="hljs-string">~S(hello)</span> | ||
<span class="hljs-string">~S[hello]</span> | ||
<span class="hljs-string">~S{hello}</span> | ||
<span class="hljs-string">~S<hello></span> | ||
|
||
<span class="hljs-string">~s/hello <span class="hljs-subst">#{name}</span>/</span> | ||
<span class="hljs-string">~s|hello <span class="hljs-subst">#{name}</span>|</span> | ||
<span class="hljs-string">~s"hello <span class="hljs-subst">#{name}</span>"</span> | ||
<span class="hljs-string">~s'hello <span class="hljs-subst">#{name}</span>'</span> | ||
<span class="hljs-string">~s(hello <span class="hljs-subst">#{name}</span>)</span> | ||
<span class="hljs-string">~s[hello <span class="hljs-subst">#{name}</span>]</span> | ||
<span class="hljs-string">~s{hello <span class="hljs-subst">#{name}</span>}</span> | ||
<span class="hljs-string">~s<hello <span class="hljs-subst">#{name}</span>></span> |
This file contains hidden or 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,23 @@ | ||
~R'this + i\s "a" regex too' | ||
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s | ||
~W(hello #{no "123" \c\d \123 interpol} world)s | ||
~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } | ||
~S"No escapes \s\t\n and no #{interpolation}" | ||
|
||
~S/hello/ | ||
~S|hello| | ||
~S"hello" | ||
~S'hello' | ||
~S(hello) | ||
~S[hello] | ||
~S{hello} | ||
~S<hello> | ||
|
||
~s/hello #{name}/ | ||
~s|hello #{name}| | ||
~s"hello #{name}" | ||
~s'hello #{name}' | ||
~s(hello #{name}) | ||
~s[hello #{name}] | ||
~s{hello #{name}} | ||
~s<hello #{name}> |
This file contains hidden or 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,4 @@ | ||
a = <span class="hljs-string">"""test"""</span> | ||
b = <span class="hljs-string">'''test'''</span> | ||
c = <span class="hljs-string">"test"</span> | ||
d = <span class="hljs-string">'test'</span> |
This file contains hidden or 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,4 @@ | ||
a = """test""" | ||
b = '''test''' | ||
c = "test" | ||
d = 'test' |
This file contains hidden or 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,17 @@ | ||
<span class="hljs-class"><span class="hljs-keyword">defmodule</span> <span class="hljs-title">Long.Module.Name</span></span> <span class="hljs-keyword">do</span> | ||
<span class="hljs-variable">@doc</span> <span class="hljs-string">~S''' | ||
No #{interpolation} of any kind. | ||
\000 \x{ff} | ||
|
||
\n #{\x{ff}} | ||
'''</span> | ||
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">func</span></span>(a, b \\ []), <span class="hljs-symbol">do:</span> <span class="hljs-symbol">:ok</span> | ||
|
||
<span class="hljs-variable">@doc</span> <span class="hljs-string">~S""" | ||
No #{interpolation} of any kind. | ||
\000 \x{ff} | ||
|
||
\n #{\x{ff}} | ||
"""</span> | ||
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">func</span></span>(a, b \\ []), <span class="hljs-symbol">do:</span> <span class="hljs-symbol">:ok</span> | ||
<span class="hljs-keyword">end</span> |
This file contains hidden or 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,17 @@ | ||
defmodule Long.Module.Name do | ||
@doc ~S''' | ||
No #{interpolation} of any kind. | ||
\000 \x{ff} | ||
|
||
\n #{\x{ff}} | ||
''' | ||
def func(a, b \\ []), do: :ok | ||
|
||
@doc ~S""" | ||
No #{interpolation} of any kind. | ||
\000 \x{ff} | ||
|
||
\n #{\x{ff}} | ||
""" | ||
def func(a, b \\ []), do: :ok | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get... What is the point in empty
contains
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's needed to override the contains on line 64... variants "inherit", so it's needed to break that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah.