X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xshogi%2Fscanner.l;h=92ec42f8c9f2437287d25679d9de98ec8590ac4e;hb=597bdc54b866e7578023a56e2b340d9877792ebf;hp=3dcf8dc169740652987d9e9a0f35854cf327ec91;hpb=8ae7e7d1b257ef36d8a9fd1cd88807954ef10764;p=gnushogi.git diff --git a/xshogi/scanner.l b/xshogi/scanner.l index 3dcf8dc..92ec42f 100644 --- a/xshogi/scanner.l +++ b/xshogi/scanner.l @@ -14,7 +14,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. @@ -61,8 +61,11 @@ * ------------------------------------------------------------------------ * */ - -static int lines = 1, cols = 1; + +#include "parser.h" + +extern int lines, cols; + %} PIECE [PLNSGBRK] @@ -72,15 +75,19 @@ COMMENT ["#"]([^\n])* %% -"\n" { lines++; cols = 1; } +"White wins" { return WHITE_WINS; } +"Black wins" { return BLACK_WINS; } +"Draw" { return DRAW; } + +"\n" { lines++; cols = 1; } "+" { cols++; return PROMOTE; } -"*" { cols++; return DROPS; } -"'" { cols++; return DROPS; } -"." { cols++; return COLON; } -{PIECE} { yylval.string = yytext; cols += strlen(yytext); return PIECE; } -{SQUARE} { yylval.string = yytext; cols += strlen(yytext); return SQUARE; } -{NUMBER} { yylval.string = yytext; cols += strlen(yytext); return NUMBER; } -{COMMENT} { yylval.string = yytext; lines++; cols = 1; return COMMENT; } +"*" { cols++; return DROPS; } +"'" { cols++; return DROPS; } +"." { cols++; return COLON; } +{PIECE} { yylval.string = yytext; cols += strlen(yytext); return PIECE; } +{SQUARE} { yylval.string = yytext; cols += strlen(yytext); return SQUARE; } +{NUMBER} { yylval.string = yytext; cols += strlen(yytext); return NUMBER; } +{COMMENT} { yylval.string = yytext; lines++; cols = 1; return COMMENT; } . { cols++; } %%