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);
91 /* Token matching functions. */
93 int lex_match_id (const char *);
94 int lex_match_int (int);
96 /* Forcible matching functions. */
97 int lex_force_match (int);
98 int lex_force_match_id (const char *);
99 int lex_force_int (void);
100 int lex_force_num (void);
101 int lex_force_id (void);
102 int lex_force_string (void);
104 /* Comparing identifiers. */
105 int lex_id_match_len (const char *keyword_string, size_t keyword_len,
106 const char *token_string, size_t token_len);
107 int lex_id_match (const char *keyword_string, const char *token_string);
109 /* Weird token functions. */
110 int lex_look_ahead (void);
111 void lex_put_back (int);
112 void lex_put_forward (int);
114 /* Weird line processing functions. */
115 char *lex_entire_line (void);
116 char *lex_rest_of_line (int *had_dot);
117 void lex_discard_line (void);
118 void lex_set_prog (char *p);
120 /* Weird line reading functions. */
121 int lex_get_line (void);
122 void lex_preprocess_line (void);
125 const char *lex_token_name (int);
126 char *lex_token_representation (void);
128 /* Really weird functions. */
129 void lex_negative_to_dash (void);
130 void lex_reset_eof (void);
131 void lex_skip_comment (void);
133 #endif /* !lexer_h */