Mercurial > octave
annotate libinterp/parse-tree/parse.h @ 21244:1473547f50f5
include octave-config.h in public header files
* mk-opts.pl, mkbuiltins, mk-ops.awk, sparse-mk-ops.awk:
Emit "#include octave-config.h" statement for generated header files.
* build-env.h, builtins.h, Cell.h, base-text-renderer.h,
c-file-ptr-stream.h, cdisplay.h, comment-list.h, data.h, debug.h,
defaults.in.h, defun-dld.h, defun-int.h, defun.h, dirfns.h, display.h,
dynamic-ld.h, error.h, errwarn.h, event-queue.h, file-io.h,
ft-text-renderer.h, gl-render.h, gl2ps-print.h, graphics.in.h,
gripes.h, help.h, hook-fcn.h, input.h, jit-ir.h, jit-typeinfo.h,
jit-util.h, load-path.h, load-save.h, ls-ascii-helper.h, ls-hdf5.h,
ls-mat-ascii.h, ls-mat4.h, ls-mat5.h, ls-oct-binary.h, ls-oct-text.h,
ls-utils.h, mex.h, mexproto.h, mxarray.in.h, oct-errno.h, oct-fstrm.h,
oct-handle.h, oct-hdf5-types.h, oct-hdf5.h, oct-hist.h, oct-iostrm.h,
oct-lvalue.h, oct-map.h, oct-obj.h, oct-opengl.h, oct-prcstrm.h,
oct-procbuf.h, oct-stdstrm.h, oct-stream.h, oct-strstrm.h, oct.h,
octave-default-image.h, octave-link.h, octave-preserve-stream-state.h,
pager.h, pr-output.h, procstream.h, profiler.h, pt-jit.h,
sighandlers.h, siglist.h, sparse-xdiv.h, sparse-xpow.h, symtab.h,
sysdep.h, text-renderer.h, toplev.h, txt-eng.h, utils.h, variables.h,
workspace-element.h, xdiv.h, xnorm.h, xpow.h, zfstream.h, oct-qhull.h,
ov-base-diag.h, ov-base-int.h, ov-base-mat.h, ov-base-scalar.h,
ov-base-sparse.h, ov-base.h, ov-bool-mat.h, ov-bool-sparse.h,
ov-bool.h, ov-builtin.h, ov-cell.h, ov-ch-mat.h, ov-class.h,
ov-classdef.h, ov-colon.h, ov-complex.h, ov-cs-list.h, ov-cx-diag.h,
ov-cx-mat.h, ov-cx-sparse.h, ov-dld-fcn.h, ov-fcn-handle.h,
ov-fcn-inline.h, ov-fcn.h, ov-float.h, ov-flt-complex.h,
ov-flt-cx-diag.h, ov-flt-cx-mat.h, ov-flt-re-diag.h, ov-flt-re-mat.h,
ov-int-traits.h, ov-int16.h, ov-int32.h, ov-int64.h, ov-int8.h,
ov-intx.h, ov-java.h, ov-lazy-idx.h, ov-mex-fcn.h, ov-null-mat.h,
ov-oncleanup.h, ov-perm.h, ov-range.h, ov-re-diag.h, ov-re-mat.h,
ov-re-sparse.h, ov-scalar.h, ov-str-mat.h, ov-struct.h,
ov-type-conv.h, ov-typeinfo.h, ov-uint16.h, ov-uint32.h, ov-uint64.h,
ov-uint8.h, ov-usr-fcn.h, ov.h, ovl.h, octave.h, op-int.h, ops.h,
options-usage.h, lex.h, parse.h, pt-all.h, pt-arg-list.h,
pt-array-list.h, pt-assign.h, pt-binop.h, pt-bp.h, pt-cbinop.h,
pt-cell.h, pt-check.h, pt-classdef.h, pt-cmd.h, pt-colon.h,
pt-const.h, pt-decl.h, pt-eval.h, pt-except.h, pt-exp.h,
pt-fcn-handle.h, pt-funcall.h, pt-id.h, pt-idx.h, pt-jump.h,
pt-loop.h, pt-mat.h, pt-misc.h, pt-pr-code.h, pt-select.h, pt-stmt.h,
pt-unop.h, pt-walk.h, pt.h, token.h, version.in.h, Array-util.h,
Array.h, CColVector.h, CDiagMatrix.h, CMatrix.h, CNDArray.h,
CRowVector.h, CSparse.h, DiagArray2.h, MArray.h, MDiagArray2.h,
MSparse.h, Matrix.h, MatrixType.h, PermMatrix.h, Range.h, Sparse.h,
boolMatrix.h, boolNDArray.h, boolSparse.h, chMatrix.h, chNDArray.h,
dColVector.h, dDiagMatrix.h, dMatrix.h, dNDArray.h, dRowVector.h,
dSparse.h, dim-vector.h, fCColVector.h, fCDiagMatrix.h, fCMatrix.h,
fCNDArray.h, fCRowVector.h, fColVector.h, fDiagMatrix.h, fMatrix.h,
fNDArray.h, fRowVector.h, idx-vector.h, int16NDArray.h,
int32NDArray.h, int64NDArray.h, int8NDArray.h, intNDArray.h,
uint16NDArray.h, uint32NDArray.h, uint64NDArray.h, uint8NDArray.h,
f77-fcn.h, lo-error.h, quit.h, CmplxAEPBAL.h, CmplxCHOL.h,
CmplxGEPBAL.h, CmplxHESS.h, CmplxLU.h, CmplxQR.h, CmplxQRP.h,
CmplxSCHUR.h, CmplxSVD.h, CollocWt.h, DAE.h, DAEFunc.h, DAERT.h,
DAERTFunc.h, DASPK.h, DASRT.h, DASSL.h, DET.h, EIG.h, LSODE.h, ODE.h,
ODEFunc.h, ODES.h, ODESFunc.h, Quad.h, base-aepbal.h, base-dae.h,
base-de.h, base-lu.h, base-min.h, base-qr.h, bsxfun-decl.h, bsxfun.h,
dbleAEPBAL.h, dbleCHOL.h, dbleGEPBAL.h, dbleHESS.h, dbleLU.h,
dbleQR.h, dbleQRP.h, dbleSCHUR.h, dbleSVD.h, eigs-base.h,
fCmplxAEPBAL.h, fCmplxCHOL.h, fCmplxGEPBAL.h, fCmplxHESS.h,
fCmplxLU.h, fCmplxQR.h, fCmplxQRP.h, fCmplxSCHUR.h, fCmplxSVD.h,
fEIG.h, floatAEPBAL.h, floatCHOL.h, floatGEPBAL.h, floatHESS.h,
floatLU.h, floatQR.h, floatQRP.h, floatSCHUR.h, floatSVD.h,
lo-mappers.h, lo-specfun.h, oct-convn.h, oct-fftw.h, oct-norm.h,
oct-rand.h, oct-spparms.h, randgamma.h, randmtzig.h, randpoisson.h,
sparse-chol.h, sparse-dmsolve.h, sparse-lu.h, sparse-qr.h,
Sparse-diag-op-defs.h, Sparse-op-decls.h, Sparse-op-defs.h,
Sparse-perm-op-defs.h, mx-base.h, mx-defs.h, mx-ext.h, mx-op-decl.h,
mx-op-defs.h, dir-ops.h, file-ops.h, file-stat.h, lo-sysdep.h,
mach-info.h, oct-env.h, oct-group.h, oct-openmp.h, oct-passwd.h,
oct-syscalls.h, oct-time.h, oct-uname.h, pathlen.h, sysdir.h,
syswait.h, action-container.h, base-list.h, byte-swap.h,
caseless-str.h, cmd-edit.h, cmd-hist.h, data-conv.h, functor.h,
glob-match.h, lo-array-errwarn.h, lo-array-gripes.h, lo-cutils.h,
lo-ieee.h, lo-macros.h, lo-math.h, lo-regexp.h, lo-traits.h,
lo-utils.h, oct-alloc.h, oct-base64.h, oct-binmap.h, oct-cmplx.h,
oct-glob.h, oct-inttypes.h, oct-locbuf.h, oct-mutex.h, oct-refcount.h,
oct-rl-edit.h, oct-rl-hist.h, oct-shlib.h, oct-sort.h, oct-sparse.h,
pathsearch.h, singleton-cleanup.h, sparse-sort.h, sparse-util.h,
statdefs.h, str-vec.h, sun-utils.h, unwind-prot.h, url-transfer.h:
Include octave-config.h.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 10 Feb 2016 14:25:53 -0500 |
parents | 538b57866b90 |
children | 9ca194f7a858 |
rev | line source |
---|---|
1 | 1 /* |
2 | |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
18927
diff
changeset
|
3 Copyright (C) 1993-2015 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 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
23 #if ! defined (octave_parse_h) |
383 | 24 #define octave_parse_h 1 |
1 | 25 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
26 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
27 |
3021 | 28 #include <cstdio> |
29 | |
1755 | 30 #include <string> |
31 | |
4426 | 32 #include <stack> |
16153
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
33 #include <vector> |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
34 #include <map> |
4426 | 35 |
16139
2fd39ab12209
move a function and data member from lexical_feedback to octave_parser
John W. Eaton <jwe@octave.org>
parents:
16138
diff
changeset
|
36 #include "lex.h" |
16153
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
37 #include "symtab.h" |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
38 #include "token.h" |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
39 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
40 class octave_comment_list; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
41 class octave_function; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
42 class octave_user_function; |
1 | 43 class tree; |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
44 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
|
45 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
|
46 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
|
47 class tree_cell; |
16155
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
48 class tree_classdef; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
49 class tree_classdef_attribute_list; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
50 class tree_classdef_body; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
51 class tree_classdef_enum_block; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
52 class tree_classdef_enum_list; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
53 class tree_classdef_events_block; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
54 class tree_classdef_events_list; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
55 class tree_classdef_methods_block; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
56 class tree_classdef_methods_list; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
57 class tree_classdef_properties_block; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
58 class tree_classdef_property_list; |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
59 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
|
60 class tree_colon_expression; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
61 class tree_command; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
62 class tree_constant; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
63 class tree_decl_command; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
64 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
|
65 class tree_expression; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
66 class tree_fcn_handle; |
16155
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
67 class tree_funcall; |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
68 class tree_function_def; |
1 | 69 class tree_identifier; |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
70 class tree_if_clause; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
71 class tree_if_command; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
72 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
|
73 class tree_index_expression; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
74 class tree_matrix; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
75 class tree_matrix; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
76 class tree_parameter_list; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
77 class tree_statement; |
13970 | 78 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
|
79 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
|
80 class tree_switch_case; |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
81 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
|
82 class tree_switch_command; |
3772 | 83 |
20940
48b2ad5ee801
maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
84 #include "ovl.h" |
1 | 85 |
86 // Nonzero means print parser debugging info (-d). | |
4753 | 87 extern int octave_debug; |
1 | 88 |
3021 | 89 // TRUE means we printed messages about reading startup files. |
90 extern bool reading_startup_message_printed; | |
91 | |
6109 | 92 extern OCTINTERP_API std::string |
5484 | 93 get_help_from_file (const std::string& nm, bool& symbol_found, |
10313 | 94 std::string& file); |
5931 | 95 |
6109 | 96 extern OCTINTERP_API std::string |
5931 | 97 get_help_from_file (const std::string& nm, bool& symbol_found); |
5484 | 98 |
6109 | 99 extern OCTINTERP_API std::string lookup_autoload (const std::string& nm); |
3021 | 100 |
6109 | 101 extern OCTINTERP_API string_vector autoloaded_functions (void); |
5592 | 102 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
103 extern OCTINTERP_API string_vector |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
104 reverse_lookup_autoload (const std::string& nm); |
5592 | 105 |
7336 | 106 extern OCTINTERP_API octave_function * |
107 load_fcn_from_file (const std::string& file_name, | |
21017
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
108 const std::string& dir_name = "", |
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
109 const std::string& dispatch_type = "", |
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
110 const std::string& package_name = "", |
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
111 const std::string& fcn_name = "", |
10313 | 112 bool autoload = false); |
3021 | 113 |
6109 | 114 extern OCTINTERP_API void |
5975 | 115 source_file (const std::string& file_name, |
21017
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
116 const std::string& context = "", |
10313 | 117 bool verbose = false, bool require_file = true, |
21017
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
118 const std::string& warn_for = ""); |
4486 | 119 |
6109 | 120 extern OCTINTERP_API octave_value_list |
3772 | 121 feval (const std::string& name, |
122 const octave_value_list& args = octave_value_list (), | |
123 int nargout = 0); | |
3156 | 124 |
6109 | 125 extern OCTINTERP_API octave_value_list |
4342 | 126 feval (octave_function *fcn, |
127 const octave_value_list& args = octave_value_list (), | |
128 int nargout = 0); | |
129 | |
6109 | 130 extern OCTINTERP_API octave_value_list |
3772 | 131 feval (const octave_value_list& args, int nargout = 0); |
3021 | 132 |
6109 | 133 extern OCTINTERP_API octave_value_list |
3523 | 134 eval_string (const std::string&, bool silent, int& parse_status, int hargout); |
3099 | 135 |
6109 | 136 extern OCTINTERP_API octave_value |
3523 | 137 eval_string (const std::string&, bool silent, int& parse_status); |
3021 | 138 |
13970 | 139 extern OCTINTERP_API void cleanup_statement_list (tree_statement_list **lst); |
140 | |
16149
49dfba4fd3c5
use pure parser and reentrant lexer interfaces
John W. Eaton <jwe@octave.org>
parents:
16142
diff
changeset
|
141 // Global access to currently active lexer. |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
142 // 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
|
143 extern octave_base_lexer *LEXER; |
16149
49dfba4fd3c5
use pure parser and reentrant lexer interfaces
John W. Eaton <jwe@octave.org>
parents:
16142
diff
changeset
|
144 |
16133
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
145 class |
16287
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
146 octave_base_parser |
16133
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
147 { |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
148 public: |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
149 |
21063
202cfd2b4514
store parser state in base class; use it in push and pull parsers
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
150 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
|
151 |
16293
57e87ddfee14
create base class for lexer
John W. Eaton <jwe@octave.org>
parents:
16288
diff
changeset
|
152 ~octave_base_parser (void); |
16157
335041cc657a
optionally use push parser interface
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
153 |
16177
a7669b4d27f6
eliminate global global_command variable
John W. Eaton <jwe@octave.org>
parents:
16164
diff
changeset
|
154 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
|
155 |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
156 // Error mesages for mismatched end tokens. |
21071
f25c14056b7c
overhaul parser error handling for end token mismatch
John W. Eaton <jwe@octave.org>
parents:
21065
diff
changeset
|
157 void end_token_error (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
|
158 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
159 // 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
|
160 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
|
161 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
162 // 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
|
163 // 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
|
164 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
|
165 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
166 // 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
|
167 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
|
168 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
169 // Finish building a range. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
170 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
|
171 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
172 // Build a constant. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
173 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
|
174 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
175 // Build a function handle. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
176 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
|
177 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
178 // 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
|
179 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
|
180 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
|
181 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
182 // Build a binary expression. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
183 tree_expression * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
184 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
|
185 tree_expression *op2); |
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 a boolean expression. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
188 tree_expression * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
189 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
|
190 tree_expression *op2); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
191 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
192 // Build a prefix expression. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
193 tree_expression * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
194 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
|
195 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
196 // Build a postfix 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_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
|
199 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
200 // 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
|
201 tree_command * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
202 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
|
203 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
|
204 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
|
205 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
206 // 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
|
207 tree_command * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
208 make_try_command (token *try_tok, tree_statement_list *body, |
17283
e6c0ac8ce5b6
eliminate parse conflicts introduced by changeset 923ce8b42db2
John W. Eaton <jwe@octave.org>
parents:
17249
diff
changeset
|
209 char catch_sep, tree_statement_list *cleanup, |
e6c0ac8ce5b6
eliminate parse conflicts introduced by changeset 923ce8b42db2
John W. Eaton <jwe@octave.org>
parents:
17249
diff
changeset
|
210 token *end_tok, octave_comment_list *lc, |
e6c0ac8ce5b6
eliminate parse conflicts introduced by changeset 923ce8b42db2
John W. Eaton <jwe@octave.org>
parents:
17249
diff
changeset
|
211 octave_comment_list *mc); |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
212 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
213 // Build a while command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
214 tree_command * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
215 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
|
216 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
|
217 octave_comment_list *lc); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
218 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
219 // 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
|
220 tree_command * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
221 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
|
222 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
|
223 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
224 // Build a for command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
225 tree_command * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
226 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
|
227 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
|
228 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
|
229 octave_comment_list *lc); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
230 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
231 // Build a break command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
232 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
|
233 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
234 // Build a continue command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
235 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
|
236 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
237 // Build a return command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
238 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
|
239 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
240 // Start an if command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
241 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
|
242 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
|
243 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
244 // Finish an if command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
245 tree_if_command * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
246 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
|
247 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
|
248 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
249 // Build an elseif clause. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
250 tree_if_clause * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
251 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
|
252 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
|
253 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
254 // Finish a switch command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
255 tree_switch_command * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
256 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
|
257 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
|
258 octave_comment_list *lc); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
259 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
260 // Build a switch case. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
261 tree_switch_case * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
262 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
|
263 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
|
264 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
265 // 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
|
266 tree_expression * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
267 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
|
268 tree_expression *rhs); |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
269 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
270 // Define a script. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
271 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
|
272 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
273 // Begin defining a function. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
274 octave_user_function * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
275 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
|
276 tree_statement *end_function); |
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 // 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
|
279 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
|
280 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
281 // 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
|
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 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
|
284 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
285 // Finish defining a function. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
286 tree_function_def * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
287 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
|
288 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
|
289 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
|
290 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
291 // 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
|
292 void |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
293 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
|
294 |
16155
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
295 tree_funcall * |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
296 make_superclass_ref (const std::string& method_nm, |
18927
09eb8a2ddb02
eliminate some unused parameter warnings in parser functions
John W. Eaton <jwe@octave.org>
parents:
18520
diff
changeset
|
297 const std::string& class_nm); |
16155
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
298 |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
299 tree_funcall * |
18927
09eb8a2ddb02
eliminate some unused parameter warnings in parser functions
John W. Eaton <jwe@octave.org>
parents:
18520
diff
changeset
|
300 make_meta_class_query (const std::string& class_nm); |
16155
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
301 |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
302 tree_classdef * |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
303 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
|
304 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
|
305 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
|
306 octave_comment_list *lc); |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
307 |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
308 tree_classdef_properties_block * |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
309 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
|
310 tree_classdef_attribute_list *a, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
311 tree_classdef_property_list *plist, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
312 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
|
313 |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
314 tree_classdef_methods_block * |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
315 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
|
316 tree_classdef_attribute_list *a, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
317 tree_classdef_methods_list *mlist, |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
318 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
|
319 |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
320 tree_classdef_events_block * |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
321 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
|
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_events_list *elist, |
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_enum_block * |
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
327 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
|
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_enum_list *elist, |
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 |
18262
69990d5edcc2
Allow to parse external methods declaration in classdef files.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17856
diff
changeset
|
332 octave_user_function * |
69990d5edcc2
Allow to parse external methods declaration in classdef files.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17856
diff
changeset
|
333 start_classdef_external_method (tree_identifier *id, |
69990d5edcc2
Allow to parse external methods declaration in classdef files.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17856
diff
changeset
|
334 tree_parameter_list *pl); |
69990d5edcc2
Allow to parse external methods declaration in classdef files.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17856
diff
changeset
|
335 |
69990d5edcc2
Allow to parse external methods declaration in classdef files.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17856
diff
changeset
|
336 tree_function_def * |
69990d5edcc2
Allow to parse external methods declaration in classdef files.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17856
diff
changeset
|
337 finish_classdef_external_method (octave_user_function *fcn, |
69990d5edcc2
Allow to parse external methods declaration in classdef files.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17856
diff
changeset
|
338 tree_parameter_list *ret_list, |
69990d5edcc2
Allow to parse external methods declaration in classdef files.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17856
diff
changeset
|
339 octave_comment_list *cl); |
69990d5edcc2
Allow to parse external methods declaration in classdef files.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17856
diff
changeset
|
340 |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
341 // Make an index expression. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
342 tree_index_expression * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
343 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
|
344 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
|
345 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
346 // 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
|
347 tree_index_expression * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
348 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
|
349 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
350 // 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
|
351 tree_index_expression * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
352 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
|
353 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
354 // Make a declaration command. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
355 tree_decl_command * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
356 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
|
357 |
16273
c5e5f6ccac5d
9/10 commits reworking the lexer
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
358 // Validate matrix or cell |
c5e5f6ccac5d
9/10 commits reworking the lexer
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
359 bool validate_array_list (tree_expression *e); |
c5e5f6ccac5d
9/10 commits reworking the lexer
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
360 |
c5e5f6ccac5d
9/10 commits reworking the lexer
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
361 // Validate matrix object used in "[lhs] = ..." assignments. |
c5e5f6ccac5d
9/10 commits reworking the lexer
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
362 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
|
363 |
16237
70f465930546
rearrange class heirarchy for tree_cell and tree_matrix
John W. Eaton <jwe@octave.org>
parents:
16210
diff
changeset
|
364 // 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
|
365 // and finish_cell). |
70f465930546
rearrange class heirarchy for tree_cell and tree_matrix
John W. Eaton <jwe@octave.org>
parents:
16210
diff
changeset
|
366 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
|
367 |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
368 // 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
|
369 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
|
370 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
371 // 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
|
372 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
|
373 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
374 // 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
|
375 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
|
376 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
377 // 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
|
378 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 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
|
380 |
17693
efbe746f8fa8
eliminate octave_comment_buffer singleton
John W. Eaton <jwe@octave.org>
parents:
17283
diff
changeset
|
381 // Finish building a statement. |
21139
538b57866b90
consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents:
21073
diff
changeset
|
382 template <typename T> |
17693
efbe746f8fa8
eliminate octave_comment_buffer singleton
John W. Eaton <jwe@octave.org>
parents:
17283
diff
changeset
|
383 tree_statement *make_statement (T *arg); |
efbe746f8fa8
eliminate octave_comment_buffer singleton
John W. Eaton <jwe@octave.org>
parents:
17283
diff
changeset
|
384 |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
385 // Create a statement list. |
16136
ed36d5543b27
don't declare octave_parser member functions static
John W. Eaton <jwe@octave.org>
parents:
16134
diff
changeset
|
386 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
|
387 |
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
388 // 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
|
389 tree_statement_list * |
16134
ec9c6222ef5a
move static parser helper functions to octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16133
diff
changeset
|
390 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
|
391 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
|
392 |
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
|
393 // Generic error messages. |
21065
e1ee2203efe0
allow location info to be passed to octave_base_parser::bison_error
John W. Eaton <jwe@octave.org>
parents:
21063
diff
changeset
|
394 void bison_error (const std::string& s, int l = -1, int c = -1); |
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
|
395 |
21073
f7cc48f601d2
additional reworking of error handling in the parser (bug #46877)
John W. Eaton <jwe@octave.org>
parents:
21071
diff
changeset
|
396 // Contains error message if Bison-generated parser returns non-zero |
f7cc48f601d2
additional reworking of error handling in the parser (bug #46877)
John W. Eaton <jwe@octave.org>
parents:
21071
diff
changeset
|
397 // status. |
f7cc48f601d2
additional reworking of error handling in the parser (bug #46877)
John W. Eaton <jwe@octave.org>
parents:
21071
diff
changeset
|
398 std::string parse_error_msg; |
f7cc48f601d2
additional reworking of error handling in the parser (bug #46877)
John W. Eaton <jwe@octave.org>
parents:
21071
diff
changeset
|
399 |
16153
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
400 // 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
|
401 bool endfunction_found; |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
402 |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
403 // 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
|
404 bool autoloading; |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
405 |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
406 // 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
|
407 // element. |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
408 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
|
409 |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
410 // 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
|
411 // 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
|
412 bool parsing_subfunctions; |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
413 |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
414 // 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
|
415 // 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
|
416 int max_fcn_depth; |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
417 |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
418 // = 0 currently outside any function. |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
419 // = 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
|
420 // > 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
|
421 // 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
|
422 // nested function. |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
423 int curr_fcn_depth; |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
424 |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
425 // 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
|
426 // used while reading function files. |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
427 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
|
428 |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
429 // 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
|
430 // constructors. |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
431 std::string curr_class_name; |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
432 |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16644
diff
changeset
|
433 // 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
|
434 // in a package directory (+-directory). |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16644
diff
changeset
|
435 std::string curr_package_name; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16644
diff
changeset
|
436 |
16153
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
437 // 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
|
438 // 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
|
439 // 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
|
440 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
|
441 |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
442 // 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
|
443 octave_function *primary_fcn_ptr; |
a57c2c8c8163
move some variables into the octave_parser class
John W. Eaton <jwe@octave.org>
parents:
16149
diff
changeset
|
444 |
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
|
445 // 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
|
446 // 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
|
447 // 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
|
448 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
|
449 |
16155
0259254a3ccc
maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16153
diff
changeset
|
450 // 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
|
451 tree_classdef *classdef_object; |
16211
3449bf257514
maint: fix botched merge of default to classdef
John W. Eaton <jwe@octave.org>
parents:
16205
diff
changeset
|
452 |
16177
a7669b4d27f6
eliminate global global_command variable
John W. Eaton <jwe@octave.org>
parents:
16164
diff
changeset
|
453 // Result of parsing input. |
a7669b4d27f6
eliminate global global_command variable
John W. Eaton <jwe@octave.org>
parents:
16164
diff
changeset
|
454 tree_statement_list *stmt_list; |
a7669b4d27f6
eliminate global global_command variable
John W. Eaton <jwe@octave.org>
parents:
16164
diff
changeset
|
455 |
16149
49dfba4fd3c5
use pure parser and reentrant lexer interfaces
John W. Eaton <jwe@octave.org>
parents:
16142
diff
changeset
|
456 // State of the lexer. |
16293
57e87ddfee14
create base class for lexer
John W. Eaton <jwe@octave.org>
parents:
16288
diff
changeset
|
457 octave_base_lexer& lexer; |
16149
49dfba4fd3c5
use pure parser and reentrant lexer interfaces
John W. Eaton <jwe@octave.org>
parents:
16142
diff
changeset
|
458 |
21063
202cfd2b4514
store parser state in base class; use it in push and pull parsers
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
459 // Internal state of the Bison parser. |
202cfd2b4514
store parser state in base class; use it in push and pull parsers
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
460 void *parser_state; |
202cfd2b4514
store parser state in base class; use it in push and pull parsers
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
461 |
16287
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
462 private: |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
463 |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
464 // No copying! |
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 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
|
467 |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
468 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
|
469 }; |
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 class |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
472 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
|
473 { |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
474 public: |
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 (void) |
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 ())) |
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 |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
480 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
|
481 : 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
|
482 { } |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
483 |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
484 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
|
485 : 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
|
486 { } |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
487 |
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
|
488 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
|
489 : 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
|
490 { } |
bef822a80ffb
if not interactive, bypass readline and read stdin as a file (bug #38520)
John W. Eaton <jwe@octave.org>
parents:
16294
diff
changeset
|
491 |
16287
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
492 ~octave_parser (void) { } |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
493 |
04a7953496a7
create base class for parser; use reference for curr_lexer
John W. Eaton <jwe@octave.org>
parents:
16273
diff
changeset
|
494 int run (void); |
16133
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 private: |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
497 |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
498 // No copying! |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
499 |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
500 octave_parser (const octave_parser&); |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
501 |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
502 octave_parser& operator = (const octave_parser&); |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
503 }; |
249d62b3fac8
new class for parser state
John W. Eaton <jwe@octave.org>
parents:
16122
diff
changeset
|
504 |
16294
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
505 class |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
506 octave_push_parser : public octave_base_parser |
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 public: |
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 octave_push_parser (void) |
21063
202cfd2b4514
store parser state in base class; use it in push and pull parsers
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
511 : octave_base_parser (*(new octave_push_lexer ())) |
202cfd2b4514
store parser state in base class; use it in push and pull parsers
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
512 { } |
16294
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
513 |
21063
202cfd2b4514
store parser state in base class; use it in push and pull parsers
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
514 ~octave_push_parser (void) { } |
16294
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 int run (const std::string& input, bool eof); |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
517 |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
518 private: |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
519 |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
520 // No copying! |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
521 |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
522 octave_push_parser (const octave_push_parser&); |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
523 |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
524 octave_push_parser& operator = (const octave_push_parser&); |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
525 }; |
0925d1f6875e
push parser/lexer interface
John W. Eaton <jwe@octave.org>
parents:
16293
diff
changeset
|
526 |
1 | 527 #endif |