[Pkg-javascript-commits] [node-acorn-jsx] 152/484: Remove invalid of tokLineStart
Bastien Roucariès
rouca at moszumanska.debian.org
Sat Aug 19 14:20:18 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-acorn-jsx.
commit b7972ad95ccc62da8e98730adb3ae5898f138b63
Author: Marijn Haverbeke <marijnh at gmail.com>
Date: Thu Oct 10 09:58:23 2013 +0200
Remove invalid of tokLineStart
This is only tracked when locations are on, so it can't be used
unconditionally.
Closes #71
---
acorn.js | 3 ++-
index.html | 7 ++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/acorn.js b/acorn.js
index f479be8..e115f88 100644
--- a/acorn.js
+++ b/acorn.js
@@ -598,7 +598,8 @@
function readToken_plus_min(code) { // '+-'
var next = input.charCodeAt(tokPos + 1);
if (next === code) {
- if (next == 45 && input.charCodeAt(tokPos + 2) == 62 && lastEnd < tokLineStart) {
+ if (next == 45 && input.charCodeAt(tokPos + 2) == 62 &&
+ newline.test(input.slice(lastEnd, tokPos))) {
// A `-->` line comment
tokPos += 3;
skipLineComment();
diff --git a/index.html b/index.html
index 67f043a..b7569c8 100644
--- a/index.html
+++ b/index.html
@@ -247,7 +247,7 @@ switch first dispatches on the lengths, to save on comparisons.</p>
<span class="p">}</span></pre></div> </td> </tr> <tr id="section-40"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-40">¶</a> </div> <p>The ECMAScript 3 reserved word list.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">isReservedWord3</span [...]
whitespace, identifier, and identifier-start categories. These
are only applied when a character is found to actually have a
-code point above 128.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">nonASCIIwhitespace</span> <span class="o">=</span> <span class="sr">/[\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]/</span><span class="p">;</span>
+code point above 128.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">nonASCIIwhitespace</span> <span class="o">=</span> <span class="sr">/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/</span><span class="p">;</span>
<span class="kd">var</span> <span class="nx">nonASCIIidentifierStartChars</span> <span class="o">=</span> <span class="s2">"\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u0 [...]
<span class="kd">var</span> <span class="nx">nonASCIIidentifierChars</span> <span class="o">=</span> <span class="s2">"\u0300-\u036f\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u0620-\u0649\u0672-\u06d3\u06e7-\u06e8\u06fb-\u06fc\u0730-\u074a\u0800-\u0814\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0840-\u0857\u08e4-\u08fe\u0900-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962-\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09d7\u09df- [...]
<span class="kd">var</span> <span class="nx">nonASCIIidentifierStart</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">RegExp</span><span class="p">(</span><span class="s2">"["</span> <span class="o">+</span> <span class="nx">nonASCIIidentifierStartChars</span> <span class="o">+</span> <span class="s2">"]"</span><span class="p">);</span>
@@ -331,7 +331,7 @@ whitespace and comments, and.</p> </td> <td class="code"
<span class="o">++</span><span class="nx">tokCurLine</span><span class="p">;</span>
<span class="nx">tokLineStart</span> <span class="o">=</span> <span class="nx">tokPos</span><span class="p">;</span>
<span class="p">}</span>
- <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">ch</span> <span class="o">===</span> <span class="mi">10</span><span class="p">)</span> <span class="p">{</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">ch</span> <span class="o">===</span> <span class="mi">10</span> <span class="o">||</span> <span class="nx">ch</span> <span class="o">===</span> <span class="mi">8232</span> <span class="o">||</span> <span class="nx">ch</span> <span class="o">===</span> <span class="mi">8233</span><span class="p">)</span> <span class="p">{</span>
<span class="o">++</span><span class="nx">tokPos</span><span class="p">;</span>
<span class="o">++</span><span class="nx">tokCurLine</span><span class="p">;</span>
<span class="nx">tokLineStart</span> <span class="o">=</span> <span class="nx">tokPos</span><span class="p">;</span>
@@ -396,7 +396,8 @@ into it.</p>
<span class="kd">function</span> <span class="nx">readToken_plus_min</span><span class="p">(</span><span class="nx">code</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// '+-'</span>
<span class="kd">var</span> <span class="nx">next</span> <span class="o">=</span> <span class="nx">input</span><span class="p">.</span><span class="nx">charCodeAt</span><span class="p">(</span><span class="nx">tokPos</span> <span class="o">+</span> <span class="mi">1</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">next</span> <span class="o">===</span> <span class="nx">code</span><span class="p">)</span> <span class="p">{</span>
- <span class="k">if</span> <span class="p">(</span><span class="nx">next</span> <span class="o">==</span> <span class="mi">45</span> <span class="o">&&</span> <span class="nx">input</span><span class="p">.</span><span class="nx">charCodeAt</span><span class="p">(</span><span class="nx">tokPos</span> <span class="o">+</span> <span class="mi">2</span><span class="p">)</span> <span class="o">==</span> <span class="mi">62</span> <span class="o">&&</span> <span class="nx" [...]
+ <span class="k">if</span> <span class="p">(</span><span class="nx">next</span> <span class="o">==</span> <span class="mi">45</span> <span class="o">&&</span> <span class="nx">input</span><span class="p">.</span><span class="nx">charCodeAt</span><span class="p">(</span><span class="nx">tokPos</span> <span class="o">+</span> <span class="mi">2</span><span class="p">)</span> <span class="o">==</span> <span class="mi">62</span> <span class="o">&&</span>
+ <span class="nx">newline</span><span class="p">.</span><span class="nx">test</span><span class="p">(</span><span class="nx">input</span><span class="p">.</span><span class="nx">slice</span><span class="p">(</span><span class="nx">lastEnd</span><span class="p">,</span> <span class="nx">tokPos</span><span class="p">)))</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-58"> <td class="docs"> [...]
<span class="nx">skipLineComment</span><span class="p">();</span>
<span class="nx">skipSpace</span><span class="p">();</span>
<span class="k">return</span> <span class="nx">readToken</span><span class="p">();</span>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git
More information about the Pkg-javascript-commits
mailing list