lib/adarwin/preprocessor.rb in bones-compiler-1.3.1 vs lib/adarwin/preprocessor.rb in bones-compiler-1.6.0

- old
+ new

@@ -18,20 +18,21 @@ def initialize(source_code) @source_code = source_code @header_code = '' @parsed_code = '' @target_code = '' - @scop_code = '' + @scop_code = [] end # This is the method to perform the actual preprocessing. This method takes # care of all the pre-processor tasks. The output is stored in the two # attributes +header_code+, and +scop+. # FIXME: What about multi-line statements? For example, a multi-line comment # could have a commented-out SCoP or define or include. def process scop = false + scop_code = '' scop_in_code = false # Process the file line by line @source_code.each_line.with_index do |line,index| if line =~ /^#{WHITESPACE}#/ @@ -53,15 +54,17 @@ @parsed_code += '{'+NL # Found the end of a SCoP elsif line =~ /^#{WHITESPACE}#{SCOP_END}/ scop = false + @scop_code.push(scop_code) + scop_code = '' @parsed_code += '}'+NL end # Nothing special in the code going on here else - @scop_code += line if scop + scop_code += line if scop @parsed_code += line @target_code += line end end