1 /* PSPP - computes sample statistics.
2 Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 #include <data/identifier.h>
26 #include <data/variable.h>
27 #include <libpspp/getl.h>
32 struct lexer * lex_create (struct source_stream *);
33 void lex_destroy (struct lexer *);
35 struct source_stream * lex_get_source_stream (const struct lexer *);
38 /* Common functions. */
39 void lex_get (struct lexer *);
40 void lex_error (struct lexer *, const char *, ...);
41 void lex_sbc_only_once (const char *);
42 void lex_sbc_missing (struct lexer *, const char *);
43 int lex_end_of_command (struct lexer *);
45 /* Token testing functions. */
46 bool lex_is_number (struct lexer *);
47 double lex_number (struct lexer *);
48 bool lex_is_integer (struct lexer *);
49 long lex_integer (struct lexer *);
50 bool lex_is_string (struct lexer *);
53 /* Token matching functions. */
54 bool lex_match (struct lexer *, int);
55 bool lex_match_id (struct lexer *, const char *);
56 bool lex_match_int (struct lexer *, int);
58 /* Forcible matching functions. */
59 bool lex_force_match (struct lexer *, int);
60 bool lex_force_match_id (struct lexer *, const char *);
61 bool lex_force_int (struct lexer *);
62 bool lex_force_num (struct lexer *);
63 bool lex_force_id (struct lexer *);
64 bool lex_force_string (struct lexer *);
66 /* Weird token functions. */
67 int lex_look_ahead (struct lexer *);
68 void lex_put_back (struct lexer *, int);
69 void lex_put_back_id (struct lexer *, const char *tokid);
71 /* Weird line processing functions. */
72 const char *lex_entire_line (const struct lexer *);
73 const struct string *lex_entire_line_ds (const struct lexer *);
74 const char *lex_rest_of_line (const struct lexer *);
75 bool lex_end_dot (const struct lexer *);
76 void lex_preprocess_line (struct string *, enum getl_syntax,
77 bool *line_starts_command,
78 bool *line_ends_command);
79 void lex_discard_line (struct lexer *);
80 void lex_discard_rest_of_command (struct lexer *);
82 /* Weird line reading functions. */
83 bool lex_get_line (struct lexer *);
84 bool lex_get_line_raw (struct lexer *, enum getl_syntax *);
87 const char *lex_token_name (int);
88 char *lex_token_representation (struct lexer *);
91 int lex_token (const struct lexer *);
92 double lex_tokval (const struct lexer *);
93 const char *lex_tokid (const struct lexer *);
94 const struct string *lex_tokstr (const struct lexer *);
96 /* Really weird functions. */
97 void lex_negative_to_dash (struct lexer *);
98 void lex_skip_comment (struct lexer *);
100 #endif /* !lexer_h */