Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Accept an already parsed AST #10

Open
wants to merge 2 commits into from

5 participants

@Couto

This is a very specific feature that I needed to avoid repetition.
Since it was made to solve a very particular problem, feel free to close this ticket without accepting it, if you feel so.

I needed to analyze the AST before walking through the nodes, since I had the source, and the esprima's generated ast, it fell redundant to let falafel generate the AST again, so this pull request is only a way of using the options to provide an AST to falafel.

@inian

The AST passed in must have range attached to each node. There must be a check done to see if there is range attached to the passed in AST.

@jareware

I would need either this or #33. Any chance of getting a maintainer to merge either one in?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 9, 2012
  1. Allow falafel to accept a parsed ast

    Couto authored
Commits on Dec 10, 2012
  1. Dont mess with whitespaces

    Couto authored
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  index.js
View
3  index.js
@@ -29,7 +29,8 @@ module.exports = function (src, opts, fn) {
opts.range = true;
if (typeof src !== 'string') src = String(src);
- var ast = parse(src, opts);
+ var ast = opts.ast || parse(src, opts);
+ delete opts.ast;
var result = {
chunks : src.split(''),
Something went wrong with that request. Please try again.