Class: RKelly::Parser
- Inherits:
-
GeneratedParser
- Object
- GeneratedParser
- RKelly::Parser
- Defined in:
- lib/rkelly/parser.rb
Constant Summary collapse
- TOKENIZER =
Tokenizer.new
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
-
#initialize ⇒ Parser
constructor
A new instance of Parser.
-
#parse(javascript) ⇒ Object
Parse
javascriptand return an AST.
Constructor Details
#initialize ⇒ Parser
25 26 27 28 29 30 31 |
# File 'lib/rkelly/parser.rb', line 25 def initialize @tokens = [] @logger = nil @terminator = false @prev_token = nil @comments = [] end |
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
24 25 26 |
# File 'lib/rkelly/parser.rb', line 24 def logger @logger end |
Instance Method Details
#parse(javascript) ⇒ Object
Parse javascript and return an AST
34 35 36 37 38 39 |
# File 'lib/rkelly/parser.rb', line 34 def parse(javascript) @tokens = TOKENIZER.raw_tokens(javascript) @position = 0 ast = do_parse apply_comments(ast) end |