Add devblock support in IW5

This commit is contained in:
user4520 2021-10-17 13:39:31 +02:00 committed by Xenxo Espasandín
parent a015ab8708
commit b3f47d640d
12 changed files with 1907 additions and 1821 deletions

View File

@ -1,11 +1,12 @@
generate: IW5 generate: IW5
clean: clean:
rm -rf ./parser.hpp rm -rf ./parser.hpp
rm -rf ./parser.cpp rm -rf ./parser.cpp
rm -rf ./lexer.hpp rm -rf ./lexer.hpp
rm -rf ./lexer.cpp rm -rf ./lexer.cpp
IW5: lexer.lpp parser.ypp IW5: lexer.lpp parser.ypp
flex lexer.lpp flex lexer.lpp
bison parser.ypp -Wcounterexamples bison parser.ypp -Wcounterexamples
mv lexer.hpp lexer.cpp parser.hpp parser.cpp ../../src/iw5/xsk/

View File

@ -35,7 +35,12 @@ RGX_INT_DEC [0-9]+
RGX_DEFAULT (.|\n) RGX_DEFAULT (.|\n)
%x COMMENT_BLOCK_STATE %x COMMENT_BLOCK_STATE
%x DEVELOPER_BLOCK_STATE /*
this is an inclusive start condition, so rules not explicitly specifying "DEVBLOCK_ON_STATE" will also match
http://dinosaur.compilertools.net/flex/flex_11.html
*/
%s DEVBLOCK_ON_STATE
%x DEVBLOCK_OFF_STATE
%% %%
@ -54,10 +59,16 @@ RGX_DEFAULT (.|\n)
<COMMENT_BLOCK_STATE>\n { loc.lines(yyleng); loc.step(); } <COMMENT_BLOCK_STATE>\n { loc.lines(yyleng); loc.step(); }
<COMMENT_BLOCK_STATE>"*/" { BEGIN(INITIAL); } <COMMENT_BLOCK_STATE>"*/" { BEGIN(INITIAL); }
"/#" { BEGIN(DEVELOPER_BLOCK_STATE); } "/#" { BEGIN(devblock_mode == xsk::gsc::dev_blocks::on ? DEVBLOCK_ON_STATE : DEVBLOCK_OFF_STATE); }
<DEVELOPER_BLOCK_STATE>. /* ignore everything if we're in devblock-off state */
<DEVELOPER_BLOCK_STATE>\n { loc.lines(yyleng); loc.step(); } <DEVBLOCK_OFF_STATE>.
<DEVELOPER_BLOCK_STATE>"#/" { BEGIN(INITIAL); } <DEVBLOCK_OFF_STATE>\n { loc.lines(yyleng); loc.step(); }
/* always exit devblock state when seeing #/ */
<DEVBLOCK_OFF_STATE,DEVBLOCK_ON_STATE>"#/" { BEGIN(INITIAL); }
/* for better errors */
<INITIAL>"*/" { throw iw5::parser::syntax_error(loc, "unmatched multiline comment end ('*/')"); }
<INITIAL>"#/" { throw iw5::parser::syntax_error(loc, "unmatched devblock end ('#/')"); }
"breakpoint" { return iw5::parser::make_BREAKPOINT(loc); } "breakpoint" { return iw5::parser::make_BREAKPOINT(loc); }
"prof_begin" { return iw5::parser::make_PROFBEGIN(loc); } "prof_begin" { return iw5::parser::make_PROFBEGIN(loc); }

View File

@ -24,16 +24,18 @@
%lex-param { yyscan_t yyscanner } %lex-param { yyscan_t yyscanner }
%lex-param { xsk::gsc::location& loc } %lex-param { xsk::gsc::location& loc }
%lex-param { xsk::gsc::dev_blocks devblock_mode }
%parse-param { yyscan_t yyscanner } %parse-param { yyscan_t yyscanner }
%parse-param { xsk::gsc::location& loc } %parse-param { xsk::gsc::location& loc }
%parse-param { xsk::gsc::program_ptr& ast } %parse-param { xsk::gsc::program_ptr& ast }
%parse-param { xsk::gsc::dev_blocks devblock_mode }
%code requires %code requires
{ {
#include "iw5.hpp" #include "iw5.hpp"
typedef void *yyscan_t; typedef void *yyscan_t;
#define YY_DECL xsk::gsc::iw5::parser::symbol_type IW5lex(yyscan_t yyscanner, xsk::gsc::location& loc) #define YY_DECL xsk::gsc::iw5::parser::symbol_type IW5lex(yyscan_t yyscanner, xsk::gsc::location& loc, xsk::gsc::dev_blocks devblock_mode)
} }
%code top %code top
@ -42,7 +44,7 @@ typedef void *yyscan_t;
#include "parser.hpp" #include "parser.hpp"
#include "lexer.hpp" #include "lexer.hpp"
using namespace xsk::gsc; using namespace xsk::gsc;
xsk::gsc::iw5::parser::symbol_type IW5lex(yyscan_t yyscanner, xsk::gsc::location& loc); xsk::gsc::iw5::parser::symbol_type IW5lex(yyscan_t yyscanner, xsk::gsc::location& loc, xsk::gsc::dev_blocks devblock_mode);
} }
%token BREAKPOINT "breakpoint" %token BREAKPOINT "breakpoint"

View File

