From: H.G.Muller Date: Mon, 2 Mar 2015 21:12:36 +0000 (+0100) Subject: Wrap kif comments in braces X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=fe8b9b8e74f9192cffffb8e0eb95227a0eab086b Wrap kif comments in braces The parser assumes that a text that parsed as comment contained enclosing braces, but in kif files we have to apply those ourselves, to prevent a bare comment (starting with '*'!) to appear between the moves. --- diff --git a/parser.c b/parser.c index c997ccd..8acc2da 100644 --- a/parser.c +++ b/parser.c @@ -675,7 +675,12 @@ badMove:// we failed to find algebraic move commentEnd = *p; if(i) return Comment; // return comment that runs to EOF immediately } if(commentEnd) SkipWhite(p); - if(lastChar == '\n' && kifu && **p == '*') { while(**p && **p != '\n') (*p)++; return Comment; } // .kif comment + if(kifu && **p == '*') { // .kif comment + char *q = yytext; + while(**p && **p != '\n') { if(q < yytext + 10*MSG_SIZ-3) *q++ = **p; (*p)++; } + parseStart = yytext; *yytext = '{'; strcpy(q, "}\n"); // wrap in braces + return Comment; + } if(Match("*", p)) result = GameUnfinished; else if(**p == '0') { if( Match("0-1", p) || Match("0/1", p) || Match("0:1", p) ||