function out = iscoloninind(line,colpos)
%   This software is protected by german copyright and international treaties.             
%   Copyright 2004 Markus Junghöfer & Peter Peyk. All Rights Reserved.                     
%                                                                                          
%   THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE        
%   NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO,    
%   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE    
%   OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
%   TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT,       
%   INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE      
%   OR DOCUMENTATION.                                                                      
if isempty(line)
    out = 0;
    return
end
if ~strcmp(line(colpos),':')
    error('invalid colon position in iscoloninarg!');
end


lbracks = findstr(line,'(');
rbracks = findstr(line,')');

if isempty(lbracks) & isempty(rbracks)
    out = 0;
    return
end

if length(lbracks)~=length(rbracks)
    error('invalid bracketing in iscoloninarg!');
end

closestleftbrack = findleftopenbrackof(line,colpos);
counter = 0;
while line(closestleftbrack-1)==' '
    line(closestleftbrack-1)=[];
    counter = counter +1;
    closestleftbrack = findleftopenbrackof(line,colpos-counter);
end
if ~isempty(closestleftbrack)
	if ~isdelimiter(line(closestleftbrack-1))
		endpos = closestleftbrack-1;
		startpos = endpos;
		while ~isdelimiter(line(startpos))
            startpos = startpos-1;
            if startpos<1
                startpos = 0;
                break;
            end
        end
        startpos = startpos +1;
        tmpstring = deblankex(line(startpos:endpos));
        if strcmp(tmpstring,'transpose') |strcmp(tmpstring,'ctranspose')|strcmp(tmpstring,'colon') |...
                exist(tmpstring)==5 | exist(tmpstring)==2 |exist(tmpstring)==6 |strcmp(tmpstring,'ldivide') |...
                strcmp(tmpstring,'mldivide') |strcmp(tmpstring,'rdivide') |strcmp(tmpstring,'mrdivide') |...
                strcmp(tmpstring,'times') | strcmp(tmpstring,'mtimes') |  strcmp(tmpstring,'power') |...
                strcmp(tmpstring,'mpower') | strcmp(tmpstring,'mpower')|strcmp(tmpstring,'horzcat')|strcmp(tmpstring,'vercat')
            out = 0;
            return
        else
            out = 1;
            return
        end
	else
        if strcmp(line(closestleftbrack-1),'*') | strcmp(line(closestleftbrack-1),'/') | strcmp(line(closestleftbrack-1),'^') | strcmp(line(closestleftbrack-1),';')
            out = 0;
            return
        elseif strcmp(line(closestleftbrack-1),',')
            ownerpos = closestleftbrack-1;
            while 1
                leftbrack = findleftbrackof(line,ownerpos);
                [owner,ownerpos] = getbrackowner(line,leftbrack);
                if isopstring(owner)
                    out = 0;
                    return
                elseif strcmp(owner,'*') | strcmp(owner,'/') | strcmp(owner,'^') | strcmp(owner,';')
                    out = 0;
                    return
                elseif ~strcmp(owner,'(') & ~strcmp(owner,',')
                    out = 1;
                    return
                end
            end
        else
            out = 0;
            return
        end 
	end
else
    out = 0;
    return
end


return