]> git.sesse.net Git - pgn-extract/blob - tokens.h
Add support for outputting positions in my own bit-packed FEN format.
[pgn-extract] / tokens.h
1 /*
2  *  Program: pgn-extract: a Portable Game Notation (PGN) extractor.
3  *  Copyright (C) 1994-2014 David Barnes
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 1, or (at your option)
7  *  any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  *
18  *  David Barnes may be contacted as D.J.Barnes@kent.ac.uk
19  *  http://www.cs.kent.ac.uk/people/staff/djb/
20  *
21  */
22
23         /* Define a type for lexical classification of tokens.
24          * Not all of these values are returned to the parser.
25          */
26 typedef enum {
27     /* The first section of tokens contains those that are
28      * returned to the parser as complete token identifications.
29      */
30     EOF_TOKEN, TAG, STRING, COMMENT, NAG,
31     CHECK_SYMBOL, MOVE_NUMBER, RAV_START, RAV_END,
32     MOVE, TERMINATING_RESULT,
33     /* The remaining tokens are those that are used to
34      * perform the identification.  They are not handled by
35      * the parser.
36      */
37     WHITESPACE, TAG_START, TAG_END, DOUBLE_QUOTE,
38     COMMENT_START, COMMENT_END, ANNOTATE,
39     DOT, PERCENT, ESCAPE, ALPHA, DIGIT,
40     STAR, DASH, EOS, OPERATOR, NO_TOKEN, ERROR_TOKEN
41 } TokenType;
42
43 typedef union {
44     /* This string is used to retain tag and result information. */
45     char *token_string;
46     /* Move information. */
47     Move *move_details;
48     unsigned move_number;
49     StringList *nags;
50     Variation *variation_details;
51     CommentList *comment;
52     /* An index into the Game_Header.Tags array for tag strings. */
53     unsigned tag_index;
54 } YYSTYPE;
55
56 extern YYSTYPE yylval;