Class: DBC::Parser
Instance Attribute Summary
#scope
Instance Method Summary
collapse
#macro?, #process_scope, #start_of_line?
#peek_nonspace
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, whitespace?
Constructor Details
#initialize(str, file = nil, line = 1) ⇒ Parser
Returns a new instance of Parser.
150
151
152
153
154
155
156
|
# File 'lib/dbc/dbc.rb', line 150
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
162
163
164
|
# File 'lib/dbc/dbc.rb', line 162
def empty?
@token_cache.empty? and super
end
|
#file ⇒ Object
166
167
168
169
170
171
172
|
# File 'lib/dbc/dbc.rb', line 166
def file
if @token_cache.empty?
super
else
@token_cache.file
end
end
|
#line ⇒ Object
174
175
176
177
178
179
180
|
# File 'lib/dbc/dbc.rb', line 174
def line
if @token_cache.empty?
super
else
@token_cache.line
end
end
|
#shift ⇒ Object
158
159
160
|
# File 'lib/dbc/dbc.rb', line 158
def shift
process_scope(@token_cache.empty? ? super : @token_cache.shift)
end
|