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
23 /* Returns nonzero if character CH may be the first character in an
25 #define CHAR_IS_ID1(CH) \
26 (isalpha ((unsigned char) (CH)) \
31 /* Returns nonzero if character CH may be a character in an
32 identifier other than the first. */
33 #define CHAR_IS_IDN(CH) \
35 || isdigit ((unsigned char) (CH)) \
40 /* The order of the enumerals below is important. Do not change it. */
43 T_ID = 256, /* Identifier. */
45 T_STRING, /* Quoted string. */
46 T_STOP, /* End of input. */
66 T_FIRST_KEYWORD = T_AND,
67 T_LAST_KEYWORD = T_WITH,
68 T_N_KEYWORDS = T_LAST_KEYWORD - T_FIRST_KEYWORD + 1,
75 extern struct string tokstr;
82 /* Common functions. */
84 void lex_error (const char *, ...);
85 int lex_end_of_command (void);
87 /* Token testing functions. */
88 int lex_integer_p (void);
89 long lex_integer (void);
90 int lex_double_p (void);
91 double lex_double (void);
93 /* Token matching functions. */
95 int lex_match_id (const char *);
96 int lex_match_int (int);
98 /* Forcible matching functions. */
99 int lex_force_match (int);
100 int lex_force_match_id (const char *);
101 int lex_force_int (void);
102 int lex_force_num (void);
103 int lex_force_id (void);
104 int lex_force_string (void);
106 /* Comparing identifiers. */
107 int lex_id_match_len (const char *keyword_string, size_t keyword_len,
108 const char *token_string, size_t token_len);
109 int lex_id_match (const char *keyword_string, const char *token_string);
111 /* Weird token functions. */
112 int lex_look_ahead (void);
113 void lex_put_back (int);
114 void lex_put_back_id (const char *tokid);
116 /* Weird line processing functions. */
117 char *lex_entire_line (void);
118 char *lex_rest_of_line (int *had_dot);
119 void lex_discard_line (void);
120 void lex_set_prog (char *p);
122 /* Weird line reading functions. */
123 int lex_get_line (void);
124 void lex_preprocess_line (void);
127 const char *lex_token_name (int);
128 char *lex_token_representation (void);
130 /* Really weird functions. */
131 void lex_negative_to_dash (void);
132 void lex_reset_eof (void);
133 void lex_skip_comment (void);
135 #endif /* !lexer_h */