Mercurial > octave
annotate libinterp/parse-tree/parse.h @ 16676:7368654f302f classdef
Initial support for (classdef) packages.
* libinterp/interpfcn/load-path.h (class load_path::loader): New class.
(load_path::default_loader, load_path::loader_map): New members.
(load_path::load_path): Initialize them.
(load_path::fcn_map, load_path::private_fcn_map,
load_path::method_map): Move to class load_path::loader.
(load_path::add_to_fcn_map, load_path::add_to_private_fcn_map,
load_path::add_to_method_map, load_path::move_fcn_map,
load_path::move_method_map, load_path::remove_fcn_map,
load_path::remove_private_fcn_map, load_path::remove_method_map):
Move to class load_path::loader.
(load_path::move): Change signature.
(load_path::do_move, load_path::remove, load_path::add,
load_path::get_loader): New methods.
(load_path::find_package, load_path::do_find_package): Likewise.
(load_path::dir_info::package_dir_map): New member.
(load_path::dir_info::dir_info, load_path::dir_info::operator=):
Initialize/assign it.
(load_path::dir_info::get_package_dir): New method.
(load_path::do_find_fcn, load_path::do_find_private_fcn): Remove
methods.
(load_path::find_fcn, load_path::find_private_fcn,
load_path::find_fcn_file, load_path::find_oct_file,
load_path::find_mex_file): Rewrite using class load_path::loader.
New argument for package name.
*libinterp/interpfcn/load-path.cc (load_path::dir_info::initialize):
Clear package_map_dir.
(load_path::dir_info::get_package_dir): New method.
(load_path::dir_info::get_files_list): Use it.
(load_path::add_to_fcn_map, load_path::add_to_private_fcn_map,
load_path::add_to_method_map, load_path::move_fcn_map,
load_path::move_method_map, load_path::remove_fcn_map,
load_path::remove_private_fcn_map, load_path::remove_method_map):
Move to class load_path::loader.
(load_path::move): Move implementation to do_move, rewrite using
class load_path::loader. Signature change.
(load_path::do_move, load_path::add, load_path::remove): New methods.
(load_path::do_clear): Rewrite using class load_path::loader.
(load_path::do_add): Use "do_move" and "add" methods.
(load_path::do_remove): Rewrite using "remove" method.
(load_path::do_update): Rewitre using class load_path::loader and
"add" method.
(load_path::do_find_method, load_path::do_methods,
load_path::do_overloads, load_path::do_fcn_names, load_path::do_display):
Move Implementation to class load_path::loader, without "do_" prefix.
Rewrite original to redirect to appropriate loaders.
(F__dump_load_path__): New debug function.
* libinterp/interpfcn/symtab.h (symbol_table::package_name): New member.
(symbol_table::symbol_table): Initialize it.
(symbol_table::find): New scope argument.
(symbol_table::alloc_package_scope): New method.
(symbol_table::fcn_info::find, symbol_table::fcn_info::find_function,
symbol_table::fcn_info::find_user_function,
symbol_table::fcn_info::fcn_info_rep::xfind,
symbol_table::fcn_info::fcn_info_rep::load_class_constructor,
symbol_table::fcn_info::fcn_info_rep::find,
symbol_table::fcn_info::fcn_info_rep::find_user_function): New
argument for package name.
(symbol_table::fcn_info::fcn_info_rep::package): New member.
(symbol_table::fcn_info::fcn_info_rep::find_package,
symbol_table::fcn_info::fcn_info_rep::clear_package): New methods.
(symbol_table::fcn_info::fcn_info_rep::clear): Clear package.
* libinterp/interpfcn/symtab.cc
(symbol_table::fcn_info::fcn_info_rep::load_class_constructor,
symbol_table::fcn_info::fcn_info_rep::find,
symbol_table::fcn_info::fcn_info_rep::xfind,
symbol_table::fcn_info::fcn_info_rep::find_user_function):
New argument for package name.
(symbol_table::fcn_info::fcn_info_rep::find_package): New method.
(symbol_table::find): New scope argument.
(symbol_table::do_find): Use package_name member.
* libinterp/octave-value/ov-classdef.h
(cdef_package::cdef_package_rep::scope): New member.
(cdef_package::cdef_package_rep::~cdef_package_rep): New destructor.
(cdef_package::cdef_package_rep::meta_subsref,
cdef_package::cdef_package_rep::meta_release,
cdef_package::cdef_package_rep::meta_is_postfix_index_handled,
cdef_package::cdef_package_rep::find,
cdef_package::cdef_package_rep::wrap): New methods.
(cdef_package::find): New method.
(cdef_manager::find_package, cdef_manager::do_find_package): New
argument "load_if_not_found".
(cdef_manager::find_package_symbol,
cdef_manager::do_find_package_symbol): New methods.
* libinterp/octave-value/ov-classdef.cc
(cdef_manager::do_find_package_symbol): New method.
(cdef_manager::do_find_package): New argument. Create package object if
it is not loaded yet and the package exists in load_path.
(cdef_manager::do_find_class): Handle class names with package.
(cdef_package::cdef_package_rep::meta_subsref,
cdef_package::cdef_package_rep::meta_release,
cdef_package::cdef_package_rep::find): New methods.
(cdef_class::make_meta_class): Handle package-scoped classes.
(make_package): Assign correct name to the package object.
* libinterp/parse-tree/pt-classdef.h (tree_classdef::pack_name): New
member.
(tree_classdef::tree_classdef): New argument. Initialize it.
(tree_classdef::package_name): New accessor.
* libinterp/parse-tree/parse.h (octave_base_parser::curr_package_name):
New member.
(octave_base_parser::octave_base_parser): Initialize it.
(load_fcn_from_file): New argument for package name.
* libinterp/parse-tree/oct-parse.in.yy (load_fcn_from_file): New
argument for package name. Change callers.
(parse_fcn_from_file): New argument for package name. Change callers.
(octave_base_parser::make_classdef): Use curr_package_name to create
the tree_classdef object.
* libinterp/octave-value/ov-fcn-handle.cc (octave_fcn_handle::set_fcn):
Adapt to new load_fcn_from_file signature.
* libinterp/interp-core/ls-mat5.cc (read_mat5_binary_element): Adapt
to new load_fcn_from_file signature.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Fri, 17 May 2013 23:17:25 -0400 |
parents | 856cb7cba231 |
children | c702371ff6df |
rev | line source |
---|---|
1 | 1 /* |
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 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
1 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
1 | 20 |
21 */ | |
22 | |
383 | 23 #if !defined (octave_parse_h) |
24 #define octave_parse_h 1 | |
1 | 25 |
3021 | 26 #include <cstdio> |
27 | |
1755 | 28 #include <string> |
29 | |
4426 | 30 #include <stack> |
16153
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
31 #include <vector> |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
32 #include <map> |
4426 | 33 |
16139
2fd39ab12209
move a function and data member from lexical_feedback to octave_parser
John W. Eaton <jwe@octave.org>
parents:
16138
diff
changeset
|
34 #include "lex.h" |
16153
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
35 #include "symtab.h" |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
36 #include "token.h" |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
37 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
38 class octave_comment_list; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
39 class octave_function; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
40 class octave_user_function; |
1 | 41 class tree; |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
42 class tree_anon_fcn_handle; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
43 class tree_argument_list; |
16237
70f465930546
rearrange class heirarchy for tree_cell and tree_matrix
John W. Eaton <jwe@octave.org>
parents:
16210
diff
changeset
|
44 class tree_array_list; |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
45 class tree_cell; |
16155
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
46 class tree_classdef; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
47 class tree_classdef_attribute_list; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
48 class tree_classdef_body; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
49 class tree_classdef_enum_block; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
50 class tree_classdef_enum_list; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
51 class tree_classdef_events_block; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
52 class tree_classdef_events_list; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
53 class tree_classdef_methods_block; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
54 class tree_classdef_methods_list; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
55 class tree_classdef_properties_block; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
56 class tree_classdef_property_list; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
57 class tree_classdef_superclass_list; |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
58 class tree_colon_expression; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
59 class tree_command; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
60 class tree_constant; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
61 class tree_decl_command; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
62 class tree_decl_init_list; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
63 class tree_expression; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
64 class tree_fcn_handle; |
16155
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
65 class tree_funcall; |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
66 class tree_function_def; |
1 | 67 class tree_identifier; |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
68 class tree_if_clause; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
69 class tree_if_command; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
70 class tree_if_command_list; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
71 class tree_index_expression; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
72 class tree_matrix; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
73 class tree_matrix; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
74 class tree_parameter_list; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
75 class tree_statement; |
13970 | 76 class tree_statement_list; |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
77 class tree_statement_listtree_statement; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
78 class tree_switch_case; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
79 class tree_switch_case_list; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
80 class tree_switch_command; |
3772 | 81 |
82 #include "oct-obj.h" | |
1 | 83 |
84 // Nonzero means print parser debugging info (-d). | |
4753 | 85 extern int octave_debug; |
1 | 86 |
3021 | 87 // TRUE means we printed messages about reading startup files. |
88 extern bool reading_startup_message_printed; | |
89 | |
6109 | 90 extern OCTINTERP_API std::string |
5484 | 91 get_help_from_file (const std::string& nm, bool& symbol_found, |
10313 | 92 std::string& file); |
5931 | 93 |
6109 | 94 extern OCTINTERP_API std::string |
5931 | 95 get_help_from_file (const std::string& nm, bool& symbol_found); |
5484 | 96 |
6109 | 97 extern OCTINTERP_API std::string lookup_autoload (const std::string& nm); |
3021 | 98 |
6109 | 99 extern OCTINTERP_API string_vector autoloaded_functions (void); |
5592 | 100 |
6109 | 101 extern OCTINTERP_API string_vector reverse_lookup_autoload (const std::string& nm); |
5592 | 102 |
7336 | 103 extern OCTINTERP_API octave_function * |
104 load_fcn_from_file (const std::string& file_name, | |
10313 | 105 const std::string& dir_name = std::string (), |
106 const std::string& dispatch_type = std::string (), | |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16644
diff
changeset
|
107 const std::string& package_name = std::string (), |
10313 | 108 const std::string& fcn_name = std::string (), |
109 bool autoload = false); | |
3021 | 110 |
6109 | 111 extern OCTINTERP_API void |
5975 | 112 source_file (const std::string& file_name, |
10313 | 113 const std::string& context = std::string (), |
114 bool verbose = false, bool require_file = true, | |
115 const std::string& warn_for = std::string ()); | |
4486 | 116 |
6109 | 117 extern OCTINTERP_API octave_value_list |
3772 | 118 feval (const std::string& name, |
119 const octave_value_list& args = octave_value_list (), | |
120 int nargout = 0); | |
3156 | 121 |
6109 | 122 extern OCTINTERP_API octave_value_list |
4342 | 123 feval (octave_function *fcn, |
124 const octave_value_list& args = octave_value_list (), | |
125 int nargout = 0); | |
126 | |
6109 | 127 extern OCTINTERP_API octave_value_list |
3772 | 128 feval (const octave_value_list& args, int nargout = 0); |
3021 | 129 |
6109 | 130 extern OCTINTERP_API octave_value_list |
3523 | 131 eval_string (const std::string&, bool silent, int& parse_status, int hargout); |
3099 | 132 |
6109 | 133 extern OCTINTERP_API octave_value |
3523 | 134 eval_string (const std::string&, bool silent, int& parse_status); |
3021 | 135 |
13970 | 136 extern OCTINTERP_API void cleanup_statement_list (tree_statement_list **lst); |
137 | |
16149
49dfba4fd3c5
use pure parser and reentrant lexer interfaces
John W. Eaton <jwe@octave.org>
parents:
16142
diff
changeset
|
138 // Global access to currently active lexer. |
49dfba4fd3c5
use pure parser and reentrant lexer interfaces
John W. Eaton <jwe@octave.org>
parents:
16142
diff
changeset
|
139 // FIXME -- to be removed after more parser+lexer refactoring. |
16293
57e87ddfee14
create base class for lexer
John W. Eaton <jwe@octave.org>
parents:
16288
diff
changeset
|
140 extern octave_base_lexer *LEXER; |
16149
49dfba4fd3c5
use pure parser and reentrant lexer interfaces
John W. Eaton <jwe@octave.org>
parents:
16142
diff
changeset
|
141 |
16133
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
142 class |
16287
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
143 octave_base_parser |
16133
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
144 { |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
145 public: |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
146 |
16293
57e87ddfee14
create base class for lexer
John W. Eaton <jwe@octave.org>
parents:
16288
diff
changeset
|
147 octave_base_parser (octave_base_lexer& lxr) |
16195
b52d2f9294b6
use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents:
16177
diff
changeset
|
148 : endfunction_found (false), |
b52d2f9294b6
use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents:
16177
diff
changeset
|
149 autoloading (false), fcn_file_from_relative_lookup (false), |
b52d2f9294b6
use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents:
16177
diff
changeset
|
150 parsing_subfunctions (false), max_fcn_depth (0), |
b52d2f9294b6
use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents:
16177
diff
changeset
|
151 curr_fcn_depth (0), primary_fcn_scope (-1), |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16644
diff
changeset
|
152 curr_class_name (), curr_package_name (), function_scopes (), |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16644
diff
changeset
|
153 primary_fcn_ptr (0), subfunction_names (), classdef_object (0), |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16644
diff
changeset
|
154 stmt_list (0), lexer (lxr) |
16195
b52d2f9294b6
use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents:
16177
diff
changeset
|
155 { |
b52d2f9294b6
use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents:
16177
diff
changeset
|
156 init (); |
b52d2f9294b6
use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents:
16177
diff
changeset
|
157 } |
b52d2f9294b6
use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents:
16177
diff
changeset
|
158 |
16293
57e87ddfee14
create base class for lexer
John W. Eaton <jwe@octave.org>
parents:
16288
diff
changeset
|
159 ~octave_base_parser (void); |
16157
335041cc657a
optionally use push parser interface
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
160 |
335041cc657a
optionally use push parser interface
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
161 void init (void); |
16133
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
162 |
16177
a7669b4d27f6
eliminate global global_command variable
John W. Eaton <jwe@octave.org>
parents:
16164
diff
changeset
|
163 void reset (void); |
16139
2fd39ab12209
move a function and data member from lexical_feedback to octave_parser
John W. Eaton <jwe@octave.org>
parents:
16138
diff
changeset
|
164 |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
165 // Error mesages for mismatched end tokens. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
166 void end_error (const char *type, token::end_tok_type ettype, int l, int c); |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
167 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
168 // Check to see that end tokens are properly matched. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
169 bool end_token_ok (token *tok, token::end_tok_type expected); |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
170 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
171 // Maybe print a warning if an assignment expression is used as the |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
172 // test in a logical expression. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
173 void maybe_warn_assign_as_truth_value (tree_expression *expr); |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
174 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
175 // Maybe print a warning about switch labels that aren't constants. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
176 void maybe_warn_variable_switch_label (tree_expression *expr); |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
177 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
178 // Finish building a range. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
179 tree_expression *finish_colon_expression (tree_colon_expression *e); |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
180 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
181 // Build a constant. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
182 tree_constant *make_constant (int op, token *tok_val); |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
183 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
184 // Build a function handle. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
185 tree_fcn_handle *make_fcn_handle (token *tok_val); |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
186 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
187 // Build an anonymous function handle. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
188 tree_anon_fcn_handle * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
189 make_anon_fcn_handle (tree_parameter_list *param_list, tree_statement *stmt); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
190 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
191 // Build a binary expression. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
192 tree_expression * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
193 make_binary_op (int op, tree_expression *op1, token *tok_val, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
194 tree_expression *op2); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
195 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
196 // Build a boolean expression. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
197 tree_expression * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
198 make_boolean_op (int op, tree_expression *op1, token *tok_val, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
199 tree_expression *op2); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
200 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
201 // Build a prefix expression. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
202 tree_expression * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
203 make_prefix_op (int op, tree_expression *op1, token *tok_val); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
204 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
205 // Build a postfix expression. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
206 tree_expression * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
207 make_postfix_op (int op, tree_expression *op1, token *tok_val); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
208 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
209 // Build an unwind-protect command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
210 tree_command * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
211 make_unwind_command (token *unwind_tok, tree_statement_list *body, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
212 tree_statement_list *cleanup, token *end_tok, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
213 octave_comment_list *lc, octave_comment_list *mc); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
214 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
215 // Build a try-catch command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
216 tree_command * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
217 make_try_command (token *try_tok, tree_statement_list *body, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
218 tree_statement_list *cleanup, token *end_tok, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
219 octave_comment_list *lc, octave_comment_list *mc); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
220 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
221 // Build a while command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
222 tree_command * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
223 make_while_command (token *while_tok, tree_expression *expr, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
224 tree_statement_list *body, token *end_tok, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
225 octave_comment_list *lc); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
226 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
227 // Build a do-until command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
228 tree_command * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
229 make_do_until_command (token *until_tok, tree_statement_list *body, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
230 tree_expression *expr, octave_comment_list *lc); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
231 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
232 // Build a for command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
233 tree_command * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
234 make_for_command (int tok_id, token *for_tok, tree_argument_list *lhs, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
235 tree_expression *expr, tree_expression *maxproc, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
236 tree_statement_list *body, token *end_tok, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
237 octave_comment_list *lc); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
238 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
239 // Build a break command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
240 tree_command *make_break_command (token *break_tok); |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
241 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
242 // Build a continue command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
243 tree_command *make_continue_command (token *continue_tok); |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
244 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
245 // Build a return command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
246 tree_command *make_return_command (token *return_tok); |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
247 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
248 // Start an if command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
249 tree_if_command_list * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
250 start_if_command (tree_expression *expr, tree_statement_list *list); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
251 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
252 // Finish an if command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
253 tree_if_command * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
254 finish_if_command (token *if_tok, tree_if_command_list *list, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
255 token *end_tok, octave_comment_list *lc); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
256 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
257 // Build an elseif clause. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
258 tree_if_clause * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
259 make_elseif_clause (token *elseif_tok, tree_expression *expr, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
260 tree_statement_list *list, octave_comment_list *lc); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
261 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
262 // Finish a switch command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
263 tree_switch_command * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
264 finish_switch_command (token *switch_tok, tree_expression *expr, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
265 tree_switch_case_list *list, token *end_tok, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
266 octave_comment_list *lc); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
267 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
268 // Build a switch case. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
269 tree_switch_case * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
270 make_switch_case (token *case_tok, tree_expression *expr, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
271 tree_statement_list *list, octave_comment_list *lc); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
272 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
273 // Build an assignment to a variable. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
274 tree_expression * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
275 make_assign_op (int op, tree_argument_list *lhs, token *eq_tok, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
276 tree_expression *rhs); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
277 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
278 // Define a script. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
279 void make_script (tree_statement_list *cmds, tree_statement *end_script); |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
280 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
281 // Begin defining a function. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
282 octave_user_function * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
283 start_function (tree_parameter_list *param_list, tree_statement_list *body, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
284 tree_statement *end_function); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
285 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
286 // Create a no-op statement for end_function. |
16627
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16335
diff
changeset
|
287 tree_statement *make_end (const std::string& type, bool eof, int l, int c); |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
288 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
289 // Do most of the work for defining a function. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
290 octave_user_function * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
291 frob_function (const std::string& fname, octave_user_function *fcn); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
292 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
293 // Finish defining a function. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
294 tree_function_def * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
295 finish_function (tree_parameter_list *ret_list, |
16627
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16335
diff
changeset
|
296 octave_user_function *fcn, octave_comment_list *lc, |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16335
diff
changeset
|
297 int l, int c); |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
298 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
299 // Reset state after parsing function. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
300 void |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
301 recover_from_parsing_function (void); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
302 |
16155
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
303 tree_funcall * |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
304 make_superclass_ref (const std::string& method_nm, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
305 const std::string& package_nm, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
306 const std::string& class_nm, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
307 int l, int c); |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
308 |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
309 tree_funcall * |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
310 make_meta_class_query (const std::string& package_nm, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
311 const std::string& class_nm, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
312 int l, int c); |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
313 |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
314 tree_classdef * |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
315 make_classdef (token *tok_val, tree_classdef_attribute_list *a, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
316 tree_identifier *id, tree_classdef_superclass_list *sc, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
317 tree_classdef_body *body, token *end_tok, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
318 octave_comment_list *lc); |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
319 |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
320 tree_classdef_properties_block * |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
321 make_classdef_properties_block (token *tok_val, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
322 tree_classdef_attribute_list *a, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
323 tree_classdef_property_list *plist, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
324 token *end_tok, octave_comment_list *lc); |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
325 |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
326 tree_classdef_methods_block * |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
327 make_classdef_methods_block (token *tok_val, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
328 tree_classdef_attribute_list *a, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
329 tree_classdef_methods_list *mlist, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
330 token *end_tok, octave_comment_list *lc); |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
331 |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
332 tree_classdef_events_block * |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
333 make_classdef_events_block (token *tok_val, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
334 tree_classdef_attribute_list *a, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
335 tree_classdef_events_list *elist, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
336 token *end_tok, octave_comment_list *lc); |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
337 |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
338 tree_classdef_enum_block * |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
339 make_classdef_enum_block (token *tok_val, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
340 tree_classdef_attribute_list *a, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
341 tree_classdef_enum_list *elist, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
342 token *end_tok, octave_comment_list *lc); |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
343 |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
344 // Make an index expression. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
345 tree_index_expression * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
346 make_index_expression (tree_expression *expr, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
347 tree_argument_list *args, char type); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
348 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
349 // Make an indirect reference expression. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
350 tree_index_expression * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
351 make_indirect_ref (tree_expression *expr, const std::string&); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
352 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
353 // Make an indirect reference expression with dynamic field name. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
354 tree_index_expression * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
355 make_indirect_ref (tree_expression *expr, tree_expression *field); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
356 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
357 // Make a declaration command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
358 tree_decl_command * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
359 make_decl_command (int tok, token *tok_val, tree_decl_init_list *lst); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
360 |
16273
c5e5f6ccac5d
9/10 commits reworking the lexer
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
361 // Validate matrix or cell |
c5e5f6ccac5d
9/10 commits reworking the lexer
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
362 bool validate_array_list (tree_expression *e); |
c5e5f6ccac5d
9/10 commits reworking the lexer
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
363 |
c5e5f6ccac5d
9/10 commits reworking the lexer
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
364 // Validate matrix object used in "[lhs] = ..." assignments. |
c5e5f6ccac5d
9/10 commits reworking the lexer
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
365 tree_argument_list *validate_matrix_for_assignment (tree_expression *e); |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
366 |
16237
70f465930546
rearrange class heirarchy for tree_cell and tree_matrix
John W. Eaton <jwe@octave.org>
parents:
16210
diff
changeset
|
367 // Finish building an array_list (common action for finish_matrix |
70f465930546
rearrange class heirarchy for tree_cell and tree_matrix
John W. Eaton <jwe@octave.org>
parents:
16210
diff
changeset
|
368 // and finish_cell). |
70f465930546
rearrange class heirarchy for tree_cell and tree_matrix
John W. Eaton <jwe@octave.org>
parents:
16210
diff
changeset
|
369 tree_expression *finish_array_list (tree_array_list *a); |
70f465930546
rearrange class heirarchy for tree_cell and tree_matrix
John W. Eaton <jwe@octave.org>
parents:
16210
diff
changeset
|
370 |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
371 // Finish building a matrix list. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
372 tree_expression *finish_matrix (tree_matrix *m); |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
373 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
374 // Finish building a cell list. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
375 tree_expression *finish_cell (tree_cell *c); |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
376 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
377 // Maybe print a warning. Duh. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
378 void maybe_warn_missing_semi (tree_statement_list *); |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
379 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
380 // Set the print flag for a statement based on the separator type. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
381 tree_statement_list * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
382 set_stmt_print_flag (tree_statement_list *, char, bool); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
383 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
384 // Create a statement list. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
385 tree_statement_list *make_statement_list (tree_statement *stmt); |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
386 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
387 // Append a statement to an existing statement list. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
388 tree_statement_list * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
389 append_statement_list (tree_statement_list *list, char sep, |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
390 tree_statement *stmt, bool warn_missing_semi); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
391 |
16142
26d65d677557
rename yyerror to bison_error and make it a member of octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16139
diff
changeset
|
392 // Generic error messages. |
26d65d677557
rename yyerror to bison_error and make it a member of octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16139
diff
changeset
|
393 void bison_error (const char *s); |
26d65d677557
rename yyerror to bison_error and make it a member of octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16139
diff
changeset
|
394 |
16153
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
395 // Have we found an explicit end to a function? |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
396 bool endfunction_found; |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
397 |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
398 // TRUE means we are in the process of autoloading a function. |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
399 bool autoloading; |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
400 |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
401 // TRUE means the current function file was found in a relative path |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
402 // element. |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
403 bool fcn_file_from_relative_lookup; |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
404 |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
405 // FALSE if we are still at the primary function. Subfunctions can |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
406 // only be declared inside function files. |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
407 bool parsing_subfunctions; |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
408 |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
409 // Maximum function depth detected. Used to determine whether |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
410 // we have nested functions or just implicitly ended subfunctions. |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
411 int max_fcn_depth; |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
412 |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
413 // = 0 currently outside any function. |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
414 // = 1 inside the primary function or a subfunction. |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
415 // > 1 means we are looking at a function definition that seems to be |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
416 // inside a function. Note that the function still might not be a |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
417 // nested function. |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
418 int curr_fcn_depth; |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
419 |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
420 // Scope where we install all subfunctions and nested functions. Only |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
421 // used while reading function files. |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
422 symbol_table::scope_id primary_fcn_scope; |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
423 |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
424 // Name of the current class when we are parsing class methods or |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
425 // constructors. |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
426 std::string curr_class_name; |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
427 |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16644
diff
changeset
|
428 // Name of the current package when we are parsing an element contained |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16644
diff
changeset
|
429 // in a package directory (+-directory). |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16644
diff
changeset
|
430 std::string curr_package_name; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16644
diff
changeset
|
431 |
16153
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
432 // A stack holding the nested function scopes being parsed. |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
433 // We don't use std::stack, because we want the clear method. Also, we |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
434 // must access one from the top |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
435 std::vector<symbol_table::scope_id> function_scopes; |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
436 |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
437 // Pointer to the primary user function or user script function. |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
438 octave_function *primary_fcn_ptr; |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
439 |
16627
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16335
diff
changeset
|
440 // List of subfunction names, initially in the order they are |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16335
diff
changeset
|
441 // installed in the symbol table, then ordered as they appear in the |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16335
diff
changeset
|
442 // file. Eventually stashed in the primary function object. |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16335
diff
changeset
|
443 std::list<std::string> subfunction_names; |
de91b1621260
adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents:
16335
diff
changeset
|
444 |
16155
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
445 // Pointer to the classdef object we just parsed, if any. |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
446 tree_classdef *classdef_object; |
16211
3449bf257514
maint: fix botched merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16205
diff
changeset
|
447 |
16177
a7669b4d27f6
eliminate global global_command variable
John W. Eaton <jwe@octave.org>
parents:
16164
diff
changeset
|
448 // Result of parsing input. |
a7669b4d27f6
eliminate global global_command variable
John W. Eaton <jwe@octave.org>
parents:
16164
diff
changeset
|
449 tree_statement_list *stmt_list; |
a7669b4d27f6
eliminate global global_command variable
John W. Eaton <jwe@octave.org>
parents:
16164
diff
changeset
|
450 |
16149
49dfba4fd3c5
use pure parser and reentrant lexer interfaces
John W. Eaton <jwe@octave.org>
parents:
16142
diff
changeset
|
451 // State of the lexer. |
16293
57e87ddfee14
create base class for lexer
John W. Eaton <jwe@octave.org>
parents:
16288
diff
changeset
|
452 octave_base_lexer& lexer; |
16149
49dfba4fd3c5
use pure parser and reentrant lexer interfaces
John W. Eaton <jwe@octave.org>
parents:
16142
diff
changeset
|
453 |
16287
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
454 private: |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
455 |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
456 // No copying! |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
457 |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
458 octave_base_parser (const octave_base_parser&); |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
459 |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
460 octave_base_parser& operator = (const octave_base_parser&); |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
461 }; |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
462 |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
463 class |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
464 octave_parser : public octave_base_parser |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
465 { |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
466 public: |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
467 |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
468 octave_parser (void) |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
469 : octave_base_parser (*(new octave_lexer ())) |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
470 { } |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
471 |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
472 octave_parser (FILE *file) |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
473 : octave_base_parser (*(new octave_lexer (file))) |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
474 { } |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
475 |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
476 octave_parser (const std::string& eval_string) |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
477 : octave_base_parser (*(new octave_lexer (eval_string))) |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
478 { } |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
479 |
16335
bef822a80ffb
if not interactive, bypass readline and read stdin as a file (bug #38520)
John W. Eaton <jwe@octave.org>
parents:
16294
diff
changeset
|
480 octave_parser (octave_lexer& lxr) |
bef822a80ffb
if not interactive, bypass readline and read stdin as a file (bug #38520)
John W. Eaton <jwe@octave.org>
parents:
16294
diff
changeset
|
481 : octave_base_parser (lxr) |
bef822a80ffb
if not interactive, bypass readline and read stdin as a file (bug #38520)
John W. Eaton <jwe@octave.org>
parents:
16294
diff
changeset
|
482 { } |
bef822a80ffb
if not interactive, bypass readline and read stdin as a file (bug #38520)
John W. Eaton <jwe@octave.org>
parents:
16294
diff
changeset
|
483 |
16287
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
484 ~octave_parser (void) { } |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
485 |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
486 int run (void); |
16133
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
487 |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
488 private: |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
489 |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
490 // No copying! |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
491 |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
492 octave_parser (const octave_parser&); |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
493 |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
494 octave_parser& operator = (const octave_parser&); |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
495 }; |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
496 |
16294
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
497 class |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
498 octave_push_parser : public octave_base_parser |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
499 { |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
500 public: |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
501 |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
502 octave_push_parser (void) |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
503 : octave_base_parser (*(new octave_push_lexer ())), parser_state (0) |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
504 { |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
505 init (); |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
506 } |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
507 |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
508 ~octave_push_parser (void); |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
509 |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
510 void init (void); |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
511 |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
512 int run (const std::string& input, bool eof); |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
513 |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
514 private: |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
515 |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
516 // Internal state of the Bison parser. |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
517 void *parser_state; |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
518 |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
519 // No copying! |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
520 |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
521 octave_push_parser (const octave_push_parser&); |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
522 |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
523 octave_push_parser& operator = (const octave_push_parser&); |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
524 }; |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
525 |
1 | 526 #endif |