JSPM

  • Created
  • Published
  • Downloads 29105
  • Score
    100M100P100Q148115F
  • License MIT

putout parser

Package Exports

  • @putout/engine-parser
  • @putout/engine-parser/acorn
  • @putout/engine-parser/babel
  • @putout/engine-parser/babel/options
  • @putout/engine-parser/espree
  • @putout/engine-parser/esprima

Readme

@putout/engine-parser NPM version

putout engine that parses input.

Install

npm i @putout/engine-parser

Supported parsers

Any parser should be installed before use, but you can be shure that @babel/parse always installed.

API

print(ast)

Print code from ast

parse(code)

You can add default options for custom parser you use.

parse.fresh(code)

parse without memoization.

parse.ast(template)

create node using memoization.

parse.ast.fresh(template)

create node without memoization.

Example

const {parse} = require('@putout/engin-parser');
const parser = 'acorn';

const code = parse('var t = "hello"', {
    parser,
});

License

MIT