Added new files resulting from directory restructuring.
[pspp-builds.git] / src / data / identifier.h
1 /* PSPP - computes sample statistics.
2    Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
3    Written by Ben Pfaff <blp@gnu.org>.
4
5    This program is free software; you can redistribute it and/or
6    modify it under the terms of the GNU General Public License as
7    published by the Free Software Foundation; either version 2 of the
8    License, or (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18    02110-1301, USA. */
19
20 #if !lex_def_h
21 #define lex_def_h 1
22
23 #include <ctype.h>
24 #include <stdbool.h>
25 #include <sys/types.h>
26
27 /* Token types. */
28 /* The order of the enumerals below is important.  Do not change it. */
29 enum
30   {
31     T_ID = 256, /* Identifier. */
32     T_POS_NUM,  /* Positive number. */
33     T_NEG_NUM,  /* Negative number. */
34     T_STRING,   /* Quoted string. */
35     T_STOP,     /* End of input. */
36
37     T_AND,      /* AND */
38     T_OR,       /* OR */
39     T_NOT,      /* NOT */
40
41     T_EQ,       /* EQ */
42     T_GE,       /* GE or >= */
43     T_GT,       /* GT or > */
44     T_LE,       /* LE or <= */
45     T_LT,       /* LT or < */
46     T_NE,       /* NE or ~= */
47
48     T_ALL,      /* ALL */
49     T_BY,       /* BY */
50     T_TO,       /* TO */
51     T_WITH,     /* WITH */
52
53     T_EXP,      /* ** */
54
55     T_FIRST_KEYWORD = T_AND,
56     T_LAST_KEYWORD = T_WITH,
57     T_N_KEYWORDS = T_LAST_KEYWORD - T_FIRST_KEYWORD + 1
58   };
59
60 /* Recognizing identifiers. */
61 bool lex_is_id1 (char);
62 bool lex_is_idn (char);
63 char *lex_skip_identifier (const char *);
64
65 /* Comparing identifiers. */
66 bool lex_id_match_len (const char *keyword_string, size_t keyword_len,
67                        const char *token_string, size_t token_len);
68 bool lex_id_match (const char *keyword_string, const char *token_string);
69 int lex_id_to_token (const char *id, size_t len);
70
71 #endif /* !lex_def_h */