@ -46,7 +46,7 @@ auto compiler::parse_buffer(const std::string& file, std::vector<std::uint8_t>&
YY_BUFFER_STATE yybuffer = iw5__scan_buffer(reinterpret_cast<char*>(data.data()), data.size(), scanner); YY_BUFFER_STATE yybuffer = iw5__scan_buffer(reinterpret_cast<char*>(data.data()), data.size(), scanner);
parser parser(scanner, loc, result); parser parser(scanner, loc, result, m_devblocks);
if(parser.parse() || result == nullptr) if(parser.parse() || result == nullptr)
{ {

View File

@ -1,159 +1,163 @@
// Copyright 2021 xensik. All rights reserved. // Copyright 2021 xensik. All rights reserved.
// //
// Use of this source code is governed by a GNU GPLv3 license // Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file. // that can be found in the LICENSE file.
#pragma once #pragma once
namespace xsk::gsc::iw5 namespace xsk::gsc::iw5
{ {
enum class opcode : std::uint8_t; enum class opcode : std::uint8_t;
class compiler : public gsc::compiler class compiler : public gsc::compiler
{ {
std::string filename_; std::string filename_;
std::vector<gsc::function_ptr> assembly_; std::vector<gsc::function_ptr> assembly_;
gsc::function_ptr function_; gsc::function_ptr function_;
std::uint32_t index_; std::uint32_t index_;
std::uint32_t label_idx_; std::uint32_t label_idx_;
std::uint8_t stack_idx_; std::uint8_t stack_idx_;
std::vector<std::string> local_stack_; std::vector<std::string> local_stack_;
std::vector<std::string> local_functions_; std::vector<std::string> local_functions_;
std::vector<include_t> includes_; std::vector<include_t> includes_;
std::vector<animtree_t> animtrees_; std::vector<animtree_t> animtrees_;
std::unordered_map<std::string, gsc::expr_ptr> constants_; std::unordered_map<std::string, gsc::expr_ptr> constants_;
std::function<std::vector<std::uint8_t>(const std::string&)> callback_readf_; std::function<std::vector<std::uint8_t>(const std::string&)> callback_readf_;
std::vector<gsc::context*> break_ctxs_; std::vector<gsc::context*> break_ctxs_;
std::vector<gsc::context*> continue_ctxs_; std::vector<gsc::context*> continue_ctxs_;
bool can_break_; bool can_break_;
bool can_continue_; bool can_continue_;
public: public:
auto output() -> std::vector<gsc::function_ptr>; compiler(gsc::dev_blocks devblocks);
void compile(const std::string& file, std::vector<std::uint8_t>& data);
void set_readf_callback(std::function<std::vector<std::uint8_t>(const std::string&)> func); auto output() -> std::vector<gsc::function_ptr>;
void compile(const std::string& file, std::vector<std::uint8_t>& data);
private: void set_readf_callback(std::function<std::vector<std::uint8_t>(const std::string&)> func);
auto parse_buffer(const std::string& file, std::vector<std::uint8_t>& data) -> gsc::program_ptr;
auto parse_file(const std::string& file) -> gsc::program_ptr; private:
void compile_program(const gsc::program_ptr& program); auto parse_buffer(const std::string& file, std::vector<std::uint8_t>& data) -> gsc::program_ptr;
void emit_include(const gsc::include_ptr& include); auto parse_file(const std::string& file) -> gsc::program_ptr;
void emit_define(const gsc::define_ptr& define); void compile_program(const gsc::program_ptr& program);
void emit_usingtree(const gsc::usingtree_ptr& animtree); void emit_include(const gsc::include_ptr& include);
void emit_constant(const gsc::constant_ptr& constant); void emit_define(const gsc::define_ptr& define);
void emit_thread(const gsc::thread_ptr& thread); void emit_usingtree(const gsc::usingtree_ptr& animtree);
void emit_parameters(const gsc::context_ptr& ctx, const gsc::parameters_ptr& params); void emit_constant(const gsc::constant_ptr& constant);
void emit_stmt(const gsc::context_ptr& ctx, const gsc::stmt_ptr& stmt, bool last); void emit_thread(const gsc::thread_ptr& thread);
void emit_stmt_list(const gsc::context_ptr& ctx, const gsc::stmt_list_ptr& stmt, bool last); void emit_parameters(const gsc::context_ptr& ctx, const gsc::parameters_ptr& params);
void emit_stmt_call(const gsc::context_ptr& ctx, const gsc::stmt_call_ptr& stmt); void emit_stmt(const gsc::context_ptr& ctx, const gsc::stmt_ptr& stmt, bool last);
void emit_stmt_assign(const gsc::context_ptr& ctx, const gsc::stmt_assign_ptr& stmt); void emit_stmt_list(const gsc::context_ptr& ctx, const gsc::stmt_list_ptr& stmt, bool last);
void emit_stmt_endon(const gsc::context_ptr& ctx, const gsc::stmt_endon_ptr& stmt); void emit_stmt_call(const gsc::context_ptr& ctx, const gsc::stmt_call_ptr& stmt);
void emit_stmt_notify(const gsc::context_ptr& ctx, const gsc::stmt_notify_ptr& stmt); void emit_stmt_assign(const gsc::context_ptr& ctx, const gsc::stmt_assign_ptr& stmt);
void emit_stmt_wait(const gsc::context_ptr& ctx, const gsc::stmt_wait_ptr& stmt); void emit_stmt_endon(const gsc::context_ptr& ctx, const gsc::stmt_endon_ptr& stmt);
void emit_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt); void emit_stmt_notify(const gsc::context_ptr& ctx, const gsc::stmt_notify_ptr& stmt);
void emit_stmt_waittillmatch(const gsc::context_ptr& ctx, const gsc::stmt_waittillmatch_ptr& stmt); void emit_stmt_wait(const gsc::context_ptr& ctx, const gsc::stmt_wait_ptr& stmt);
void emit_stmt_waittillframeend(const gsc::context_ptr& ctx, const gsc::stmt_waittillframeend_ptr& stmt); void emit_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt);
void emit_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt, bool last); void emit_stmt_waittillmatch(const gsc::context_ptr& ctx, const gsc::stmt_waittillmatch_ptr& stmt);
void emit_stmt_ifelse(const gsc::context_ptr& ctx, const gsc::stmt_ifelse_ptr& stmt, bool last); void emit_stmt_waittillframeend(const gsc::context_ptr& ctx, const gsc::stmt_waittillframeend_ptr& stmt);
void emit_stmt_while(const gsc::context_ptr& ctx, const gsc::stmt_while_ptr& stmt); void emit_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt, bool last);
void emit_stmt_for(const gsc::context_ptr& ctx, const gsc::stmt_for_ptr& stmt); void emit_stmt_ifelse(const gsc::context_ptr& ctx, const gsc::stmt_ifelse_ptr& stmt, bool last);
void emit_stmt_foreach(const gsc::context_ptr& ctx, const gsc::stmt_foreach_ptr& stmt); void emit_stmt_while(const gsc::context_ptr& ctx, const gsc::stmt_while_ptr& stmt);
void emit_stmt_switch(const gsc::context_ptr& ctx, const gsc::stmt_switch_ptr& stmt); void emit_stmt_for(const gsc::context_ptr& ctx, const gsc::stmt_for_ptr& stmt);
void emit_stmt_case(const gsc::context_ptr& ctx, const gsc::stmt_case_ptr& stmt); void emit_stmt_foreach(const gsc::context_ptr& ctx, const gsc::stmt_foreach_ptr& stmt);
void emit_stmt_default(const gsc::context_ptr& ctx, const gsc::stmt_default_ptr& stmt); void emit_stmt_switch(const gsc::context_ptr& ctx, const gsc::stmt_switch_ptr& stmt);
void emit_stmt_break(const gsc::context_ptr& ctx, const gsc::stmt_break_ptr& stmt); void emit_stmt_case(const gsc::context_ptr& ctx, const gsc::stmt_case_ptr& stmt);
void emit_stmt_continue(const gsc::context_ptr& ctx, const gsc::stmt_continue_ptr& stmt); void emit_stmt_default(const gsc::context_ptr& ctx, const gsc::stmt_default_ptr& stmt);
void emit_stmt_return(const gsc::context_ptr& ctx, const gsc::stmt_return_ptr& stmt); void emit_stmt_break(const gsc::context_ptr& ctx, const gsc::stmt_break_ptr& stmt);
void emit_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr); void emit_stmt_continue(const gsc::context_ptr& ctx, const gsc::stmt_continue_ptr& stmt);
void emit_expr_assign(const gsc::context_ptr& ctx, const gsc::expr_assign_ptr& expr); void emit_stmt_return(const gsc::context_ptr& ctx, const gsc::stmt_return_ptr& stmt);
void emit_expr_ternary(const gsc::context_ptr& ctx, const gsc::expr_ternary_ptr& expr); void emit_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr);
void emit_expr_binary(const gsc::context_ptr& ctx, const gsc::expr_binary_ptr& expr); void emit_expr_assign(const gsc::context_ptr& ctx, const gsc::expr_assign_ptr& expr);
void emit_expr_and(const gsc::context_ptr& ctx, const gsc::expr_and_ptr& expr); void emit_expr_ternary(const gsc::context_ptr& ctx, const gsc::expr_ternary_ptr& expr);
void emit_expr_or(const gsc::context_ptr& ctx, const gsc::expr_or_ptr& expr); void emit_expr_binary(const gsc::context_ptr& ctx, const gsc::expr_binary_ptr& expr);
void emit_expr_complement(const gsc::context_ptr& ctx, const gsc::expr_complement_ptr& expr); void emit_expr_and(const gsc::context_ptr& ctx, const gsc::expr_and_ptr& expr);
void emit_expr_not(const gsc::context_ptr& ctx, const gsc::expr_not_ptr& expr); void emit_expr_or(const gsc::context_ptr& ctx, const gsc::expr_or_ptr& expr);
void emit_expr_call(const gsc::context_ptr& ctx, const gsc::expr_call_ptr& expr); void emit_expr_complement(const gsc::context_ptr& ctx, const gsc::expr_complement_ptr& expr);
void emit_expr_call_pointer(const gsc::context_ptr& ctx, const gsc::expr_call_ptr& expr); void emit_expr_not(const gsc::context_ptr& ctx, const gsc::expr_not_ptr& expr);
void emit_expr_call_pointer_type(const gsc::context_ptr& ctx, int args, bool builtin, bool method, bool thread, bool child); void emit_expr_call(const gsc::context_ptr& ctx, const gsc::expr_call_ptr& expr);
void emit_expr_call_function(const gsc::context_ptr& ctx, const gsc::expr_call_ptr& expr); void emit_expr_call_pointer(const gsc::context_ptr& ctx, const gsc::expr_call_ptr& expr);
void emit_expr_call_function_builtin(const gsc::context_ptr& ctx, const std::string& func, int args, bool method); void emit_expr_call_pointer_type(const gsc::context_ptr& ctx, int args, bool builtin, bool method, bool thread, bool child);
void emit_expr_call_function_local(const gsc::context_ptr& ctx, const std::string& func, int args, bool method, bool thread, bool child); void emit_expr_call_function(const gsc::context_ptr& ctx, const gsc::expr_call_ptr& expr);
void emit_expr_call_function_far(const gsc::context_ptr& ctx, const std::string& file, const std::string& func, int args, bool method, bool thread, bool child); void emit_expr_call_function_builtin(const gsc::context_ptr& ctx, const std::string& func, int args, bool method);
void emit_expr_arguments(const gsc::context_ptr& ctx, const gsc::expr_arguments_ptr& arg_list); void emit_expr_call_function_local(const gsc::context_ptr& ctx, const std::string& func, int args, bool method, bool thread, bool child);
void emit_expr_function(const gsc::context_ptr& ctx, const gsc::expr_function_ptr& node); void emit_expr_call_function_far(const gsc::context_ptr& ctx, const std::string& file, const std::string& func, int args, bool method, bool thread, bool child);
void emit_expr_clear_variable(const gsc::context_ptr& ctx, const gsc::expr_ptr& lvalue); void emit_expr_arguments(const gsc::context_ptr& ctx, const gsc::expr_arguments_ptr& arg_list);
void emit_expr_add_array(const gsc::context_ptr& ctx, const gsc::expr_add_array_ptr& expr); void emit_expr_function(const gsc::context_ptr& ctx, const gsc::expr_function_ptr& node);
void emit_expr_size(const gsc::context_ptr& ctx, const gsc::expr_size_ptr& expr); void emit_expr_clear_variable(const gsc::context_ptr& ctx, const gsc::expr_ptr& lvalue);
void emit_variable_ref(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr, bool set); void emit_expr_add_array(const gsc::context_ptr& ctx, const gsc::expr_add_array_ptr& expr);
void emit_array_variable_ref(const gsc::context_ptr& ctx, const gsc::expr_array_ptr& expr, bool set); void emit_expr_size(const gsc::context_ptr& ctx, const gsc::expr_size_ptr& expr);
void emit_field_variable_ref(const gsc::context_ptr& ctx, const gsc::expr_field_ptr& expr, bool set); void emit_variable_ref(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr, bool set);
void emit_local_variable_ref(const gsc::context_ptr& ctx, const gsc::name_ptr& expr, bool set); void emit_array_variable_ref(const gsc::context_ptr& ctx, const gsc::expr_array_ptr& expr, bool set);
void emit_variable(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr); void emit_field_variable_ref(const gsc::context_ptr& ctx, const gsc::expr_field_ptr& expr, bool set);
void emit_array_variable(const gsc::context_ptr& ctx, const gsc::expr_array_ptr& expr); void emit_local_variable_ref(const gsc::context_ptr& ctx, const gsc::name_ptr& expr, bool set);
void emit_field_variable(const gsc::context_ptr& ctx, const gsc::expr_field_ptr& expr); void emit_variable(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr);
void emit_local_variable(const gsc::context_ptr& ctx, const gsc::name_ptr& expr); void emit_array_variable(const gsc::context_ptr& ctx, const gsc::expr_array_ptr& expr);
void emit_clear_local_variable(const gsc::context_ptr& ctx, const gsc::name_ptr& expr); void emit_field_variable(const gsc::context_ptr& ctx, const gsc::expr_field_ptr& expr);
void emit_create_local_vars(const gsc::context_ptr& ctx); void emit_local_variable(const gsc::context_ptr& ctx, const gsc::name_ptr& expr);
void emit_remove_local_vars(const gsc::context_ptr& ctx); void emit_clear_local_variable(const gsc::context_ptr& ctx, const gsc::name_ptr& expr);
void emit_object(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr); void emit_create_local_vars(const gsc::context_ptr& ctx);
void emit_animtree(const gsc::context_ptr& ctx, const gsc::animtree_ptr& animtree); void emit_remove_local_vars(const gsc::context_ptr& ctx);
void emit_animation(const gsc::context_ptr& ctx, const gsc::animation_ptr& animation); void emit_object(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr);
void emit_istring(const gsc::context_ptr& ctx, const gsc::istring_ptr& str); void emit_animtree(const gsc::context_ptr& ctx, const gsc::animtree_ptr& animtree);
void emit_string(const gsc::context_ptr& ctx, const gsc::string_ptr& str); void emit_animation(const gsc::context_ptr& ctx, const gsc::animation_ptr& animation);
void emit_color(const gsc::context_ptr& ctx, const gsc::color_ptr& color); void emit_istring(const gsc::context_ptr& ctx, const gsc::istring_ptr& str);
void emit_vector(const gsc::context_ptr& ctx, const gsc::vector_ptr& vec); void emit_string(const gsc::context_ptr& ctx, const gsc::string_ptr& str);
void emit_float(const gsc::context_ptr& ctx, const gsc::float_ptr& num); void emit_color(const gsc::context_ptr& ctx, const gsc::color_ptr& color);
void emit_integer(const gsc::context_ptr& ctx, const gsc::integer_ptr& num); void emit_vector(const gsc::context_ptr& ctx, const gsc::vector_ptr& vec);
void emit_false(const gsc::context_ptr& ctx, const gsc::false_ptr& expr); void emit_float(const gsc::context_ptr& ctx, const gsc::float_ptr& num);
void emit_true(const gsc::context_ptr& ctx, const gsc::true_ptr& expr); void emit_integer(const gsc::context_ptr& ctx, const gsc::integer_ptr& num);
void emit_opcode(const gsc::context_ptr& ctx, opcode op); void emit_false(const gsc::context_ptr& ctx, const gsc::false_ptr& expr);
void emit_opcode(const gsc::context_ptr& ctx, opcode op, const std::string& data); void emit_true(const gsc::context_ptr& ctx, const gsc::true_ptr& expr);
void emit_opcode(const gsc::context_ptr& ctx, opcode op, const std::vector<std::string>& data); void emit_opcode(const gsc::context_ptr& ctx, opcode op);
void process_thread(const gsc::context_ptr& ctx, const gsc::thread_ptr& thread); void emit_opcode(const gsc::context_ptr& ctx, opcode op, const std::string& data);
void process_parameters(const gsc::context_ptr& ctx, const gsc::parameters_ptr& params); void emit_opcode(const gsc::context_ptr& ctx, opcode op, const std::vector<std::string>& data);
void process_stmt(const gsc::context_ptr& ctx, const gsc::stmt_ptr& stmt); void process_thread(const gsc::context_ptr& ctx, const gsc::thread_ptr& thread);
void process_stmt_list(const gsc::context_ptr& ctx, const gsc::stmt_list_ptr& stmt); void process_parameters(const gsc::context_ptr& ctx, const gsc::parameters_ptr& params);
void process_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr); void process_stmt(const gsc::context_ptr& ctx, const gsc::stmt_ptr& stmt);
void process_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt); void process_stmt_list(const gsc::context_ptr& ctx, const gsc::stmt_list_ptr& stmt);
void process_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt); void process_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr);
void process_stmt_ifelse(const gsc::context_ptr& ctx, const gsc::stmt_ifelse_ptr& stmt); void process_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt);
void process_stmt_while(const gsc::context_ptr& ctx, const gsc::stmt_while_ptr& stmt); void process_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt);
void process_stmt_for(const gsc::context_ptr& ctx, const gsc::stmt_for_ptr& stmt); void process_stmt_ifelse(const gsc::context_ptr& ctx, const gsc::stmt_ifelse_ptr& stmt);
void process_stmt_foreach(const gsc::context_ptr& ctx, const gsc::stmt_foreach_ptr& stmt); void process_stmt_while(const gsc::context_ptr& ctx, const gsc::stmt_while_ptr& stmt);
void process_stmt_switch(const gsc::context_ptr& ctx, const gsc::stmt_switch_ptr& stmt); void process_stmt_for(const gsc::context_ptr& ctx, const gsc::stmt_for_ptr& stmt);
void process_stmt_break(const gsc::context_ptr& ctx, const gsc::stmt_break_ptr& stmt); void process_stmt_foreach(const gsc::context_ptr& ctx, const gsc::stmt_foreach_ptr& stmt);
void process_stmt_continue(const gsc::context_ptr& ctx, const gsc::stmt_continue_ptr& stmt); void process_stmt_switch(const gsc::context_ptr& ctx, const gsc::stmt_switch_ptr& stmt);
void process_stmt_return(const gsc::context_ptr& ctx, const gsc::stmt_return_ptr& stmt); void process_stmt_break(const gsc::context_ptr& ctx, const gsc::stmt_break_ptr& stmt);
void register_variable(const gsc::context_ptr& ctx, const std::string& name); void process_stmt_continue(const gsc::context_ptr& ctx, const gsc::stmt_continue_ptr& stmt);
void initialize_variable(const gsc::context_ptr& ctx, const gsc::name_ptr& name); void process_stmt_return(const gsc::context_ptr& ctx, const gsc::stmt_return_ptr& stmt);
void create_variable(const gsc::context_ptr& ctx, const gsc::name_ptr& name); void register_variable(const gsc::context_ptr& ctx, const std::string& name);
auto variable_stack_index(const gsc::context_ptr& ctx, const gsc::name_ptr& name) -> std::uint8_t; void initialize_variable(const gsc::context_ptr& ctx, const gsc::name_ptr& name);
auto variable_create_index(const gsc::context_ptr& ctx, const gsc::name_ptr& name) -> std::string; void create_variable(const gsc::context_ptr& ctx, const gsc::name_ptr& name);
auto variable_access_index(const gsc::context_ptr& ctx, const gsc::name_ptr& name) -> std::string; auto variable_stack_index(const gsc::context_ptr& ctx, const gsc::name_ptr& name) -> std::uint8_t;
auto variable_initialized(const gsc::context_ptr& ctx, const gsc::name_ptr& name) -> bool; auto variable_create_index(const gsc::context_ptr& ctx, const gsc::name_ptr& name) -> std::string;
auto is_include_call(const std::string& name, std::string& file) -> bool; auto variable_access_index(const gsc::context_ptr& ctx, const gsc::name_ptr& name) -> std::string;
auto is_local_call(const std::string& name) -> bool; auto variable_initialized(const gsc::context_ptr& ctx, const gsc::name_ptr& name) -> bool;
auto is_builtin_call(const std::string& name) -> bool; auto is_include_call(const std::string& name, std::string& file) -> bool;
auto is_builtin_func(const std::string& name) -> bool; auto is_local_call(const std::string& name) -> bool;
auto is_builtin_method(const std::string& name) -> bool; auto is_builtin_call(const std::string& name) -> bool;
auto is_constant_condition(const gsc::expr_ptr& expr) -> bool; auto is_builtin_func(const std::string& name) -> bool;
auto create_label() -> std::string; auto is_builtin_method(const std::string& name) -> bool;
auto insert_label() -> std::string; auto is_constant_condition(const gsc::expr_ptr& expr) -> bool;
void insert_label(const std::string& label); auto create_label() -> std::string;
auto insert_label() -> std::string;
static gsc::include_t include_maps_mp_utility_; void insert_label(const std::string& label);
static gsc::include_t include_common_scripts_utility_;
static gsc::include_t include_common_scripts_createfx_; static gsc::include_t include_maps_mp_utility_;
static gsc::include_t include_maps_mp_gametypes_hud_util_; static gsc::include_t include_common_scripts_utility_;
auto map_known_includes(const std::string& include) -> bool; static gsc::include_t include_common_scripts_createfx_;
static gsc::include_t include_maps_mp_gametypes_hud_util_;
// debug auto map_known_includes(const std::string& include) -> bool;
void print_debug_info();
void print_opcodes(std::uint32_t index, std::uint32_t size); // debug
void print_function(const gsc::function_ptr& func); void print_debug_info();
void print_instruction(const gsc::instruction_ptr& inst); void print_opcodes(std::uint32_t index, std::uint32_t size);
void print_label(const std::string& label); void print_function(const gsc::function_ptr& func);
}; void print_instruction(const gsc::instruction_ptr& inst);
void print_label(const std::string& label);
} // namespace xsk::gsc::iw5
gsc::dev_blocks m_devblocks;
};
} // namespace xsk::gsc::iw5

