Class: PryCoolline::ParenMatch::Parser
- Inherits:
-
Object
- Object
- PryCoolline::ParenMatch::Parser
- Defined in:
- lib/pry-coolline/paren_match.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code, pairs = Pairs) ⇒ Parser
constructor
A new instance of Parser.
-
#next_token ⇒ Token
Returns the next token found in the array and removes it.
- #parse ⇒ AST::Root
Constructor Details
#initialize(code, pairs = Pairs) ⇒ Parser
Returns a new instance of Parser.
178 179 180 |
# File 'lib/pry-coolline/paren_match.rb', line 178 def initialize(code, pairs = Pairs) @tokens = tokenize(code, pairs) end |
Class Method Details
.parse(code, pairs = Pairs) ⇒ AST::Root
173 174 175 |
# File 'lib/pry-coolline/paren_match.rb', line 173 def self.parse(code, pairs = Pairs) new(code, pairs).parse end |
Instance Method Details
#next_token ⇒ Token
Returns the next token found in the array and removes it.
190 191 192 |
# File 'lib/pry-coolline/paren_match.rb', line 190 def next_token @tokens.shift end |
#parse ⇒ AST::Root
183 184 185 |
# File 'lib/pry-coolline/paren_match.rb', line 183 def parse AST::Root.new self end |