1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 1997-9, 2000, 2006, 2010 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU 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, see <http://www.gnu.org/licenses/>. */
21 #include <libpspp/ll.h>
27 /* Syntax rules that apply to a given source line. */
30 /* Each line that begins in column 1 starts a new command. A
31 `+' or `-' in column 1 is ignored to allow visual
32 indentation of new commands. Continuation lines must be
33 indented from the left margin. A period at the end of a
34 line does end a command, but it is optional. */
37 /* Each command must end in a period or in a blank line. */
43 /* When errors are encountered, report the error and continue to
47 /* When errors are encountered, abort the current stream. */
51 /* An abstract base class for objects which act as line buffers for the
52 PSPP. Ie anything which might contain content for the lexer */
55 /* Returns true if the interface is interactive, that is, if
56 it prompts a human user. This property is independent of
57 the syntax mode returned by the read member function. */
58 bool (*interactive) (const struct getl_interface *);
60 /* Read a line the intended syntax mode from the interface.
61 Returns true if succesful, false on failure or at end of
63 bool (*read) (struct getl_interface *,
66 /* Close and destroy the interface */
67 void (*close) (struct getl_interface *);
69 /* Filter for current and all included sources, which may
70 modify the line. Usually null. */
71 void (*filter) (struct getl_interface *,
74 /* Returns the name of the source */
75 const char * (*name) (const struct getl_interface *);
77 /* Returns the current location within the source */
78 int (*location) (const struct getl_interface *);
83 struct source_stream *create_source_stream (void);
85 enum syntax_mode source_stream_current_syntax_mode
86 (const struct source_stream *);
89 enum error_mode source_stream_current_error_mode
90 (const struct source_stream *);
93 void destroy_source_stream (struct source_stream *);
95 void getl_clear_include_path (struct source_stream *);
96 void getl_add_include_dir (struct source_stream *, const char *);
97 char **getl_include_path (const struct source_stream *);
99 void getl_abort_noninteractive (struct source_stream *);
100 bool getl_is_interactive (const struct source_stream *);
102 bool getl_read_line (struct source_stream *, struct string *);
104 void getl_append_source (struct source_stream *, struct getl_interface *s,
105 enum syntax_mode, enum error_mode) ;
107 void getl_include_source (struct source_stream *, struct getl_interface *s,
108 enum syntax_mode, enum error_mode) ;
110 const char * getl_source_name (const struct source_stream *);
111 int getl_source_location (const struct source_stream *);
113 #endif /* line-buffer.h */