test/vendor/ceedling/vendor/cmock/lib/cmock_header_parser.rb
# Return the number of pairs of braces/square brackets in the function provided by the user
# +source+:: String containing the function to be processed
Return the number of pairs of braces/square brackets in the function provided by the user
+source+:: String containing the function to be processed
Return the number of pairs of braces / square brackets in the function provided by the user + source + :: String containing the function to be processed
def count_number_of_pairs_of_braces_in_function(source)
    is_function_start_found = false
    curr_level = 0
    total_pairs = 0
    source.each_char do |c|
      if ("{" == c)
        curr_level += 1
        total_pairs  +=1
        is_function_start_found = true
      elsif ("}" == c)
        curr_level -=1
      end
      break if is_function_start_found && curr_level == 0    
    end
    if 0 != curr_level
      total_pairs = 0          
    end
    return total_pairs
  end
def count_number_of_pairs_of_braces_in_function ( source ) is_function_start_found = false curr_level = 0 total_pairs = 0 source . each_char do | c | if ( "{" == c ) curr_level += 1 total_pairs += 1 is_function_start_found = true elsif ( "}" == c ) curr_level -= 1 end break if is_function_start_found && curr_level == 0 end if 0 != curr_level total_pairs = 0 end return total_pairs end
Return the number of pairs of braces/square brackets in the function provided by the user
+source+:: String containing the function to be processed
Return the number of pairs of braces / square brackets in the function provided by the user + source + :: String containing the function to be processed
# We reached the end of the inline function body # Something is fishy about this source, not enough closing braces?
source