%% parse_paren
%   function will output the string contained within parenthesis,
%   including other opening and closing parenthesis.
% inputs:
%   string:string - string containing parenthesis
%   pos:int - position to start reading the string from, the
%       position of the oppening parenthesis
% outputs;
%   paren_string:string - the string contained within the
%       parenthesis
%   new_pos:int - the position where the ending parenthesis was found.
% Author: Colin Eles elesc@mcmaster.ca
% Organization: McMaster Centre for Software Certification
function [paren_string, new_pos] = parse_paren(string,pos)
% pos points to opening (
paren_string = string(pos);
i = pos+1;

while( string(i) ~= ')')
    if (string(i) == '(')
        [paren_string_temp, new_pos] = PVS_checker.parse_paren(string,i);
        paren_string = [paren_string paren_string_temp];
        i = new_pos;
    else
        paren_string = [paren_string string(i)];
    end
    i = i + 1;
end
paren_string = [paren_string string(i)];
new_pos = i;

end