[Pkg-javascript-commits] [node-acorn-jsx] 167/484: Note non-reentrancy of parser in onComment docs

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:20:21 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 b1623b10c13225ae64cf68315960fb8118463efa
Author: Marijn Haverbeke <marijnh at gmail.com>
Date:   Wed Nov 20 10:59:12 2013 +0100

    Note non-reentrancy of parser in onComment docs
    
    Closes #80
---
 README.md  | 3 +++
 acorn.js   | 3 ++-
 index.html | 3 ++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 80b0fbd..a4f5fbf 100644
--- a/README.md
+++ b/README.md
@@ -78,6 +78,9 @@ object referring to that same position.
   of the comment’s start and end are passed as two additional
   parameters.
 
+  Note that you are not allowed to call the parser from the
+  callback—that will corrupt its internal state.
+
 - **ranges**: Nodes have their start and end characters offsets
   recorded in `start` and `end` properties (directly on the node,
   rather than the `loc` object, which holds line/column data. To also
diff --git a/acorn.js b/acorn.js
index ec3d4ed..bbd32cf 100644
--- a/acorn.js
+++ b/acorn.js
@@ -77,7 +77,8 @@
     // character offsets that denote the start and end of the comment.
     // When the `locations` option is on, two more parameters are
     // passed, the full `{line, column}` locations of the start and
-    // end of the comments.
+    // end of the comments. Note that you are not allowed to call the
+    // parser from the callback—that will corrupt its internal state.
     onComment: null,
     // Nodes have their start and end characters offsets recorded in
     // `start` and `end` properties (directly on the node, rather than
diff --git a/index.html b/index.html
index 9c86b83..c1df00b 100644
--- a/index.html
+++ b/index.html
@@ -50,7 +50,8 @@ boolean indicating whether this is a block (<code>/* */</code>) comment,
 character offsets that denote the start and end of the comment.
 When the <code>locations</code> option is on, two more parameters are
 passed, the full <code>{line, column}</code> locations of the start and
-end of the comments.</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nx">onComment</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span></pre></div>             </td>           </tr>                               <tr id="section-10">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-10">¶</a>               </div>               [...]
+end of the comments. Note that you are not allowed to call the
+parser from the callback—that will corrupt its internal state.</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nx">onComment</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span></pre></div>             </td>           </tr>                               <tr id="section-10">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-10">&#1 [...]
 <code>start</code> and <code>end</code> properties (directly on the node, rather than
 the <code>loc</code> object, which holds line/column data. To also add a
 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=745678">semi-standardized</a> <code>range</code> property holding a <code>[start,

-- 
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