eece68f5aefc9285af609e19a555625b035e0550
[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 #ifndef DATA_IDENTIFIER_H
21 #define DATA_IDENTIFIER_H 1
22
23 #include <ctype.h>
24 #include <stdbool.h>
25 #include <sys/types.h>
26 #include <libpspp/str.h>
27
28 /* Token types. */
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
56 /* Tokens. */
57 bool lex_is_keyword (int token);
58
59 /* Recognizing identifiers. */
60 bool lex_is_id1 (char);
61 bool lex_is_idn (char);
62 size_t lex_id_get_length (struct substring);
63
64 /* Comparing identifiers. */
65 bool lex_id_match (struct substring keyword, struct substring token);
66 int lex_id_to_token (struct substring);
67
68 /* Identifier names. */
69 const char *lex_id_name (int);
70
71 #endif /* !data/identifier.h */