1 /* PSPP - computes sample statistics.
2 Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
3 Written by Ben Pfaff <blp@gnu.org>.
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.
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.
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., 59 Temple Place - Suite 330, Boston, MA
25 /* Returns nonzero if character CH may be the first character in an
27 #define CHAR_IS_ID1(CH) \
28 (isalpha ((unsigned char) (CH)) \
33 /* Returns nonzero if character CH may be a character in an
34 identifier other than the first. */
35 #define CHAR_IS_IDN(CH) \
37 || isdigit ((unsigned char) (CH)) \
42 /* The order of the enumerals below is important. Do not change it. */
45 T_ID = 256, /* Identifier. */
46 T_POS_NUM, /* Positive number. */
47 T_NEG_NUM, /* Negative number. */
48 T_STRING, /* Quoted string. */
49 T_STOP, /* End of input. */
69 T_FIRST_KEYWORD = T_AND,
70 T_LAST_KEYWORD = T_WITH,
71 T_N_KEYWORDS = T_LAST_KEYWORD - T_FIRST_KEYWORD + 1
78 extern struct string tokstr;
86 /* Common functions. */
88 void lex_error (const char *, ...);
89 int lex_end_of_command (void);
91 /* Token testing functions. */
92 bool lex_is_number (void);
93 double lex_number (void);
94 bool lex_is_integer (void);
95 long lex_integer (void);
97 /* Token matching functions. */
99 int lex_match_id (const char *);
100 int lex_match_int (int);
102 /* Forcible matching functions. */
103 int lex_force_match (int);
104 int lex_force_match_id (const char *);
105 int lex_force_int (void);
106 int lex_force_num (void);
107 int lex_force_id (void);
108 int lex_force_string (void);
110 /* Comparing identifiers. */
111 int lex_id_match_len (const char *keyword_string, size_t keyword_len,
112 const char *token_string, size_t token_len);
113 int lex_id_match (const char *keyword_string, const char *token_string);
115 /* Weird token functions. */
116 int lex_look_ahead (void);
117 void lex_put_back (int);
118 void lex_put_back_id (const char *tokid);
120 /* Weird line processing functions. */
121 const char *lex_entire_line (void);
122 const char *lex_rest_of_line (int *end_dot);
123 void lex_discard_line (void);
124 void lex_set_prog (char *p);
126 /* Weird line reading functions. */
127 int lex_get_line (void);
128 void lex_preprocess_line (void);
131 const char *lex_token_name (int);
132 char *lex_token_representation (void);
134 /* Really weird functions. */
135 void lex_negative_to_dash (void);
136 void lex_reset_eof (void);
137 void lex_skip_comment (void);
139 #endif /* !lexer_h */