Fork me on GitHub

Module ringo/parser

This module provides an interface to the Rhino parser.

Functions


parseScriptResource (resource)

Parse a script resource and return its AST tree.

Parameters

Resource resource an instance of org.ringojs.repository.Resource

Returns

AstNode the root node of the AST tree, an instance of org.mozilla.javascript.ast.AstRoot

visitScriptResource (resource, visitorFunction)

Parse a script resource and apply the visitor function to its AST tree. The function takes one argument which is a org.mozilla.javascript.ast.AstNode. The function must return true to visit child nodes of the current node.

Parameters

Resource resource an instance of org.ringojs.repository.Resource
Function visitorFunction the visitor function