accept c++-style comments for interoperability with foreign code. Reference: /n/sources/patch/applied/yacccmt Date: Sat Nov 21 17:24:45 CET 2009 Signed-off-by: quanstro@quanstro.net --- /sys/src/cmd/yacc.c Sat Nov 21 17:23:24 2009 +++ /sys/src/cmd/yacc.c Sat Nov 21 17:23:18 2009 @@ -1918,17 +1918,22 @@ /* i is the number of lines skipped */ i = 0; - if(Bgetrune(finput) != '*') - error("illegal comment"); c = Bgetrune(finput); - while(c != Beof) { - while(c == '*') - if((c=Bgetrune(finput)) == '/') - return i; - if(c == '\n') - i++; - c = Bgetrune(finput); - } + if(c == '/'){ + while((c = Bgetrune(finput)) != Beof) + if(c == '\n') + return 1; + }else if(c == '*'){ + while((c = Bgetrune(finput)) != Beof) { + while(c == '*') + if((c=Bgetrune(finput)) == '/') + return i; + if(c == '\n') + i++; + } + }else + error("illegal comment"); + error("EOF inside comment"); return 0; }