class SyntaxTree::Parser::TokenList
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.
Attributes
Public Class Methods
Source
# File lib/syntax_tree/parser.rb, line 66 def initialize @tokens = [] @last_deleted = nil end
Public Instance Methods
Source
# File lib/syntax_tree/parser.rb, line 79 def any?(&block) tokens.any?(&block) end
Source
# File lib/syntax_tree/parser.rb, line 91 def delete(value) @last_deleted = tokens.delete(value) || @last_deleted end
Source
# File lib/syntax_tree/parser.rb, line 95 def delete_at(index) @last_deleted = tokens.delete_at(index) end
Source
# File lib/syntax_tree/parser.rb, line 83 def reverse_each(&block) tokens.reverse_each(&block) end
Source
# File lib/syntax_tree/parser.rb, line 87 def rindex(&block) tokens.rindex(&block) end