Class: DBC::Parser
Constant Summary
Constants included
from CTokenizer
CTokenizer::EOF_TOKEN
Instance Attribute Summary
#scope
#source
Instance Method Summary
collapse
#macro?, #process_scope, #start_of_line?
#match?, #post_match, #scan
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) ⇒ Parser
Returns a new instance of Parser.
156
157
158
159
160
161
162
|
# File 'lib/dbc/dbc.rb', line 156
def initialize(str, file=nil, line=1)
super(str, file, line)
@token_cache = CTokenizer::Cache.new(super.file, super.line)
@scope = 0
@macro = false
@start_line = true end
|
Instance Method Details
#empty? ⇒ Boolean
168
169
170
|
# File 'lib/dbc/dbc.rb', line 168
def empty?
@token_cache.empty? and super
end
|
#file ⇒ Object
172
173
174
175
176
177
178
|
# File 'lib/dbc/dbc.rb', line 172
def file
if @token_cache.empty?
super
else
@token_cache.file
end
end
|
#line ⇒ Object
180
181
182
183
184
185
186
|
# File 'lib/dbc/dbc.rb', line 180
def line
if @token_cache.empty?
super
else
@token_cache.line
end
end
|
#shift ⇒ Object
164
165
166
|
# File 'lib/dbc/dbc.rb', line 164
def shift
process_scope(@token_cache.empty? ? super : @token_cache.shift)
end
|