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;
83 /* Common functions. */
85 void lex_error (const char *, ...);
86 int lex_end_of_command (void);
88 /* Token testing functions. */
89 int lex_integer_p (void);
90 long lex_integer (void);
91 int lex_double_p (void);
92 double lex_double (void);
94 /* Token matching functions. */
96 int lex_match_id (const char *);
97 int lex_match_int (int);
99 /* Forcible matching functions. */
100 int lex_force_match (int);
101 int lex_force_match_id (const char *);
102 int lex_force_int (void);
103 int lex_force_num (void);
104 int lex_force_id (void);
105 int lex_force_string (void);
107 /* Comparing identifiers. */
108 int lex_id_match_len (const char *keyword_string, size_t keyword_len,
109 const char *token_string, size_t token_len);
110 int lex_id_match (const char *keyword_string, const char *token_string);
112 /* Weird token functions. */
113 int lex_look_ahead (void);
114 void lex_put_back (int);
115 void lex_put_back_id (const char *tokid);
117 /* Weird line processing functions. */
118 const char *lex_entire_line (void);
119 const char *lex_rest_of_line (int *end_dot);
120 void lex_discard_line (void);
121 void lex_set_prog (char *p);
123 /* Weird line reading functions. */
124 int lex_get_line (void);
125 void lex_preprocess_line (void);
128 const char *lex_token_name (int);
129 char *lex_token_representation (void);
131 /* Really weird functions. */
132 void lex_negative_to_dash (void);
133 void lex_reset_eof (void);
134 void lex_skip_comment (void);
136 #endif /* !lexer_h */