X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xshogi%2Fparser.y;h=809d3a4f9a89a35f2a5e97883e83923057553ab9;hb=597bdc54b866e7578023a56e2b340d9877792ebf;hp=33f8212fddbe3f526fe8571918c873619214f648;hpb=8ae7e7d1b257ef36d8a9fd1cd88807954ef10764;p=gnushogi.git diff --git a/xshogi/parser.y b/xshogi/parser.y index 33f8212..809d3a4 100644 --- a/xshogi/parser.y +++ b/xshogi/parser.y @@ -15,7 +15,7 @@ * Modified implementation of ISS mode for XShogi: Matthias Mutz * Current maintainer: Michael C. Vanier * - * XShogi borrows its piece bitmaps from CRANES Shogi. + * XShogi borrows some of its piece bitmaps from CRANES Shogi. * * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts. * Enhancements Copyright 1992 Free Software Foundation, Inc. @@ -89,10 +89,13 @@ extern void SendToProgram(char *message, FILE *fp); extern void MakeMove(ShogiMove *move_type, int from_x, int from_y, int to_x, int to_y); +int lines = 1, cols = 1; + %} %start goal -%token PROMOTE DROPS PIECE SQUARE NUMBER COMMENT COLON +%token PROMOTE DROPS PIECE SQUARE NUMBER COMMENT COLON +%token BLACK_WINS WHITE_WINS DRAW %union { int val; char* string; } @@ -170,21 +173,33 @@ extern void MakeMove(ShogiMove *move_type, int from_x, int from_y, strcpy(moveList[currentMove], currentMoveString); MakeMove(&move_type, from_x, from_y, to_x, to_y); } + | BLACK_WINS + { + loaded_game_finished = 1; + DisplayMessage("Black wins", False); + } + | WHITE_WINS + { + loaded_game_finished = 1; + DisplayMessage("White wins", False); + } + | DRAW + { + loaded_game_finished = 1; + DisplayMessage("Draw", False); + } ; promotion: | PROMOTE - { move_type = (BlackOnMove(currentMove) ? BlackPromotion : WhitePromotion); - strcat(currentMoveString,"+"); } + { move_type = (BlackOnMove(currentMove) + ? BlackPromotion : WhitePromotion); + strcat(currentMoveString,"+"); } ; %% - -#include "scanner.c" - - static void yyerror(char *errmsg) { if (strlen(token) > 0) @@ -202,6 +217,7 @@ static void yyerror(char *errmsg) exit(-1); } +extern FILE *yyin; void parseGameFile() {