Class: DBC::Cache
- Inherits:
-
CTokenizer::LexerBase
- Object
- CTokenizer::LexerBase
- DBC::Cache
- Defined in:
- lib/dbc/dbc.rb
Constant Summary
Constants included from CTokenizer
Instance Attribute Summary
Attributes inherited from CTokenizer::LexerBase
Instance Method Summary collapse
-
#initialize(str, file = nil, line = 1) ⇒ Cache
constructor
A new instance of Cache.
- #reset ⇒ Object
- #scan(re) ⇒ Object
- #shift ⇒ Object
Methods inherited from CTokenizer::LexerBase
#empty?, #file, #line, #match?, #post_match
Methods included from CTokenizer
check_token, #collect, #each, #error, error, line_count, #parse_error, #to_a, #token_error, #warning, whitespace?
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
47 48 49 50 51 |
# File 'lib/dbc/dbc.rb', line 47 def reset cache = @token_cache @token_cache = CTokenizer::Cache.new(self.file, self.line) cache end |
#scan(re) ⇒ Object
35 36 37 38 39 |
# File 'lib/dbc/dbc.rb', line 35 def scan(re) str = super @token_cache << [:UNKNOWN, str.freeze].freeze str end |
#shift ⇒ Object
41 42 43 44 45 |
# File 'lib/dbc/dbc.rb', line 41 def shift t = super @token_cache << t t end |