-
Notifications
You must be signed in to change notification settings - Fork 22
Avoid ambiguity in regexp-based extraction #211
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
Draft
nicolo-ribaudo
wants to merge
1
commit into
tc39:main
Choose a base branch
from
nicolo-ribaudo:regexp-based-changes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1350,7 +1350,7 @@ | |
| <emu-alg> | ||
| 1. Let _tokens_ be the List of tokens obtained by parsing _source_ according to <emu-xref href="#sec-ecmascript-language-lexical-grammar">ECMA-262's lexical grammar</emu-xref>. | ||
| 1. For each nonterminal _token_ in _tokens_, in reverse order, do | ||
| 1. If _token_ is not |SingleLineComment| or |MultiLineComment|, return *null*. | ||
| 1. If _token_ is not |SingleLineComment|, return *null*. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also check for disallowed chars here so that both implementation match up |
||
| 1. Let _comment_ be the content of _token_. | ||
| 1. Let _sourceMapURL_ be MatchSourceMapURL(_comment_). | ||
| 1. If _sourceMapURL_ is a String, return _sourceMapURL_. | ||
|
|
@@ -1362,9 +1362,9 @@ | |
|
|
||
| <emu-alg> | ||
| 1. Let _lines_ be StringSplit(_source_, « *"\u000D\u000A"*, *"\u000A"*, *"\u000D"*, *"\u2028"*, *"\u2029"* »). | ||
| 1. NOTE: The regular expression above matches the |LineTerminatorSequence| production. | ||
| 1. NOTE: The list of strings above matches the |LineTerminatorSequence| production. | ||
| 1. Let _lastURL_ be *null*. | ||
| 1. For each String _lineStr_ in _lines_, do | ||
| 1. For each String _lineStr_ in _lines_, in reverse List order, do | ||
| 1. Let _line_ be StringToCodePoints(_lineStr_). | ||
| 1. Let _position_ be 0. | ||
| 1. Let _lineLength_ be the length of _line_. | ||
|
|
@@ -1376,25 +1376,17 @@ | |
| 1. Set _position_ to _position_ + 1. | ||
| 1. If _second_ is U+002F (SOLIDUS), then | ||
| 1. Let _comment_ be the substring of _lineStr_ from _position_ to _lineLength_. | ||
| 1. If _comment_ contains the code point U+0022 (QUOTATION MARK), U+0027 (APOSTROPHE), U+002F (SOLIDUS), or U+0060 (GRAVE ACCENT), then | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| 1. Return *null*. | ||
| 1. Let _sourceMapURL_ be MatchSourceMapURL(_comment_). | ||
| 1. If _sourceMapURL_ is a String, set _lastURL_ to _sourceMapURL_. | ||
| 1. If _sourceMapURL_ is a String, return _sourceMapURL_. | ||
| 1. Set _position_ to _lineLength_. | ||
| 1. Else if _second_ is U+002A (ASTERISK), then | ||
| 1. Let _commentCp_ be a new empty List. | ||
| 1. Repeat, while _position_ + 1 < _lineLength_, | ||
| 1. Let _c1_ be _line_[_position_]. | ||
| 1. Set _position_ to _position_ + 1. | ||
| 1. Let _c2_ be _line_[_position_]. | ||
| 1. If _c1_ is U+002A (ASTERISK) and _c2_ is U+002F (SOLIDUS), then | ||
| 1. Set _position_ to _position_ + 1. | ||
| 1. Let _sourceMapURL_ be MatchSourceMapURL(CodePointsToString(_commentCp_)). | ||
| 1. If _sourceMapURL_ is a String, set _lastURL_ to _sourceMapURL_. | ||
| 1. Append _c1_ to _commentCp_. | ||
| 1. Else, | ||
| 1. Set _lastURL_ to *null*. | ||
| 1. Else if _first_ is not an ECMAScript |WhiteSpace|, then | ||
| 1. Set _lastURL_ to *null*. | ||
| 1. NOTE: We reset _lastURL_ to *null* whenever we find a non-comment code character. | ||
| 1. Return *null*. | ||
| 1. Else if _first_ is an ECMAScript |WhiteSpace|, then | ||
| 1. Set _position_ to _position_ + 1. | ||
| 1. Else, | ||
| 1. Return *null*. | ||
| 1. Return _lastURL_. | ||
| </emu-alg> | ||
| <emu-note> | ||
|
|
||
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.
Does it have to skip over whitespace tokens here?