[Pkg-javascript-commits] [node-acorn-jsx] 272/484: Remove trailing whitespace from acorn.js
Bastien Roucariès
rouca at moszumanska.debian.org
Sat Aug 19 14:20:42 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 40f1c671619bb5f5a664d455060aea8d8368b2ab
Author: Marijn Haverbeke <marijnh at gmail.com>
Date: Thu Aug 21 18:12:04 2014 +0200
Remove trailing whitespace from acorn.js
---
acorn.js | 56 +++++++++++++++++++++++++-------------------------
index.html | 69 ++++++++++++++++++++++++++++++--------------------------------
2 files changed, 61 insertions(+), 64 deletions(-)
diff --git a/acorn.js b/acorn.js
index fc7aeaf..acf76f6 100644
--- a/acorn.js
+++ b/acorn.js
@@ -763,7 +763,7 @@
case 125: ++tokPos; return finishToken(_braceR);
case 58: ++tokPos; return finishToken(_colon);
case 63: ++tokPos; return finishToken(_question);
-
+
case 96: // '`'
if (options.ecmaVersion >= 6) {
++tokPos;
@@ -944,7 +944,7 @@
function readCodePoint() {
var ch = input.charCodeAt(tokPos), code;
-
+
if (ch === 123) {
if (options.ecmaVersion < 6) unexpected();
++tokPos;
@@ -1159,7 +1159,7 @@
this.start = tokStart;
this.end = null;
}
-
+
exports.Node = Node;
function SourceLocation() {
@@ -1267,7 +1267,7 @@
switch (node.type) {
case "Identifier":
case "MemberExpression":
- break;
+ break;
case "ObjectExpression":
node.type = "ObjectPattern";
@@ -1374,7 +1374,7 @@
: "Assigning to " + expr.name + " in strict mode"
);
break;
-
+
case "MemberExpression":
if (!isBinding) break;
@@ -1474,7 +1474,7 @@
else return parseExpressionStatement(node, expr);
}
}
-
+
function parseBreakContinueStatement(node, keyword) {
var isBreak = keyword == "break";
next();
@@ -1497,13 +1497,13 @@
if (i === labels.length) raise(node.start, "Unsyntactic " + keyword);
return finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
}
-
+
function parseDebuggerStatement(node) {
next();
semicolon();
return finishNode(node, "DebuggerStatement");
}
-
+
function parseDoStatement(node) {
next();
labels.push(loopLabel);
@@ -1514,7 +1514,7 @@
semicolon();
return finishNode(node, "DoWhileStatement");
}
-
+
// Disambiguating between a `for` and a `for`/`in` or `for`/`of`
// loop is non-trivial. Basically, we have to parse the init `var`
// statement or expression, disallowing the `in` operator (see
@@ -1522,7 +1522,7 @@
// whether the next token is `in` or `of`. When there is no init
// part (semicolon immediately after the opening parenthesis), it
// is a regular `for` loop.
-
+
function parseForStatement(node) {
next();
labels.push(loopLabel);
@@ -1545,12 +1545,12 @@
}
return parseFor(node, init);
}
-
+
function parseFunctionStatement(node) {
next();
return parseFunction(node, true);
}
-
+
function parseIfStatement(node) {
next();
node.test = parseParenExpression();
@@ -1558,7 +1558,7 @@
node.alternate = eat(_else) ? parseStatement() : null;
return finishNode(node, "IfStatement");
}
-
+
function parseReturnStatement(node) {
if (!inFunction && !options.allowReturnOutsideFunction)
raise(tokStart, "'return' outside of function");
@@ -1572,7 +1572,7 @@
else { node.argument = parseExpression(); semicolon(); }
return finishNode(node, "ReturnStatement");
}
-
+
function parseSwitchStatement(node) {
next();
node.discriminant = parseParenExpression();
@@ -1607,7 +1607,7 @@
labels.pop();
return finishNode(node, "SwitchStatement");
}
-
+
function parseThrowStatement(node) {
next();
if (newline.test(input.slice(lastEnd, tokStart)))
@@ -1616,7 +1616,7 @@
semicolon();
return finishNode(node, "ThrowStatement");
}
-
+
function parseTryStatement(node) {
next();
node.block = parseBlock();
@@ -1639,14 +1639,14 @@
raise(node.start, "Missing catch or finally clause");
return finishNode(node, "TryStatement");
}
-
+
function parseVarStatement(node, kind) {
next();
parseVar(node, false, kind);
semicolon();
return finishNode(node, "VariableDeclaration");
}
-
+
function parseWhileStatement(node) {
next();
node.test = parseParenExpression();
@@ -1655,7 +1655,7 @@
labels.pop();
return finishNode(node, "WhileStatement");
}
-
+
function parseWithStatement(node) {
if (strict) raise(tokStart, "'with' in strict mode");
next();
@@ -1663,12 +1663,12 @@
node.body = parseStatement();
return finishNode(node, "WithStatement");
}
-
+
function parseEmptyStatement(node) {
next();
return finishNode(node, "EmptyStatement");
}
-
+
function parseLabeledStatement(node, maybeName, expr) {
for (var i = 0; i < labels.length; ++i)
if (labels[i].name === maybeName) raise(expr.start, "Label '" + maybeName + "' is already declared");
@@ -1679,7 +1679,7 @@
node.label = expr;
return finishNode(node, "LabeledStatement");
}
-
+
function parseExpressionStatement(node, expr) {
node.expression = expr;
semicolon();
@@ -1920,7 +1920,7 @@
var node = startNode();
next();
return finishNode(node, "ThisExpression");
-
+
case _yield:
if (inGenerator) return parseYield();
@@ -1930,7 +1930,7 @@
return parseArrowExpression(startNodeFrom(id), [id]);
}
return id;
-
+
case _num: case _string: case _regexp:
var node = startNode();
node.value = tokVal;
@@ -2179,7 +2179,7 @@
initFunction(node);
var defaults = node.defaults, hasDefaults = false;
-
+
for (var i = 0, lastI = params.length - 1; i <= lastI; i++) {
var param = params[i];
@@ -2209,7 +2209,7 @@
function parseFunctionParams(node) {
var defaults = [], hasDefaults = false;
-
+
expect(_parenL);
for (;;) {
if (eat(_parenR)) {
@@ -2240,7 +2240,7 @@
function parseFunctionBody(node, allowExpression) {
var isExpression = allowExpression && tokType !== _braceL;
-
+
if (isExpression) {
node.body = parseExpression(true);
node.expression = true;
@@ -2270,7 +2270,7 @@
// Parse a class declaration or literal (depending on the
// `isStatement` parameter).
-
+
function parseClass(node, isStatement) {
next();
node.id = tokType === _name ? parseIdent() : isStatement ? unexpected() : null;
diff --git a/index.html b/index.html
index 08470b0..bfdc2e1 100644
--- a/index.html
+++ b/index.html
@@ -526,7 +526,7 @@ by a digit or another two dots.</p> </td> <td class="cod
<span class="k">case</span> <span class="mi">125</span><span class="o">:</span> <span class="o">++</span><span class="nx">tokPos</span><span class="p">;</span> <span class="k">return</span> <span class="nx">finishToken</span><span class="p">(</span><span class="nx">_braceR</span><span class="p">);</span>
<span class="k">case</span> <span class="mi">58</span><span class="o">:</span> <span class="o">++</span><span class="nx">tokPos</span><span class="p">;</span> <span class="k">return</span> <span class="nx">finishToken</span><span class="p">(</span><span class="nx">_colon</span><span class="p">);</span>
<span class="k">case</span> <span class="mi">63</span><span class="o">:</span> <span class="o">++</span><span class="nx">tokPos</span><span class="p">;</span> <span class="k">return</span> <span class="nx">finishToken</span><span class="p">(</span><span class="nx">_question</span><span class="p">);</span>
-
+
<span class="k">case</span> <span class="mi">96</span><span class="o">:</span> <span class="c1">// '`'</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">options</span><span class="p">.</span><span class="nx">ecmaVersion</span> <span class="o">>=</span> <span class="mi">6</span><span class="p">)</span> <span class="p">{</span>
<span class="o">++</span><span class="nx">tokPos</span><span class="p">;</span>
@@ -675,7 +675,7 @@ will return <code>null</code> unless the integer has exactly <code>len</code> di
<span class="k">return</span> <span class="nx">finishToken</span><span class="p">(</span><span class="nx">_num</span><span class="p">,</span> <span class="nx">val</span><span class="p">);</span>
<span class="p">}</span></pre></div> </td> </tr> <tr id="section-80"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-80">¶</a> </div> <p>Read a string value, interpreting backslash-escapes.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">function</span> <span class="nx"> [...]
<span class="kd">var</span> <span class="nx">ch</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="p">),</span> <span class="nx">code</span><span class="p">;</span>
-
+
<span class="k">if</span> <span class="p">(</span><span class="nx">ch</span> <span class="o">===</span> <span class="mi">123</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">options</span><span class="p">.</span><span class="nx">ecmaVersion</span> <span class="o"><</span> <span class="mi">6</span><span class="p">)</span> <span class="nx">unexpected</span><span class="p">();</span>
<span class="o">++</span><span class="nx">tokPos</span><span class="p">;</span>
@@ -847,7 +847,7 @@ tests ("use strict"; 010; -- should fail).</p> </td> <td
<span class="k">this</span><span class="p">.</span><span class="nx">start</span> <span class="o">=</span> <span class="nx">tokStart</span><span class="p">;</span>
<span class="k">this</span><span class="p">.</span><span class="nx">end</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
<span class="p">}</span>
-
+
<span class="nx">exports</span><span class="p">.</span><span class="nx">Node</span> <span class="o">=</span> <span class="nx">Node</span><span class="p">;</span>
<span class="kd">function</span> <span class="nx">SourceLocation</span><span class="p">()</span> <span class="p">{</span>
@@ -916,7 +916,7 @@ if possible.</p> </td> <td class="code"> <
<span class="k">switch</span> <span class="p">(</span><span class="nx">node</span><span class="p">.</span><span class="nx">type</span><span class="p">)</span> <span class="p">{</span>
<span class="k">case</span> <span class="s2">"Identifier"</span><span class="o">:</span>
<span class="k">case</span> <span class="s2">"MemberExpression"</span><span class="o">:</span>
- <span class="k">break</span><span class="p">;</span>
+ <span class="k">break</span><span class="p">;</span>
<span class="k">case</span> <span class="s2">"ObjectExpression"</span><span class="o">:</span>
<span class="nx">node</span><span class="p">.</span><span class="nx">type</span> <span class="o">=</span> <span class="s2">"ObjectPattern"</span><span class="p">;</span>
@@ -1007,7 +1007,7 @@ to.</p> </td> <td class="code"> <div class
<span class="o">:</span> <span class="s2">"Assigning to "</span> <span class="o">+</span> <span class="nx">expr</span><span class="p">.</span><span class="nx">name</span> <span class="o">+</span> <span class="s2">" in strict mode"</span>
<span class="p">);</span>
<span class="k">break</span><span class="p">;</span>
-
+
<span class="k">case</span> <span class="s2">"MemberExpression"</span><span class="o">:</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">isBinding</span><span class="p">)</span> <span class="k">break</span><span class="p">;</span>
@@ -1090,7 +1090,7 @@ Identifier node, we switch to interpreting it as a label.</p> </td>
<span class="k">else</span> <span class="k">return</span> <span class="nx">parseExpressionStatement</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="nx">expr</span><span class="p">);</span>
<span class="p">}</span>
<span class="p">}</span>
-
+
<span class="kd">function</span> <span class="nx">parseBreakContinueStatement</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="nx">keyword</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">isBreak</span> <span class="o">=</span> <span class="nx">keyword</span> <span class="o">==</span> <span class="s2">"break"</span><span class="p">;</span>
<span class="nx">next</span><span class="p">();</span>
@@ -1110,13 +1110,13 @@ continue to.</p> </td> <td class="code"> <
<span class="k">if</span> <span class="p">(</span><span class="nx">i</span> <span class="o">===</span> <span class="nx">labels</span><span class="p">.</span><span class="nx">length</span><span class="p">)</span> <span class="nx">raise</span><span class="p">(</span><span class="nx">node</span><span class="p">.</span><span class="nx">start</span><span class="p">,</span> <span class="s2">"Unsyntactic "</span> <span class="o">+</span> <span class="nx">keyword</span><span class= [...]
<span class="k">return</span> <span class="nx">finishNode</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="nx">isBreak</span> <span class="o">?</span> <span class="s2">"BreakStatement"</span> <span class="o">:</span> <span class="s2">"ContinueStatement"</span><span class="p">);</span>
<span class="p">}</span>
-
+
<span class="kd">function</span> <span class="nx">parseDebuggerStatement</span><span class="p">(</span><span class="nx">node</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">next</span><span class="p">();</span>
<span class="nx">semicolon</span><span class="p">();</span>
<span class="k">return</span> <span class="nx">finishNode</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="s2">"DebuggerStatement"</span><span class="p">);</span>
<span class="p">}</span>
-
+
<span class="kd">function</span> <span class="nx">parseDoStatement</span><span class="p">(</span><span class="nx">node</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">next</span><span class="p">();</span>
<span class="nx">labels</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">loopLabel</span><span class="p">);</span>
@@ -1126,15 +1126,13 @@ continue to.</p> </td> <td class="code"> <
<span class="nx">node</span><span class="p">.</span><span class="nx">test</span> <span class="o">=</span> <span class="nx">parseParenExpression</span><span class="p">();</span>
<span class="nx">semicolon</span><span class="p">();</span>
<span class="k">return</span> <span class="nx">finishNode</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="s2">"DoWhileStatement"</span><span class="p">);</span>
- <span class="p">}</span>
- </pre></div> </td> </tr> <tr id="section-113"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-113">¶</a> </div> <p>Disambiguating between a <code>for</code> and a <code>for</code>/<code>in</code> or <code>for</code>/<code>of</code>
+ <span class="p">}</span></pre></div> </td> </tr> <tr id="section-113"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-113">¶</a> </div> <p>Disambiguating between a <code>for</code> and a <code>for</code>/<code>in</code> or <code>for</code>/<code>of</code>
loop is non-trivial. Basically, we have to parse the init <code>var</code>
statement or expression, disallowing the <code>in</code> operator (see
the second parameter to <code>parseExpression</code>), and then check
whether the next token is <code>in</code> or <code>of</code>. When there is no init
part (semicolon immediately after the opening parenthesis), it
-is a regular <code>for</code> loop.</p> </td> <td class="code"> <div class="highlight"><pre>
- <span class="kd">function</span> <span class="nx">parseForStatement</span><span class="p">(</span><span class="nx">node</span><span class="p">)</span> <span class="p">{</span>
+is a regular <code>for</code> loop.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">function</span> <span class="nx">parseForStatement</span><span class="p">(</span><span class="nx">node</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">next</span><span class="p">();</span>
<span class="nx">labels</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">loopLabel</span><span class="p">);</span>
<span class="nx">expect</span><span class="p">(</span><span class="nx">_parenL</span><span class="p">);</span>
@@ -1156,12 +1154,12 @@ is a regular <code>for</code> loop.</p> </td> <td class=
<span class="p">}</span>
<span class="k">return</span> <span class="nx">parseFor</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="nx">init</span><span class="p">);</span>
<span class="p">}</span>
-
+
<span class="kd">function</span> <span class="nx">parseFunctionStatement</span><span class="p">(</span><span class="nx">node</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">next</span><span class="p">();</span>
<span class="k">return</span> <span class="nx">parseFunction</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
<span class="p">}</span>
-
+
<span class="kd">function</span> <span class="nx">parseIfStatement</span><span class="p">(</span><span class="nx">node</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">next</span><span class="p">();</span>
<span class="nx">node</span><span class="p">.</span><span class="nx">test</span> <span class="o">=</span> <span class="nx">parseParenExpression</span><span class="p">();</span>
@@ -1169,7 +1167,7 @@ is a regular <code>for</code> loop.</p> </td> <td class=
<span class="nx">node</span><span class="p">.</span><span class="nx">alternate</span> <span class="o">=</span> <span class="nx">eat</span><span class="p">(</span><span class="nx">_else</span><span class="p">)</span> <span class="o">?</span> <span class="nx">parseStatement</span><span class="p">()</span> <span class="o">:</span> <span class="kc">null</span><span class="p">;</span>
<span class="k">return</span> <span class="nx">finishNode</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="s2">"IfStatement"</span><span class="p">);</span>
<span class="p">}</span>
-
+
<span class="kd">function</span> <span class="nx">parseReturnStatement</span><span class="p">(</span><span class="nx">node</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">inFunction</span> <span class="o">&&</span> <span class="o">!</span><span class="nx">options</span><span class="p">.</span><span class="nx">allowReturnOutsideFunction</span><span class="p">)</span>
<span class="nx">raise</span><span class="p">(</span><span class="nx">tokStart</span><span class="p">,</span> <span class="s2">"'return' outside of function"</span><span class="p">);</span>
@@ -1179,7 +1177,7 @@ possibility to insert one.</p> </td> <td class="code">
<span class="k">else</span> <span class="p">{</span> <span class="nx">node</span><span class="p">.</span><span class="nx">argument</span> <span class="o">=</span> <span class="nx">parseExpression</span><span class="p">();</span> <span class="nx">semicolon</span><span class="p">();</span> <span class="p">}</span>
<span class="k">return</span> <span class="nx">finishNode</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="s2">"ReturnStatement"</span><span class="p">);</span>
<span class="p">}</span>
-
+
<span class="kd">function</span> <span class="nx">parseSwitchStatement</span><span class="p">(</span><span class="nx">node</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">next</span><span class="p">();</span>
<span class="nx">node</span><span class="p">.</span><span class="nx">discriminant</span> <span class="o">=</span> <span class="nx">parseParenExpression</span><span class="p">();</span>
@@ -1210,7 +1208,7 @@ adding statements to.</p> </td> <td class="code">
<span class="nx">labels</span><span class="p">.</span><span class="nx">pop</span><span class="p">();</span>
<span class="k">return</span> <span class="nx">finishNode</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="s2">"SwitchStatement"</span><span class="p">);</span>
<span class="p">}</span>
-
+
<span class="kd">function</span> <span class="nx">parseThrowStatement</span><span class="p">(</span><span class="nx">node</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">next</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</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">tokStart</span><span class="p">)))</span>
@@ -1219,7 +1217,7 @@ adding statements to.</p> </td> <td class="code">
<span class="nx">semicolon</span><span class="p">();</span>
<span class="k">return</span> <span class="nx">finishNode</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="s2">"ThrowStatement"</span><span class="p">);</span>
<span class="p">}</span>
-
+
<span class="kd">function</span> <span class="nx">parseTryStatement</span><span class="p">(</span><span class="nx">node</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">next</span><span class="p">();</span>
<span class="nx">node</span><span class="p">.</span><span class="nx">block</span> <span class="o">=</span> <span class="nx">parseBlock</span><span class="p">();</span>
@@ -1242,14 +1240,14 @@ adding statements to.</p> </td> <td class="code">
<span class="nx">raise</span><span class="p">(</span><span class="nx">node</span><span class="p">.</span><span class="nx">start</span><span class="p">,</span> <span class="s2">"Missing catch or finally clause"</span><span class="p">);</span>
<span class="k">return</span> <span class="nx">finishNode</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="s2">"TryStatement"</span><span class="p">);</span>
<span class="p">}</span>
-
+
<span class="kd">function</span> <span class="nx">parseVarStatement</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="nx">kind</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">next</span><span class="p">();</span>
<span class="nx">parseVar</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="kc">false</span><span class="p">,</span> <span class="nx">kind</span><span class="p">);</span>
<span class="nx">semicolon</span><span class="p">();</span>
<span class="k">return</span> <span class="nx">finishNode</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="s2">"VariableDeclaration"</span><span class="p">);</span>
<span class="p">}</span>
-
+
<span class="kd">function</span> <span class="nx">parseWhileStatement</span><span class="p">(</span><span class="nx">node</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">next</span><span class="p">();</span>
<span class="nx">node</span><span class="p">.</span><span class="nx">test</span> <span class="o">=</span> <span class="nx">parseParenExpression</span><span class="p">();</span>
@@ -1258,7 +1256,7 @@ adding statements to.</p> </td> <td class="code">
<span class="nx">labels</span><span class="p">.</span><span class="nx">pop</span><span class="p">();</span>
<span class="k">return</span> <span class="nx">finishNode</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="s2">"WhileStatement"</span><span class="p">);</span>
<span class="p">}</span>
-
+
<span class="kd">function</span> <span class="nx">parseWithStatement</span><span class="p">(</span><span class="nx">node</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">strict</span><span class="p">)</span> <span class="nx">raise</span><span class="p">(</span><span class="nx">tokStart</span><span class="p">,</span> <span class="s2">"'with' in strict mode"</span><span class="p">);</span>
<span class="nx">next</span><span class="p">();</span>
@@ -1266,12 +1264,12 @@ adding statements to.</p> </td> <td class="code">
<span class="nx">node</span><span class="p">.</span><span class="nx">body</span> <span class="o">=</span> <span class="nx">parseStatement</span><span class="p">();</span>
<span class="k">return</span> <span class="nx">finishNode</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="s2">"WithStatement"</span><span class="p">);</span>
<span class="p">}</span>
-
+
<span class="kd">function</span> <span class="nx">parseEmptyStatement</span><span class="p">(</span><span class="nx">node</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">next</span><span class="p">();</span>
<span class="k">return</span> <span class="nx">finishNode</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="s2">"EmptyStatement"</span><span class="p">);</span>
<span class="p">}</span>
-
+
<span class="kd">function</span> <span class="nx">parseLabeledStatement</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="nx">maybeName</span><span class="p">,</span> <span class="nx">expr</span><span class="p">)</span> <span class="p">{</span>
<span class="k">for</span> <span class="p">(</span><span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o"><</span> <span class="nx">labels</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="o">++</span><span class="nx">i</span><span class="p">)</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">labels</span><span class="p">[</span><span class="nx">i</span><span class="p">].</span><span class="nx">name</span> <span class="o">===</span> <span class="nx">maybeName</span><span class="p">)</span> <span class="nx">raise</span><span class="p">(</span><span class="nx">expr</span><span class="p">.</span><span class="nx">start</span><span class="p">,</span> <span class="s2">"Label '"</span> <span class [...]
@@ -1282,7 +1280,7 @@ adding statements to.</p> </td> <td class="code">
<span class="nx">node</span><span class="p">.</span><span class="nx">label</span> <span class="o">=</span> <span class="nx">expr</span><span class="p">;</span>
<span class="k">return</span> <span class="nx">finishNode</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="s2">"LabeledStatement"</span><span class="p">);</span>
<span class="p">}</span>
-
+
<span class="kd">function</span> <span class="nx">parseExpressionStatement</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="nx">expr</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">node</span><span class="p">.</span><span class="nx">expression</span> <span class="o">=</span> <span class="nx">expr</span><span class="p">;</span>
<span class="nx">semicolon</span><span class="p">();</span>
@@ -1467,7 +1465,7 @@ or <code>{}</code>.</p> </td> <td class="code">
<span class="kd">var</span> <span class="nx">node</span> <span class="o">=</span> <span class="nx">startNode</span><span class="p">();</span>
<span class="nx">next</span><span class="p">();</span>
<span class="k">return</span> <span class="nx">finishNode</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="s2">"ThisExpression"</span><span class="p">);</span>
-
+
<span class="k">case</span> <span class="nx">_yield</span><span class="o">:</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">inGenerator</span><span class="p">)</span> <span class="k">return</span> <span class="nx">parseYield</span><span class="p">();</span>
@@ -1477,7 +1475,7 @@ or <code>{}</code>.</p> </td> <td class="code">
<span class="k">return</span> <span class="nx">parseArrowExpression</span><span class="p">(</span><span class="nx">startNodeFrom</span><span class="p">(</span><span class="nx">id</span><span class="p">),</span> <span class="p">[</span><span class="nx">id</span><span class="p">]);</span>
<span class="p">}</span>
<span class="k">return</span> <span class="nx">id</span><span class="p">;</span>
-
+
<span class="k">case</span> <span class="nx">_num</span><span class="o">:</span> <span class="k">case</span> <span class="nx">_string</span><span class="o">:</span> <span class="k">case</span> <span class="nx">_regexp</span><span class="o">:</span>
<span class="kd">var</span> <span class="nx">node</span> <span class="o">=</span> <span class="nx">startNode</span><span class="p">();</span>
<span class="nx">node</span><span class="p">.</span><span class="nx">value</span> <span class="o">=</span> <span class="nx">tokVal</span><span class="p">;</span>
@@ -1603,7 +1601,7 @@ least, not without wrapping it in parentheses. Thus, it uses the</p>
<span class="k">if</span> <span class="p">(</span><span class="nx">options</span><span class="p">.</span><span class="nx">allowTrailingCommas</span> <span class="o">&&</span> <span class="nx">eat</span><span class="p">(</span><span class="nx">_braceR</span><span class="p">))</span> <span class="k">break</span><span class="p">;</span>
<span class="p">}</span> <span class="k">else</span> <span class="nx">first</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
- <span class="kd">var</span> <span class="nx">prop</span> <span class="o">=</span> <span class="nx">startNode</span><span class="p">(),</span> <span class="nx">kind</span><span class="p">,</span> <span class="nx">isGenerator</span><span class="p">;</span>
+ <span class="kd">var</span> <span class="nx">prop</span> <span class="o">=</span> <span class="nx">startNode</span><span class="p">(),</span> <span class="nx">isGenerator</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">options</span><span class="p">.</span><span class="nx">ecmaVersion</span> <span class="o">>=</span> <span class="mi">6</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">prop</span><span class="p">.</span><span class="nx">method</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
<span class="nx">prop</span><span class="p">.</span><span class="nx">shorthand</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
@@ -1612,19 +1610,19 @@ least, not without wrapping it in parentheses. Thus, it uses the</p>
<span class="nx">parsePropertyName</span><span class="p">(</span><span class="nx">prop</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">eat</span><span class="p">(</span><span class="nx">_colon</span><span class="p">))</span> <span class="p">{</span>
<span class="nx">prop</span><span class="p">.</span><span class="nx">value</span> <span class="o">=</span> <span class="nx">parseExpression</span><span class="p">(</span><span class="kc">true</span><span class="p">);</span>
- <span class="nx">kind</span> <span class="o">=</span> <span class="nx">prop</span><span class="p">.</span><span class="nx">kind</span> <span class="o">=</span> <span class="s2">"init"</span><span class="p">;</span>
+ <span class="nx">prop</span><span class="p">.</span><span class="nx">kind</span> <span class="o">=</span> <span class="s2">"init"</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">options</span><span class="p">.</span><span class="nx">ecmaVersion</span> <span class="o">>=</span> <span class="mi">6</span> <span class="o">&&</span> <span class="nx">tokType</span> <span class="o">===</span> <span class="nx">_parenL</span><span class="p">)</span> <span class="p">{</span>
- <span class="nx">kind</span> <span class="o">=</span> <span class="nx">prop</span><span class="p">.</span><span class="nx">kind</span> <span class="o">=</span> <span class="s2">"init"</span><span class="p">;</span>
+ <span class="nx">prop</span><span class="p">.</span><span class="nx">kind</span> <span class="o">=</span> <span class="s2">"init"</span><span class="p">;</span>
<span class="nx">prop</span><span class="p">.</span><span class="nx">method</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
<span class="nx">prop</span><span class="p">.</span><span class="nx">value</span> <span class="o">=</span> <span class="nx">parseMethod</span><span class="p">(</span><span class="nx">isGenerator</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">options</span><span class="p">.</span><span class="nx">ecmaVersion</span> <span class="o">>=</span> <span class="mi">5</span> <span class="o">&&</span> <span class="o">!</span><span class="nx">prop</span><span class="p">.</span><span class="nx">computed</span> <span class="o">&&</span> <span class="nx">prop</span><span class="p">.</span><span cl [...]
<span class="p">(</span><span class="nx">prop</span><span class="p">.</span><span class="nx">key</span><span class="p">.</span><span class="nx">name</span> <span class="o">===</span> <span class="s2">"get"</span> <span class="o">||</span> <span class="nx">prop</span><span class="p">.</span><span class="nx">key</span><span class="p">.</span><span class="nx">name</span> <span class="o">===</span> <span class="s2">"set"</span><span class="p">))</span> <s [...]
<span class="k">if</span> <span class="p">(</span><span class="nx">isGenerator</span><span class="p">)</span> <span class="nx">unexpected</span><span class="p">();</span>
- <span class="nx">kind</span> <span class="o">=</span> <span class="nx">prop</span><span class="p">.</span><span class="nx">kind</span> <span class="o">=</span> <span class="nx">prop</span><span class="p">.</span><span class="nx">key</span><span class="p">.</span><span class="nx">name</span><span class="p">;</span>
+ <span class="nx">prop</span><span class="p">.</span><span class="nx">kind</span> <span class="o">=</span> <span class="nx">prop</span><span class="p">.</span><span class="nx">key</span><span class="p">.</span><span class="nx">name</span><span class="p">;</span>
<span class="nx">parsePropertyName</span><span class="p">(</span><span class="nx">prop</span><span class="p">);</span>
<span class="nx">prop</span><span class="p">.</span><span class="nx">value</span> <span class="o">=</span> <span class="nx">parseMethod</span><span class="p">(</span><span class="kc">false</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">options</span><span class="p">.</span><span class="nx">ecmaVersion</span> <span class="o">>=</span> <span class="mi">6</span> <span class="o">&&</span> <span class="o">!</span><span class="nx">prop</span><span class="p">.</span><span class="nx">computed</span> <span class="o">&&</span> <span class="nx">prop</span><span class="p">.</span><span cl [...]
- <span class="nx">kind</span> <span class="o">=</span> <span class="nx">prop</span><span class="p">.</span><span class="nx">kind</span> <span class="o">=</span> <span class="s2">"init"</span><span class="p">;</span>
+ <span class="nx">prop</span><span class="p">.</span><span class="nx">kind</span> <span class="o">=</span> <span class="s2">"init"</span><span class="p">;</span>
<span class="nx">prop</span><span class="p">.</span><span class="nx">value</span> <span class="o">=</span> <span class="nx">prop</span><span class="p">.</span><span class="nx">key</span><span class="p">;</span>
<span class="nx">prop</span><span class="p">.</span><span class="nx">shorthand</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
<span class="p">}</span> <span class="k">else</span> <span class="nx">unexpected</span><span class="p">();</span>
@@ -1684,7 +1682,7 @@ least, not without wrapping it in parentheses. Thus, it uses the</p>
<span class="nx">initFunction</span><span class="p">(</span><span class="nx">node</span><span class="p">);</span>
<span class="kd">var</span> <span class="nx">defaults</span> <span class="o">=</span> <span class="nx">node</span><span class="p">.</span><span class="nx">defaults</span><span class="p">,</span> <span class="nx">hasDefaults</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
-
+
<span class="k">for</span> <span class="p">(</span><span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="nx">lastI</span> <span class="o">=</span> <span class="nx">params</span><span class="p">.</span><span class="nx">length</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> <span class="nx">i</span> <span class="o"><=</span> <span class="nx">lastI</span><span cla [...]
<span class="kd">var</span> <span class="nx">param</span> <span class="o">=</span> <span class="nx">params</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>
@@ -1710,7 +1708,7 @@ least, not without wrapping it in parentheses. Thus, it uses the</p>
<span class="k">return</span> <span class="nx">finishNode</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="s2">"ArrowFunctionExpression"</span><span class="p">);</span>
<span class="p">}</span></pre></div> </td> </tr> <tr id="section-144"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-144">¶</a> </div> <p>Parse function parameters.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">function</span> <span class="nx">parseFunctionParams</spa [...]
<span class="kd">var</span> <span class="nx">defaults</span> <span class="o">=</span> <span class="p">[],</span> <span class="nx">hasDefaults</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
-
+
<span class="nx">expect</span><span class="p">(</span><span class="nx">_parenL</span><span class="p">);</span>
<span class="k">for</span> <span class="p">(;;)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">eat</span><span class="p">(</span><span class="nx">_parenR</span><span class="p">))</span> <span class="p">{</span>
@@ -1737,7 +1735,7 @@ least, not without wrapping it in parentheses. Thus, it uses the</p>
<span class="k">if</span> <span class="p">(</span><span class="nx">hasDefaults</span><span class="p">)</span> <span class="nx">node</span><span class="p">.</span><span class="nx">defaults</span> <span class="o">=</span> <span class="nx">defaults</span><span class="p">;</span>
<span class="p">}</span></pre></div> </td> </tr> <tr id="section-145"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-145">¶</a> </div> <p>Parse function body and check parameters.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">function</span> <span class="nx">parseFunc [...]
<span class="kd">var</span> <span class="nx">isExpression</span> <span class="o">=</span> <span class="nx">allowExpression</span> <span class="o">&&</span> <span class="nx">tokType</span> <span class="o">!==</span> <span class="nx">_braceL</span><span class="p">;</span>
-
+
<span class="k">if</span> <span class="p">(</span><span class="nx">isExpression</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">node</span><span class="p">.</span><span class="nx">body</span> <span class="o">=</span> <span class="nx">parseExpression</span><span class="p">(</span><span class="kc">true</span><span class="p">);</span>
<span class="nx">node</span><span class="p">.</span><span class="nx">expression</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
@@ -1759,8 +1757,7 @@ or <code>arguments</code>.</p> </td> <td class="code">
<span class="nx">checkFunctionParam</span><span class="p">(</span><span class="nx">node</span><span class="p">.</span><span class="nx">rest</span><span class="p">,</span> <span class="nx">nameHash</span><span class="p">);</span>
<span class="p">}</span>
<span class="p">}</span></pre></div> </td> </tr> <tr id="section-148"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-148">¶</a> </div> <p>Parse a class declaration or literal (depending on the
-<code>isStatement</code> parameter).</p> </td> <td class="code"> <div class="highlight"><pre>
- <span class="kd">function</span> <span class="nx">parseClass</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="nx">isStatement</span><span class="p">)</span> <span class="p">{</span>
+<code>isStatement</code> parameter).</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">function</span> <span class="nx">parseClass</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="nx">isStatement</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">next</span><span class="p">();</span>
<span class="nx">node</span><span class="p">.</span><span class="nx">id</span> <span class="o">=</span> <span class="nx">tokType</span> <span class="o">===</span> <span class="nx">_name</span> <span class="o">?</span> <span class="nx">parseIdent</span><span class="p">()</span> <span class="o">:</span> <span class="nx">isStatement</span> <span class="o">?</span> <span class="nx">unexpected</span><span class="p">()</span> <span class="o">:</span> <span class="kc">null</span><span class [...]
<span class="nx">node</span><span class="p">.</span><span class="nx">superClass</span> <span class="o">=</span> <span class="nx">eat</span><span class="p">(</span><span class="nx">_extends</span><span class="p">)</span> <span class="o">?</span> <span class="nx">parseExpression</span><span class="p">()</span> <span class="o">:</span> <span class="kc">null</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