Home Manual Reference Source Test Repository
public class | source

ASTParser

ASTParser is a fork of Astring. The original author is David Bonnet and Astring is released under an MIT license. This version is only available by the MPLv2.0 license. Please see the original source.

See:

Static Method Summary

Static Public Methods
public static

parse(node: object, options: object): ASTData

ASTParser returns an instance of ParserData containing a string representing the rendered code of the provided AST node.

Static Public Methods

public static parse(node: object, options: object): ASTData source

ASTParser returns an instance of ParserData containing a string representing the rendered code of the provided AST node. In addition Halstead operators and operands are available via ParserData.

Params:

NameTypeAttributeDescription
node object

An ESTree or Babylon AST node.

options object

Optional parameters for source code formatting.

Return:

ASTData

Return Properties:

NameTypeAttributeDescription
indent string

A string to use for indentation (defaults to \t)

lineEnd string

A string to use for line endings (defaults to \n)

startingIndentLevel number

indent level to start from (default to 0)