Questions tagged [esprima]

Esprima is a high performance, standard-compliant JavaScript parser written in JavaScript.

Distributed under the BSD licence, Esprima features full support for JavaScript 5.1 and will run on many browsers and other JavaScript platforms such as Rhino and Node.js.

73 questions
0
votes
1 answer

ESPRIMA error with Aurelia-auth in Aurelia 1

I'm trying to convert an Aurelia project and have run into a problem. I installed aurelia-auth and configured it in the aurelia.json file as: { "name": "aurelia-auth", "path": "../node_modules/aurelia-auth/src", "main":…
Ross
  • 101
  • 1
  • 8
0
votes
3 answers

Validate JavaScript code without enforcing a specific style

I would like to validate some JavaScript code for syntactic correctness, but without enforcing a specific coding-style to the user. My first approach was to use esvalidate that comes included with esprima. This does the job partially, as it detects…
Golo Roden
  • 140,679
  • 96
  • 298
  • 425
0
votes
1 answer

esprima.js/gulp-strip-debug interfering with gulp-jshint task by reporting unhelpful errors when stripping debugger statements

This is something that just started happening yesterday, and it's causing me a big headache. As part of my build for arcade.ly I have a check-scripts task that strips debugging code and runs jshint over all my JavaScript: gulp.task('check-scripts',…
Bart Read
  • 2,717
  • 3
  • 22
  • 32
0
votes
2 answers

Is there any framework supporting events on AST node visiting?

While working with Esprima JavaScript Parser, which generates an AST in JSON format from JS source code, I noticed that it would be handy if I could register the type of a node (string) and trigger events when this type of node is visited, such…
Nick Louloudakis
  • 5,856
  • 4
  • 41
  • 54
0
votes
0 answers

How to count number of if/for/while/switch/try statements using esprima

I want to display files that have more then 3 if/for/while/switch/try statements (same as sonar) so far I have code that traverse the tree and count statements for whole file: var fs = require('fs'); var esprima = require('esprima'); function…
jcubic
  • 61,973
  • 54
  • 229
  • 402
0
votes
2 answers

how to install node.js package esprima offline?

Hi I'd like to install the package esprima for node.js, I want to get the AST of some JS code. But I can't find a way to download the package and install it in an offline pc. Any ideas?
kaladin
  • 55
  • 4
0
votes
2 answers

Getting "Error: Cannot find module 'esprima'" after updating Meteor to 1.0.2.1

After updating Meteor to version 1.0.2.1 I am getting an error: Error: Cannot find module 'esprima' W20150109-09:58:02.883(-6)? (STDERR) at Function.Module._resolveFilename (module.js:338:15) W20150109-09:58:02.883(-6)? (STDERR) at…
Conor Strejcek
  • 382
  • 2
  • 15
0
votes
1 answer

How does one detect whether a semicolon is used to terminate an expression in the Mozilla Parser AST as generated by Esprima?

A developer has created a very simple program: var a = 6; var b = 7 console.log(a * b); I want to ensure that the developers uses semicolons because i don't trust all of the developers to know all the ASI rules. Since I will be adding other code…
kzh
  • 19,810
  • 13
  • 73
  • 97
0
votes
1 answer

Javascript Object from External file, program

I am so confused about JavaScript's object system. I know that everything is considered Object in JavaScript but in this code of Esprima, I don't see any statement to declare this project to be accessed with esrpima like the following line:…
user2671513
-1
votes
2 answers

Unable to use esprima with ReactJS - Unexpected token

I am trying to parse a functions parameters with esprima in react js. I am getting following error Error: Line 1: Unexpected token ( ▶ 9 stack frames were collapsed. App.render src/v4/EsprimaTest.js:12:29 9 | 10 | 11 | render() { 12 | …
Rohit Bansal
  • 1,039
  • 2
  • 12
  • 21
-1
votes
1 answer

loc and range in esprima

Esprima is a good library for parse, analyse for multi-purpose javascript code. But I am not understand loc and range in esprima. In the website, they said that: loc Nodes have line and column-based location info. range Nodes have an index-based…
tkha
  • 3
  • 3
-2
votes
1 answer

How to use a global nodejs module?

I got the following error when I try to use esprima. Does anybody know how to fix the problem? Thanks. $ npm install -g esprima /usr/local/bin/esparse -> /usr/local/lib/node_modules/esprima/bin/esparse.js /usr/local/bin/esvalidate ->…
user1424739
  • 11,937
  • 17
  • 63
  • 152
-2
votes
4 answers

transpiler battle: breaking out of nested function, with vs without throw

I have just finished writing "version 0" of my first (toy) transpiler. It works. It turns a string of "pseudo JavaScript" (JavaScript with an additional feature) into a string of runnable JavaScript. Now, I want to improve it. The work area possibly…
mathheadinclouds
  • 3,507
  • 2
  • 27
  • 37
1 2 3 4
5