Class: SyntaxTree::Parser::TokenList
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- SyntaxTree::Parser::TokenList
- Defined in:
- lib/syntax_tree/parser.rb
Overview
This represents all of the tokens coming back from the lexer. It is replacing a simple array because it keeps track of the last deleted token from the list for better error messages.
Instance Attribute Summary collapse
-
#last_deleted ⇒ Object
readonly
Returns the value of attribute last_deleted.
Instance Method Summary collapse
- #delete(value) ⇒ Object
- #delete_at(index) ⇒ Object
-
#initialize(object) ⇒ TokenList
constructor
A new instance of TokenList.
Constructor Details
#initialize(object) ⇒ TokenList
Returns a new instance of TokenList.
66 67 68 69 |
# File 'lib/syntax_tree/parser.rb', line 66 def initialize(object) super @last_deleted = nil end |
Instance Attribute Details
#last_deleted ⇒ Object (readonly)
Returns the value of attribute last_deleted.
64 65 66 |
# File 'lib/syntax_tree/parser.rb', line 64 def last_deleted @last_deleted end |
Instance Method Details
#delete(value) ⇒ Object
71 72 73 |
# File 'lib/syntax_tree/parser.rb', line 71 def delete(value) @last_deleted = super || @last_deleted end |
#delete_at(index) ⇒ Object
75 76 77 |
# File 'lib/syntax_tree/parser.rb', line 75 def delete_at(index) @last_deleted = super end |