class ParsingParcels
This is a collection of parsing aids to be used in other modules
Public Instance Methods
Source
# File lib/ceedling/parsing_parcels.rb, line 17 def code_lines(input) comment_block = false full_line = '' input.each_line do |line| m = line.match /(.*)\\\s*$/ if (!m.nil?) full_line += m[1] elsif full_line.empty? _line, comment_block = clean_code_line( line, comment_block ) yield( _line ) else _line, comment_block = clean_code_line( full_line + line, comment_block ) yield( _line ) full_line = '' end end end
This parser accepts a collection of lines which it will sweep through and tidy, giving the purified lines to the block (one line at a time) for further analysis. It analyzes a single line at a time, which is far more memory efficient and faster for large files. However, this requires it to also handle backslash line continuations as a single line at this point.