26 #if ! defined (octave_parse_h)
27 #define octave_parse_h 1
29 #include "octave-config.h"
52 class parse_exception;
95 class tree_statement_listtree_statement;
100 OCTAVE_END_NAMESPACE(
octave)
113 class parent_scope_info
117 typedef std::pair<symbol_scope, std::string> value_type;
119 typedef std::deque<value_type>::iterator iterator;
120 typedef std::deque<value_type>::const_iterator const_iterator;
122 typedef std::deque<value_type>::reverse_iterator reverse_iterator;
123 typedef std::deque<value_type>::const_reverse_iterator const_reverse_iterator;
125 parent_scope_info () =
delete;
128 : m_parser (
parser), m_info (), m_all_names ()
131 OCTAVE_DISABLE_COPY_MOVE (parent_scope_info)
133 ~parent_scope_info () =
default;
135 OCTINTERP_API std::size_t size ()
const;
137 OCTINTERP_API
void push (
const value_type& elt);
141 OCTINTERP_API
void pop ();
143 OCTINTERP_API
bool name_ok (
const std::string& name);
145 OCTINTERP_API
bool name_current_scope (
const std::string& name);
149 OCTINTERP_API std::string parent_name ()
const;
151 OCTINTERP_API
void clear ();
156 std::deque<value_type> m_info;
157 std::set<std::string> m_all_names;
172 OCTINTERP_API
void reset ();
176 m_classdef_object = obj;
181 return m_classdef_object;
184 OCTINTERP_API
void statement_list (std::shared_ptr<tree_statement_list>& lst);
193 m_parsing_subfunctions = flag;
198 return m_parsing_subfunctions;
203 m_parsing_local_functions = flag;
208 return m_parsing_local_functions;
213 return m_curr_fcn_depth;
218 m_endfunction_found = flag;
223 return m_endfunction_found;
234 OCTINTERP_API
bool push_fcn_symtab ();
398 const std::string& doc_string);
402 make_end (
const std::string& type,
bool eof,
420 make_arguments_block (
token *arguments_tok,
454 recover_from_parsing_function ();
463 make_classdef_properties_block (
token *tok_val,
481 make_classdef_methods_block (
token *tok_val,
488 make_classdef_events_block (
token *tok_val,
505 make_classdef_enum_block (
token *tok_val,
526 make_classdef_superclass (
token *fqident);
647 make_identifier (
token *ident);
650 make_superclass_ref (
token *superclassref);
653 make_metaclass_query (
token *metaquery);
660 template <
typename T>
697 OCTINTERP_API
void disallow_command_syntax ();
700 OCTINTERP_API
void bison_error (
const std::string& s);
701 OCTINTERP_API
void bison_error (
const std::string& s,
const filepos& pos);
702 OCTINTERP_API
void bison_error (
const std::string& s,
int line,
int column);
703 OCTINTERP_API
void bison_error (
const std::list<parse_exception>& pe);
704 OCTINTERP_API
void bison_error (
const parse_exception& pe);
708 const std::string& file,
const std::string& dir_name,
709 const std::string& dispatch_type,
710 const std::string& package_name,
bool require_file,
711 bool force_script,
bool autoload,
bool relative_lookup);
723 OCTINTERP_API
bool validate_primary_fcn ();
726 bool at_eof =
false);
803 OCTINTERP_API
void maybe_warn_assign_as_truth_value (
tree_expression *expr);
806 OCTINTERP_API
void maybe_warn_variable_switch_label (
tree_expression *expr);
816 const std::string& file,
const std::string& dir_name,
817 const std::string& dispatch_type,
818 const std::string& package_name,
bool require_file,
819 bool force_script,
bool autoload,
bool relative_lookup);
849 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (
parser)
853 OCTINTERP_API
int run ();
862 m_interpreter (interp), m_reader ()
870 m_interpreter (interp), m_reader (reader)
881 OCTINTERP_API
int run ();
886 OCTINTERP_API
int run (
const std::string& input,
bool eof);
892 std::shared_ptr<input_reader> m_reader;
895 extern OCTINTERP_API std::string
899 extern OCTINTERP_API std::string
904 const std::string& dir_name =
"",
905 const std::string& dispatch_type =
"",
906 const std::string& package_name =
"",
907 const std::string& fcn_name =
"",
908 bool autoload =
false);
910 extern OCTINTERP_API
void
912 const std::string& context =
"",
913 bool verbose =
false,
bool require_file =
true);
938 OCTAVE_END_NAMESPACE(
octave)
std::shared_ptr< tree_statement_list > statement_list() const
std::shared_ptr< tree_statement_list > m_stmt_list
octave_user_function * frob_function(tree_identifier *id, octave_user_function *fcn)
bool endfunction_found() const
bool parsing_local_functions() const
octave_value m_primary_fcn
parent_scope_info m_function_scopes
void parsing_subfunctions(bool flag)
std::string m_curr_class_name
bool m_parsing_local_functions
std::string m_curr_package_name
bool m_fcn_file_from_relative_lookup
symbol_scope m_primary_fcn_scope
int curr_fcn_depth() const
bool at_end_of_input() const
std::list< std::string > m_subfunction_names
void parsing_local_functions(bool flag)
bool parsing_subfunctions() const
std::shared_ptr< tree_classdef > classdef_object() const
bool m_parsing_subfunctions
base_lexer & get_lexer() const
void endfunction_found(bool flag)
std::shared_ptr< tree_classdef > m_classdef_object
void classdef_object(const std::shared_ptr< tree_classdef > &obj)
std::string m_parse_error_msg
parser(const std::string &eval_string, interpreter &interp)
parser(interpreter &interp)
parser(FILE *file, interpreter &interp, std::string encoding)
parser(FILE *file, interpreter &interp)
push_parser(interpreter &interp)
push_parser(interpreter &interp, input_reader *reader)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
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)
octave_value_list feval(const char *name, const octave_value_list &args=octave_value_list(), int nargout=0)
std::string get_help_from_file(const std::string &nm, bool &symbol_found, std::string &file)
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)
void source_file(const std::string &file_name, const std::string &context="", bool verbose=false, bool require_file=true)