26 #if ! defined (octave_parse_h)
27 #define octave_parse_h 1
29 #include "octave-config.h"
95 class tree_statement_listtree_statement;
128 : m_parser (
parser), m_info (), m_all_names ()
139 OCTINTERP_API std::size_t size (
void)
const;
141 OCTINTERP_API
void push (
const value_type& elt);
145 OCTINTERP_API
void pop (
void);
147 OCTINTERP_API
bool name_ok (
const std::string& name);
149 OCTINTERP_API
bool name_current_scope (
const std::string& name);
153 OCTINTERP_API std::string parent_name (
void)
const;
155 OCTINTERP_API
void clear (
void);
180 OCTINTERP_API
void reset (
void);
184 m_classdef_object = obj;
189 return m_classdef_object;
192 OCTINTERP_API
void statement_list (std::shared_ptr<tree_statement_list>& lst);
201 m_parsing_subfunctions = flag;
206 return m_parsing_subfunctions;
211 m_parsing_local_functions = flag;
216 return m_parsing_local_functions;
221 return m_curr_fcn_depth;
226 m_endfunction_found = flag;
231 return m_endfunction_found;
242 OCTINTERP_API
bool push_fcn_symtab (
void);
409 make_end (
const std::string& type,
bool eof,
427 make_arguments_block (
token *arguments_tok,
461 recover_from_parsing_function (
void);
470 make_classdef_properties_block (
token *tok_val,
488 make_classdef_methods_block (
token *tok_val,
495 make_classdef_events_block (
token *tok_val,
512 make_classdef_enum_block (
token *tok_val,
533 make_classdef_superclass (
token *fqident);
654 make_identifier (
token *ident);
657 make_superclass_ref (
token *superclassref);
660 make_metaclass_query (
token *metaquery);
667 template <
typename T>
704 OCTINTERP_API
void disallow_command_syntax (
void);
707 OCTINTERP_API
void bison_error (
const std::string& s);
708 OCTINTERP_API
void bison_error (
const std::string& s,
const filepos& pos);
709 OCTINTERP_API
void bison_error (
const std::string& s,
int line,
int column);
710 OCTINTERP_API
void bison_error (
const std::list<parse_exception>& pe);
715 const std::string& file,
const std::string& dir_name,
716 const std::string& dispatch_type,
717 const std::string& package_name,
bool require_file,
718 bool force_script,
bool autoload,
bool relative_lookup);
726 virtual int run (
void) = 0;
730 OCTINTERP_API
bool validate_primary_fcn (
void);
733 bool at_eof =
false);
810 OCTINTERP_API
void maybe_warn_assign_as_truth_value (
tree_expression *expr);
813 OCTINTERP_API
void maybe_warn_variable_switch_label (
tree_expression *expr);
823 const std::string& file,
const std::string& dir_name,
824 const std::string& dispatch_type,
825 const std::string& package_name,
bool require_file,
826 bool force_script,
bool autoload,
bool relative_lookup);
864 OCTINTERP_API
int run (
void);
896 OCTINTERP_API
int run (
void);
901 OCTINTERP_API
int run (
const std::string&
input,
bool eof);
910 extern OCTINTERP_API std::string
914 extern OCTINTERP_API std::string
919 const std::string& dir_name =
"",
920 const std::string& dispatch_type =
"",
921 const std::string& package_name =
"",
922 const std::string& fcn_name =
"",
923 bool autoload =
false);
925 extern OCTINTERP_API
void
927 const std::string& context =
"",
928 bool verbose =
false,
bool require_file =
true);
931 feval (
const char *name,
936 feval (
const std::string& name,
953 extern OCTINTERP_API
void
static octave_value make_fcn_handle(const octave_value &fcn, const std::string &meth_name, const std::string &class_name)
parent_scope_info(const parent_scope_info &)=delete
std::deque< value_type > m_info
parent_scope_info(void)=delete
std::deque< value_type >::const_iterator const_iterator
std::deque< value_type >::const_reverse_iterator const_reverse_iterator
std::set< std::string > m_all_names
parent_scope_info(base_parser &parser)
std::deque< value_type >::iterator iterator
~parent_scope_info(void)=default
std::pair< symbol_scope, std::string > value_type
std::deque< value_type >::reverse_iterator reverse_iterator
OCTINTERP_API tree_statement * make_statement(T *arg)
std::shared_ptr< tree_statement_list > m_stmt_list
octave_value m_primary_fcn
parent_scope_info m_function_scopes
void parsing_subfunctions(bool flag)
bool at_end_of_input(void) const
std::string m_curr_class_name
std::shared_ptr< tree_classdef > classdef_object(void) const
bool m_parsing_local_functions
std::string m_curr_package_name
bool m_fcn_file_from_relative_lookup
symbol_scope m_primary_fcn_scope
OCTINTERP_API octave_user_function * frob_function(tree_identifier *id, octave_user_function *fcn)
std::shared_ptr< tree_statement_list > statement_list(void) const
std::list< std::string > m_subfunction_names
void parsing_local_functions(bool flag)
base_lexer & get_lexer(void) const
bool endfunction_found(void) const
bool m_parsing_subfunctions
bool parsing_subfunctions(void) const
void endfunction_found(bool flag)
base_parser(const base_parser &)=delete
int curr_fcn_depth(void) const
std::shared_ptr< tree_classdef > m_classdef_object
bool parsing_local_functions(void) const
void classdef_object(const std::shared_ptr< tree_classdef > &obj)
std::string m_parse_error_msg
parser(const parser &)=delete
OCTINTERP_API int run(void)
parser(const std::string &eval_string, interpreter &interp)
parser(interpreter &interp)
parser(FILE *file, interpreter &interp, std::string encoding)
parser & operator=(const parser &)=delete
parser(FILE *file, interpreter &interp)
OCTINTERP_API int run(void)
push_parser(interpreter &interp)
interpreter & m_interpreter
push_parser(interpreter &interp, input_reader *reader)
~push_parser(void)=default
push_parser & operator=(const push_parser &)=delete
push_parser(const push_parser &)=delete
std::shared_ptr< input_reader > m_reader
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
static int input(yyscan_t yyscanner)
OCTINTERP_API void cleanup_statement_list(tree_statement_list **lst)
OCTINTERP_API void source_file(const std::string &file_name, const std::string &context="", bool verbose=false, bool require_file=true)
OCTINTERP_API octave_value_list feval(const char *name, const octave_value_list &args=octave_value_list(), int nargout=0)
Evaluate an Octave function (built-in or interpreted) and return the list of result values.
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)
OCTINTERP_API octave_value parse_fcn_file(interpreter &interp, const std::string &full_file, const std::string &file, const std::string &dir_name, const std::string &dispatch_type, const std::string &package_name, bool require_file, bool force_script, bool autoload, bool relative_lookup)
OCTINTERP_API std::string get_help_from_file(const std::string &nm, bool &symbol_found, std::string &file)