X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=parser.l;h=88567ef132f7d191b6a2f778806d350f4b5d4679;hb=12921be07acd4ac78e94a1c5699f1183f76b1c93;hp=ac665815d52e47a357f0a6cb369500fe00d12ee2;hpb=a9f394f721b7c2b69aed0f7fd8ddf01c197a8b09;p=xboard.git diff --git a/parser.l b/parser.l index ac66581..88567ef 100644 --- a/parser.l +++ b/parser.l @@ -178,7 +178,7 @@ extern void CopyBoard P((Board to, Board from)); %} %% -"+"?[A-Z][/]?[a-l][0-9][xX:-]?[a-l][0-9]((=?\(?[A-Z]\)?)|[=+])? { +"+"?[A-Z][/]?[a-l][0-9][xX:-]?[a-l][0-9](([=/]?\(?[A-Z]\)?)|[=+])? { /* * Fully-qualified algebraic move, possibly with promotion */ @@ -268,7 +268,7 @@ extern void CopyBoard P((Board to, Board from)); return (int) result; } -[a-l][0-9][xX:-]?[a-l][0-9]((=?\(?[A-Za-z]\)?)|[=+])? { +[a-l][0-9][xX:-]?[a-l][0-9](([=/]?\(?[A-Za-z]\)?)|[=+])? { /* * Simple algebraic move, possibly with promotion * [HGM] Engine moves are received in this format, with lower-case promoChar! @@ -330,7 +330,7 @@ extern void CopyBoard P((Board to, Board from)); } else if(result == WhiteNonPromotion || result == BlackNonPromotion) currentMoveString[4] = '='; currentMoveString[5] = NULLCHAR; - } else if(appData.testLegality && // strip off unnecessary and false promo characters + } else if(appData.testLegality && gameInfo.variant != VariantSChess && // strip off unnecessary and false promo characters !(result == WhitePromotion || result == BlackPromotion || result == WhiteNonPromotion || result == BlackNonPromotion)) currentMoveString[4] = NULLCHAR; @@ -592,7 +592,7 @@ extern void CopyBoard P((Board to, Board from)); } } -"+"?[A-Z][xX:-]?[a-l][0-9]((=?\(?[A-Z]\)?)|[=+])? { +"+"?[A-Z][xX:-]?[a-l][0-9](([=/]?\(?[A-Z]\)?)|[=+])? { /* * piece move, possibly ambiguous */ @@ -620,7 +620,7 @@ extern void CopyBoard P((Board to, Board from)); cl.ftIn = yytext[1+skip] - AAA; cl.promoCharIn = NULLCHAR; - if(yyleng-skip > 3 && gameInfo.variant == VariantShogi) /* [HGM] can have Shogi-style promotion */ + if(yyleng-skip > 3 && (gameInfo.variant == VariantShogi || gameInfo.variant == VariantSChess)) /* [HGM] can have Shogi-style promotion */ cl.promoCharIn = yytext[yyleng-1-(yytext[yyleng-1]==')')]; if(cl.promoCharIn == '+' && gameInfo.variant != VariantShogi) cl.promoCharIn = NULLCHAR; // + means check outside Shogi @@ -649,7 +649,7 @@ extern void CopyBoard P((Board to, Board from)); return (int) cl.kind; } -"+"?[A-Z][a-l0-9][xX:-]?[a-l][0-9]((=?\(?[A-Z]\)?)|[=+])? { +"+"?[A-Z][a-l0-9][xX:-]?[a-l][0-9](([=/]?\(?[A-Z]\)?)|[=+])? { /* * piece move with rank or file disambiguator */ @@ -687,7 +687,7 @@ extern void CopyBoard P((Board to, Board from)); cl.ftIn = yytext[2+skip] - AAA; cl.promoCharIn = NULLCHAR; - if(yyleng-skip > 4) /* [HGM] can have Shogi-style promotion */ + if(yyleng-skip > 4 && (gameInfo.variant == VariantShogi || gameInfo.variant == VariantSChess)) /* [HGM] can have Shogi-style promotion */ cl.promoCharIn = yytext[yyleng-1-(yytext[yyleng-1]==')')]; if(cl.promoCharIn == '+' && gameInfo.variant != VariantShogi) cl.promoCharIn = NULLCHAR; // + means check outside Shogi @@ -823,6 +823,9 @@ extern void CopyBoard P((Board to, Board from)); } [A-Za-z][@*][a-l][0-9] { + + if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ + /* Bughouse piece drop. */ currentMoveString[1] = '@'; currentMoveString[2] = yytext[2];