Skip to content

kristianmandrup/aster-parse-js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aster-parse-js

NPM version Build Status

JavaScript parser for aster.

Usage

This is internal module and should be used as part of aster-parse or aster-src.

It uses esprima to do it's job.

API

parseJS(options)

options.loc

Type: Boolean Default: true

Location tracking (required for source maps).

options.comments

Type: Boolean Default: false

Include comments to AST.

options.parser

Customized parser generator, by default:

function defaultParser(options) {
    return function (files) {
        return files.map(function (file) {
            return {
                type: 'File',
                program: parse(file.contents, {loc: options.loc, source: file.path, attachComment: options.attachComment}),
                loc: {
                    source: file.path
                }
            };
        });
    };
}

You can f.ex change the type: 'File' if you are not parsing files.

License

MIT License

About

JavaScript parser for aster

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%