GithubHelp home page GithubHelp logo

Comments (6)

getify avatar getify commented on May 22, 2024

FYI: esprima does include the ; in its range based counting:

http://esprima.org/demo/parse.html?code=var%20x%20%3D%200%3B

(make sure to turn on the "Index-based range" option)

Esprima reports 0-10 for the range (the ranges are apparently "start position to end position, but not including end position"), instead of 0-9.

from acorn.

michaelficarra avatar michaelficarra commented on May 22, 2024

IMO, the semicolon and any whitespace/comments leading up to it should be included in the range.

from acorn.

marijnh avatar marijnh commented on May 22, 2024

I agree this is a bug. Fixed in attached commit.

@michaelficarra No, whitespace around a node definitely will not be included in the node's span.

from acorn.

michaelficarra avatar michaelficarra commented on May 22, 2024

@marijnh: ... it's internal whitespace. To be clear, I meant this:

var x = 0    ;
         ^^^^

from acorn.

marijnh avatar marijnh commented on May 22, 2024

@michaelficarra Ah, I see. In that case, I am in full agreement. I assumed it in "leading up to it" was the var statement.

from acorn.

apatil avatar apatil commented on May 22, 2024

Great, thanks!

from acorn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.