annotate src/parse.h @ 14138:72c96de7a403 stable

maint: update copyright notices for 2012
author John W. Eaton <jwe@octave.org>
date Mon, 02 Jan 2012 14:25:41 -0500
parents c93b953f7d54
children 8d1ae996c122
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
1 /*
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
2
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 13970
diff changeset
3 Copyright (C) 1993-2012 John W. Eaton
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
4
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
6
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6109
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6109
diff changeset
10 option) any later version.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
11
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
15 for more details.
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
16
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6109
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6109
diff changeset
19 <http://www.gnu.org/licenses/>.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
20
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
21 */
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
22
383
0b52c68ec81f [project @ 1994-03-09 21:19:44 by jwe]
jwe
parents: 338
diff changeset
23 #if !defined (octave_parse_h)
0b52c68ec81f [project @ 1994-03-09 21:19:44 by jwe]
jwe
parents: 338
diff changeset
24 #define octave_parse_h 1
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
25
3021
18d64612e67a [project @ 1997-06-03 22:18:56 by jwe]
jwe
parents: 2907
diff changeset
26 #include <cstdio>
18d64612e67a [project @ 1997-06-03 22:18:56 by jwe]
jwe
parents: 2907
diff changeset
27
1755
3a9462b655f1 [project @ 1996-01-22 04:47:22 by jwe]
jwe
parents: 1315
diff changeset
28 #include <string>
3a9462b655f1 [project @ 1996-01-22 04:47:22 by jwe]
jwe
parents: 1315
diff changeset
29
4426
51a0dcde8778 [project @ 2003-06-13 19:16:37 by jwe]
jwe
parents: 4342
diff changeset
30 #include <stack>
51a0dcde8778 [project @ 2003-06-13 19:16:37 by jwe]
jwe
parents: 4342
diff changeset
31
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
32 extern void reset_parser (void);
4753
9f0ce1536368 [project @ 2004-02-13 17:55:24 by jwe]
jwe
parents: 4486
diff changeset
33 extern int octave_lex (void);
9f0ce1536368 [project @ 2004-02-13 17:55:24 by jwe]
jwe
parents: 4486
diff changeset
34 extern int octave_parse (void);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
35
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
36 class tree;
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
37 class tree_matrix;
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
38 class tree_identifier;
13970
c93b953f7d54 plug some memory leaks
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
39 class tree_statement_list;
7102
a627f27c1e8e [project @ 2007-11-06 17:02:11 by jwe]
jwe
parents: 7017
diff changeset
40 class octave_function;
3772
e44ffad3d06c [project @ 2001-02-03 06:23:38 by jwe]
jwe
parents: 3523
diff changeset
41
e44ffad3d06c [project @ 2001-02-03 06:23:38 by jwe]
jwe
parents: 3523
diff changeset
42 #include "oct-obj.h"
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
43
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
44 // Nonzero means print parser debugging info (-d).
4753
9f0ce1536368 [project @ 2004-02-13 17:55:24 by jwe]
jwe
parents: 4486
diff changeset
45 extern int octave_debug;
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
46
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
47 // The current input line number.
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
48 extern int input_line_number;
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
49
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
50 // The column of the current token.
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
51 extern int current_input_column;
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
52
338
82d30a23c979 [project @ 1994-02-07 07:09:33 by jwe]
jwe
parents: 195
diff changeset
53 // Buffer for help text snagged from function files.
4426
51a0dcde8778 [project @ 2003-06-13 19:16:37 by jwe]
jwe
parents: 4342
diff changeset
54 extern std::stack<std::string> help_buf;
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
55
3021
18d64612e67a [project @ 1997-06-03 22:18:56 by jwe]
jwe
parents: 2907
diff changeset
56 // TRUE means we are using readline.
18d64612e67a [project @ 1997-06-03 22:18:56 by jwe]
jwe
parents: 2907
diff changeset
57 extern bool line_editing;
18d64612e67a [project @ 1997-06-03 22:18:56 by jwe]
jwe
parents: 2907
diff changeset
58
18d64612e67a [project @ 1997-06-03 22:18:56 by jwe]
jwe
parents: 2907
diff changeset
59 // TRUE means we printed messages about reading startup files.
18d64612e67a [project @ 1997-06-03 22:18:56 by jwe]
jwe
parents: 2907
diff changeset
60 extern bool reading_startup_message_printed;
18d64612e67a [project @ 1997-06-03 22:18:56 by jwe]
jwe
parents: 2907
diff changeset
61
18d64612e67a [project @ 1997-06-03 22:18:56 by jwe]
jwe
parents: 2907
diff changeset
62 // TRUE means input is coming from startup file.
18d64612e67a [project @ 1997-06-03 22:18:56 by jwe]
jwe
parents: 2907
diff changeset
63 extern bool input_from_startup_file;
18d64612e67a [project @ 1997-06-03 22:18:56 by jwe]
jwe
parents: 2907
diff changeset
64
4186
bf9c5ca4c3f3 [project @ 2002-11-19 00:33:40 by jwe]
jwe
parents: 3772
diff changeset
65 // Keep track of symbol table information when parsing functions.
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7102
diff changeset
66 extern std::stack<symbol_table::scope_id> symtab_context;
4238
a5a68c0afe56 [project @ 2002-12-25 21:04:33 by jwe]
jwe
parents: 4214
diff changeset
67
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7102
diff changeset
68 // Name of the current class when we are parsing class methods or
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7102
diff changeset
69 // constructors.
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7102
diff changeset
70 extern std::string current_class_name;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7102
diff changeset
71
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5975
diff changeset
72 extern OCTINTERP_API std::string
5484
2ff5363a16bd [project @ 2005-10-06 17:12:12 by jwe]
jwe
parents: 5312
diff changeset
73 get_help_from_file (const std::string& nm, bool& symbol_found,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
74 std::string& file);
5931
25da9a7d5f6d [project @ 2006-08-16 06:52:19 by jwe]
jwe
parents: 5781
diff changeset
75
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5975
diff changeset
76 extern OCTINTERP_API std::string
5931
25da9a7d5f6d [project @ 2006-08-16 06:52:19 by jwe]
jwe
parents: 5781
diff changeset
77 get_help_from_file (const std::string& nm, bool& symbol_found);
5484
2ff5363a16bd [project @ 2005-10-06 17:12:12 by jwe]
jwe
parents: 5312
diff changeset
78
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5975
diff changeset
79 extern OCTINTERP_API std::string lookup_autoload (const std::string& nm);
3021
18d64612e67a [project @ 1997-06-03 22:18:56 by jwe]
jwe
parents: 2907
diff changeset
80
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5975
diff changeset
81 extern OCTINTERP_API string_vector autoloaded_functions (void);
5592
61d6cebd243b [project @ 2006-01-12 17:55:22 by dbateman]
dbateman
parents: 5484
diff changeset
82
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5975
diff changeset
83 extern OCTINTERP_API string_vector reverse_lookup_autoload (const std::string& nm);
5592
61d6cebd243b [project @ 2006-01-12 17:55:22 by dbateman]
dbateman
parents: 5484
diff changeset
84
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7102
diff changeset
85 extern OCTINTERP_API octave_function *
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7102
diff changeset
86 load_fcn_from_file (const std::string& file_name,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
87 const std::string& dir_name = std::string (),
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
88 const std::string& dispatch_type = std::string (),
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
89 const std::string& fcn_name = std::string (),
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
90 bool autoload = false);
3021
18d64612e67a [project @ 1997-06-03 22:18:56 by jwe]
jwe
parents: 2907
diff changeset
91
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5975
diff changeset
92 extern OCTINTERP_API void
5975
e64059303a6f [project @ 2006-08-29 16:37:39 by jwe]
jwe
parents: 5931
diff changeset
93 source_file (const std::string& file_name,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
94 const std::string& context = std::string (),
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
95 bool verbose = false, bool require_file = true,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
96 const std::string& warn_for = std::string ());
4486
6ceba1f351fb [project @ 2003-08-22 16:49:46 by jwe]
jwe
parents: 4426
diff changeset
97
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5975
diff changeset
98 extern OCTINTERP_API octave_value_list
3772
e44ffad3d06c [project @ 2001-02-03 06:23:38 by jwe]
jwe
parents: 3523
diff changeset
99 feval (const std::string& name,
e44ffad3d06c [project @ 2001-02-03 06:23:38 by jwe]
jwe
parents: 3523
diff changeset
100 const octave_value_list& args = octave_value_list (),
e44ffad3d06c [project @ 2001-02-03 06:23:38 by jwe]
jwe
parents: 3523
diff changeset
101 int nargout = 0);
3156
a494f93e60ff [project @ 1998-02-20 07:47:48 by jwe]
jwe
parents: 3100
diff changeset
102
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5975
diff changeset
103 extern OCTINTERP_API octave_value_list
4342
813effe14ee1 [project @ 2003-02-20 08:35:55 by jwe]
jwe
parents: 4238
diff changeset
104 feval (octave_function *fcn,
813effe14ee1 [project @ 2003-02-20 08:35:55 by jwe]
jwe
parents: 4238
diff changeset
105 const octave_value_list& args = octave_value_list (),
813effe14ee1 [project @ 2003-02-20 08:35:55 by jwe]
jwe
parents: 4238
diff changeset
106 int nargout = 0);
813effe14ee1 [project @ 2003-02-20 08:35:55 by jwe]
jwe
parents: 4238
diff changeset
107
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5975
diff changeset
108 extern OCTINTERP_API octave_value_list
3772
e44ffad3d06c [project @ 2001-02-03 06:23:38 by jwe]
jwe
parents: 3523
diff changeset
109 feval (const octave_value_list& args, int nargout = 0);
3021
18d64612e67a [project @ 1997-06-03 22:18:56 by jwe]
jwe
parents: 2907
diff changeset
110
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5975
diff changeset
111 extern OCTINTERP_API octave_value_list
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3489
diff changeset
112 eval_string (const std::string&, bool silent, int& parse_status, int hargout);
3099
8ce6fed79320 [project @ 1997-11-14 09:49:28 by jwe]
jwe
parents: 3021
diff changeset
113
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5975
diff changeset
114 extern OCTINTERP_API octave_value
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3489
diff changeset
115 eval_string (const std::string&, bool silent, int& parse_status);
3021
18d64612e67a [project @ 1997-06-03 22:18:56 by jwe]
jwe
parents: 2907
diff changeset
116
13970
c93b953f7d54 plug some memory leaks
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
117 extern OCTINTERP_API void cleanup_statement_list (tree_statement_list **lst);
c93b953f7d54 plug some memory leaks
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
118
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
119 #endif