1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 1997-9, 2000, 2006 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. */
41 /* An abstract base class for objects which act as line buffers for the
42 PSPP. Ie anything which might contain content for the lexer */
45 /* Returns true if the interface is interactive, that is, if
46 it prompts a human user. This property is independent of
47 the syntax mode returned by the read member function. */
48 bool (*interactive) (const struct getl_interface *);
50 /* Read a line the intended syntax mode from the interface.
51 Returns true if succesful, false on failure or at end of
53 bool (*read) (struct getl_interface *,
54 struct string *, enum getl_syntax *);
56 /* Close and destroy the interface */
57 void (*close) (struct getl_interface *);
59 /* Filter for current and all included sources, which may
60 modify the line. Usually null. */
61 void (*filter) (struct getl_interface *,
62 struct string *line, enum getl_syntax);
64 /* Returns the name of the source */
65 const char * (*name) (const struct getl_interface *);
67 /* Returns the current location within the source */
68 int (*location) (const struct getl_interface *);
73 struct source_stream * create_source_stream (const char *);
74 void destroy_source_stream (struct source_stream *);
76 void getl_clear_include_path (struct source_stream *);
77 void getl_add_include_dir (struct source_stream *, const char *);
78 const char * getl_include_path (const struct source_stream *);
80 void getl_abort_noninteractive (struct source_stream *);
81 bool getl_is_interactive (const struct source_stream *);
83 bool getl_read_line (struct source_stream *, struct string *,
86 void getl_append_source (struct source_stream *, struct getl_interface *s) ;
87 void getl_include_source (struct source_stream *, struct getl_interface *s) ;
89 const char * getl_source_name (const struct source_stream *);
90 int getl_source_location (const struct source_stream *);
92 #endif /* line-buffer.h */