23 #if ! defined (octave_parse_h) 24 #define octave_parse_h 1 26 #include "octave-config.h" 48 class tree_anon_fcn_handle;
49 class tree_argument_list;
50 class tree_array_list;
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;
67 class tree_decl_command;
68 class tree_decl_init_list;
69 class tree_expression;
70 class tree_fcn_handle;
72 class tree_function_def;
73 class tree_identifier;
75 class tree_if_command;
76 class tree_if_command_list;
77 class tree_index_expression;
80 class tree_parameter_list;
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;
120 size_t size (
void)
const;
401 template <
typename T>
557 bool autoload =
false);
559 extern OCTINTERP_API
void 562 bool verbose =
false,
bool require_file =
true,
589 extern OCTINTERP_API
void 593 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS) 595 OCTAVE_DEPRECATED (4.4,
"use 'octave::get_help_from_file' instead")
596 static inline
std::
string 603 OCTAVE_DEPRECATED (4.4,
"use 'octave::get_help_from_file' instead")
604 static inline
std::
string 610 OCTAVE_DEPRECATED (4.4,
"use 'octave::lookup_autoload' instead")
611 static inline
std::
string 617 OCTAVE_DEPRECATED (4.4,
"use 'octave::autoloaded_functions' instead")
624 OCTAVE_DEPRECATED (4.4,
"use 'octave::reverse_lookup_autoload' instead")
631 OCTAVE_DEPRECATED (4.4,
"use 'octave::source_file' instead")
636 const
std::
string& warn_for = "")
641 OCTAVE_DEPRECATED (4.4,
"use 'octave::feval' instead")
650 OCTAVE_DEPRECATED (4.4,
"use 'octave::feval' instead")
659 OCTAVE_DEPRECATED (4.4,
"use 'octave::feval' instead")
666 OCTAVE_DEPRECATED (4.4,
"use 'octave::eval_string' instead")
674 OCTAVE_DEPRECATED (4.4,
"use 'octave::eval_string' instead")
681 OCTAVE_DEPRECATED (4.4,
"use 'octave::cleanup_statement_list' instead")
OCTINTERP_API octave_value_list feval(const std::string &name, const octave_value_list &args=octave_value_list(), int nargout=0)
parent_scope_info(void)=default
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
For example cd octave end example noindent changes the current working directory to file
tree_index_expression * make_indirect_ref(tree_expression *expr, const std::string &)
bool m_parsing_local_functions
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
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
tree_switch_case * make_switch_case(token *case_tok, tree_expression *expr, tree_statement_list *list, comment_list *lc)
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
identity matrix If supplied two scalar respectively For allows like xample val
OCTINTERP_API std::string get_help_from_file(const std::string &nm, bool &symbol_found, std::string &file)
std::string m_curr_package_name
octave_user_function * frob_function(tree_identifier *id, octave_user_function *fcn)
tree_statement_list * m_stmt_list
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)
std::string m_parse_error_msg
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)
std::string parent_name(void) const
tree_classdef * m_classdef_object
static llvm::LLVMContext & context
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
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)
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
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="")
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
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)
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
nd deftypefn *std::string name
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
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)
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)
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)
tree_expression * finish_cell(tree_cell *c)
tree_expression * finish_array_list(tree_array_list *a)
std::deque< value_type >::const_iterator const_iterator
std::deque< value_type >::const_reverse_iterator const_reverse_iterator
void maybe_warn_variable_switch_label(tree_expression *expr)
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
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)
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)
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)
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
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)
~parent_scope_info(void)=default
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
base_parser(base_lexer &lxr)
symbol_scope parent_scope(void) const
std::pair< symbol_scope, std::string > value_type
bool m_fcn_file_from_relative_lookup
tree_switch_command * finish_switch_command(token *switch_tok, tree_expression *expr, tree_switch_case_list *list, token *end_tok, comment_list *lc)
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
std::deque< value_type >::reverse_iterator reverse_iterator
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
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
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
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)