Bracket Matching by yamaya

BEGIN{FS=OFS=x}{for(i=p=0;$++i;$i=x)if((a=index(")]}>",$i))-index("([{<",s[p])){s[++p]=$i;if(a)break}else--p}$0=p?"failed at: "($0?$0:"EOL"):"yes"

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page