Class: DBC::Cache

Inherits:
CTokenizer::LexerBase show all
Defined in:
lib/dbc/dbc.rb

Instance Method Summary collapse

Methods inherited from CTokenizer::LexerBase

#empty?, #file, #line

Methods included from CTokenizer

check_string, check_token, #collect, create_newlines, #each, error, #error, join, line_count, #parse_error, split, split_token, #to_a, #token_error, #warning

Constructor Details

#initialize(str, file = nil, line = 1) ⇒ Cache

Returns a new instance of Cache.



30
31
32
33
# File 'lib/dbc/dbc.rb', line 30

def initialize(str, file=nil, line=1)
	super(str, file, line)
	@token_cache = CTokenizer::Cache.new(super.file, super.line)
end

Instance Method Details

#resetObject



41
42
43
44
45
# File 'lib/dbc/dbc.rb', line 41

def reset
	cache = @token_cache
	@token_cache = CTokenizer::Cache.new(self.file, self.line)
	cache
end

#shiftObject



35
36
37
38
39
# File 'lib/dbc/dbc.rb', line 35

def shift
	t = super
	@token_cache << t
	t
end