Home ⌂Doc Index ◂Up ▴

eric6.Utilities.ClassBrowsers.jsclbr

Parse a JavaScript file and retrieve variables and functions.

It uses the JavaScript parser contained in the jasy web framework.

Global Attributes

SUPPORTED_TYPES
_modules

Classes

Attribute Class to represent a class attribute.
Function Class to represent a Python function.
VisibilityMixin Mixin class implementing the notion of visibility.
Visitor Class implementing a visitor going through the parsed tree.

Functions

readmodule_ex Read a JavaScript file and return a dictionary of functions and variables.


Attribute

Class to represent a class attribute.

Derived from

ClbrBaseClasses.Attribute, VisibilityMixin

Class Attributes

None

Class Methods

None

Methods

Attribute Constructor

Static Methods

None

Attribute (Constructor)

Attribute(module, name, file, lineno)

Constructor

module
name of the module containing this class
name
name of this class
file
filename containing this attribute
lineno
linenumber of the class definition
Up


Function

Class to represent a Python function.

Derived from

ClbrBaseClasses.Function, VisibilityMixin

Class Attributes

None

Class Methods

None

Methods

Function Constructor

Static Methods

None

Function (Constructor)

Function(module, name, file, lineno, signature='', separator=', ')

Constructor

module
name of the module containing this function
name
name of this function
file
filename containing this class
lineno
linenumber of the class definition
signature
parameterlist of the method
separator
string separating the parameters
Up


VisibilityMixin

Mixin class implementing the notion of visibility.

Derived from

ClbrBaseClasses.ClbrVisibilityMixinBase

Class Attributes

None

Class Methods

None

Methods

VisibilityMixin Constructor

Static Methods

None

VisibilityMixin (Constructor)

VisibilityMixin()

Constructor

Up


Visitor

Class implementing a visitor going through the parsed tree.

Derived from

object

Class Attributes

None

Class Methods

None

Methods

Visitor Constructor
__visit Private method implementing the visit logic delegating to interesting methods.
call
parse Public method to parse the source.
visit_const Public method to treat a constant node.
visit_function Public method to treat a function node.
visit_noop Public method to ignore the given node.
visit_property_init Public method to treat a property_init node.
visit_var Public method to treat a variable node.

Static Methods

None

Visitor (Constructor)

Visitor(src, module, filename)

Constructor

src
source to be parsed (string)
module
name of the module (string)
filename
file name (string)

Visitor.__visit

__visit(root)

Private method implementing the visit logic delegating to interesting methods.

root
root node to visit

Visitor.call

call()

Visitor.parse

parse()

Public method to parse the source.

Returns:
dictionary containing the parsed information

Visitor.visit_const

visit_const(node)

Public method to treat a constant node.

node
reference to the node (jasy.script.parse.Node.Node)

Visitor.visit_function

visit_function(node)

Public method to treat a function node.

node
reference to the node (jasy.script.parse.Node.Node)

Visitor.visit_noop

visit_noop(node)

Public method to ignore the given node.

node
reference to the node (jasy.script.parse.Node.Node)

Visitor.visit_property_init

visit_property_init(node)

Public method to treat a property_init node.

node
reference to the node (jasy.script.parse.Node.Node)

Visitor.visit_var

visit_var(node)

Public method to treat a variable node.

node
reference to the node (jasy.script.parse.Node.Node)
Up


readmodule_ex

readmodule_ex(module, path=None)

Read a JavaScript file and return a dictionary of functions and variables.

module
name of the JavaScript file (string)
path
path the file should be searched in (list of strings)
Returns:
the resulting dictionary
Up



Home ⌂Doc Index ◂Up ▴