Class: DBC::OCLParser

Inherits:
Parser show all
Defined in:
lib/dbc/dbc.rb

Overview

Parser

Instance Attribute Summary collapse

Attributes included from CTokenizer::Scoped

#scope

Instance Method Summary collapse

Methods inherited from Parser

#empty?, #file, #line

Methods included from CTokenizer::Scoped

#macro?, #process_scope, #start_of_line?

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) ⇒ OCLParser

Returns a new instance of OCLParser.



186
187
188
189
190
# File 'lib/dbc/dbc.rb', line 186

def initialize(str, file=nil, line=1)
	super(str, file, line)
	@conditions = {}
	@ctype_parser = CType::Parser.new()
end

Instance Attribute Details

#conditionsObject (readonly)

Returns the value of attribute conditions.



192
193
194
# File 'lib/dbc/dbc.rb', line 192

def conditions
  @conditions
end

Instance Method Details

#shiftObject



194
195
196
197
198
199
200
201
# File 'lib/dbc/dbc.rb', line 194

def shift
	t = super
	# note: comments don't affect start_of_line?
	if t[0] == :COMMENT and start_of_line? and ocl = DBC.get_ocl(t[1])
		parse_ocl(ocl)
	end
	t
end