Scroll to navigation

acorn(1) acorn(1)


acorn - parse JavaScript file


[--ecma3 | --ecma5 | --ecma6 | --ecma7 | ... | --ecma2015 | --ecma2016] [--tokenize] [--locations] [--allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]


acorn is a utility to parse a JavaScript file from the command line. It accepts as arguments the input file. The utility spits out the syntax tree as JSON data.


--ecma3, --ecma5, --ecma6, --ecma7, ..., --ecma2015, --ecma2016
Sets the ECMAScript version to parse. Default is version 7.
Tokenizer mode of the parser.
Attaches a "loc" object to each node with "start" and "end" subobjects, each of which contains the one-based line and zero-based column numbers in {line, column} form.
If enabled, skip the leading hashbang line.
No whitespace is used in the AST output.
Do not output the AST, just return the exit status.
Indicates the code shouldn't be parsed as a script but as a module. This influences global strict mode and 'import' and 'export' declarations.
Print the usage information and quit.