-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
enh(php) detect newer more flexible HEREdoc syntax #2658
Merged
joshgoebel
merged 12 commits into
highlightjs:master
from
eytienne:php_flexible_heredoc_syntax_rfc
Aug 31, 2020
Merged
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
fe8cdc0
share subst with double quoted string
eytienne a410d43
separate tests along purpose + support of indented heredoc + heredoc …
eytienne c7417a0
Merge branch 'master' into php_flexible_heredoc_syntax_rfc
eytienne 500a638
fix unclear beginning
eytienne b4c62bc
Merge branch 'php_flexible_heredoc_syntax_rfc' of github.com:eytienne…
eytienne d07c1af
fix binary string was broken + concat to main for subst
eytienne e3eb55a
Merge branch 'master' into php_flexible_heredoc_syntax_rfc
eytienne 043dab9
Update CHANGES.md
eytienne d400139
Update CHANGES.md
eytienne 355e1cf
Merge branch 'master' into php_flexible_heredoc_syntax_rfc
eytienne 6ae53c7
removes redundancy
eytienne 99449d8
Merge branch 'php_flexible_heredoc_syntax_rfc' of github.com:eytienne…
eytienne File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,23 @@ | ||
<span class="hljs-meta"><?php</span> | ||
|
||
<span class="hljs-comment">// variable substitution</span> | ||
|
||
<span class="hljs-keyword">echo</span> (<span class="hljs-string">'Hello {$person->name}! Welcome to $company!'</span>); | ||
|
||
<span class="hljs-keyword">echo</span> (<span class="hljs-string">"Hello <span class="hljs-subst">{$person->name}</span>! Welcome to <span class="hljs-subst">$company</span>!"</span>); | ||
|
||
<span class="hljs-keyword">echo</span> (<span class="hljs-string"><<<MSG | ||
Hello <span class="hljs-subst">{$person->name}</span>! Welcome to <span class="hljs-subst">$company</span>! | ||
MSG</span>); | ||
|
||
<span class="hljs-comment">// heredoc syntax</span> | ||
|
||
var_dump(<span class="hljs-string"><<<SQL | ||
SELECT * | ||
FROM table | ||
SQL</span>); | ||
|
||
var_dump(<span class="hljs-string"><<<SQL | ||
SELECT * | ||
FROM table | ||
SQL</span>); |
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,23 @@ | ||
<?php | ||
|
||
// variable substitution | ||
|
||
echo ('Hello {$person->name}! Welcome to $company!'); | ||
|
||
echo ("Hello {$person->name}! Welcome to $company!"); | ||
|
||
echo (<<<MSG | ||
Hello {$person->name}! Welcome to $company! | ||
MSG); | ||
|
||
// heredoc syntax | ||
|
||
var_dump(<<<SQL | ||
SELECT * | ||
FROM table | ||
SQL); | ||
|
||
var_dump(<<<SQL | ||
SELECT * | ||
FROM table | ||
SQL); |
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.
Did we not discuss simplifying all this?
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.
yes i moved the "<<<" into the end_same_as_begin, it seems good now, the regex is clear with the named group marker, ready yo be merged ?
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.
My point is why do we need lines 40/41/42 at all? ALL we really need here is just the END_SAME_AS_BEGIN rule without any other rules, no?
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.
right, I missed that copying from ruby.js, fixed!