From fe8b9b8e74f9192cffffb8e0eb95227a0eab086b Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Mon, 2 Mar 2015 22:12:36 +0100 Subject: [PATCH] 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. --- parser.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) 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) || -- 1.7.0.4