Class: DBC::OCLParser

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

Overview

Parser

Constant Summary

Constants included from CTokenizer

CTokenizer::EOF_TOKEN

Instance Attribute Summary collapse

Attributes included from CTokenizer::Scoped

#scope

Attributes inherited from CTokenizer::LexerBase

#source

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

Returns a new instance of OCLParser.



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

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.



198
199
200
# File 'lib/dbc/dbc.rb', line 198

def conditions
  @conditions
end

Instance Method Details

#shiftObject



200
201
202
203
204
205
206
207
# File 'lib/dbc/dbc.rb', line 200

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