File diff suppressed because it is too large Load Diff

View File

@ -2,13 +2,13 @@
#define iw5_HEADER_H 1 #define iw5_HEADER_H 1
#define iw5_IN_HEADER 1 #define iw5_IN_HEADER 1
#line 5 "lexer.hpp" #line 6 "lexer.hpp"
#include "stdafx.hpp" #include "stdafx.hpp"
#include "iw5.hpp" #include "iw5.hpp"
#include "parser.hpp" #include "parser.hpp"
using namespace xsk::gsc; using namespace xsk::gsc;
#line 11 "lexer.hpp" #line 12 "lexer.hpp"
#define YY_INT_ALIGNED short int #define YY_INT_ALIGNED short int
@ -438,7 +438,8 @@ void yyfree ( void * , yyscan_t yyscanner );
#ifdef YY_HEADER_EXPORT_START_CONDITIONS #ifdef YY_HEADER_EXPORT_START_CONDITIONS
#define INITIAL 0 #define INITIAL 0
#define COMMENT_BLOCK_STATE 1 #define COMMENT_BLOCK_STATE 1
#define DEVELOPER_BLOCK_STATE 2 #define DEVBLOCK_ON_STATE 2
#define DEVBLOCK_OFF_STATE 3
#endif #endif
@ -700,9 +701,9 @@ extern int yylex (yyscan_t yyscanner);
#undef yyTABLES_NAME #undef yyTABLES_NAME
#endif #endif
#line 157 "lexer.lpp" #line 168 "lexer.lpp"
#line 706 "lexer.hpp" #line 708 "lexer.hpp"
#undef iw5_IN_HEADER #undef iw5_IN_HEADER
#endif /* iw5_HEADER_H */ #endif /* iw5_HEADER_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
// A Bison parser, made by GNU Bison 3.7.5. // A Bison parser, made by GNU Bison 3.8.2.
// Skeleton interface for Bison LALR(1) parsers in C++ // Skeleton interface for Bison LALR(1) parsers in C++
@ -15,7 +15,7 @@
// GNU General Public License for more details. // GNU General Public License for more details.
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
// As a special exception, you may create a larger work that contains // As a special exception, you may create a larger work that contains
// part or all of the Bison parser skeleton and distribute that work // part or all of the Bison parser skeleton and distribute that work
@ -45,11 +45,11 @@
#ifndef YY_IW5_PARSER_HPP_INCLUDED #ifndef YY_IW5_PARSER_HPP_INCLUDED
# define YY_IW5_PARSER_HPP_INCLUDED # define YY_IW5_PARSER_HPP_INCLUDED
// "%code requires" blocks. // "%code requires" blocks.
#line 33 "parser.ypp" #line 35 "parser.ypp"
#include "iw5.hpp" #include "iw5.hpp"
typedef void *yyscan_t; typedef void *yyscan_t;
#define YY_DECL xsk::gsc::iw5::parser::symbol_type IW5lex(yyscan_t yyscanner, xsk::gsc::location& loc) #define YY_DECL xsk::gsc::iw5::parser::symbol_type IW5lex(yyscan_t yyscanner, xsk::gsc::location& loc, xsk::gsc::dev_blocks devblock_mode)
#line 55 "parser.hpp" #line 55 "parser.hpp"
@ -127,12 +127,18 @@ typedef void *yyscan_t;
# define YY_USE(E) /* empty */ # define YY_USE(E) /* empty */
#endif #endif
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */ /* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
# else
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# endif
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop") _Pragma ("GCC diagnostic pop")
#else #else
@ -194,7 +200,7 @@ typedef void *yyscan_t;
#line 13 "parser.ypp" #line 13 "parser.ypp"
namespace xsk { namespace gsc { namespace iw5 { namespace xsk { namespace gsc { namespace iw5 {
#line 198 "parser.hpp" #line 204 "parser.hpp"
@ -203,27 +209,32 @@ namespace xsk { namespace gsc { namespace iw5 {
class parser class parser
{ {
public: public:
#ifndef IW5STYPE #ifdef IW5STYPE
# ifdef __GNUC__
# pragma GCC message "bison: do not #define IW5STYPE in C++, use %define api.value.type"
# endif
typedef IW5STYPE value_type;
#else
/// A buffer to store and retrieve objects. /// A buffer to store and retrieve objects.
/// ///
/// Sort of a variant, but does not keep track of the nature /// Sort of a variant, but does not keep track of the nature
/// of the stored data, since that knowledge is available /// of the stored data, since that knowledge is available
/// via the current parser state. /// via the current parser state.
class semantic_type class value_type
{ {
public: public:
/// Type of *this. /// Type of *this.
typedef semantic_type self_type; typedef value_type self_type;
/// Empty construction. /// Empty construction.
semantic_type () YY_NOEXCEPT value_type () YY_NOEXCEPT
: yybuffer_ () : yyraw_ ()
, yytypeid_ (YY_NULLPTR) , yytypeid_ (YY_NULLPTR)
{} {}
/// Construct and fill. /// Construct and fill.
template <typename T> template <typename T>
semantic_type (YY_RVREF (T) t) value_type (YY_RVREF (T) t)
: yytypeid_ (&typeid (T)) : yytypeid_ (&typeid (T))
{ {
IW5_ASSERT (sizeof (T) <= size); IW5_ASSERT (sizeof (T) <= size);
@ -232,13 +243,13 @@ namespace xsk { namespace gsc { namespace iw5 {
#if 201103L <= YY_CPLUSPLUS #if 201103L <= YY_CPLUSPLUS
/// Non copyable. /// Non copyable.
semantic_type (const self_type&) = delete; value_type (const self_type&) = delete;
/// Non copyable. /// Non copyable.
self_type& operator= (const self_type&) = delete; self_type& operator= (const self_type&) = delete;
#endif #endif
/// Destruction, allowed only if empty. /// Destruction, allowed only if empty.
~semantic_type () YY_NOEXCEPT ~value_type () YY_NOEXCEPT
{ {
IW5_ASSERT (!yytypeid_); IW5_ASSERT (!yytypeid_);
} }
@ -382,7 +393,7 @@ namespace xsk { namespace gsc { namespace iw5 {
private: private:
#if YY_CPLUSPLUS < 201103L #if YY_CPLUSPLUS < 201103L
/// Non copyable. /// Non copyable.
semantic_type (const self_type&); value_type (const self_type&);
/// Non copyable. /// Non copyable.
self_type& operator= (const self_type&); self_type& operator= (const self_type&);
#endif #endif
@ -392,7 +403,7 @@ namespace xsk { namespace gsc { namespace iw5 {
T* T*
yyas_ () YY_NOEXCEPT yyas_ () YY_NOEXCEPT
{ {
void *yyp = yybuffer_.yyraw; void *yyp = yyraw_;
return static_cast<T*> (yyp); return static_cast<T*> (yyp);
} }
@ -401,7 +412,7 @@ namespace xsk { namespace gsc { namespace iw5 {
const T* const T*
yyas_ () const YY_NOEXCEPT yyas_ () const YY_NOEXCEPT
{ {
const void *yyp = yybuffer_.yyraw; const void *yyp = yyraw_;
return static_cast<const T*> (yyp); return static_cast<const T*> (yyp);
} }
@ -613,18 +624,19 @@ namespace xsk { namespace gsc { namespace iw5 {
union union
{ {
/// Strongest alignment constraints. /// Strongest alignment constraints.
long double yyalign_me; long double yyalign_me_;
/// A buffer large enough to store any of the semantic values. /// A buffer large enough to store any of the semantic values.
char yyraw[size]; char yyraw_[size];
} yybuffer_; };
/// Whether the content is built: if defined, the name of the stored type. /// Whether the content is built: if defined, the name of the stored type.
const std::type_info *yytypeid_; const std::type_info *yytypeid_;
}; };
#else
typedef IW5STYPE semantic_type;
#endif #endif
/// Backward compatibility (Bison 3.8).
typedef value_type semantic_type;
/// Symbol locations. /// Symbol locations.
typedef xsk::gsc::location location_type; typedef xsk::gsc::location location_type;
@ -761,7 +773,7 @@ namespace xsk { namespace gsc { namespace iw5 {
}; };
/// Token kind, as returned by yylex. /// Token kind, as returned by yylex.
typedef token::yytokentype token_kind_type; typedef token::token_kind_type token_kind_type;
/// Backward compatibility alias (Bison 3.6). /// Backward compatibility alias (Bison 3.6).
typedef token_kind_type token_type; typedef token_kind_type token_type;
@ -973,7 +985,7 @@ namespace xsk { namespace gsc { namespace iw5 {
typedef Base super_type; typedef Base super_type;
/// Default constructor. /// Default constructor.
basic_symbol () basic_symbol () YY_NOEXCEPT
: value () : value ()
, location () , location ()
{} {}
@ -2068,6 +2080,8 @@ namespace xsk { namespace gsc { namespace iw5 {
clear (); clear ();
} }
/// Destroy contents, and record that is empty. /// Destroy contents, and record that is empty.
void clear () YY_NOEXCEPT void clear () YY_NOEXCEPT
{ {
@ -2361,7 +2375,7 @@ switch (yykind)
void move (basic_symbol& s); void move (basic_symbol& s);
/// The semantic value. /// The semantic value.
semantic_type value; value_type value;
/// The location. /// The location.
location_type location; location_type location;
@ -2376,22 +2390,24 @@ switch (yykind)
/// Type access provider for token (enum) based symbols. /// Type access provider for token (enum) based symbols.
struct by_kind struct by_kind
{ {
/// Default constructor.
by_kind ();
#if 201103L <= YY_CPLUSPLUS
/// Move constructor.
by_kind (by_kind&& that);
#endif
/// Copy constructor.
by_kind (const by_kind& that);
/// The symbol kind as needed by the constructor. /// The symbol kind as needed by the constructor.
typedef token_kind_type kind_type; typedef token_kind_type kind_type;
/// Default constructor.
by_kind () YY_NOEXCEPT;
#if 201103L <= YY_CPLUSPLUS
/// Move constructor.
by_kind (by_kind&& that) YY_NOEXCEPT;
#endif
/// Copy constructor.
by_kind (const by_kind& that) YY_NOEXCEPT;
/// Constructor from (external) token numbers. /// Constructor from (external) token numbers.
by_kind (kind_type t); by_kind (kind_type t) YY_NOEXCEPT;
/// Record that this symbol is empty. /// Record that this symbol is empty.
void clear () YY_NOEXCEPT; void clear () YY_NOEXCEPT;
@ -2421,35 +2437,39 @@ switch (yykind)
typedef basic_symbol<by_kind> super_type; typedef basic_symbol<by_kind> super_type;
/// Empty symbol. /// Empty symbol.
symbol_type () {} symbol_type () YY_NOEXCEPT {}
/// Constructor for valueless symbols, and symbols from each type. /// Constructor for valueless symbols, and symbols from each type.
#if 201103L <= YY_CPLUSPLUS #if 201103L <= YY_CPLUSPLUS
symbol_type (int tok, location_type l) symbol_type (int tok, location_type l)
: super_type(token_type (tok), std::move (l)) : super_type (token_kind_type (tok), std::move (l))
#else #else
symbol_type (int tok, const location_type& l) symbol_type (int tok, const location_type& l)
: super_type(token_type (tok), l) : super_type (token_kind_type (tok), l)
#endif #endif
{ {
#if !defined _MSC_VER || defined __clang__
IW5_ASSERT (tok == token::IW5EOF IW5_ASSERT (tok == token::IW5EOF
|| (token::IW5error <= tok && tok <= token::MOD) || (token::IW5error <= tok && tok <= token::MOD)
|| (token::ADD_ARRAY <= tok && tok <= token::POSTDEC)); || (token::ADD_ARRAY <= tok && tok <= token::POSTDEC));
#endif
} }
#if 201103L <= YY_CPLUSPLUS #if 201103L <= YY_CPLUSPLUS
symbol_type (int tok, std::string v, location_type l) symbol_type (int tok, std::string v, location_type l)
: super_type(token_type (tok), std::move (v), std::move (l)) : super_type (token_kind_type (tok), std::move (v), std::move (l))
#else #else
symbol_type (int tok, const std::string& v, const location_type& l) symbol_type (int tok, const std::string& v, const location_type& l)
: super_type(token_type (tok), v, l) : super_type (token_kind_type (tok), v, l)
#endif #endif
{ {
#if !defined _MSC_VER || defined __clang__
IW5_ASSERT ((token::FILE <= tok && tok <= token::INT_HEX)); IW5_ASSERT ((token::FILE <= tok && tok <= token::INT_HEX));
#endif
} }
}; };
/// Build a parser object. /// Build a parser object.
parser (yyscan_t yyscanner_yyarg, xsk::gsc::location& loc_yyarg, xsk::gsc::program_ptr& ast_yyarg); parser (yyscan_t yyscanner_yyarg, xsk::gsc::location& loc_yyarg, xsk::gsc::program_ptr& ast_yyarg, xsk::gsc::dev_blocks devblock_mode_yyarg);
virtual ~parser (); virtual ~parser ();
#if 201103L <= YY_CPLUSPLUS #if 201103L <= YY_CPLUSPLUS
@ -2493,7 +2513,7 @@ switch (yykind)
/// YYSYMBOL. No bounds checking. /// YYSYMBOL. No bounds checking.
static const char *symbol_name (symbol_kind_type yysymbol); static const char *symbol_name (symbol_kind_type yysymbol);
// Implementation of make_symbol for each symbol type. // Implementation of make_symbol for each token kind.
#if 201103L <= YY_CPLUSPLUS #if 201103L <= YY_CPLUSPLUS
static static
symbol_type symbol_type
@ -4095,19 +4115,19 @@ switch (yykind)
/// Whether the given \c yypact_ value indicates a defaulted state. /// Whether the given \c yypact_ value indicates a defaulted state.
/// \param yyvalue the value to check /// \param yyvalue the value to check
static bool yy_pact_value_is_default_ (int yyvalue); static bool yy_pact_value_is_default_ (int yyvalue) YY_NOEXCEPT;
/// Whether the given \c yytable_ value indicates a syntax error. /// Whether the given \c yytable_ value indicates a syntax error.
/// \param yyvalue the value to check /// \param yyvalue the value to check
static bool yy_table_value_is_error_ (int yyvalue); static bool yy_table_value_is_error_ (int yyvalue) YY_NOEXCEPT;
static const short yypact_ninf_; static const short yypact_ninf_;
static const short yytable_ninf_; static const short yytable_ninf_;
/// Convert a scanner token kind \a t to a symbol kind. /// Convert a scanner token kind \a t to a symbol kind.
/// In theory \a t should be a token_kind_type, but character literals /// In theory \a t should be a token_kind_type, but character literals
/// are valid, yet not members of the token_type enum. /// are valid, yet not members of the token_kind_type enum.
static symbol_kind_type yytranslate_ (int t); static symbol_kind_type yytranslate_ (int t) YY_NOEXCEPT;
@ -4134,14 +4154,14 @@ switch (yykind)
static const short yycheck_[]; static const short yycheck_[];
// YYSTOS[STATE-NUM] -- The (internal number of the) accessing // YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
// symbol of state STATE-NUM. // state STATE-NUM.
static const unsigned char yystos_[]; static const unsigned char yystos_[];
// YYR1[YYN] -- Symbol number of symbol that rule YYN derives. // YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.
static const unsigned char yyr1_[]; static const unsigned char yyr1_[];
// YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. // YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.
static const signed char yyr2_[]; static const signed char yyr2_[];
@ -4240,7 +4260,7 @@ switch (yykind)
typedef typename S::size_type size_type; typedef typename S::size_type size_type;
typedef typename std::ptrdiff_t index_type; typedef typename std::ptrdiff_t index_type;
stack (size_type n = 200) stack (size_type n = 200) YY_NOEXCEPT
: seq_ (n) : seq_ (n)
{} {}
@ -4319,7 +4339,7 @@ switch (yykind)
class slice class slice
{ {
public: public:
slice (const stack& stack, index_type range) slice (const stack& stack, index_type range) YY_NOEXCEPT
: stack_ (stack) : stack_ (stack)
, range_ (range) , range_ (range)
{} {}
@ -4378,7 +4398,7 @@ switch (yykind)
void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym); void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym);
/// Pop \a n symbols from the stack. /// Pop \a n symbols from the stack.
void yypop_ (int n = 1); void yypop_ (int n = 1) YY_NOEXCEPT;
/// Constants. /// Constants.
enum enum
@ -4393,12 +4413,13 @@ switch (yykind)
yyscan_t yyscanner; yyscan_t yyscanner;
xsk::gsc::location& loc; xsk::gsc::location& loc;
xsk::gsc::program_ptr& ast; xsk::gsc::program_ptr& ast;
xsk::gsc::dev_blocks devblock_mode;
}; };
inline inline
parser::symbol_kind_type parser::symbol_kind_type
parser::yytranslate_ (int t) parser::yytranslate_ (int t) YY_NOEXCEPT
{ {
return static_cast<symbol_kind_type> (t); return static_cast<symbol_kind_type> (t);
} }
@ -4674,6 +4695,7 @@ switch (yykind)
template <typename Base> template <typename Base>
parser::symbol_kind_type parser::symbol_kind_type
parser::basic_symbol<Base>::type_get () const YY_NOEXCEPT parser::basic_symbol<Base>::type_get () const YY_NOEXCEPT
@ -4681,6 +4703,7 @@ switch (yykind)
return this->kind (); return this->kind ();
} }
template <typename Base> template <typename Base>
bool bool
parser::basic_symbol<Base>::empty () const YY_NOEXCEPT parser::basic_symbol<Base>::empty () const YY_NOEXCEPT
@ -4958,13 +4981,13 @@ switch (yykind)
// by_kind. // by_kind.
inline inline
parser::by_kind::by_kind () parser::by_kind::by_kind () YY_NOEXCEPT
: kind_ (symbol_kind::S_YYEMPTY) : kind_ (symbol_kind::S_YYEMPTY)
{} {}
#if 201103L <= YY_CPLUSPLUS #if 201103L <= YY_CPLUSPLUS
inline inline
parser::by_kind::by_kind (by_kind&& that) parser::by_kind::by_kind (by_kind&& that) YY_NOEXCEPT
: kind_ (that.kind_) : kind_ (that.kind_)
{ {
that.clear (); that.clear ();
@ -4972,15 +4995,17 @@ switch (yykind)
#endif #endif
inline inline
parser::by_kind::by_kind (const by_kind& that) parser::by_kind::by_kind (const by_kind& that) YY_NOEXCEPT
: kind_ (that.kind_) : kind_ (that.kind_)
{} {}
inline inline
parser::by_kind::by_kind (token_kind_type t) parser::by_kind::by_kind (token_kind_type t) YY_NOEXCEPT
: kind_ (yytranslate_ (t)) : kind_ (yytranslate_ (t))
{} {}
inline inline
void void
parser::by_kind::clear () YY_NOEXCEPT parser::by_kind::clear () YY_NOEXCEPT
@ -5003,6 +5028,7 @@ switch (yykind)
return kind_; return kind_;
} }
inline inline
parser::symbol_kind_type parser::symbol_kind_type
parser::by_kind::type_get () const YY_NOEXCEPT parser::by_kind::type_get () const YY_NOEXCEPT
@ -5010,9 +5036,10 @@ switch (yykind)
return this->kind (); return this->kind ();
} }
#line 13 "parser.ypp" #line 13 "parser.ypp"
} } } // xsk::gsc::iw5 } } } // xsk::gsc::iw5
#line 5016 "parser.hpp" #line 5043 "parser.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
#pragma once
namespace xsk::gsc
{
enum class dev_blocks
{
on,
off
};
}

View File

@ -1,27 +1,28 @@
// Copyright 2021 xensik. All rights reserved. // Copyright 2021 xensik. All rights reserved.
// //
// Use of this source code is governed by a GNU GPLv3 license // Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file. // that can be found in the LICENSE file.
#pragma once #pragma once
// Utility // Utility
#include "file.hpp" #include "file.hpp"
#include "string.hpp" #include "string.hpp"
#include "byte_buffer.hpp" #include "byte_buffer.hpp"
#include "compression.hpp" #include "compression.hpp"
// GSC Types // GSC Types
#include "gsc/pair.hpp" #include "gsc/devblocks.hpp"
#include "gsc/asset.hpp" #include "gsc/pair.hpp"
#include "gsc/assembly.hpp" #include "gsc/asset.hpp"
#include "gsc/context.hpp" #include "gsc/assembly.hpp"
#include "gsc/location.hpp" #include "gsc/context.hpp"
#include "gsc/nodetree.hpp" #include "gsc/location.hpp"
#include "gsc/nodetree.hpp"
// GSC Interfaces
#include "gsc/interfaces/exception.hpp" // GSC Interfaces
#include "gsc/interfaces/assembler.hpp" #include "gsc/interfaces/exception.hpp"
#include "gsc/interfaces/disassembler.hpp" #include "gsc/interfaces/assembler.hpp"
#include "gsc/interfaces/compiler.hpp" #include "gsc/interfaces/disassembler.hpp"
#include "gsc/interfaces/decompiler.hpp" #include "gsc/interfaces/compiler.hpp"
#include "gsc/interfaces/decompiler.hpp"