7 * ------------------------------------------------------------------------
8 * xshogi is based on XBoard -- an Xt/Athena user interface for GNU Chess.
10 * Original authors: Dan Sears, Chris Sears
11 * Enhancements (Version 2.0 and following): Tim Mann
12 * Modifications to XShogi (Version 1.0): Matthias Mutz
13 * Enhancements to XShogi (Version 1.1): Matthias Mutz
14 * Modified implementation of ISS mode for XShogi: Matthias Mutz
15 * Current maintainer: Michael C. Vanier
17 * XShogi borrows some of its piece bitmaps from CRANES Shogi.
19 * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
20 * Enhancements Copyright 1992 Free Software Foundation, Inc.
21 * Enhancements for XShogi Copyright 1993, 1994, 1995 Matthias Mutz
22 * Copyright (c) 1999 Michael Vanier and the Free Software Foundation
24 * The following terms apply to Digital Equipment Corporation's copyright
26 * ------------------------------------------------------------------------
29 * Permission to use, copy, modify, and distribute this software and its
30 * documentation for any purpose and without fee is hereby granted,
31 * provided that the above copyright notice appear in all copies and that
32 * both that copyright notice and this permission notice appear in
33 * supporting documentation, and that the name of Digital not be
34 * used in advertising or publicity pertaining to distribution of the
35 * software without specific, written prior permission.
37 * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
38 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
39 * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
40 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
41 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
42 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
44 * ------------------------------------------------------------------------
46 * This file is part of GNU shogi.
48 * GNU shogi is free software; you can redistribute it and/or modify
49 * it under the terms of the GNU General Public License as published by
50 * the Free Software Foundation.
52 * GNU shogi is distributed in the hope that it will be useful,
53 * but WITHOUT ANY WARRANTY; without even the implied warranty of
54 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
55 * GNU General Public License for more details.
57 * You should have received a copy of the GNU General Public License
58 * along with GNU shogi; see the file COPYING. If not, write to
59 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
61 * ------------------------------------------------------------------------
65 static int lines = 1, cols = 1;
75 "White wins" { return WHITE_WINS; }
76 "Black wins" { return BLACK_WINS; }
77 "Draw" { return DRAW; }
79 "\n" { lines++; cols = 1; }
80 "+" { cols++; return PROMOTE; }
81 "*" { cols++; return DROPS; }
82 "'" { cols++; return DROPS; }
83 "." { cols++; return COLON; }
84 {PIECE} { yylval.string = yytext; cols += strlen(yytext); return PIECE; }
85 {SQUARE} { yylval.string = yytext; cols += strlen(yytext); return SQUARE; }
86 {NUMBER} { yylval.string = yytext; cols += strlen(yytext); return NUMBER; }
87 {COMMENT} { yylval.string = yytext; lines++; cols = 1; return COMMENT; }
93 * This is to avoid having to link in a lex library;
94 * flex also allows the "%option noyywrap" option but
95 * I don't think that's generally true of other lex