Class: Parser

Defined in: src/parser.coffee

Overview

This parser is responsible for converting each file into the intermediate / AST representation as a JSON node.

Instance Method Summary

Constructor Details

::constructor(options) Source

Construct the parser

Parameters:

  • (Object) optionsAn Object of options

Instance Method Details

::convertComments(content) Source

Converts the comments to block comments, so they appear in the node structure. Only block comments are considered by Biscotto.

Parameters:

  • (String) contentA String representing the CoffeeScript file content

Array ::getAllMethods() Source

Get all the parsed methods.

Returns:

Array ::getAllVariables() Source

Get all parsed variables.

Returns:

::linkAncestors(node) Source

Attach each parent to its children, so we are able to traverse the ancestor parse tree. Since the parent attribute is already used in the class node, the parent is stored as ancestor.

Parameters:

  • (Base) nodesA Base representing the CoffeeScript nodes

::parseContent(content, file = '') Source

Parse the given CoffeeScript content.

Parameters:

  • (String) contentA String representing the CoffeeScript file content
  • (String) fileA String representing the CoffeeScript file name

::parseFile(file) Source

Parse the given CoffeeScript file.

Parameters:

  • (String) fileA String representing the the CoffeeScript filename

::showResult(generator) Source

Show the final parsing statistics.

Object ::toJSON() Source

Get a JSON representation of the object.

Returns:

  • (Object) — Returns the JSON Object.