Class: DBC::Cache
- Inherits:
-
CTokenizer::LexerBase
- Object
- CTokenizer::LexerBase
- DBC::Cache
- Defined in:
- lib/dbc/dbc.rb
Instance Method Summary collapse
-
#initialize(str, file = nil, line = 1) ⇒ Cache
constructor
A new instance of Cache.
- #reset ⇒ Object
- #shift ⇒ Object
Methods inherited from CTokenizer::LexerBase
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
#reset ⇒ Object
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 |
#shift ⇒ Object
35 36 37 38 39 |
# File 'lib/dbc/dbc.rb', line 35 def shift t = super @token_cache << t t end |