eric5.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
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
Class Methods
Methods
Static Methods
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
Function
Class to represent a Python function.
Derived from
ClbrBaseClasses.Function, VisibilityMixin
Class Attributes
Class Methods
Methods
Static Methods
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
VisibilityMixin
Mixin class implementing the notion of visibility.
Derived from
ClbrBaseClasses.ClbrVisibilityMixinBase
Class Attributes
Class Methods
Methods
Static Methods
VisibilityMixin (Constructor)
VisibilityMixin()
Method to initialize the visibility.
Visitor
Class implementing a visitor going through the parsed tree.
Derived from
object
Class Attributes
Class Methods
Methods
Visitor |
Constructor |
__visit |
Private method implementing the visit logic delegating to interesting methods. |
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
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.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.js.parse.Node.Node)
Visitor.visit_function
visit_function(node)
Public method to treat a function node.
- node
-
reference to the node (jasy.js.parse.Node.Node)
Visitor.visit_noop
visit_noop(node)
Public method to ignore the given node.
- node
-
reference to the node (jasy.js.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.js.parse.Node.Node)
Visitor.visit_var
visit_var(node)
Public method to treat a variable node.
- node
-
reference to the node (jasy.js.parse.Node.Node)
readmodule_ex
readmodule_ex(module, path=[])
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