Class: CodeModels::Js::Parser
- Inherits:
-
Parser
- Object
- Parser
- CodeModels::Js::Parser
- Defined in:
- lib/codemodels/js/parser.rb
Instance Attribute Summary collapse
-
#skip_unknown_node ⇒ Object
Returns the value of attribute skip_unknown_node.
Instance Method Summary collapse
- #internal_parse_artifact(artifact) ⇒ Object
- #tree_to_model(tree, code, artifact, offset = 0) ⇒ Object
Instance Attribute Details
#skip_unknown_node ⇒ Object
Returns the value of attribute skip_unknown_node.
10 11 12 |
# File 'lib/codemodels/js/parser.rb', line 10 def skip_unknown_node @skip_unknown_node end |
Instance Method Details
#internal_parse_artifact(artifact) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/codemodels/js/parser.rb', line 12 def internal_parse_artifact(artifact) code = artifact.code name = artifact.name java_import 'java.io.StringReader' java_import 'org.mozilla.javascript.CompilerEnvirons' rhino_parser = (java_import 'org.mozilla.javascript.Parser')[0] env = CompilerEnvirons.new parser = rhino_parser.new(env) reader = StringReader.new(code) tree = parser.parse(reader, name, 1) tree_to_model(tree,code,artifact) end |
#tree_to_model(tree, code, artifact, offset = 0) ⇒ Object
25 26 27 |
# File 'lib/codemodels/js/parser.rb', line 25 def tree_to_model(tree,code,artifact,offset=0) node_to_model(tree,code,artifact,offset) end |