@@ -85,8 +85,8 @@ class context {
8585
8686 [[nodiscard]] ps::variable& create_variable (std::string const & name, ps::value&& initializer, block_scope* scope = nullptr );
8787
88- [[nodiscard]] ps::variable& get_variable (std::string const & name, peg ::Ast const * node = nullptr , block_scope* scope = nullptr );
89- [[nodiscard]] ps::value& get_variable_value (std::string const & name, peg ::Ast const * node = nullptr , block_scope* scope = nullptr );
88+ [[nodiscard]] ps::variable& get_variable (std::string const & name, ps ::Ast const * node = nullptr , block_scope* scope = nullptr );
89+ [[nodiscard]] ps::value& get_variable_value (std::string const & name, ps ::Ast const * node = nullptr , block_scope* scope = nullptr );
9090
9191 /* *
9292 * @brief Executes a script in this context. Note that this function is NOT safe to use in interactive mode, and may be removed in a future version.
@@ -104,7 +104,7 @@ class context {
104104 struct function {
105105 // refers to key in map
106106 std::string_view name;
107- peg ::Ast const * node = nullptr ;
107+ ps ::Ast const * node = nullptr ;
108108
109109 struct parameter {
110110 std::string name {};
@@ -158,53 +158,53 @@ class context {
158158 // lifetime (see for example interactive mode).
159159 std::vector<std::shared_ptr<ps::script>> executed_scripts;
160160
161- ps::value execute (peg ::Ast const * node, block_scope* scope, std::string const & namespace_prefix = " " ); // namespace prefix used for importing
161+ ps::value execute (ps ::Ast const * node, block_scope* scope, std::string const & namespace_prefix = " " ); // namespace prefix used for importing
162162
163- static peg ::Ast const * find_child_with_type (peg ::Ast const * node, std::string_view type) noexcept ;
163+ static ps ::Ast const * find_child_with_type (ps ::Ast const * node, unsigned int type) noexcept ;
164164
165165 [[nodiscard]] ps::variable* find_variable (std::string const & name, block_scope* scope);
166166 void delete_variable (std::string const & name, block_scope* scope);
167167
168168 // checks both name and original_name
169- static bool node_is_type (peg ::Ast const * node, std::string_view type) noexcept ;
169+ static bool node_is_type (ps ::Ast const * node, unsigned int type) noexcept ;
170170
171- static ps::type evaluate_type (peg ::Ast const * node);
172- static std::string evaluate_type_name (peg ::Ast const * node);
171+ static ps::type evaluate_type (ps ::Ast const * node);
172+ static std::string evaluate_type_name (ps ::Ast const * node);
173173
174- void evaluate_declaration (peg ::Ast const * node, block_scope* scope);
175- void evaluate_function_definition (peg ::Ast const * node, std::string const & namespace_prefix = " " );
176- void evaluate_struct_definition (peg ::Ast const * node, std::string const & namespace_prefix = " " );
177- void evaluate_extern_variable (peg ::Ast const * node, std::string const & namespace_prefix = " " );
174+ void evaluate_declaration (ps ::Ast const * node, block_scope* scope);
175+ void evaluate_function_definition (ps ::Ast const * node, std::string const & namespace_prefix = " " );
176+ void evaluate_struct_definition (ps ::Ast const * node, std::string const & namespace_prefix = " " );
177+ void evaluate_extern_variable (ps ::Ast const * node, std::string const & namespace_prefix = " " );
178178
179- void evaluate_import (peg ::Ast const * node);
179+ void evaluate_import (ps ::Ast const * node);
180180
181- std::vector<ps::value> evaluate_argument_list (peg ::Ast const * call_node, block_scope* scope, bool ref = false );
181+ std::vector<ps::value> evaluate_argument_list (ps ::Ast const * call_node, block_scope* scope, bool ref = false );
182182
183- static std::string parse_namespace (peg ::Ast const * node);
183+ static std::string parse_namespace (ps ::Ast const * node);
184184
185185 // clears variables in scope, then creates variables for arguments.
186- void prepare_function_scope (peg ::Ast const * call_node, block_scope* call_scope, function* func, block_scope* func_scope);
186+ void prepare_function_scope (ps ::Ast const * call_node, block_scope* call_scope, function* func, block_scope* func_scope);
187187
188- ps::value evaluate_function_call (peg ::Ast const * node, block_scope* scope);
189- ps::value evaluate_external_call (peg ::Ast const * node, block_scope* scope, std::string const & name);
190- ps::value evaluate_builtin_function (std::string_view name, peg ::Ast const * node, block_scope* scope);
191- ps::value evaluate_list_member_function (std::string_view name, ps::variable& object, peg ::Ast const * node, block_scope* scope);
192- ps::value evaluate_string_member_function (std::string_view name, ps::variable& object, peg ::Ast const * node, block_scope* scope);
188+ ps::value evaluate_function_call (ps ::Ast const * node, block_scope* scope);
189+ ps::value evaluate_external_call (ps ::Ast const * node, block_scope* scope, std::string const & name);
190+ ps::value evaluate_builtin_function (std::string_view name, ps ::Ast const * node, block_scope* scope);
191+ ps::value evaluate_list_member_function (std::string_view name, ps::variable& object, ps ::Ast const * node, block_scope* scope);
192+ ps::value evaluate_string_member_function (std::string_view name, ps::variable& object, ps ::Ast const * node, block_scope* scope);
193193
194194 // return reference to list value, given index-expr node.
195- ps::value& index_list (peg ::Ast const * node, block_scope* scope);
196- ps::value& access_member (peg ::Ast const * node, block_scope* scope);
195+ ps::value& index_list (ps ::Ast const * node, block_scope* scope);
196+ ps::value& access_member (ps ::Ast const * node, block_scope* scope);
197197
198- ps::value evaluate_operand (peg ::Ast const * node, block_scope* scope, bool ref = false );
199- ps::value evaluate_operator (peg ::Ast const * lhs, peg ::Ast const * op, peg ::Ast const * rhs, block_scope* scope);
200- ps::value evaluate_expression (peg ::Ast const * node, block_scope* scope, bool ref = false );
201- ps::value evaluate_constructor_expression (peg ::Ast const * node, block_scope* scope);
202- ps::value evaluate_list (peg ::Ast const * node, block_scope* scope);
198+ ps::value evaluate_operand (ps ::Ast const * node, block_scope* scope, bool ref = false );
199+ ps::value evaluate_operator (ps ::Ast const * lhs, ps ::Ast const * op, ps ::Ast const * rhs, block_scope* scope);
200+ ps::value evaluate_expression (ps ::Ast const * node, block_scope* scope, bool ref = false );
201+ ps::value evaluate_constructor_expression (ps ::Ast const * node, block_scope* scope);
202+ ps::value evaluate_list (ps ::Ast const * node, block_scope* scope);
203203
204204 // returns true if cast was successful, false otherwise
205205 static bool try_cast (ps::value& val, ps::type from, ps::type to);
206206
207- static void report_error (peg ::Ast const * node, std::string_view message) ;
207+ static void report_error (ps ::Ast const * node, std::string_view message) ;
208208};
209209
210210
0 commit comments