Change license from GPLv2+ to GPLv3+.
[pspp-builds.git] / src / data / identifier.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
3
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 3 of the License, or
7    (at your option) 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, see <http://www.gnu.org/licenses/>. */
16
17 #ifndef DATA_IDENTIFIER_H
18 #define DATA_IDENTIFIER_H 1
19
20 #include <ctype.h>
21 #include <stdbool.h>
22 #include <sys/types.h>
23 #include <libpspp/str.h>
24
25 /* Token types. */
26 enum
27   {
28     T_ID = 256, /* Identifier. */
29     T_POS_NUM,  /* Positive number. */
30     T_NEG_NUM,  /* Negative number. */
31     T_STRING,   /* Quoted string. */
32     T_STOP,     /* End of input. */
33
34     T_AND,      /* AND */
35     T_OR,       /* OR */
36     T_NOT,      /* NOT */
37
38     T_EQ,       /* EQ */
39     T_GE,       /* GE or >= */
40     T_GT,       /* GT or > */
41     T_LE,       /* LE or <= */
42     T_LT,       /* LT or < */
43     T_NE,       /* NE or ~= */
44
45     T_ALL,      /* ALL */
46     T_BY,       /* BY */
47     T_TO,       /* TO */
48     T_WITH,     /* WITH */
49
50     T_EXP,      /* ** */
51   };
52
53 /* Tokens. */
54 bool lex_is_keyword (int token);
55
56 /* Recognizing identifiers. */
57 bool lex_is_id1 (char);
58 bool lex_is_idn (char);
59 size_t lex_id_get_length (struct substring);
60
61 /* Comparing identifiers. */
62 bool lex_id_match (struct substring keyword, struct substring token);
63 int lex_id_to_token (struct substring);
64
65 /* Identifier names. */
66 const char *lex_id_name (int);
67
68 #endif /* !data/identifier.h */