GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
parse.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1993-2018 John W. Eaton
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
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_parse_h)
24 #define octave_parse_h 1
25 
26 #include "octave-config.h"
27 
28 #include <cstdio>
29 
30 #include <string>
31 
32 #include <deque>
33 #include <map>
34 #include <set>
35 
36 #include "lex.h"
37 #include "pt-misc.h"
38 #include "symscope.h"
39 #include "token.h"
40 
41 class octave_function;
43 
44 namespace octave
45 {
46  class comment_list;
47  class tree;
48  class tree_anon_fcn_handle;
49  class tree_argument_list;
50  class tree_array_list;
51  class tree_cell;
52  class tree_classdef;
53  class tree_classdef_attribute_list;
54  class tree_classdef_body;
55  class tree_classdef_enum_block;
56  class tree_classdef_enum_list;
57  class tree_classdef_events_block;
58  class tree_classdef_events_list;
59  class tree_classdef_methods_block;
60  class tree_classdef_methods_list;
61  class tree_classdef_properties_block;
62  class tree_classdef_property_list;
63  class tree_classdef_superclass_list;
64  class tree_colon_expression;
65  class tree_command;
66  class tree_constant;
67  class tree_decl_command;
68  class tree_decl_init_list;
69  class tree_expression;
70  class tree_fcn_handle;
71  class tree_funcall;
72  class tree_function_def;
73  class tree_identifier;
74  class tree_if_clause;
75  class tree_if_command;
76  class tree_if_command_list;
77  class tree_index_expression;
78  class tree_matrix;
79  class tree_matrix;
80  class tree_parameter_list;
81  class tree_statement;
82  class tree_statement_list;
83  class tree_statement_listtree_statement;
84  class tree_switch_case;
85  class tree_switch_case_list;
86  class tree_switch_command;
87 }
88 
89 #include "ovl.h"
90 
91 // Nonzero means print parser debugging info (-d).
92 extern int octave_debug;
93 
94 namespace octave
95 {
97  {
98  private:
99 
101  {
102  public:
103 
104  typedef std::pair<symbol_scope, std::string> value_type;
105 
106  typedef std::deque<value_type>::iterator iterator;
107  typedef std::deque<value_type>::const_iterator const_iterator;
108 
109  typedef std::deque<value_type>::reverse_iterator reverse_iterator;
110  typedef std::deque<value_type>::const_reverse_iterator const_reverse_iterator;
111 
112  parent_scope_info (void) = default;
113 
114  parent_scope_info (const parent_scope_info&) = default;
115 
117 
118  ~parent_scope_info (void) = default;
119 
120  size_t size (void) const;
121 
122  void push (const value_type& elt);
123 
124  void push (const symbol_scope& id);
125 
126  void pop (void);
127 
128  bool name_ok (const std::string& name);
129 
130  bool name_current_scope (const std::string& name);
131 
132  symbol_scope parent_scope (void) const;
133 
134  std::string parent_name (void) const;
135 
136  void clear (void);
137 
138  private:
139 
140  std::deque<value_type> m_info;
141  std::set<std::string> m_all_names;
142  };
143 
144  public:
145 
146  base_parser (base_lexer& lxr);
147 
148  // No copying!
149 
150  base_parser (const base_parser&) = delete;
151 
152  base_parser& operator = (const base_parser&) = delete;
153 
154  ~base_parser (void);
155 
156  void reset (void);
157 
158  // Error mesages for mismatched end tokens.
159  void end_token_error (token *tok, token::end_tok_type expected);
160 
161  // Check to see that end tokens are properly matched.
162  bool end_token_ok (token *tok, token::end_tok_type expected);
163 
164  // Maybe print a warning if an assignment expression is used as the
165  // test in a logical expression.
167 
168  // Maybe print a warning about switch labels that aren't constants.
170 
171  // Build a constant.
172  tree_constant * make_constant (int op, token *tok_val);
173 
174  // Build a function handle.
176 
177  // Build an anonymous function handle.
180  tree_expression * expr);
181 
182  // Build a colon expression.
185  tree_expression *incr = nullptr);
186 
187  // Build a binary expression.
189  make_binary_op (int op, tree_expression *op1, token *tok_val,
190  tree_expression *op2);
191 
192  // Build a boolean expression.
194  make_boolean_op (int op, tree_expression *op1, token *tok_val,
195  tree_expression *op2);
196 
197  // Build a prefix expression.
199  make_prefix_op (int op, tree_expression *op1, token *tok_val);
200 
201  // Build a postfix expression.
203  make_postfix_op (int op, tree_expression *op1, token *tok_val);
204 
205  // Build an unwind-protect command.
206  tree_command *
207  make_unwind_command (token *unwind_tok, tree_statement_list *body,
208  tree_statement_list *cleanup, token *end_tok,
209  comment_list *lc, comment_list *mc);
210 
211  // Build a try-catch command.
212  tree_command *
213  make_try_command (token *try_tok, tree_statement_list *body,
214  char catch_sep, tree_statement_list *cleanup,
215  token *end_tok, comment_list *lc,
216  comment_list *mc);
217 
218  // Build a while command.
219  tree_command *
220  make_while_command (token *while_tok, tree_expression *expr,
221  tree_statement_list *body, token *end_tok,
222  comment_list *lc);
223 
224  // Build a do-until command.
225  tree_command *
227  tree_expression *expr, comment_list *lc);
228 
229  // Build a for command.
230  tree_command *
231  make_for_command (int tok_id, token *for_tok, tree_argument_list *lhs,
232  tree_expression *expr, tree_expression *maxproc,
233  tree_statement_list *body, token *end_tok,
234  comment_list *lc);
235 
236  // Build a break command.
237  tree_command * make_break_command (token *break_tok);
238 
239  // Build a continue command.
240  tree_command * make_continue_command (token *continue_tok);
241 
242  // Build a return command.
243  tree_command * make_return_command (token *return_tok);
244 
245  // Start an if command.
248 
249  // Finish an if command.
252  token *end_tok, comment_list *lc);
253 
254  // Build an elseif clause.
256  make_elseif_clause (token *elseif_tok, tree_expression *expr,
258 
259  // Finish a switch command.
261  finish_switch_command (token *switch_tok, tree_expression *expr,
262  tree_switch_case_list *list, token *end_tok,
263  comment_list *lc);
264 
265  // Build a switch case.
267  make_switch_case (token *case_tok, tree_expression *expr,
269 
270  // Build an assignment to a variable.
272  make_assign_op (int op, tree_argument_list *lhs, token *eq_tok,
273  tree_expression *rhs);
274 
275  // Define a script.
276  void make_script (tree_statement_list *cmds, tree_statement *end_script);
277 
278  // Define a function.
280  make_function (token *fcn_tok, tree_parameter_list *ret_list,
281  tree_identifier *id, tree_parameter_list *param_list,
282  tree_statement_list *body, tree_statement *end_fcn_stmt,
283  comment_list *lc);
284 
285  // Begin defining a function.
288  tree_statement_list *body, tree_statement *end_function);
289 
290  // Create a no-op statement for end_function.
291  tree_statement * make_end (const std::string& type, bool eof, int l, int c);
292 
293  // Do most of the work for defining a function.
296 
297  // Finish defining a function.
301  int l, int c);
302 
303  // Reset state after parsing function.
304  void
306 
307  tree_funcall *
308  make_superclass_ref (const std::string& method_nm,
309  const std::string& class_nm);
310 
311  tree_funcall *
312  make_meta_class_query (const std::string& class_nm);
313 
314  tree_classdef *
317  tree_classdef_body *body, token *end_tok,
318  comment_list *lc);
319 
324  token *end_tok, comment_list *lc);
325 
330  token *end_tok, comment_list *lc);
331 
336  token *end_tok, comment_list *lc);
337 
342  token *end_tok, comment_list *lc);
343 
346  tree_parameter_list *pl);
347 
350  tree_parameter_list *ret_list,
351  comment_list *cl);
352 
353  void
355  tree_statement_list *local_fcns);
356 
357  // Make an index expression.
360  tree_argument_list *args, char type);
361 
362  // Make an indirect reference expression.
365 
366  // Make an indirect reference expression with dynamic field name.
369 
370  // Make a declaration command.
372  make_decl_command (int tok, token *tok_val, tree_decl_init_list *lst);
373 
374  // Validate an function parameter list.
377  // Validate matrix or cell
379 
380  // Validate matrix object used in "[lhs] = ..." assignments.
382 
383  // Finish building an array_list (common action for finish_matrix
384  // and finish_cell).
386 
387  // Finish building a matrix list.
389 
390  // Finish building a cell list.
392 
393  // Maybe print a warning. Duh.
395 
396  // Set the print flag for a statement based on the separator type.
399 
400  // Finish building a statement.
401  template <typename T>
403 
404  // Create a statement list.
406 
407  // Append a statement to an existing statement list.
410  tree_statement *stmt, bool warn_missing_semi);
411 
412  // Generic error messages.
413  void bison_error (const std::string& s, int l = -1, int c = -1);
414 
415  // Contains error message if Bison-generated parser returns non-zero
416  // status.
418 
419  // Have we found an explicit end to a function?
421 
422  // TRUE means we are in the process of autoloading a function.
424 
425  // TRUE means the current function file was found in a relative path
426  // element.
428 
429  // FALSE if we are still at the primary function. Subfunctions can
430  // only be declared inside function files.
432 
433  // TRUE if we are parsing local functions defined at after a
434  // classdef block. Local functions can only be declared inside
435  // classdef files.
437 
438  // Maximum function depth detected. Used to determine whether
439  // we have nested functions or just implicitly ended subfunctions.
441 
442  // = 0 currently outside any function.
443  // = 1 inside the primary function or a subfunction.
444  // > 1 means we are looking at a function definition that seems to be
445  // inside a function. Note that the function still might not be a
446  // nested function.
448 
449  // Scope where we install all subfunctions and nested functions. Only
450  // used while reading function files.
452 
453  // Name of the current class when we are parsing class methods or
454  // constructors.
456 
457  // Name of the current package when we are parsing an element contained
458  // in a package directory (+-directory).
460 
461  // Nested function scopes and names currently being parsed.
463 
464  // Pointer to the primary user function or user script function.
466 
467  // List of subfunction names, initially in the order they are
468  // installed in the symbol table, then ordered as they appear in the
469  // file. Eventually stashed in the primary function object.
470  std::list<std::string> m_subfunction_names;
471 
472  // Pointer to the classdef object we just parsed, if any.
474 
475  // Result of parsing input.
477 
478  // State of the lexer.
480 
481  // Internal state of the Bison parser.
483  };
484 
485  class parser : public base_parser
486  {
487  public:
488 
489  parser (void)
490  : base_parser (*(new lexer ()))
491  { }
492 
493  parser (FILE *file)
494  : base_parser (*(new lexer (file)))
495  { }
496 
498  : base_parser (*(new lexer (eval_string)))
499  { }
500 
501  parser (lexer& lxr)
502  : base_parser (lxr)
503  { }
504 
505  // No copying!
506 
507  parser (const parser&) = delete;
508 
509  parser& operator = (const parser&) = delete;
510 
511  ~parser (void) = default;
512 
513  int run (void);
514  };
515 
516  class push_parser : public base_parser
517  {
518  public:
519 
520  push_parser (void)
521  : base_parser (*(new push_lexer ()))
522  { }
523 
524  // No copying!
525 
526  push_parser (const push_parser&) = delete;
527 
528  push_parser& operator = (const push_parser&) = delete;
529 
530  ~push_parser (void) = default;
531 
532  int run (const std::string& input, bool eof);
533  };
534 
535  extern OCTINTERP_API std::string
536  get_help_from_file (const std::string& nm, bool& symbol_found,
537  std::string& file);
538 
539  extern OCTINTERP_API std::string
540  get_help_from_file (const std::string& nm, bool& symbol_found);
541 
542  extern OCTINTERP_API
544 
545  extern OCTINTERP_API string_vector
546  autoloaded_functions (void);
547 
548  extern OCTINTERP_API string_vector
550 
551  extern OCTINTERP_API octave_value
552  load_fcn_from_file (const std::string& file_name,
553  const std::string& dir_name = "",
554  const std::string& dispatch_type = "",
555  const std::string& package_name = "",
556  const std::string& fcn_name = "",
557  bool autoload = false);
558 
559  extern OCTINTERP_API void
560  source_file (const std::string& file_name,
561  const std::string& context = "",
562  bool verbose = false, bool require_file = true,
563  const std::string& warn_for = "");
564 
565  extern OCTINTERP_API octave_value_list
566  feval (const std::string& name,
567  const octave_value_list& args = octave_value_list (),
568  int nargout = 0);
569 
570  extern OCTINTERP_API octave_value_list
572  const octave_value_list& args = octave_value_list (),
573  int nargout = 0);
574 
575  extern OCTINTERP_API octave_value_list
577  const octave_value_list& args = octave_value_list (),
578  int nargout = 0);
579 
580  extern OCTINTERP_API octave_value_list
581  feval (const octave_value_list& args, int nargout = 0);
582 
583  extern OCTINTERP_API octave_value_list
584  eval_string (const std::string&, bool silent, int& parse_status, int nargout);
585 
586  extern OCTINTERP_API octave_value
587  eval_string (const std::string&, bool silent, int& parse_status);
588 
589  extern OCTINTERP_API void
590  cleanup_statement_list (tree_statement_list **lst);
591 }
592 
593 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS)
594 
595 OCTAVE_DEPRECATED (4.4, "use 'octave::get_help_from_file' instead")
596 static inline std::string
597 get_help_from_file (const std::string& nm, bool& symbol_found,
598  std::string& file)
599 {
600  return octave::get_help_from_file (nm, symbol_found, file);
601 }
602 
603 OCTAVE_DEPRECATED (4.4, "use 'octave::get_help_from_file' instead")
604 static inline std::string
605 get_help_from_file (const std::string& nm, bool& symbol_found)
606 {
607  return octave::get_help_from_file (nm, symbol_found);
608 }
609 
610 OCTAVE_DEPRECATED (4.4, "use 'octave::lookup_autoload' instead")
611 static inline std::string
612 lookup_autoload (const std::string& nm)
613 {
614  return octave::lookup_autoload (nm);
615 }
616 
617 OCTAVE_DEPRECATED (4.4, "use 'octave::autoloaded_functions' instead")
618 static inline string_vector
620 {
622 }
623 
624 OCTAVE_DEPRECATED (4.4, "use 'octave::reverse_lookup_autoload' instead")
625 static inline string_vector
626 reverse_lookup_autoload (const std::string& nm)
627 {
629 }
630 
631 OCTAVE_DEPRECATED (4.4, "use 'octave::source_file' instead")
632 static inline void
633 source_file (const std::string& file_name,
634  const std::string& context = "",
635  bool verbose = false, bool require_file = true,
636  const std::string& warn_for = "")
637 {
638  octave::source_file (file_name, context, verbose, require_file, warn_for);
639 }
640 
641 OCTAVE_DEPRECATED (4.4, "use 'octave::feval' instead")
642 static inline octave_value_list
643 feval (const std::string& name,
644  const octave_value_list& args = octave_value_list (),
645  int nargout = 0)
646 {
647  return octave::feval (name, args, nargout);
648 }
649 
650 OCTAVE_DEPRECATED (4.4, "use 'octave::feval' instead")
651 static inline octave_value_list
653  const octave_value_list& args = octave_value_list (),
654  int nargout = 0)
655 {
656  return octave::feval (fcn, args, nargout);
657 }
658 
659 OCTAVE_DEPRECATED (4.4, "use 'octave::feval' instead")
660 static inline octave_value_list
661 feval (const octave_value_list& args, int nargout = 0)
662 {
663  return octave::feval (args, nargout);
664 }
665 
666 OCTAVE_DEPRECATED (4.4, "use 'octave::eval_string' instead")
667 static inline octave_value_list
668 eval_string (const std::string& str, bool silent, int& parse_status,
669  int nargout)
670 {
671  return octave::eval_string (str, silent, parse_status, nargout);
672 }
673 
674 OCTAVE_DEPRECATED (4.4, "use 'octave::eval_string' instead")
675 static inline octave_value
676 eval_string (const std::string& str, bool silent, int& parse_status)
677 {
678  return octave::eval_string (str, silent, parse_status);
679 }
680 
681 OCTAVE_DEPRECATED (4.4, "use 'octave::cleanup_statement_list' instead")
682 static inline void
683 cleanup_statement_list (octave::tree_statement_list **lst)
684 {
686 }
687 
688 #endif
689 
690 #endif
OCTINTERP_API octave_value_list feval(const std::string &name, const octave_value_list &args=octave_value_list(), int nargout=0)
bool name_current_scope(const std::string &name)
tree_constant * make_constant(int op, token *tok_val)
For example cd octave end example noindent changes the current working directory to an error message is printed and the working directory is not changed sc
Definition: dirfns.cc:124
For example cd octave end example noindent changes the current working directory to file
Definition: dirfns.cc:124
tree_index_expression * make_indirect_ref(tree_expression *expr, const std::string &)
bool m_parsing_local_functions
Definition: parse.h:436
OCTINTERP_API octave_value_list feval(const octave_value_list &args, int nargout=0)
tree_classdef_methods_block * make_classdef_methods_block(token *tok_val, tree_classdef_attribute_list *a, tree_classdef_methods_list *mlist, token *end_tok, comment_list *lc)
base_parser & operator=(const base_parser &)=delete
std::set< std::string > m_all_names
Definition: parse.h:141
The value of lines which begin with a space character are not saved in the history list A value of all commands are saved on the history list
Definition: oct-hist.cc:734
tree_switch_case * make_switch_case(token *case_tok, tree_expression *expr, tree_statement_list *list, comment_list *lc)
~parser(void)=default
tree_expression * make_colon_expression(tree_expression *base, tree_expression *limit, tree_expression *incr=nullptr)
tree_argument_list * validate_matrix_for_assignment(tree_expression *e)
tree_if_command * finish_if_command(token *if_tok, tree_if_command_list *list, token *end_tok, comment_list *lc)
OCTINTERP_API std::string get_help_from_file(const std::string &nm, bool &symbol_found)
std::deque< value_type > m_info
Definition: parse.h:140
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:4986
OCTINTERP_API std::string get_help_from_file(const std::string &nm, bool &symbol_found, std::string &file)
std::string m_curr_package_name
Definition: parse.h:459
octave_user_function * frob_function(tree_identifier *id, octave_user_function *fcn)
tree_statement_list * m_stmt_list
Definition: parse.h:476
tree_function_def * make_function(token *fcn_tok, tree_parameter_list *ret_list, tree_identifier *id, tree_parameter_list *param_list, tree_statement_list *body, tree_statement *end_fcn_stmt, comment_list *lc)
push_parser & operator=(const push_parser &)=delete
OCTINTERP_API octave_value load_fcn_from_file(const std::string &file_name, const std::string &dir_name="", const std::string &dispatch_type="", const std::string &package_name="", const std::string &fcn_name="", bool autoload=false)
tree_statement * make_end(const std::string &type, bool eof, int l, int c)
STL namespace.
std::string m_parse_error_msg
Definition: parse.h:417
tree_classdef * make_classdef(token *tok_val, tree_classdef_attribute_list *a, tree_identifier *id, tree_classdef_superclass_list *sc, tree_classdef_body *body, token *end_tok, comment_list *lc)
void * m_parser_state
Definition: parse.h:482
std::string parent_name(void) const
parser(FILE *file)
Definition: parse.h:493
tree_classdef * m_classdef_object
Definition: parse.h:473
static llvm::LLVMContext & context
Definition: jit-typeinfo.cc:79
OCTINTERP_API std::string lookup_autoload(const std::string &nm)
tree_funcall * make_superclass_ref(const std::string &method_nm, const std::string &class_nm)
void maybe_warn_missing_semi(tree_statement_list *)
tree_command * make_while_command(token *while_tok, tree_expression *expr, tree_statement_list *body, token *end_tok, comment_list *lc)
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
Definition: file-io.cc:587
s
Definition: file-io.cc:2729
tree_command * make_for_command(int tok_id, token *for_tok, tree_argument_list *lhs, tree_expression *expr, tree_expression *maxproc, tree_statement_list *body, token *end_tok, comment_list *lc)
i e
Definition: data.cc:2591
void end_token_error(token *tok, token::end_tok_type expected)
bool name_ok(const std::string &name)
octave_user_function * start_classdef_external_method(tree_identifier *id, tree_parameter_list *pl)
std::list< std::string > m_subfunction_names
Definition: parse.h:470
octave_value arg
Definition: pr-output.cc:3244
octave_function * fcn
Definition: ov-class.cc:1754
tree_command * make_return_command(token *return_tok)
OCTINTERP_API void source_file(const std::string &file_name, const std::string &context="", bool verbose=false, bool require_file=true, const std::string &warn_for="")
parser(lexer &lxr)
Definition: parse.h:501
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:400
void maybe_warn_assign_as_truth_value(tree_expression *expr)
tree_expression * make_binary_op(int op, tree_expression *op1, token *tok_val, tree_expression *op2)
void push(const value_type &elt)
tree_function_def * finish_function(tree_parameter_list *ret_list, octave_user_function *fcn, comment_list *lc, int l, int c)
int run(const std::string &input, bool eof)
void finish_classdef_file(tree_classdef *cls, tree_statement_list *local_fcns)
bool verbose
Definition: load-save.cc:667
tree_command * make_unwind_command(token *unwind_tok, tree_statement_list *body, tree_statement_list *cleanup, token *end_tok, comment_list *lc, comment_list *mc)
symbol_scope m_primary_fcn_scope
Definition: parse.h:451
nd deftypefn *std::string name
Definition: sysdep.cc:647
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
Definition: utils.cc:975
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
Definition: ov-usr-fcn.cc:997
OCTINTERP_API octave_value_list eval_string(const std::string &, bool silent, int &parse_status, int nargout)
tree_statement * make_statement(T *arg)
tree_command * make_continue_command(token *continue_tok)
bool validate_array_list(tree_expression *e)
bool validate_param_list(tree_parameter_list *lst, tree_parameter_list::in_or_out type)
std::string str
Definition: hash.cc:118
tree_expression * make_postfix_op(int op, tree_expression *op1, token *tok_val)
tree_decl_command * make_decl_command(int tok, token *tok_val, tree_decl_init_list *lst)
tree_classdef_events_block * make_classdef_events_block(token *tok_val, tree_classdef_attribute_list *a, tree_classdef_events_list *elist, token *end_tok, comment_list *lc)
bool m_endfunction_found
Definition: parse.h:420
tree_expression * finish_cell(tree_cell *c)
is false
Definition: cellfun.cc:400
tree_expression * finish_array_list(tree_array_list *a)
std::deque< value_type >::const_iterator const_iterator
Definition: parse.h:107
std::deque< value_type >::const_reverse_iterator const_reverse_iterator
Definition: parse.h:110
void maybe_warn_variable_switch_label(tree_expression *expr)
idx type
Definition: ov.cc:3114
void make_script(tree_statement_list *cmds, tree_statement *end_script)
OCTINTERP_API void cleanup_statement_list(tree_statement_list **lst)
tree_funcall * make_meta_class_query(const std::string &class_nm)
OCTAVE_EXPORT octave_value_list or cell arrays Arguments are concatenated vertically The returned values are padded with blanks as needed to make each row of the string array have the same length Empty input strings are significant and will concatenated in the output For numerical input
Definition: strfns.cc:81
parser(void)
Definition: parse.h:489
tree_statement_list * set_stmt_print_flag(tree_statement_list *, char, bool)
tree_expression * make_assign_op(int op, tree_argument_list *lhs, token *eq_tok, tree_expression *rhs)
octave_user_function * start_function(tree_identifier *id, tree_parameter_list *param_list, tree_statement_list *body, tree_statement *end_function)
base_lexer & m_lexer
Definition: parse.h:479
OCTINTERP_API string_vector autoloaded_functions(void)
void bison_error(const std::string &s, int l=-1, int c=-1)
tree_fcn_handle * make_fcn_handle(token *tok_val)
push_parser(void)
Definition: parse.h:520
tree_statement_list * make_statement_list(tree_statement *stmt)
~push_parser(void)=default
tree_anon_fcn_handle * make_anon_fcn_handle(tree_parameter_list *param_list, tree_expression *expr)
parser & operator=(const parser &)=delete
void recover_from_parsing_function(void)
parser(const std::string &eval_string)
Definition: parse.h:497
tree_expression * make_boolean_op(int op, tree_expression *op1, token *tok_val, tree_expression *op2)
tree_command * make_break_command(token *break_tok)
tree_index_expression * make_index_expression(tree_expression *expr, tree_argument_list *args, char type)
parent_scope_info & operator=(const parent_scope_info &)=default
std::deque< value_type >::iterator iterator
Definition: parse.h:106
tree_if_clause * make_elseif_clause(token *elseif_tok, tree_expression *expr, tree_statement_list *list, comment_list *lc)
tree_classdef_properties_block * make_classdef_properties_block(token *tok_val, tree_classdef_attribute_list *a, tree_classdef_property_list *plist, token *end_tok, comment_list *lc)
OCTINTERP_API string_vector reverse_lookup_autoload(const std::string &nm)
tree_command * make_try_command(token *try_tok, tree_statement_list *body, char catch_sep, tree_statement_list *cleanup, token *end_tok, comment_list *lc, comment_list *mc)
bool m_parsing_subfunctions
Definition: parse.h:431
base_parser(base_lexer &lxr)
symbol_scope parent_scope(void) const
std::pair< symbol_scope, std::string > value_type
Definition: parse.h:104
bool m_fcn_file_from_relative_lookup
Definition: parse.h:427
tree_switch_command * finish_switch_command(token *switch_tok, tree_expression *expr, tree_switch_case_list *list, token *end_tok, comment_list *lc)
int octave_debug
tree_command * make_do_until_command(token *until_tok, tree_statement_list *body, tree_expression *expr, comment_list *lc)
parent_scope_info m_function_scopes
Definition: parse.h:462
int run(void)
std::deque< value_type >::reverse_iterator reverse_iterator
Definition: parse.h:109
tree_if_command_list * start_if_command(tree_expression *expr, tree_statement_list *list)
bool end_token_ok(token *tok, token::end_tok_type expected)
tree_statement_list * append_statement_list(tree_statement_list *list, char sep, tree_statement *stmt, bool warn_missing_semi)
std::string m_curr_class_name
Definition: parse.h:455
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:888
int m_curr_fcn_depth
Definition: parse.h:447
tree_expression * finish_matrix(tree_matrix *m)
tree_expression * make_prefix_op(int op, tree_expression *op1, token *tok_val)
octave_function * m_primary_fcn_ptr
Definition: parse.h:465
OCTINTERP_API octave_value eval_string(const std::string &, bool silent, int &parse_status)
tree_function_def * finish_classdef_external_method(octave_user_function *fcn, tree_parameter_list *ret_list, comment_list *cl)
tree_classdef_enum_block * make_classdef_enum_block(token *tok_val, tree_classdef_attribute_list *a, tree_classdef_enum_list *elist, token *end_tok, comment_list *lc)
bool m_autoloading
Definition: parse.h:423