mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-09-22 10:07:25 +00:00
prettified debug output produced for function prototype parsing that fails
git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@177 bf332499-1b4d-0410-844d-d2d48d5cc64c
This commit is contained in:
@@ -236,14 +236,33 @@ class CMockHeaderParser
|
||||
if (decl[:return][:type].nil? or decl[:name].nil? or decl[:args].nil? or
|
||||
decl[:return][:type].empty? or decl[:name].empty?)
|
||||
raise "Failed Parsing Declaration Prototype!\n" +
|
||||
" declaration: #{declaration}\n" +
|
||||
" modifier: #{decl[:modifier]}\n" +
|
||||
" return: #{decl[:return]}\n" +
|
||||
" function: #{decl[:name]}\n" +
|
||||
" args:#{decl[:args]}\n"
|
||||
" declaration: '#{declaration}'\n" +
|
||||
" modifier: '#{decl[:modifier]}'\n" +
|
||||
" return: #{prototype_inspect_hash(decl[:return])}\n" +
|
||||
" function: '#{decl[:name]}'\n" +
|
||||
" args: #{prototype_inspect_array_of_hashes(decl[:args])}\n"
|
||||
end
|
||||
|
||||
|
||||
return decl
|
||||
end
|
||||
|
||||
def prototype_inspect_hash(hash)
|
||||
pairs = []
|
||||
hash.each_pair { |name, value| pairs << ":#{name} => #{"'" if (value.class == String)}#{value}#{"'" if (value.class == String)}" }
|
||||
return "{#{pairs.join(', ')}}"
|
||||
end
|
||||
|
||||
def prototype_inspect_array_of_hashes(array)
|
||||
hashes = []
|
||||
array.each { |hash| hashes << prototype_inspect_hash(hash) }
|
||||
case (array.size)
|
||||
when 0
|
||||
return "[]"
|
||||
when 1
|
||||
return "[#{hashes[0]}]"
|
||||
else
|
||||
return "[\n #{hashes.join("\n ")}\n ]\n"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user