[Pkg-javascript-commits] [node-acorn-jsx] 45/484: Attach .raw property to literal nodes

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:20:02 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 5d83150951bbb94a8ea9a1bb6cbf24c5fd5e66f1
Author: Marijn Haverbeke <marijnh at gmail.com>
Date:   Fri Nov 2 16:35:09 2012 +0100

    Attach .raw property to literal nodes
---
 acorn.js   | 1 +
 index.html | 1 +
 2 files changed, 2 insertions(+)

diff --git a/acorn.js b/acorn.js
index 83dc01f..eb1c7d4 100644
--- a/acorn.js
+++ b/acorn.js
@@ -1421,6 +1421,7 @@
     case _num: case _string: case _regexp:
       var node = startNode();
       node.value = tokVal;
+      node.raw = input.slice(tokStart, tokEnd);
       next();
       return finishNode(node, "Literal");
 
diff --git a/index.html b/index.html
index 2cee49e..5d63154 100644
--- a/index.html
+++ b/index.html
@@ -1033,6 +1033,7 @@ or <code>{}</code>.</p>             </td>             <td class="code">
     <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>
+      <span class="nx">node</span><span class="p">.</span><span class="nx">raw</span> <span class="o">=</span> <span class="nx">input</span><span class="p">.</span><span class="nx">slice</span><span class="p">(</span><span class="nx">tokStart</span><span class="p">,</span> <span class="nx">tokEnd</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">"Literal"</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