From b3f47d640d283279fe8bc0888ca64e66e8e9b6bc Mon Sep 17 00:00:00 2001 From: user4520 Date: Sun, 17 Oct 2021 13:39:31 +0200 Subject: [PATCH] Add devblock support in IW5 --- gen/iw5/Makefile | 23 +- gen/iw5/lexer.lpp | 21 +- gen/iw5/parser.ypp | 6 +- src/iw5/xsk/compiler.cpp | 2 +- src/iw5/xsk/compiler.hpp | 322 ++++---- src/iw5/xsk/lexer.cpp | 968 ++++++++++++------------ src/iw5/xsk/lexer.hpp | 11 +- src/iw5/xsk/parser.cpp | 903 +++++++++++----------- src/iw5/xsk/parser.hpp | 151 ++-- src/tool/xsk/main.cpp | 1256 +++++++++++++++---------------- src/utils/xsk/gsc/devblocks.hpp | 10 + src/utils/xsk/utils.hpp | 55 +- 12 files changed, 1907 insertions(+), 1821 deletions(-) create mode 100644 src/utils/xsk/gsc/devblocks.hpp diff --git a/gen/iw5/Makefile b/gen/iw5/Makefile index a8a260aa..a8863424 100644 --- a/gen/iw5/Makefile +++ b/gen/iw5/Makefile @@ -1,11 +1,12 @@ -generate: IW5 - -clean: - rm -rf ./parser.hpp - rm -rf ./parser.cpp - rm -rf ./lexer.hpp - rm -rf ./lexer.cpp - -IW5: lexer.lpp parser.ypp - flex lexer.lpp - bison parser.ypp -Wcounterexamples +generate: IW5 + +clean: + rm -rf ./parser.hpp + rm -rf ./parser.cpp + rm -rf ./lexer.hpp + rm -rf ./lexer.cpp + +IW5: lexer.lpp parser.ypp + flex lexer.lpp + bison parser.ypp -Wcounterexamples + mv lexer.hpp lexer.cpp parser.hpp parser.cpp ../../src/iw5/xsk/ diff --git a/gen/iw5/lexer.lpp b/gen/iw5/lexer.lpp index e9045797..14e56ad8 100644 --- a/gen/iw5/lexer.lpp +++ b/gen/iw5/lexer.lpp @@ -35,7 +35,12 @@ RGX_INT_DEC [0-9]+ RGX_DEFAULT (.|\n) %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) \n { loc.lines(yyleng); loc.step(); } "*/" { BEGIN(INITIAL); } -"/#" { BEGIN(DEVELOPER_BLOCK_STATE); } -. -\n { loc.lines(yyleng); loc.step(); } -"#/" { BEGIN(INITIAL); } +"/#" { BEGIN(devblock_mode == xsk::gsc::dev_blocks::on ? DEVBLOCK_ON_STATE : DEVBLOCK_OFF_STATE); } + /* ignore everything if we're in devblock-off state */ +. +\n { loc.lines(yyleng); loc.step(); } + /* always exit devblock state when seeing #/ */ +"#/" { BEGIN(INITIAL); } + + /* for better errors */ +"*/" { throw iw5::parser::syntax_error(loc, "unmatched multiline comment end ('*/')"); } +"#/" { throw iw5::parser::syntax_error(loc, "unmatched devblock end ('#/')"); } "breakpoint" { return iw5::parser::make_BREAKPOINT(loc); } "prof_begin" { return iw5::parser::make_PROFBEGIN(loc); } diff --git a/gen/iw5/parser.ypp b/gen/iw5/parser.ypp index 6e42c3c7..91809a77 100644 --- a/gen/iw5/parser.ypp +++ b/gen/iw5/parser.ypp @@ -24,16 +24,18 @@ %lex-param { yyscan_t yyscanner } %lex-param { xsk::gsc::location& loc } +%lex-param { xsk::gsc::dev_blocks devblock_mode } %parse-param { yyscan_t yyscanner } %parse-param { xsk::gsc::location& loc } %parse-param { xsk::gsc::program_ptr& ast } +%parse-param { xsk::gsc::dev_blocks devblock_mode } %code requires { #include "iw5.hpp" 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 @@ -42,7 +44,7 @@ typedef void *yyscan_t; #include "parser.hpp" #include "lexer.hpp" 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" diff --git a/src/iw5/xsk/compiler.cpp b/src/iw5/xsk/compiler.cpp index 2170cb06..aeb0caaa 100644 --- a/src/iw5/xsk/compiler.cpp +++ b/src/iw5/xsk/compiler.cpp @@ -46,7 +46,7 @@ auto compiler::parse_buffer(const std::string& file, std::vector& YY_BUFFER_STATE yybuffer = iw5__scan_buffer(reinterpret_cast(data.data()), data.size(), scanner); - parser parser(scanner, loc, result); + parser parser(scanner, loc, result, m_devblocks); if(parser.parse() || result == nullptr) { diff --git a/src/iw5/xsk/compiler.hpp b/src/iw5/xsk/compiler.hpp index ef127176..4910c525 100644 --- a/src/iw5/xsk/compiler.hpp +++ b/src/iw5/xsk/compiler.hpp @@ -1,159 +1,163 @@ -// Copyright 2021 xensik. All rights reserved. -// -// Use of this source code is governed by a GNU GPLv3 license -// that can be found in the LICENSE file. - -#pragma once - -namespace xsk::gsc::iw5 -{ - -enum class opcode : std::uint8_t; - -class compiler : public gsc::compiler -{ - std::string filename_; - std::vector assembly_; - gsc::function_ptr function_; - std::uint32_t index_; - std::uint32_t label_idx_; - std::uint8_t stack_idx_; - std::vector local_stack_; - std::vector local_functions_; - std::vector includes_; - std::vector animtrees_; - std::unordered_map constants_; - std::function(const std::string&)> callback_readf_; - std::vector break_ctxs_; - std::vector continue_ctxs_; - bool can_break_; - bool can_continue_; - -public: - auto output() -> std::vector; - void compile(const std::string& file, std::vector& data); - void set_readf_callback(std::function(const std::string&)> func); - -private: - auto parse_buffer(const std::string& file, std::vector& data) -> gsc::program_ptr; - auto parse_file(const std::string& file) -> gsc::program_ptr; - void compile_program(const gsc::program_ptr& program); - void emit_include(const gsc::include_ptr& include); - void emit_define(const gsc::define_ptr& define); - void emit_usingtree(const gsc::usingtree_ptr& animtree); - void emit_constant(const gsc::constant_ptr& constant); - void emit_thread(const gsc::thread_ptr& thread); - void emit_parameters(const gsc::context_ptr& ctx, const gsc::parameters_ptr& params); - void emit_stmt(const gsc::context_ptr& ctx, const gsc::stmt_ptr& stmt, bool last); - void emit_stmt_list(const gsc::context_ptr& ctx, const gsc::stmt_list_ptr& stmt, bool last); - void emit_stmt_call(const gsc::context_ptr& ctx, const gsc::stmt_call_ptr& stmt); - void emit_stmt_assign(const gsc::context_ptr& ctx, const gsc::stmt_assign_ptr& stmt); - void emit_stmt_endon(const gsc::context_ptr& ctx, const gsc::stmt_endon_ptr& stmt); - void emit_stmt_notify(const gsc::context_ptr& ctx, const gsc::stmt_notify_ptr& stmt); - void emit_stmt_wait(const gsc::context_ptr& ctx, const gsc::stmt_wait_ptr& stmt); - void emit_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt); - void emit_stmt_waittillmatch(const gsc::context_ptr& ctx, const gsc::stmt_waittillmatch_ptr& stmt); - void emit_stmt_waittillframeend(const gsc::context_ptr& ctx, const gsc::stmt_waittillframeend_ptr& stmt); - void emit_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt, bool last); - void emit_stmt_ifelse(const gsc::context_ptr& ctx, const gsc::stmt_ifelse_ptr& stmt, bool last); - void emit_stmt_while(const gsc::context_ptr& ctx, const gsc::stmt_while_ptr& stmt); - void emit_stmt_for(const gsc::context_ptr& ctx, const gsc::stmt_for_ptr& stmt); - void emit_stmt_foreach(const gsc::context_ptr& ctx, const gsc::stmt_foreach_ptr& stmt); - void emit_stmt_switch(const gsc::context_ptr& ctx, const gsc::stmt_switch_ptr& stmt); - void emit_stmt_case(const gsc::context_ptr& ctx, const gsc::stmt_case_ptr& stmt); - void emit_stmt_default(const gsc::context_ptr& ctx, const gsc::stmt_default_ptr& stmt); - void emit_stmt_break(const gsc::context_ptr& ctx, const gsc::stmt_break_ptr& stmt); - void emit_stmt_continue(const gsc::context_ptr& ctx, const gsc::stmt_continue_ptr& stmt); - void emit_stmt_return(const gsc::context_ptr& ctx, const gsc::stmt_return_ptr& stmt); - void emit_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr); - void emit_expr_assign(const gsc::context_ptr& ctx, const gsc::expr_assign_ptr& expr); - void emit_expr_ternary(const gsc::context_ptr& ctx, const gsc::expr_ternary_ptr& expr); - void emit_expr_binary(const gsc::context_ptr& ctx, const gsc::expr_binary_ptr& expr); - void emit_expr_and(const gsc::context_ptr& ctx, const gsc::expr_and_ptr& expr); - void emit_expr_or(const gsc::context_ptr& ctx, const gsc::expr_or_ptr& expr); - void emit_expr_complement(const gsc::context_ptr& ctx, const gsc::expr_complement_ptr& expr); - void emit_expr_not(const gsc::context_ptr& ctx, const gsc::expr_not_ptr& expr); - void emit_expr_call(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_pointer_type(const gsc::context_ptr& ctx, int args, bool builtin, 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_builtin(const gsc::context_ptr& ctx, const std::string& func, int args, bool method); - 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_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_arguments(const gsc::context_ptr& ctx, const gsc::expr_arguments_ptr& arg_list); - void emit_expr_function(const gsc::context_ptr& ctx, const gsc::expr_function_ptr& node); - void emit_expr_clear_variable(const gsc::context_ptr& ctx, const gsc::expr_ptr& lvalue); - void emit_expr_add_array(const gsc::context_ptr& ctx, const gsc::expr_add_array_ptr& expr); - void emit_expr_size(const gsc::context_ptr& ctx, const gsc::expr_size_ptr& expr); - void emit_variable_ref(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr, bool set); - void emit_array_variable_ref(const gsc::context_ptr& ctx, const gsc::expr_array_ptr& expr, bool set); - void emit_field_variable_ref(const gsc::context_ptr& ctx, const gsc::expr_field_ptr& expr, bool set); - void emit_local_variable_ref(const gsc::context_ptr& ctx, const gsc::name_ptr& expr, bool set); - void emit_variable(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr); - void emit_array_variable(const gsc::context_ptr& ctx, const gsc::expr_array_ptr& expr); - void emit_field_variable(const gsc::context_ptr& ctx, const gsc::expr_field_ptr& expr); - void emit_local_variable(const gsc::context_ptr& ctx, const gsc::name_ptr& expr); - void emit_clear_local_variable(const gsc::context_ptr& ctx, const gsc::name_ptr& expr); - void emit_create_local_vars(const gsc::context_ptr& ctx); - void emit_remove_local_vars(const gsc::context_ptr& ctx); - void emit_object(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr); - void emit_animtree(const gsc::context_ptr& ctx, const gsc::animtree_ptr& animtree); - void emit_animation(const gsc::context_ptr& ctx, const gsc::animation_ptr& animation); - void emit_istring(const gsc::context_ptr& ctx, const gsc::istring_ptr& str); - void emit_string(const gsc::context_ptr& ctx, const gsc::string_ptr& str); - void emit_color(const gsc::context_ptr& ctx, const gsc::color_ptr& color); - void emit_vector(const gsc::context_ptr& ctx, const gsc::vector_ptr& vec); - void emit_float(const gsc::context_ptr& ctx, const gsc::float_ptr& num); - void emit_integer(const gsc::context_ptr& ctx, const gsc::integer_ptr& num); - void emit_false(const gsc::context_ptr& ctx, const gsc::false_ptr& expr); - void emit_true(const gsc::context_ptr& ctx, const gsc::true_ptr& expr); - void emit_opcode(const gsc::context_ptr& ctx, opcode op); - void emit_opcode(const gsc::context_ptr& ctx, opcode op, const std::string& data); - void emit_opcode(const gsc::context_ptr& ctx, opcode op, const std::vector& data); - void process_thread(const gsc::context_ptr& ctx, const gsc::thread_ptr& thread); - void process_parameters(const gsc::context_ptr& ctx, const gsc::parameters_ptr& params); - void process_stmt(const gsc::context_ptr& ctx, const gsc::stmt_ptr& stmt); - void process_stmt_list(const gsc::context_ptr& ctx, const gsc::stmt_list_ptr& stmt); - void process_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr); - void process_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt); - void process_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt); - void process_stmt_ifelse(const gsc::context_ptr& ctx, const gsc::stmt_ifelse_ptr& stmt); - void process_stmt_while(const gsc::context_ptr& ctx, const gsc::stmt_while_ptr& stmt); - void process_stmt_for(const gsc::context_ptr& ctx, const gsc::stmt_for_ptr& stmt); - void process_stmt_foreach(const gsc::context_ptr& ctx, const gsc::stmt_foreach_ptr& stmt); - void process_stmt_switch(const gsc::context_ptr& ctx, const gsc::stmt_switch_ptr& stmt); - void process_stmt_break(const gsc::context_ptr& ctx, const gsc::stmt_break_ptr& stmt); - void process_stmt_continue(const gsc::context_ptr& ctx, const gsc::stmt_continue_ptr& stmt); - void process_stmt_return(const gsc::context_ptr& ctx, const gsc::stmt_return_ptr& stmt); - void register_variable(const gsc::context_ptr& ctx, const std::string& name); - void initialize_variable(const gsc::context_ptr& ctx, const gsc::name_ptr& name); - void create_variable(const gsc::context_ptr& ctx, const gsc::name_ptr& name); - auto variable_stack_index(const gsc::context_ptr& ctx, const gsc::name_ptr& name) -> std::uint8_t; - auto variable_create_index(const gsc::context_ptr& ctx, const gsc::name_ptr& name) -> std::string; - auto variable_access_index(const gsc::context_ptr& ctx, const gsc::name_ptr& name) -> std::string; - auto variable_initialized(const gsc::context_ptr& ctx, const gsc::name_ptr& name) -> bool; - auto is_include_call(const std::string& name, std::string& file) -> bool; - auto is_local_call(const std::string& name) -> bool; - auto is_builtin_call(const std::string& name) -> bool; - auto is_builtin_func(const std::string& name) -> bool; - auto is_builtin_method(const std::string& name) -> bool; - auto is_constant_condition(const gsc::expr_ptr& expr) -> bool; - auto create_label() -> std::string; - auto insert_label() -> std::string; - void insert_label(const std::string& label); - - static gsc::include_t include_maps_mp_utility_; - static gsc::include_t include_common_scripts_utility_; - static gsc::include_t include_common_scripts_createfx_; - static gsc::include_t include_maps_mp_gametypes_hud_util_; - auto map_known_includes(const std::string& include) -> bool; - - // debug - void print_debug_info(); - void print_opcodes(std::uint32_t index, std::uint32_t size); - 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 +// Copyright 2021 xensik. All rights reserved. +// +// Use of this source code is governed by a GNU GPLv3 license +// that can be found in the LICENSE file. + +#pragma once + +namespace xsk::gsc::iw5 +{ + +enum class opcode : std::uint8_t; + +class compiler : public gsc::compiler +{ + std::string filename_; + std::vector assembly_; + gsc::function_ptr function_; + std::uint32_t index_; + std::uint32_t label_idx_; + std::uint8_t stack_idx_; + std::vector local_stack_; + std::vector local_functions_; + std::vector includes_; + std::vector animtrees_; + std::unordered_map constants_; + std::function(const std::string&)> callback_readf_; + std::vector break_ctxs_; + std::vector continue_ctxs_; + bool can_break_; + bool can_continue_; + +public: + compiler(gsc::dev_blocks devblocks); + + auto output() -> std::vector; + void compile(const std::string& file, std::vector& data); + void set_readf_callback(std::function(const std::string&)> func); + +private: + auto parse_buffer(const std::string& file, std::vector& data) -> gsc::program_ptr; + auto parse_file(const std::string& file) -> gsc::program_ptr; + void compile_program(const gsc::program_ptr& program); + void emit_include(const gsc::include_ptr& include); + void emit_define(const gsc::define_ptr& define); + void emit_usingtree(const gsc::usingtree_ptr& animtree); + void emit_constant(const gsc::constant_ptr& constant); + void emit_thread(const gsc::thread_ptr& thread); + void emit_parameters(const gsc::context_ptr& ctx, const gsc::parameters_ptr& params); + void emit_stmt(const gsc::context_ptr& ctx, const gsc::stmt_ptr& stmt, bool last); + void emit_stmt_list(const gsc::context_ptr& ctx, const gsc::stmt_list_ptr& stmt, bool last); + void emit_stmt_call(const gsc::context_ptr& ctx, const gsc::stmt_call_ptr& stmt); + void emit_stmt_assign(const gsc::context_ptr& ctx, const gsc::stmt_assign_ptr& stmt); + void emit_stmt_endon(const gsc::context_ptr& ctx, const gsc::stmt_endon_ptr& stmt); + void emit_stmt_notify(const gsc::context_ptr& ctx, const gsc::stmt_notify_ptr& stmt); + void emit_stmt_wait(const gsc::context_ptr& ctx, const gsc::stmt_wait_ptr& stmt); + void emit_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt); + void emit_stmt_waittillmatch(const gsc::context_ptr& ctx, const gsc::stmt_waittillmatch_ptr& stmt); + void emit_stmt_waittillframeend(const gsc::context_ptr& ctx, const gsc::stmt_waittillframeend_ptr& stmt); + void emit_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt, bool last); + void emit_stmt_ifelse(const gsc::context_ptr& ctx, const gsc::stmt_ifelse_ptr& stmt, bool last); + void emit_stmt_while(const gsc::context_ptr& ctx, const gsc::stmt_while_ptr& stmt); + void emit_stmt_for(const gsc::context_ptr& ctx, const gsc::stmt_for_ptr& stmt); + void emit_stmt_foreach(const gsc::context_ptr& ctx, const gsc::stmt_foreach_ptr& stmt); + void emit_stmt_switch(const gsc::context_ptr& ctx, const gsc::stmt_switch_ptr& stmt); + void emit_stmt_case(const gsc::context_ptr& ctx, const gsc::stmt_case_ptr& stmt); + void emit_stmt_default(const gsc::context_ptr& ctx, const gsc::stmt_default_ptr& stmt); + void emit_stmt_break(const gsc::context_ptr& ctx, const gsc::stmt_break_ptr& stmt); + void emit_stmt_continue(const gsc::context_ptr& ctx, const gsc::stmt_continue_ptr& stmt); + void emit_stmt_return(const gsc::context_ptr& ctx, const gsc::stmt_return_ptr& stmt); + void emit_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr); + void emit_expr_assign(const gsc::context_ptr& ctx, const gsc::expr_assign_ptr& expr); + void emit_expr_ternary(const gsc::context_ptr& ctx, const gsc::expr_ternary_ptr& expr); + void emit_expr_binary(const gsc::context_ptr& ctx, const gsc::expr_binary_ptr& expr); + void emit_expr_and(const gsc::context_ptr& ctx, const gsc::expr_and_ptr& expr); + void emit_expr_or(const gsc::context_ptr& ctx, const gsc::expr_or_ptr& expr); + void emit_expr_complement(const gsc::context_ptr& ctx, const gsc::expr_complement_ptr& expr); + void emit_expr_not(const gsc::context_ptr& ctx, const gsc::expr_not_ptr& expr); + void emit_expr_call(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_pointer_type(const gsc::context_ptr& ctx, int args, bool builtin, 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_builtin(const gsc::context_ptr& ctx, const std::string& func, int args, bool method); + 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_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_arguments(const gsc::context_ptr& ctx, const gsc::expr_arguments_ptr& arg_list); + void emit_expr_function(const gsc::context_ptr& ctx, const gsc::expr_function_ptr& node); + void emit_expr_clear_variable(const gsc::context_ptr& ctx, const gsc::expr_ptr& lvalue); + void emit_expr_add_array(const gsc::context_ptr& ctx, const gsc::expr_add_array_ptr& expr); + void emit_expr_size(const gsc::context_ptr& ctx, const gsc::expr_size_ptr& expr); + void emit_variable_ref(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr, bool set); + void emit_array_variable_ref(const gsc::context_ptr& ctx, const gsc::expr_array_ptr& expr, bool set); + void emit_field_variable_ref(const gsc::context_ptr& ctx, const gsc::expr_field_ptr& expr, bool set); + void emit_local_variable_ref(const gsc::context_ptr& ctx, const gsc::name_ptr& expr, bool set); + void emit_variable(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr); + void emit_array_variable(const gsc::context_ptr& ctx, const gsc::expr_array_ptr& expr); + void emit_field_variable(const gsc::context_ptr& ctx, const gsc::expr_field_ptr& expr); + void emit_local_variable(const gsc::context_ptr& ctx, const gsc::name_ptr& expr); + void emit_clear_local_variable(const gsc::context_ptr& ctx, const gsc::name_ptr& expr); + void emit_create_local_vars(const gsc::context_ptr& ctx); + void emit_remove_local_vars(const gsc::context_ptr& ctx); + void emit_object(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr); + void emit_animtree(const gsc::context_ptr& ctx, const gsc::animtree_ptr& animtree); + void emit_animation(const gsc::context_ptr& ctx, const gsc::animation_ptr& animation); + void emit_istring(const gsc::context_ptr& ctx, const gsc::istring_ptr& str); + void emit_string(const gsc::context_ptr& ctx, const gsc::string_ptr& str); + void emit_color(const gsc::context_ptr& ctx, const gsc::color_ptr& color); + void emit_vector(const gsc::context_ptr& ctx, const gsc::vector_ptr& vec); + void emit_float(const gsc::context_ptr& ctx, const gsc::float_ptr& num); + void emit_integer(const gsc::context_ptr& ctx, const gsc::integer_ptr& num); + void emit_false(const gsc::context_ptr& ctx, const gsc::false_ptr& expr); + void emit_true(const gsc::context_ptr& ctx, const gsc::true_ptr& expr); + void emit_opcode(const gsc::context_ptr& ctx, opcode op); + void emit_opcode(const gsc::context_ptr& ctx, opcode op, const std::string& data); + void emit_opcode(const gsc::context_ptr& ctx, opcode op, const std::vector& data); + void process_thread(const gsc::context_ptr& ctx, const gsc::thread_ptr& thread); + void process_parameters(const gsc::context_ptr& ctx, const gsc::parameters_ptr& params); + void process_stmt(const gsc::context_ptr& ctx, const gsc::stmt_ptr& stmt); + void process_stmt_list(const gsc::context_ptr& ctx, const gsc::stmt_list_ptr& stmt); + void process_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr); + void process_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt); + void process_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt); + void process_stmt_ifelse(const gsc::context_ptr& ctx, const gsc::stmt_ifelse_ptr& stmt); + void process_stmt_while(const gsc::context_ptr& ctx, const gsc::stmt_while_ptr& stmt); + void process_stmt_for(const gsc::context_ptr& ctx, const gsc::stmt_for_ptr& stmt); + void process_stmt_foreach(const gsc::context_ptr& ctx, const gsc::stmt_foreach_ptr& stmt); + void process_stmt_switch(const gsc::context_ptr& ctx, const gsc::stmt_switch_ptr& stmt); + void process_stmt_break(const gsc::context_ptr& ctx, const gsc::stmt_break_ptr& stmt); + void process_stmt_continue(const gsc::context_ptr& ctx, const gsc::stmt_continue_ptr& stmt); + void process_stmt_return(const gsc::context_ptr& ctx, const gsc::stmt_return_ptr& stmt); + void register_variable(const gsc::context_ptr& ctx, const std::string& name); + void initialize_variable(const gsc::context_ptr& ctx, const gsc::name_ptr& name); + void create_variable(const gsc::context_ptr& ctx, const gsc::name_ptr& name); + auto variable_stack_index(const gsc::context_ptr& ctx, const gsc::name_ptr& name) -> std::uint8_t; + auto variable_create_index(const gsc::context_ptr& ctx, const gsc::name_ptr& name) -> std::string; + auto variable_access_index(const gsc::context_ptr& ctx, const gsc::name_ptr& name) -> std::string; + auto variable_initialized(const gsc::context_ptr& ctx, const gsc::name_ptr& name) -> bool; + auto is_include_call(const std::string& name, std::string& file) -> bool; + auto is_local_call(const std::string& name) -> bool; + auto is_builtin_call(const std::string& name) -> bool; + auto is_builtin_func(const std::string& name) -> bool; + auto is_builtin_method(const std::string& name) -> bool; + auto is_constant_condition(const gsc::expr_ptr& expr) -> bool; + auto create_label() -> std::string; + auto insert_label() -> std::string; + void insert_label(const std::string& label); + + static gsc::include_t include_maps_mp_utility_; + static gsc::include_t include_common_scripts_utility_; + static gsc::include_t include_common_scripts_createfx_; + static gsc::include_t include_maps_mp_gametypes_hud_util_; + auto map_known_includes(const std::string& include) -> bool; + + // debug + void print_debug_info(); + void print_opcodes(std::uint32_t index, std::uint32_t size); + void print_function(const gsc::function_ptr& func); + void print_instruction(const gsc::instruction_ptr& inst); + void print_label(const std::string& label); + + gsc::dev_blocks m_devblocks; +}; + +} // namespace xsk::gsc::iw5 diff --git a/src/iw5/xsk/lexer.cpp b/src/iw5/xsk/lexer.cpp index ce0ca7ce..eb25494c 100644 --- a/src/iw5/xsk/lexer.cpp +++ b/src/iw5/xsk/lexer.cpp @@ -1,10 +1,10 @@ -#line 1 "lexer.cpp" +#line 2 "lexer.cpp" #include "stdafx.hpp" #include "iw5.hpp" #include "parser.hpp" using namespace xsk::gsc; -#line 7 "lexer.cpp" +#line 8 "lexer.cpp" #define YY_INT_ALIGNED short int @@ -553,8 +553,8 @@ static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 104 -#define YY_END_OF_BUFFER 105 +#define YY_NUM_RULES 106 +#define YY_END_OF_BUFFER 107 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -562,43 +562,43 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[314] = +static const flex_int16_t yy_accept[320] = { 0, - 0, 0, 0, 0, 0, 0, 105, 103, 1, 2, - 88, 103, 103, 87, 91, 103, 48, 49, 85, 83, - 54, 84, 55, 86, 102, 102, 57, 58, 72, 82, - 73, 59, 94, 52, 53, 92, 94, 94, 94, 94, - 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, - 94, 94, 50, 90, 51, 89, 5, 6, 5, 9, - 10, 9, 69, 0, 96, 0, 0, 0, 0, 0, - 78, 0, 67, 0, 80, 0, 0, 76, 60, 74, - 61, 75, 98, 0, 8, 4, 3, 77, 98, 102, - 99, 0, 0, 0, 0, 56, 64, 70, 68, 71, + 0, 0, 0, 0, 0, 0, 0, 0, 107, 105, + 1, 2, 90, 105, 105, 89, 93, 105, 50, 51, + 87, 85, 56, 86, 57, 88, 104, 104, 59, 60, + 74, 84, 75, 61, 96, 54, 55, 94, 96, 96, + 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, + 96, 96, 96, 96, 52, 92, 53, 91, 5, 6, + 5, 105, 87, 9, 10, 9, 71, 0, 98, 0, + 13, 0, 0, 0, 0, 80, 0, 69, 0, 82, + 0, 0, 12, 78, 62, 76, 63, 77, 100, 0, + 8, 4, 3, 79, 100, 104, 101, 0, 0, 0, - 65, 94, 81, 94, 94, 94, 94, 94, 94, 94, - 94, 94, 94, 94, 24, 29, 94, 94, 94, 94, - 94, 94, 94, 94, 94, 94, 94, 79, 66, 7, - 11, 0, 96, 0, 0, 0, 0, 0, 0, 95, - 0, 0, 0, 0, 96, 0, 98, 0, 3, 98, - 98, 99, 100, 101, 93, 62, 63, 94, 94, 94, - 94, 94, 94, 94, 94, 94, 94, 27, 94, 94, - 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, - 94, 97, 0, 0, 0, 0, 95, 0, 0, 95, - 0, 0, 46, 94, 39, 31, 94, 94, 94, 25, + 0, 58, 66, 72, 70, 73, 67, 96, 83, 96, + 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, + 26, 31, 96, 96, 96, 96, 96, 96, 96, 96, + 96, 96, 96, 81, 68, 7, 11, 0, 98, 0, + 0, 0, 0, 0, 0, 97, 0, 0, 0, 0, + 98, 0, 100, 0, 3, 100, 100, 101, 102, 103, + 95, 64, 65, 96, 96, 96, 96, 96, 96, 96, + 96, 96, 96, 29, 96, 96, 96, 96, 96, 96, + 96, 96, 96, 96, 96, 96, 96, 99, 0, 0, + 0, 0, 97, 0, 0, 97, 0, 0, 48, 96, - 94, 94, 94, 44, 94, 94, 94, 94, 45, 94, - 94, 94, 40, 94, 20, 94, 0, 0, 0, 0, - 43, 33, 94, 94, 94, 18, 41, 94, 47, 94, - 94, 94, 94, 94, 94, 94, 94, 26, 0, 0, - 0, 0, 94, 94, 94, 94, 94, 19, 94, 94, - 35, 30, 94, 36, 94, 94, 97, 0, 0, 0, - 94, 94, 94, 32, 28, 94, 94, 94, 94, 94, - 0, 15, 0, 94, 94, 34, 94, 14, 94, 94, - 21, 17, 0, 94, 94, 94, 94, 42, 94, 94, - 0, 12, 94, 13, 38, 94, 94, 0, 37, 94, + 41, 33, 96, 96, 96, 27, 96, 96, 96, 46, + 96, 96, 96, 96, 47, 96, 96, 96, 42, 96, + 22, 96, 0, 0, 0, 0, 45, 35, 96, 96, + 96, 20, 43, 96, 49, 96, 96, 96, 96, 96, + 96, 96, 96, 28, 0, 0, 0, 0, 96, 96, + 96, 96, 96, 21, 96, 96, 37, 32, 96, 38, + 96, 96, 99, 0, 0, 0, 96, 96, 96, 34, + 30, 96, 96, 96, 96, 96, 0, 17, 0, 96, + 96, 36, 96, 16, 96, 96, 23, 19, 0, 96, + 96, 96, 96, 44, 96, 96, 0, 14, 96, 15, - 94, 0, 94, 94, 0, 94, 22, 0, 94, 16, - 94, 23, 0 + 40, 96, 96, 0, 39, 96, 96, 0, 96, 96, + 0, 96, 24, 0, 96, 18, 96, 25, 0 } ; static const YY_CHAR yy_ec[256] = @@ -636,182 +636,184 @@ static const YY_CHAR yy_ec[256] = static const YY_CHAR yy_meta[64] = { 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 1, 4, 4, 4, - 4, 1, 1, 1, 1, 1, 1, 4, 4, 5, - 5, 1, 6, 1, 1, 5, 4, 4, 4, 4, - 4, 4, 5, 5, 7, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 7, 5, 5, 5, 5, 1, + 1, 1, 1, 1, 1, 3, 4, 5, 5, 5, + 5, 1, 1, 1, 1, 1, 1, 5, 5, 6, + 6, 1, 7, 1, 1, 6, 5, 5, 5, 5, + 5, 5, 6, 6, 8, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 8, 6, 6, 6, 6, 1, 1, 1, 1 } ; -static const flex_int16_t yy_base[334] = +static const flex_int16_t yy_base[340] = { 0, - 0, 0, 61, 62, 63, 64, 667, 668, 668, 668, - 641, 63, 34, 640, 67, 68, 668, 668, 639, 65, - 668, 66, 64, 81, 89, 95, 641, 668, 70, 637, - 74, 668, 628, 668, 668, 635, 53, 71, 88, 47, - 86, 93, 103, 104, 98, 79, 108, 101, 111, 112, - 114, 117, 668, 123, 668, 668, 668, 668, 642, 668, - 668, 641, 668, 144, 668, 152, 0, 608, 607, 602, - 668, 146, 668, 149, 668, 150, 162, 668, 668, 668, - 668, 668, 154, 609, 668, 668, 0, 668, 168, 181, - 187, 160, 193, 211, 0, 668, 628, 668, 668, 668, + 0, 0, 61, 62, 60, 63, 64, 65, 690, 691, + 691, 691, 664, 71, 60, 663, 73, 70, 691, 691, + 63, 70, 691, 69, 71, 94, 102, 109, 665, 691, + 61, 661, 76, 691, 652, 691, 691, 659, 60, 74, + 99, 75, 63, 101, 80, 104, 106, 108, 111, 115, + 119, 117, 121, 122, 691, 120, 691, 691, 691, 691, + 666, 140, 657, 691, 691, 664, 691, 157, 691, 168, + 691, 0, 631, 630, 625, 691, 159, 691, 156, 691, + 158, 165, 691, 691, 691, 691, 691, 691, 184, 632, + 691, 691, 0, 691, 188, 194, 200, 163, 164, 218, - 627, 618, 668, 133, 129, 171, 136, 184, 180, 182, - 158, 147, 186, 188, 617, 616, 134, 70, 192, 183, - 208, 201, 212, 210, 214, 223, 225, 668, 668, 668, - 668, 254, 255, 258, 0, 603, 608, 601, 257, 668, - 264, 262, 263, 265, 266, 270, 668, 586, 0, 262, - 668, 289, 295, 0, 611, 668, 668, 244, 252, 253, - 243, 268, 269, 279, 284, 285, 273, 286, 288, 291, - 297, 298, 300, 301, 287, 303, 304, 305, 306, 311, - 315, 0, 595, 595, 592, 344, 345, 348, 343, 349, - 351, 599, 606, 324, 605, 604, 326, 328, 330, 603, + 0, 691, 651, 691, 691, 691, 650, 641, 691, 54, + 145, 178, 139, 191, 190, 189, 154, 196, 202, 215, + 640, 639, 208, 195, 167, 211, 219, 217, 228, 212, + 235, 236, 237, 691, 691, 691, 691, 266, 267, 271, + 0, 626, 631, 624, 272, 691, 280, 166, 275, 270, + 277, 284, 691, 609, 0, 270, 691, 276, 300, 0, + 634, 691, 691, 273, 265, 268, 281, 278, 274, 287, + 290, 293, 294, 296, 297, 299, 301, 302, 303, 306, + 308, 312, 309, 316, 318, 319, 320, 0, 618, 618, + 615, 349, 350, 358, 347, 351, 361, 622, 629, 333, - 245, 331, 334, 602, 336, 346, 353, 335, 601, 341, - 342, 357, 600, 358, 359, 360, 0, 578, 576, 587, - 668, 364, 362, 365, 370, 596, 595, 366, 594, 369, - 371, 373, 374, 375, 388, 378, 387, 593, 0, 573, - 584, 587, 391, 392, 393, 377, 396, 589, 397, 400, - 588, 587, 401, 586, 402, 409, 668, 577, 576, 579, - 410, 406, 404, 582, 581, 411, 417, 419, 426, 414, - 572, 668, 563, 413, 430, 578, 431, 577, 432, 433, - 435, 668, 564, 437, 441, 439, 442, 575, 446, 447, - 559, 558, 452, 550, 503, 453, 448, 481, 478, 456, + 628, 627, 335, 336, 338, 626, 339, 344, 341, 625, + 343, 353, 356, 354, 624, 363, 364, 366, 623, 365, + 367, 368, 0, 601, 599, 610, 691, 371, 372, 375, + 378, 619, 618, 377, 617, 379, 382, 380, 384, 386, + 394, 398, 399, 616, 0, 596, 607, 610, 400, 402, + 381, 405, 407, 612, 406, 408, 611, 610, 409, 609, + 415, 416, 691, 600, 599, 602, 420, 419, 421, 605, + 604, 412, 427, 425, 435, 423, 595, 691, 586, 436, + 439, 601, 441, 600, 440, 442, 445, 691, 587, 446, + 451, 448, 450, 598, 456, 458, 582, 579, 459, 570, - 454, 458, 462, 461, 468, 466, 473, 459, 463, 668, - 468, 464, 668, 512, 519, 526, 530, 537, 542, 546, - 553, 289, 560, 567, 574, 581, 585, 224, 592, 599, - 219, 188, 93 + 528, 461, 463, 496, 516, 468, 470, 469, 469, 471, + 479, 472, 486, 477, 473, 691, 474, 479, 691, 522, + 530, 538, 543, 551, 557, 561, 569, 506, 577, 585, + 593, 601, 605, 248, 613, 621, 188, 183, 109 } ; -static const flex_int16_t yy_def[334] = +static const flex_int16_t yy_def[340] = { 0, - 313, 1, 314, 314, 315, 315, 313, 313, 313, 313, - 313, 316, 317, 313, 313, 318, 313, 313, 313, 313, - 313, 313, 313, 313, 319, 319, 313, 313, 313, 313, - 313, 313, 320, 313, 313, 313, 320, 320, 320, 320, - 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, - 320, 320, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 316, 313, 321, 322, 322, 313, 313, - 313, 323, 313, 324, 313, 318, 325, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 326, 313, 313, 319, - 319, 319, 319, 319, 327, 313, 313, 313, 313, 313, + 319, 1, 320, 320, 1, 1, 321, 321, 319, 319, + 319, 319, 319, 322, 323, 319, 319, 324, 319, 319, + 319, 319, 319, 319, 319, 319, 325, 325, 319, 319, + 319, 319, 319, 319, 326, 319, 319, 319, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 319, 319, 319, 319, 319, 319, + 319, 323, 319, 319, 319, 319, 319, 322, 319, 327, + 319, 328, 328, 319, 319, 319, 329, 319, 330, 319, + 324, 331, 319, 319, 319, 319, 319, 319, 319, 319, + 319, 319, 332, 319, 319, 325, 325, 325, 325, 325, - 313, 320, 313, 320, 320, 320, 320, 320, 320, 320, - 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, - 320, 320, 320, 320, 320, 320, 320, 313, 313, 313, - 313, 316, 316, 321, 328, 313, 313, 313, 323, 313, - 329, 324, 330, 318, 318, 325, 313, 313, 326, 313, - 313, 319, 319, 94, 327, 313, 313, 320, 320, 320, - 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, - 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, - 320, 331, 313, 313, 313, 323, 323, 329, 324, 324, - 330, 313, 320, 320, 320, 320, 320, 320, 320, 320, + 333, 319, 319, 319, 319, 319, 319, 326, 319, 326, + 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 319, 319, 319, 319, 322, 322, 327, + 334, 319, 319, 319, 329, 319, 335, 330, 336, 324, + 324, 331, 319, 319, 332, 319, 319, 325, 325, 100, + 333, 319, 319, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 337, 319, 319, + 319, 329, 329, 335, 330, 330, 336, 319, 326, 326, - 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, - 320, 320, 320, 320, 320, 320, 332, 313, 313, 313, - 313, 320, 320, 320, 320, 320, 320, 320, 320, 320, - 320, 320, 320, 320, 320, 320, 320, 320, 333, 313, - 313, 313, 320, 320, 320, 320, 320, 320, 320, 320, - 320, 320, 320, 320, 320, 320, 313, 313, 313, 313, - 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, - 313, 313, 313, 320, 320, 320, 320, 320, 320, 320, - 320, 313, 313, 320, 320, 320, 320, 320, 320, 320, - 313, 320, 320, 320, 320, 320, 320, 313, 320, 320, + 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 338, 319, 319, 319, 319, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 339, 319, 319, 319, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 319, 319, 319, 319, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 319, 319, 319, 326, + 326, 326, 326, 326, 326, 326, 326, 319, 319, 326, + 326, 326, 326, 326, 326, 326, 319, 326, 326, 326, - 320, 313, 320, 320, 313, 320, 320, 313, 320, 313, - 320, 320, 0, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313 + 326, 326, 326, 319, 326, 326, 326, 319, 326, 326, + 319, 326, 326, 319, 326, 319, 326, 326, 0, 319, + 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + 319, 319, 319, 319, 319, 319, 319, 319, 319 } ; -static const flex_int16_t yy_nxt[732] = +static const flex_int16_t yy_nxt[755] = { 0, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 26, - 26, 27, 28, 29, 30, 31, 32, 33, 33, 33, - 33, 34, 8, 35, 36, 33, 37, 38, 39, 40, - 41, 42, 43, 33, 44, 33, 45, 33, 46, 33, - 47, 48, 49, 50, 51, 33, 52, 33, 33, 53, - 54, 55, 56, 58, 58, 61, 61, 65, 62, 62, - 68, 72, 59, 59, 73, 74, 65, 79, 69, 95, - 81, 83, 83, 83, 83, 95, 85, 109, 70, 80, - 82, 75, 86, 97, 98, 66, 257, 87, 100, 101, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, + 28, 29, 30, 31, 32, 33, 34, 35, 35, 35, + 35, 36, 10, 37, 38, 35, 39, 40, 41, 42, + 43, 44, 45, 35, 46, 35, 47, 35, 48, 35, + 49, 50, 51, 52, 53, 35, 54, 35, 35, 55, + 56, 57, 58, 60, 60, 62, 65, 65, 62, 66, + 66, 63, 61, 61, 63, 69, 71, 77, 69, 83, + 78, 79, 85, 87, 103, 104, 101, 84, 89, 89, + 89, 89, 101, 88, 86, 101, 73, 80, 164, 91, - 77, 104, 95, 95, 89, 88, 90, 91, 91, 90, - 89, 95, 90, 90, 90, 90, 84, 93, 95, 94, - 95, 95, 105, 171, 106, 95, 93, 95, 118, 112, - 95, 107, 110, 95, 111, 95, 95, 108, 117, 114, - 95, 120, 113, 95, 95, 115, 95, 128, 65, 95, - 140, 121, 116, 126, 64, 123, 133, 140, 65, 119, - 127, 95, 125, 124, 76, 95, 95, 122, 95, 159, - 145, 83, 83, 83, 83, 313, 66, 158, 141, 95, - 162, 143, 77, 129, 134, 150, 150, 150, 150, 170, - 95, 239, 95, 167, 146, 147, 89, 166, 90, 90, + 106, 107, 82, 70, 74, 92, 101, 101, 110, 116, + 93, 117, 101, 263, 75, 115, 120, 95, 94, 96, + 97, 97, 96, 90, 95, 111, 96, 96, 96, 96, + 99, 101, 100, 101, 101, 112, 101, 118, 101, 99, + 101, 101, 113, 101, 134, 121, 123, 101, 114, 101, + 119, 101, 122, 101, 101, 126, 137, 124, 132, 127, + 129, 69, 125, 146, 146, 133, 69, 81, 130, 131, + 68, 101, 139, 151, 146, 128, 73, 101, 319, 319, + 135, 159, 159, 168, 74, 165, 101, 245, 149, 70, + 82, 147, 223, 172, 75, 101, 101, 152, 149, 101, - 90, 90, 89, 95, 152, 152, 152, 90, 313, 151, - 153, 153, 95, 95, 95, 95, 95, 160, 95, 95, - 95, 164, 217, 161, 95, 95, 313, 182, 154, 154, - 154, 154, 163, 95, 165, 169, 173, 168, 154, 154, - 95, 172, 95, 95, 95, 175, 95, 154, 154, 154, - 154, 154, 154, 179, 174, 95, 176, 95, 65, 65, - 64, 140, 133, 177, 178, 142, 139, 180, 187, 181, - 140, 190, 76, 65, 65, 95, 95, 95, 145, 150, - 150, 150, 150, 196, 95, 95, 66, 66, 194, 141, - 134, 193, 135, 226, 143, 191, 188, 77, 77, 195, + 140, 89, 89, 89, 89, 156, 156, 156, 156, 95, + 101, 96, 96, 96, 96, 95, 178, 158, 158, 158, + 96, 101, 101, 101, 166, 153, 101, 101, 101, 157, + 167, 170, 101, 319, 101, 160, 160, 160, 160, 169, + 101, 171, 173, 101, 101, 160, 160, 101, 177, 101, + 101, 101, 188, 174, 160, 160, 160, 160, 160, 160, + 101, 181, 175, 176, 179, 180, 184, 101, 101, 101, + 69, 69, 182, 68, 185, 139, 146, 148, 69, 183, + 186, 187, 145, 196, 193, 69, 81, 156, 156, 156, + 156, 95, 151, 158, 158, 158, 96, 101, 70, 70, - 95, 95, 146, 151, 89, 95, 152, 152, 152, 90, - 313, 95, 153, 153, 197, 199, 95, 95, 95, 95, - 95, 95, 198, 95, 200, 202, 203, 95, 204, 95, - 95, 205, 95, 95, 201, 95, 95, 95, 95, 207, - 210, 206, 209, 95, 212, 213, 214, 95, 140, 140, - 139, 140, 187, 142, 208, 211, 95, 140, 95, 190, - 95, 216, 95, 95, 215, 223, 95, 95, 95, 222, - 228, 227, 224, 95, 95, 143, 141, 141, 95, 233, - 188, 143, 229, 191, 225, 95, 232, 230, 231, 95, - 95, 95, 95, 235, 95, 234, 95, 95, 95, 236, + 101, 200, 82, 140, 147, 101, 101, 197, 101, 82, + 101, 157, 194, 101, 201, 319, 152, 159, 159, 101, + 199, 202, 101, 205, 203, 101, 101, 204, 101, 101, + 206, 101, 101, 101, 101, 101, 209, 210, 101, 211, + 101, 101, 207, 213, 101, 212, 208, 215, 101, 218, + 101, 101, 101, 146, 146, 146, 219, 214, 220, 146, + 145, 216, 193, 148, 217, 101, 222, 101, 101, 196, + 101, 101, 221, 101, 229, 101, 101, 234, 228, 149, + 230, 147, 147, 149, 233, 101, 101, 232, 101, 235, + 194, 237, 231, 197, 236, 101, 101, 101, 101, 101, - 238, 95, 95, 95, 247, 95, 95, 95, 249, 95, - 95, 250, 237, 245, 243, 244, 246, 252, 253, 95, - 95, 251, 255, 95, 95, 95, 248, 254, 95, 95, - 264, 256, 95, 95, 95, 262, 95, 266, 95, 265, - 261, 95, 95, 95, 276, 95, 95, 263, 267, 95, - 269, 95, 268, 277, 274, 270, 278, 275, 95, 279, - 281, 284, 95, 95, 95, 95, 280, 95, 287, 95, - 285, 95, 288, 95, 95, 286, 289, 293, 95, 95, - 95, 295, 290, 297, 95, 95, 95, 294, 95, 300, - 292, 299, 304, 95, 95, 95, 95, 296, 95, 310, + 101, 239, 241, 101, 101, 238, 242, 101, 244, 101, + 101, 101, 101, 101, 101, 253, 101, 240, 101, 255, + 243, 249, 256, 251, 252, 250, 101, 258, 257, 259, + 101, 101, 101, 260, 101, 269, 254, 101, 101, 101, + 101, 101, 261, 262, 101, 268, 272, 101, 101, 267, + 271, 101, 101, 101, 283, 101, 273, 101, 270, 101, + 274, 282, 276, 275, 280, 285, 284, 101, 101, 287, + 281, 101, 101, 101, 101, 286, 293, 101, 101, 291, + 101, 294, 101, 101, 290, 292, 295, 299, 101, 301, + 101, 101, 296, 101, 303, 101, 300, 306, 305, 298, - 95, 301, 306, 303, 307, 95, 309, 312, 308, 305, - 95, 311, 57, 57, 57, 57, 57, 57, 57, 60, - 60, 60, 60, 60, 60, 60, 64, 64, 64, 64, - 64, 64, 64, 67, 302, 95, 67, 76, 76, 76, - 76, 76, 76, 76, 92, 92, 92, 92, 92, 102, - 102, 102, 102, 132, 132, 132, 132, 132, 132, 132, - 139, 139, 139, 139, 139, 139, 139, 142, 142, 142, - 142, 142, 142, 142, 144, 144, 144, 144, 144, 144, - 144, 149, 95, 149, 149, 149, 149, 149, 155, 155, - 95, 155, 186, 186, 186, 186, 186, 186, 186, 189, + 101, 101, 101, 101, 101, 101, 101, 302, 310, 312, + 141, 101, 315, 318, 313, 309, 307, 316, 101, 314, + 311, 317, 59, 59, 59, 59, 59, 59, 59, 59, + 64, 64, 64, 64, 64, 64, 64, 64, 68, 68, + 68, 68, 68, 68, 68, 68, 72, 72, 101, 308, + 72, 81, 81, 81, 81, 81, 81, 81, 81, 98, + 101, 98, 98, 98, 98, 108, 108, 108, 108, 138, + 138, 138, 138, 138, 138, 138, 138, 145, 145, 145, + 145, 145, 145, 145, 145, 148, 148, 148, 148, 148, + 148, 148, 148, 150, 150, 150, 150, 150, 150, 150, - 189, 189, 189, 189, 189, 189, 298, 95, 291, 95, - 95, 283, 282, 95, 95, 273, 272, 271, 95, 95, - 95, 95, 260, 259, 258, 95, 95, 95, 95, 242, - 241, 240, 95, 95, 95, 95, 95, 95, 95, 221, - 220, 219, 218, 95, 192, 185, 184, 183, 95, 95, - 95, 157, 156, 148, 138, 137, 136, 131, 130, 103, - 95, 99, 96, 78, 71, 63, 313, 7, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, + 150, 155, 101, 155, 155, 155, 155, 155, 155, 161, + 161, 101, 161, 192, 192, 192, 192, 192, 192, 192, + 192, 195, 195, 195, 195, 195, 195, 195, 195, 304, + 101, 297, 101, 101, 289, 288, 101, 101, 279, 278, + 277, 101, 101, 101, 101, 266, 265, 264, 101, 101, + 101, 101, 248, 247, 246, 101, 101, 101, 101, 101, + 101, 101, 227, 226, 225, 224, 101, 198, 191, 190, + 189, 101, 101, 101, 163, 162, 154, 144, 143, 142, + 137, 84, 136, 109, 101, 105, 102, 76, 67, 319, + 9, 319, 319, 319, 319, 319, 319, 319, 319, 319, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313 + 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + 319, 319, 319, 319 } ; -static const flex_int16_t yy_chk[732] = +static const flex_int16_t yy_chk[755] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -819,81 +821,83 @@ static const flex_int16_t yy_chk[732] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 3, 4, 5, 6, 12, 5, 6, - 13, 15, 3, 4, 15, 15, 16, 20, 13, 40, - 22, 23, 23, 23, 23, 37, 24, 40, 13, 20, - 22, 15, 24, 29, 29, 12, 333, 24, 31, 31, + 1, 1, 1, 3, 4, 5, 7, 8, 6, 7, + 8, 5, 3, 4, 6, 14, 15, 17, 18, 21, + 17, 17, 22, 24, 31, 31, 110, 21, 25, 25, + 25, 25, 39, 24, 22, 43, 15, 17, 110, 26, - 16, 37, 118, 38, 25, 24, 25, 25, 25, 25, - 26, 46, 26, 26, 26, 26, 23, 25, 41, 25, - 39, 25, 38, 118, 39, 42, 25, 26, 46, 42, - 45, 39, 41, 48, 41, 43, 44, 39, 45, 43, - 47, 48, 42, 49, 50, 44, 51, 54, 64, 52, - 72, 49, 44, 52, 66, 50, 66, 74, 76, 47, - 52, 105, 51, 50, 77, 104, 117, 49, 107, 105, - 77, 83, 83, 83, 83, 92, 64, 104, 72, 112, - 107, 74, 76, 54, 66, 89, 89, 89, 89, 117, - 111, 332, 92, 112, 77, 83, 90, 111, 90, 90, + 33, 33, 18, 14, 15, 26, 40, 42, 39, 43, + 26, 43, 45, 339, 15, 42, 45, 27, 26, 27, + 27, 27, 27, 25, 28, 40, 28, 28, 28, 28, + 27, 41, 27, 44, 27, 41, 46, 44, 47, 27, + 48, 28, 41, 49, 56, 46, 47, 50, 41, 52, + 44, 51, 46, 53, 54, 50, 62, 48, 54, 51, + 52, 68, 49, 77, 79, 54, 81, 82, 52, 53, + 70, 113, 70, 82, 148, 51, 62, 111, 98, 99, + 56, 99, 99, 113, 62, 111, 117, 338, 79, 68, + 81, 77, 337, 117, 62, 98, 99, 82, 148, 125, - 90, 90, 91, 106, 91, 91, 91, 91, 93, 89, - 93, 93, 109, 90, 110, 120, 108, 106, 113, 91, - 114, 109, 331, 106, 119, 93, 94, 328, 94, 94, - 94, 94, 108, 122, 110, 114, 120, 113, 94, 94, - 121, 119, 124, 94, 123, 122, 125, 94, 94, 94, - 94, 94, 94, 125, 121, 126, 123, 127, 132, 133, - 134, 139, 134, 123, 124, 143, 141, 126, 141, 127, - 142, 143, 146, 144, 145, 161, 158, 201, 146, 150, - 150, 150, 150, 161, 159, 160, 132, 133, 159, 139, - 134, 158, 322, 201, 142, 143, 141, 144, 145, 160, + 70, 89, 89, 89, 89, 95, 95, 95, 95, 96, + 112, 96, 96, 96, 96, 97, 125, 97, 97, 97, + 97, 116, 115, 114, 112, 89, 96, 124, 118, 95, + 112, 115, 97, 100, 119, 100, 100, 100, 100, 114, + 123, 116, 118, 126, 130, 100, 100, 120, 124, 128, + 100, 127, 334, 119, 100, 100, 100, 100, 100, 100, + 129, 128, 120, 123, 126, 127, 130, 131, 132, 133, + 138, 139, 129, 140, 131, 140, 145, 149, 150, 129, + 132, 133, 147, 149, 147, 151, 152, 156, 156, 156, + 156, 158, 152, 158, 158, 158, 158, 165, 138, 139, - 162, 163, 146, 150, 152, 167, 152, 152, 152, 152, - 153, 164, 153, 153, 162, 164, 165, 166, 168, 175, - 169, 152, 163, 170, 165, 167, 168, 153, 169, 171, - 172, 170, 173, 174, 166, 176, 177, 178, 179, 172, - 175, 171, 174, 180, 177, 178, 179, 181, 186, 187, - 188, 189, 188, 191, 173, 176, 194, 190, 197, 191, - 198, 181, 199, 202, 180, 197, 203, 208, 205, 194, - 203, 202, 198, 210, 211, 189, 186, 187, 206, 210, - 188, 190, 205, 191, 199, 207, 208, 206, 207, 212, - 214, 215, 216, 212, 223, 211, 222, 224, 228, 214, + 166, 165, 150, 140, 145, 164, 169, 149, 158, 151, + 168, 156, 147, 167, 166, 159, 152, 159, 159, 170, + 164, 167, 171, 170, 168, 172, 173, 169, 174, 175, + 171, 176, 159, 177, 178, 179, 174, 175, 180, 176, + 181, 183, 172, 178, 182, 177, 173, 180, 184, 183, + 185, 186, 187, 192, 193, 195, 184, 179, 185, 196, + 194, 181, 194, 197, 182, 200, 187, 203, 204, 197, + 205, 207, 186, 209, 203, 211, 208, 209, 200, 195, + 204, 192, 193, 196, 208, 212, 214, 207, 213, 211, + 194, 213, 205, 197, 212, 216, 217, 220, 218, 221, - 216, 230, 225, 231, 228, 232, 233, 234, 231, 246, - 236, 231, 215, 224, 222, 223, 225, 233, 234, 237, - 235, 232, 236, 243, 244, 245, 230, 235, 247, 249, - 246, 237, 250, 253, 255, 244, 263, 249, 262, 247, - 243, 256, 261, 266, 263, 274, 270, 245, 250, 267, - 255, 268, 253, 266, 261, 256, 267, 262, 269, 268, - 270, 274, 275, 277, 279, 280, 269, 281, 279, 284, - 275, 286, 280, 285, 287, 277, 281, 285, 289, 290, - 297, 287, 281, 290, 293, 296, 301, 286, 300, 296, - 284, 293, 301, 304, 303, 309, 312, 289, 306, 308, + 222, 216, 218, 228, 229, 214, 220, 230, 222, 234, + 231, 236, 238, 251, 237, 234, 239, 217, 240, 237, + 221, 228, 237, 230, 231, 229, 241, 239, 238, 240, + 242, 243, 249, 241, 250, 251, 236, 252, 255, 253, + 256, 259, 242, 243, 272, 250, 255, 261, 262, 249, + 253, 268, 267, 269, 272, 276, 256, 274, 252, 273, + 259, 269, 262, 261, 267, 274, 273, 275, 280, 276, + 268, 281, 285, 283, 286, 275, 285, 287, 290, 281, + 292, 286, 293, 291, 280, 283, 287, 291, 295, 293, + 296, 299, 287, 302, 296, 303, 292, 302, 299, 290, - 311, 297, 303, 300, 304, 307, 306, 311, 305, 302, - 299, 309, 314, 314, 314, 314, 314, 314, 314, 315, - 315, 315, 315, 315, 315, 315, 316, 316, 316, 316, - 316, 316, 316, 317, 298, 295, 317, 318, 318, 318, - 318, 318, 318, 318, 319, 319, 319, 319, 319, 320, - 320, 320, 320, 321, 321, 321, 321, 321, 321, 321, - 323, 323, 323, 323, 323, 323, 323, 324, 324, 324, - 324, 324, 324, 324, 325, 325, 325, 325, 325, 325, - 325, 326, 294, 326, 326, 326, 326, 326, 327, 327, - 292, 327, 329, 329, 329, 329, 329, 329, 329, 330, + 306, 309, 307, 310, 312, 315, 317, 295, 307, 309, + 328, 318, 312, 317, 310, 306, 303, 314, 313, 311, + 308, 315, 320, 320, 320, 320, 320, 320, 320, 320, + 321, 321, 321, 321, 321, 321, 321, 321, 322, 322, + 322, 322, 322, 322, 322, 322, 323, 323, 305, 304, + 323, 324, 324, 324, 324, 324, 324, 324, 324, 325, + 301, 325, 325, 325, 325, 326, 326, 326, 326, 327, + 327, 327, 327, 327, 327, 327, 327, 329, 329, 329, + 329, 329, 329, 329, 329, 330, 330, 330, 330, 330, + 330, 330, 330, 331, 331, 331, 331, 331, 331, 331, - 330, 330, 330, 330, 330, 330, 291, 288, 283, 278, - 276, 273, 271, 265, 264, 260, 259, 258, 254, 252, - 251, 248, 242, 241, 240, 238, 229, 227, 226, 220, - 219, 218, 213, 209, 204, 200, 196, 195, 193, 192, - 185, 184, 183, 155, 148, 138, 137, 136, 116, 115, - 102, 101, 97, 84, 70, 69, 68, 62, 59, 36, - 33, 30, 27, 19, 14, 11, 7, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, + 331, 332, 300, 332, 332, 332, 332, 332, 332, 333, + 333, 298, 333, 335, 335, 335, 335, 335, 335, 335, + 335, 336, 336, 336, 336, 336, 336, 336, 336, 297, + 294, 289, 284, 282, 279, 277, 271, 270, 266, 265, + 264, 260, 258, 257, 254, 248, 247, 246, 244, 235, + 233, 232, 226, 225, 224, 219, 215, 210, 206, 202, + 201, 199, 198, 191, 190, 189, 161, 154, 144, 143, + 142, 122, 121, 108, 107, 103, 90, 75, 74, 73, + 66, 63, 61, 38, 35, 32, 29, 16, 13, 9, + 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313 + 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + 319, 319, 319, 319 } ; /* The intent behind this definition is that it'll catch @@ -914,13 +918,19 @@ static const flex_int16_t yy_chk[732] = #line 23 "lexer.lpp" #define YY_USER_ACTION loc.columns(yyleng); -#line 917 "lexer.cpp" +#line 922 "lexer.cpp" -#line 919 "lexer.cpp" +/* + 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 +*/ + +#line 929 "lexer.cpp" #define INITIAL 0 #define COMMENT_BLOCK_STATE 1 -#define DEVELOPER_BLOCK_STATE 2 +#define DEVBLOCK_ON_STATE 2 +#define DEVBLOCK_OFF_STATE 3 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way @@ -1176,15 +1186,15 @@ YY_DECL } { -#line 40 "lexer.lpp" +#line 45 "lexer.lpp" -#line 44 "lexer.lpp" +#line 49 "lexer.lpp" loc.step(); -#line 1187 "lexer.cpp" +#line 1198 "lexer.cpp" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { @@ -1211,13 +1221,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 314 ) + if ( yy_current_state >= 320 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } - while ( yy_current_state != 313 ); + while ( yy_current_state != 319 ); yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; @@ -1239,537 +1249,551 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 47 "lexer.lpp" +#line 52 "lexer.lpp" { loc.step(); } YY_BREAK case 2: /* rule 2 can match eol */ YY_RULE_SETUP -#line 49 "lexer.lpp" +#line 54 "lexer.lpp" { loc.lines(yyleng); loc.step(); } YY_BREAK case 3: YY_RULE_SETUP -#line 51 "lexer.lpp" +#line 56 "lexer.lpp" YY_BREAK case 4: YY_RULE_SETUP -#line 53 "lexer.lpp" +#line 58 "lexer.lpp" { BEGIN(COMMENT_BLOCK_STATE); } YY_BREAK case 5: YY_RULE_SETUP -#line 54 "lexer.lpp" +#line 59 "lexer.lpp" YY_BREAK case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 55 "lexer.lpp" +#line 60 "lexer.lpp" { loc.lines(yyleng); loc.step(); } YY_BREAK case 7: YY_RULE_SETUP -#line 56 "lexer.lpp" +#line 61 "lexer.lpp" { BEGIN(INITIAL); } YY_BREAK case 8: YY_RULE_SETUP -#line 58 "lexer.lpp" -{ BEGIN(DEVELOPER_BLOCK_STATE); } +#line 63 "lexer.lpp" +{ BEGIN(devblock_mode == xsk::gsc::dev_blocks::on ? DEVBLOCK_ON_STATE : DEVBLOCK_OFF_STATE); } YY_BREAK +/* ignore everything if we're in devblock-off state */ case 9: YY_RULE_SETUP -#line 59 "lexer.lpp" +#line 65 "lexer.lpp" YY_BREAK case 10: /* rule 10 can match eol */ YY_RULE_SETUP -#line 60 "lexer.lpp" +#line 66 "lexer.lpp" { loc.lines(yyleng); loc.step(); } YY_BREAK +/* always exit devblock state when seeing #/ */ case 11: YY_RULE_SETUP -#line 61 "lexer.lpp" -{ BEGIN(INITIAL); } +#line 68 "lexer.lpp" +{ BEGIN(INITIAL); } YY_BREAK +/* for better errors */ case 12: YY_RULE_SETUP -#line 63 "lexer.lpp" -{ return iw5::parser::make_BREAKPOINT(loc); } +#line 71 "lexer.lpp" +{ throw iw5::parser::syntax_error(loc, "unmatched multiline comment end ('*/')"); } YY_BREAK case 13: YY_RULE_SETUP -#line 64 "lexer.lpp" -{ return iw5::parser::make_PROFBEGIN(loc); } +#line 72 "lexer.lpp" +{ throw iw5::parser::syntax_error(loc, "unmatched devblock end ('#/')"); } YY_BREAK case 14: YY_RULE_SETUP -#line 65 "lexer.lpp" -{ return iw5::parser::make_PROFEND(loc); } +#line 74 "lexer.lpp" +{ return iw5::parser::make_BREAKPOINT(loc); } YY_BREAK case 15: YY_RULE_SETUP -#line 66 "lexer.lpp" -{ return iw5::parser::make_INCLUDE(loc); } +#line 75 "lexer.lpp" +{ return iw5::parser::make_PROFBEGIN(loc); } YY_BREAK case 16: YY_RULE_SETUP -#line 67 "lexer.lpp" -{ return iw5::parser::make_USINGTREE(loc); } +#line 76 "lexer.lpp" +{ return iw5::parser::make_PROFEND(loc); } YY_BREAK case 17: YY_RULE_SETUP -#line 68 "lexer.lpp" -{ return iw5::parser::make_ANIMTREE(loc); } +#line 77 "lexer.lpp" +{ return iw5::parser::make_INCLUDE(loc); } YY_BREAK case 18: YY_RULE_SETUP -#line 69 "lexer.lpp" -{ return iw5::parser::make_ENDON(loc); } +#line 78 "lexer.lpp" +{ return iw5::parser::make_USINGTREE(loc); } YY_BREAK case 19: YY_RULE_SETUP -#line 70 "lexer.lpp" -{ return iw5::parser::make_NOTIFY(loc); } +#line 79 "lexer.lpp" +{ return iw5::parser::make_ANIMTREE(loc); } YY_BREAK case 20: YY_RULE_SETUP -#line 71 "lexer.lpp" -{ return iw5::parser::make_WAIT(loc); } +#line 80 "lexer.lpp" +{ return iw5::parser::make_ENDON(loc); } YY_BREAK case 21: YY_RULE_SETUP -#line 72 "lexer.lpp" -{ return iw5::parser::make_WAITTILL(loc); } +#line 81 "lexer.lpp" +{ return iw5::parser::make_NOTIFY(loc); } YY_BREAK case 22: YY_RULE_SETUP -#line 73 "lexer.lpp" -{ return iw5::parser::make_WAITTILLMATCH(loc); } +#line 82 "lexer.lpp" +{ return iw5::parser::make_WAIT(loc); } YY_BREAK case 23: YY_RULE_SETUP -#line 74 "lexer.lpp" -{ return iw5::parser::make_WAITTILLFRAMEEND(loc); } +#line 83 "lexer.lpp" +{ return iw5::parser::make_WAITTILL(loc); } YY_BREAK case 24: YY_RULE_SETUP -#line 75 "lexer.lpp" -{ return iw5::parser::make_IF(loc); } +#line 84 "lexer.lpp" +{ return iw5::parser::make_WAITTILLMATCH(loc); } YY_BREAK case 25: YY_RULE_SETUP -#line 76 "lexer.lpp" -{ return iw5::parser::make_ELSE(loc); } +#line 85 "lexer.lpp" +{ return iw5::parser::make_WAITTILLFRAMEEND(loc); } YY_BREAK case 26: YY_RULE_SETUP -#line 77 "lexer.lpp" -{ return iw5::parser::make_WHILE(loc); } +#line 86 "lexer.lpp" +{ return iw5::parser::make_IF(loc); } YY_BREAK case 27: YY_RULE_SETUP -#line 78 "lexer.lpp" -{ return iw5::parser::make_FOR(loc); } +#line 87 "lexer.lpp" +{ return iw5::parser::make_ELSE(loc); } YY_BREAK case 28: YY_RULE_SETUP -#line 79 "lexer.lpp" -{ return iw5::parser::make_FOREACH(loc); } +#line 88 "lexer.lpp" +{ return iw5::parser::make_WHILE(loc); } YY_BREAK case 29: YY_RULE_SETUP -#line 80 "lexer.lpp" -{ return iw5::parser::make_IN(loc); } +#line 89 "lexer.lpp" +{ return iw5::parser::make_FOR(loc); } YY_BREAK case 30: YY_RULE_SETUP -#line 81 "lexer.lpp" -{ return iw5::parser::make_SWITCH(loc); } +#line 90 "lexer.lpp" +{ return iw5::parser::make_FOREACH(loc); } YY_BREAK case 31: YY_RULE_SETUP -#line 82 "lexer.lpp" -{ return iw5::parser::make_CASE(loc); } +#line 91 "lexer.lpp" +{ return iw5::parser::make_IN(loc); } YY_BREAK case 32: YY_RULE_SETUP -#line 83 "lexer.lpp" -{ return iw5::parser::make_DEFAULT(loc); } +#line 92 "lexer.lpp" +{ return iw5::parser::make_SWITCH(loc); } YY_BREAK case 33: YY_RULE_SETUP -#line 84 "lexer.lpp" -{ return iw5::parser::make_BREAK(loc); } +#line 93 "lexer.lpp" +{ return iw5::parser::make_CASE(loc); } YY_BREAK case 34: YY_RULE_SETUP -#line 85 "lexer.lpp" -{ return iw5::parser::make_CONTINUE(loc); } +#line 94 "lexer.lpp" +{ return iw5::parser::make_DEFAULT(loc); } YY_BREAK case 35: YY_RULE_SETUP -#line 86 "lexer.lpp" -{ return iw5::parser::make_RETURN(loc); } +#line 95 "lexer.lpp" +{ return iw5::parser::make_BREAK(loc); } YY_BREAK case 36: YY_RULE_SETUP -#line 87 "lexer.lpp" -{ return iw5::parser::make_THREAD(loc); } +#line 96 "lexer.lpp" +{ return iw5::parser::make_CONTINUE(loc); } YY_BREAK case 37: YY_RULE_SETUP -#line 88 "lexer.lpp" -{ return iw5::parser::make_CHILDTHREAD(loc); } +#line 97 "lexer.lpp" +{ return iw5::parser::make_RETURN(loc); } YY_BREAK case 38: YY_RULE_SETUP -#line 89 "lexer.lpp" -{ return iw5::parser::make_THISTHREAD(loc); } +#line 98 "lexer.lpp" +{ return iw5::parser::make_THREAD(loc); } YY_BREAK case 39: YY_RULE_SETUP -#line 90 "lexer.lpp" -{ return iw5::parser::make_CALL(loc); } +#line 99 "lexer.lpp" +{ return iw5::parser::make_CHILDTHREAD(loc); } YY_BREAK case 40: YY_RULE_SETUP -#line 91 "lexer.lpp" -{ return iw5::parser::make_TRUE(loc); } +#line 100 "lexer.lpp" +{ return iw5::parser::make_THISTHREAD(loc); } YY_BREAK case 41: YY_RULE_SETUP -#line 92 "lexer.lpp" -{ return iw5::parser::make_FALSE(loc); } +#line 101 "lexer.lpp" +{ return iw5::parser::make_CALL(loc); } YY_BREAK case 42: YY_RULE_SETUP -#line 93 "lexer.lpp" -{ return iw5::parser::make_UNDEFINED(loc); } +#line 102 "lexer.lpp" +{ return iw5::parser::make_TRUE(loc); } YY_BREAK case 43: YY_RULE_SETUP -#line 94 "lexer.lpp" -{ return iw5::parser::make_SIZE(loc); } +#line 103 "lexer.lpp" +{ return iw5::parser::make_FALSE(loc); } YY_BREAK case 44: YY_RULE_SETUP -#line 95 "lexer.lpp" -{ return iw5::parser::make_GAME(loc); } +#line 104 "lexer.lpp" +{ return iw5::parser::make_UNDEFINED(loc); } YY_BREAK case 45: YY_RULE_SETUP -#line 96 "lexer.lpp" -{ return iw5::parser::make_SELF(loc); } +#line 105 "lexer.lpp" +{ return iw5::parser::make_SIZE(loc); } YY_BREAK case 46: YY_RULE_SETUP -#line 97 "lexer.lpp" -{ return iw5::parser::make_ANIM(loc); } +#line 106 "lexer.lpp" +{ return iw5::parser::make_GAME(loc); } YY_BREAK case 47: YY_RULE_SETUP -#line 98 "lexer.lpp" -{ return iw5::parser::make_LEVEL(loc); } +#line 107 "lexer.lpp" +{ return iw5::parser::make_SELF(loc); } YY_BREAK case 48: YY_RULE_SETUP -#line 99 "lexer.lpp" -{ return iw5::parser::make_LPAREN(loc); } +#line 108 "lexer.lpp" +{ return iw5::parser::make_ANIM(loc); } YY_BREAK case 49: YY_RULE_SETUP -#line 100 "lexer.lpp" -{ return iw5::parser::make_RPAREN(loc); } +#line 109 "lexer.lpp" +{ return iw5::parser::make_LEVEL(loc); } YY_BREAK case 50: YY_RULE_SETUP -#line 101 "lexer.lpp" -{ return iw5::parser::make_LBRACE(loc); } +#line 110 "lexer.lpp" +{ return iw5::parser::make_LPAREN(loc); } YY_BREAK case 51: YY_RULE_SETUP -#line 102 "lexer.lpp" -{ return iw5::parser::make_RBRACE(loc); } +#line 111 "lexer.lpp" +{ return iw5::parser::make_RPAREN(loc); } YY_BREAK case 52: YY_RULE_SETUP -#line 103 "lexer.lpp" -{ return iw5::parser::make_LBRACKET(loc); } +#line 112 "lexer.lpp" +{ return iw5::parser::make_LBRACE(loc); } YY_BREAK case 53: YY_RULE_SETUP -#line 104 "lexer.lpp" -{ return iw5::parser::make_RBRACKET(loc); } +#line 113 "lexer.lpp" +{ return iw5::parser::make_RBRACE(loc); } YY_BREAK case 54: YY_RULE_SETUP -#line 105 "lexer.lpp" -{ return iw5::parser::make_COMMA(loc); } +#line 114 "lexer.lpp" +{ return iw5::parser::make_LBRACKET(loc); } YY_BREAK case 55: YY_RULE_SETUP -#line 106 "lexer.lpp" -{ return iw5::parser::make_DOT(loc); } +#line 115 "lexer.lpp" +{ return iw5::parser::make_RBRACKET(loc); } YY_BREAK case 56: YY_RULE_SETUP -#line 107 "lexer.lpp" -{ return iw5::parser::make_DOUBLECOLON(loc); } +#line 116 "lexer.lpp" +{ return iw5::parser::make_COMMA(loc); } YY_BREAK case 57: YY_RULE_SETUP -#line 108 "lexer.lpp" -{ return iw5::parser::make_COLON(loc); } +#line 117 "lexer.lpp" +{ return iw5::parser::make_DOT(loc); } YY_BREAK case 58: YY_RULE_SETUP -#line 109 "lexer.lpp" -{ return iw5::parser::make_SEMICOLON(loc); } +#line 118 "lexer.lpp" +{ return iw5::parser::make_DOUBLECOLON(loc); } YY_BREAK case 59: YY_RULE_SETUP -#line 110 "lexer.lpp" -{ return iw5::parser::make_QMARK(loc); } +#line 119 "lexer.lpp" +{ return iw5::parser::make_COLON(loc); } YY_BREAK case 60: YY_RULE_SETUP -#line 111 "lexer.lpp" -{ return iw5::parser::make_INCREMENT(loc); } +#line 120 "lexer.lpp" +{ return iw5::parser::make_SEMICOLON(loc); } YY_BREAK case 61: YY_RULE_SETUP -#line 112 "lexer.lpp" -{ return iw5::parser::make_DECREMENT(loc); } +#line 121 "lexer.lpp" +{ return iw5::parser::make_QMARK(loc); } YY_BREAK case 62: YY_RULE_SETUP -#line 113 "lexer.lpp" -{ return iw5::parser::make_ASSIGN_LSHIFT(loc); } +#line 122 "lexer.lpp" +{ return iw5::parser::make_INCREMENT(loc); } YY_BREAK case 63: YY_RULE_SETUP -#line 114 "lexer.lpp" -{ return iw5::parser::make_ASSIGN_RSHIFT(loc); } +#line 123 "lexer.lpp" +{ return iw5::parser::make_DECREMENT(loc); } YY_BREAK case 64: YY_RULE_SETUP -#line 115 "lexer.lpp" -{ return iw5::parser::make_LSHIFT(loc); } +#line 124 "lexer.lpp" +{ return iw5::parser::make_ASSIGN_LSHIFT(loc); } YY_BREAK case 65: YY_RULE_SETUP -#line 116 "lexer.lpp" -{ return iw5::parser::make_RSHIFT(loc); } +#line 125 "lexer.lpp" +{ return iw5::parser::make_ASSIGN_RSHIFT(loc); } YY_BREAK case 66: YY_RULE_SETUP -#line 117 "lexer.lpp" -{ return iw5::parser::make_OR(loc); } +#line 126 "lexer.lpp" +{ return iw5::parser::make_LSHIFT(loc); } YY_BREAK case 67: YY_RULE_SETUP -#line 118 "lexer.lpp" -{ return iw5::parser::make_AND(loc); } +#line 127 "lexer.lpp" +{ return iw5::parser::make_RSHIFT(loc); } YY_BREAK case 68: YY_RULE_SETUP -#line 119 "lexer.lpp" -{ return iw5::parser::make_EQUALITY(loc); } +#line 128 "lexer.lpp" +{ return iw5::parser::make_OR(loc); } YY_BREAK case 69: YY_RULE_SETUP -#line 120 "lexer.lpp" -{ return iw5::parser::make_INEQUALITY(loc); } +#line 129 "lexer.lpp" +{ return iw5::parser::make_AND(loc); } YY_BREAK case 70: YY_RULE_SETUP -#line 121 "lexer.lpp" -{ return iw5::parser::make_LESS_EQUAL(loc); } +#line 130 "lexer.lpp" +{ return iw5::parser::make_EQUALITY(loc); } YY_BREAK case 71: YY_RULE_SETUP -#line 122 "lexer.lpp" -{ return iw5::parser::make_GREATER_EQUAL(loc); } +#line 131 "lexer.lpp" +{ return iw5::parser::make_INEQUALITY(loc); } YY_BREAK case 72: YY_RULE_SETUP -#line 123 "lexer.lpp" -{ return iw5::parser::make_LESS(loc); } +#line 132 "lexer.lpp" +{ return iw5::parser::make_LESS_EQUAL(loc); } YY_BREAK case 73: YY_RULE_SETUP -#line 124 "lexer.lpp" -{ return iw5::parser::make_GREATER(loc); } +#line 133 "lexer.lpp" +{ return iw5::parser::make_GREATER_EQUAL(loc); } YY_BREAK case 74: YY_RULE_SETUP -#line 125 "lexer.lpp" -{ return iw5::parser::make_ASSIGN_ADD(loc); } +#line 134 "lexer.lpp" +{ return iw5::parser::make_LESS(loc); } YY_BREAK case 75: YY_RULE_SETUP -#line 126 "lexer.lpp" -{ return iw5::parser::make_ASSIGN_SUB(loc); } +#line 135 "lexer.lpp" +{ return iw5::parser::make_GREATER(loc); } YY_BREAK case 76: YY_RULE_SETUP -#line 127 "lexer.lpp" -{ return iw5::parser::make_ASSIGN_MULT(loc); } +#line 136 "lexer.lpp" +{ return iw5::parser::make_ASSIGN_ADD(loc); } YY_BREAK case 77: YY_RULE_SETUP -#line 128 "lexer.lpp" -{ return iw5::parser::make_ASSIGN_DIV(loc); } +#line 137 "lexer.lpp" +{ return iw5::parser::make_ASSIGN_SUB(loc); } YY_BREAK case 78: YY_RULE_SETUP -#line 129 "lexer.lpp" -{ return iw5::parser::make_ASSIGN_MOD(loc); } +#line 138 "lexer.lpp" +{ return iw5::parser::make_ASSIGN_MULT(loc); } YY_BREAK case 79: YY_RULE_SETUP -#line 130 "lexer.lpp" -{ return iw5::parser::make_ASSIGN_BITWISE_OR(loc); } +#line 139 "lexer.lpp" +{ return iw5::parser::make_ASSIGN_DIV(loc); } YY_BREAK case 80: YY_RULE_SETUP -#line 131 "lexer.lpp" -{ return iw5::parser::make_ASSIGN_BITWISE_AND(loc); } +#line 140 "lexer.lpp" +{ return iw5::parser::make_ASSIGN_MOD(loc); } YY_BREAK case 81: YY_RULE_SETUP -#line 132 "lexer.lpp" -{ return iw5::parser::make_ASSIGN_BITWISE_EXOR(loc); } +#line 141 "lexer.lpp" +{ return iw5::parser::make_ASSIGN_BITWISE_OR(loc); } YY_BREAK case 82: YY_RULE_SETUP -#line 133 "lexer.lpp" -{ return iw5::parser::make_ASSIGN(loc); } +#line 142 "lexer.lpp" +{ return iw5::parser::make_ASSIGN_BITWISE_AND(loc); } YY_BREAK case 83: YY_RULE_SETUP -#line 134 "lexer.lpp" -{ return iw5::parser::make_ADD(loc); } +#line 143 "lexer.lpp" +{ return iw5::parser::make_ASSIGN_BITWISE_EXOR(loc); } YY_BREAK case 84: YY_RULE_SETUP -#line 135 "lexer.lpp" -{ return iw5::parser::make_SUB(loc); } +#line 144 "lexer.lpp" +{ return iw5::parser::make_ASSIGN(loc); } YY_BREAK case 85: YY_RULE_SETUP -#line 136 "lexer.lpp" -{ return iw5::parser::make_MULT(loc); } +#line 145 "lexer.lpp" +{ return iw5::parser::make_ADD(loc); } YY_BREAK case 86: YY_RULE_SETUP -#line 137 "lexer.lpp" -{ return iw5::parser::make_DIV(loc); } +#line 146 "lexer.lpp" +{ return iw5::parser::make_SUB(loc); } YY_BREAK case 87: YY_RULE_SETUP -#line 138 "lexer.lpp" -{ return iw5::parser::make_MOD(loc); } +#line 147 "lexer.lpp" +{ return iw5::parser::make_MULT(loc); } YY_BREAK case 88: YY_RULE_SETUP -#line 139 "lexer.lpp" -{ return iw5::parser::make_NOT(loc); } +#line 148 "lexer.lpp" +{ return iw5::parser::make_DIV(loc); } YY_BREAK case 89: YY_RULE_SETUP -#line 140 "lexer.lpp" -{ return iw5::parser::make_COMPLEMENT(loc); } +#line 149 "lexer.lpp" +{ return iw5::parser::make_MOD(loc); } YY_BREAK case 90: YY_RULE_SETUP -#line 141 "lexer.lpp" -{ return iw5::parser::make_BITWISE_OR(loc); } +#line 150 "lexer.lpp" +{ return iw5::parser::make_NOT(loc); } YY_BREAK case 91: YY_RULE_SETUP -#line 142 "lexer.lpp" -{ return iw5::parser::make_BITWISE_AND(loc); } +#line 151 "lexer.lpp" +{ return iw5::parser::make_COMPLEMENT(loc); } YY_BREAK case 92: YY_RULE_SETUP -#line 143 "lexer.lpp" -{ return iw5::parser::make_BITWISE_EXOR(loc); } +#line 152 "lexer.lpp" +{ return iw5::parser::make_BITWISE_OR(loc); } YY_BREAK case 93: YY_RULE_SETUP -#line 144 "lexer.lpp" -{ return iw5::parser::make_FILE(utils::string::fordslash(yytext), loc); } +#line 153 "lexer.lpp" +{ return iw5::parser::make_BITWISE_AND(loc); } YY_BREAK case 94: YY_RULE_SETUP -#line 145 "lexer.lpp" -{ return iw5::parser::make_NAME((std::string(yytext, 3) == "_ID") ? std::string(yytext) : utils::string::to_lower(yytext), loc); } +#line 154 "lexer.lpp" +{ return iw5::parser::make_BITWISE_EXOR(loc); } YY_BREAK case 95: -/* rule 95 can match eol */ YY_RULE_SETUP -#line 146 "lexer.lpp" -{ return iw5::parser::make_ISTRING(std::string(yytext).substr(1), loc); } +#line 155 "lexer.lpp" +{ return iw5::parser::make_FILE(utils::string::fordslash(yytext), loc); } YY_BREAK case 96: -/* rule 96 can match eol */ YY_RULE_SETUP -#line 147 "lexer.lpp" -{ return iw5::parser::make_STRING(std::string(yytext), loc); } +#line 156 "lexer.lpp" +{ return iw5::parser::make_NAME((std::string(yytext, 3) == "_ID") ? std::string(yytext) : utils::string::to_lower(yytext), loc); } YY_BREAK case 97: +/* rule 97 can match eol */ YY_RULE_SETUP -#line 148 "lexer.lpp" -{ return iw5::parser::make_COLOR(std::string(yytext).substr(1), loc); } +#line 157 "lexer.lpp" +{ return iw5::parser::make_ISTRING(std::string(yytext).substr(1), loc); } YY_BREAK case 98: +/* rule 98 can match eol */ YY_RULE_SETUP -#line 149 "lexer.lpp" -{ return iw5::parser::make_FLOAT(std::string(yytext), loc); } +#line 158 "lexer.lpp" +{ return iw5::parser::make_STRING(std::string(yytext), loc); } YY_BREAK case 99: YY_RULE_SETUP -#line 150 "lexer.lpp" -{ return iw5::parser::make_INT_OCT(utils::string::oct_to_dec(yytext), loc); } +#line 159 "lexer.lpp" +{ return iw5::parser::make_COLOR(std::string(yytext).substr(1), loc); } YY_BREAK case 100: YY_RULE_SETUP -#line 151 "lexer.lpp" -{ return iw5::parser::make_INT_BIN(utils::string::bin_to_dec(yytext), loc); } +#line 160 "lexer.lpp" +{ return iw5::parser::make_FLOAT(std::string(yytext), loc); } YY_BREAK case 101: YY_RULE_SETUP -#line 152 "lexer.lpp" -{ return iw5::parser::make_INT_HEX(utils::string::hex_to_dec(yytext), loc); } +#line 161 "lexer.lpp" +{ return iw5::parser::make_INT_OCT(utils::string::oct_to_dec(yytext), loc); } YY_BREAK case 102: YY_RULE_SETUP -#line 153 "lexer.lpp" +#line 162 "lexer.lpp" +{ return iw5::parser::make_INT_BIN(utils::string::bin_to_dec(yytext), loc); } + YY_BREAK +case 103: +YY_RULE_SETUP +#line 163 "lexer.lpp" +{ return iw5::parser::make_INT_HEX(utils::string::hex_to_dec(yytext), loc); } + YY_BREAK +case 104: +YY_RULE_SETUP +#line 164 "lexer.lpp" { return iw5::parser::make_INT_DEC(std::string(yytext), loc); } YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(COMMENT_BLOCK_STATE): -case YY_STATE_EOF(DEVELOPER_BLOCK_STATE): -#line 154 "lexer.lpp" +case YY_STATE_EOF(DEVBLOCK_ON_STATE): +case YY_STATE_EOF(DEVBLOCK_OFF_STATE): +#line 165 "lexer.lpp" { return iw5::parser::make_IW5EOF(loc); } YY_BREAK -case 103: -/* rule 103 can match eol */ +case 105: +/* rule 105 can match eol */ YY_RULE_SETUP -#line 155 "lexer.lpp" +#line 166 "lexer.lpp" { throw iw5::parser::syntax_error(loc, "bad token: '" + std::string(yytext) + "'"); } YY_BREAK -case 104: +case 106: YY_RULE_SETUP -#line 157 "lexer.lpp" +#line 168 "lexer.lpp" ECHO; YY_BREAK -#line 1772 "lexer.cpp" +#line 1797 "lexer.cpp" case YY_END_OF_BUFFER: { @@ -2067,7 +2091,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 314 ) + if ( yy_current_state >= 320 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; @@ -2096,11 +2120,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 314 ) + if ( yy_current_state >= 320 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 313); + yy_is_jam = (yy_current_state == 319); (void)yyg; return yy_is_jam ? 0 : yy_current_state; @@ -2899,6 +2923,6 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 157 "lexer.lpp" +#line 168 "lexer.lpp" diff --git a/src/iw5/xsk/lexer.hpp b/src/iw5/xsk/lexer.hpp index a9159b1b..598588b2 100644 --- a/src/iw5/xsk/lexer.hpp +++ b/src/iw5/xsk/lexer.hpp @@ -2,13 +2,13 @@ #define iw5_HEADER_H 1 #define iw5_IN_HEADER 1 -#line 5 "lexer.hpp" +#line 6 "lexer.hpp" #include "stdafx.hpp" #include "iw5.hpp" #include "parser.hpp" using namespace xsk::gsc; -#line 11 "lexer.hpp" +#line 12 "lexer.hpp" #define YY_INT_ALIGNED short int @@ -438,7 +438,8 @@ void yyfree ( void * , yyscan_t yyscanner ); #ifdef YY_HEADER_EXPORT_START_CONDITIONS #define INITIAL 0 #define COMMENT_BLOCK_STATE 1 -#define DEVELOPER_BLOCK_STATE 2 +#define DEVBLOCK_ON_STATE 2 +#define DEVBLOCK_OFF_STATE 3 #endif @@ -700,9 +701,9 @@ extern int yylex (yyscan_t yyscanner); #undef yyTABLES_NAME #endif -#line 157 "lexer.lpp" +#line 168 "lexer.lpp" -#line 706 "lexer.hpp" +#line 708 "lexer.hpp" #undef iw5_IN_HEADER #endif /* iw5_HEADER_H */ diff --git a/src/iw5/xsk/parser.cpp b/src/iw5/xsk/parser.cpp index d52fa763..724b2766 100644 --- a/src/iw5/xsk/parser.cpp +++ b/src/iw5/xsk/parser.cpp @@ -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 implementation for Bison LALR(1) parsers in C++ @@ -15,7 +15,7 @@ // GNU General Public License for more details. // You should have received a copy of the GNU General Public License -// along with this program. If not, see . +// along with this program. If not, see . // As a special exception, you may create a larger work that contains // part or all of the Bison parser skeleton and distribute that work @@ -35,13 +35,13 @@ // private implementation details that can be changed or removed. // "%code top" blocks. -#line 40 "parser.ypp" +#line 42 "parser.ypp" #include "stdafx.hpp" #include "parser.hpp" #include "lexer.hpp" 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); #line 47 "parser.cpp" @@ -148,7 +148,7 @@ namespace xsk { namespace gsc { namespace iw5 { #line 149 "parser.cpp" /// Build a parser object. - parser::parser (yyscan_t yyscanner_yyarg, xsk::gsc::location& loc_yyarg, xsk::gsc::program_ptr& ast_yyarg) + parser::parser (yyscan_t yyscanner_yyarg, xsk::gsc::location& loc_yyarg, xsk::gsc::program_ptr& ast_yyarg, xsk::gsc::dev_blocks devblock_mode_yyarg) #if IW5DEBUG : yydebug_ (false), yycdebug_ (&std::cerr), @@ -158,7 +158,8 @@ namespace xsk { namespace gsc { namespace iw5 { yy_lac_established_ (false), yyscanner (yyscanner_yyarg), loc (loc_yyarg), - ast (ast_yyarg) + ast (ast_yyarg), + devblock_mode (devblock_mode_yyarg) {} parser::~parser () @@ -167,9 +168,9 @@ namespace xsk { namespace gsc { namespace iw5 { parser::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW {} - /*---------------. - | symbol kinds. | - `---------------*/ + /*---------. + | symbol. | + `---------*/ @@ -1336,7 +1337,7 @@ namespace xsk { namespace gsc { namespace iw5 { } void - parser::yypop_ (int n) + parser::yypop_ (int n) YY_NOEXCEPT { yystack_.pop (n); } @@ -1379,13 +1380,13 @@ namespace xsk { namespace gsc { namespace iw5 { } bool - parser::yy_pact_value_is_default_ (int yyvalue) + parser::yy_pact_value_is_default_ (int yyvalue) YY_NOEXCEPT { return yyvalue == yypact_ninf_; } bool - parser::yy_table_value_is_error_ (int yyvalue) + parser::yy_table_value_is_error_ (int yyvalue) YY_NOEXCEPT { return yyvalue == yytable_ninf_; } @@ -1416,8 +1417,8 @@ namespace xsk { namespace gsc { namespace iw5 { /// The return value of parse (). int yyresult; - /// Discard the LAC context in case there still is one left from a - /// previous invocation. + // Discard the LAC context in case there still is one left from a + // previous invocation. yy_lac_discard_ ("init"); #if YY_EXCEPTIONS @@ -1465,7 +1466,7 @@ namespace xsk { namespace gsc { namespace iw5 { try #endif // YY_EXCEPTIONS { - symbol_type yylookahead (yylex (yyscanner, loc)); + symbol_type yylookahead (yylex (yyscanner, loc, devblock_mode)); yyla.move (yylookahead); } #if YY_EXCEPTIONS @@ -1495,7 +1496,7 @@ namespace xsk { namespace gsc { namespace iw5 { if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.kind ()) { if (!yy_lac_establish_ (yyla.kind ())) - goto yyerrlab; + goto yyerrlab; goto yydefault; } @@ -1506,7 +1507,7 @@ namespace xsk { namespace gsc { namespace iw5 { if (yy_table_value_is_error_ (yyn)) goto yyerrlab; if (!yy_lac_establish_ (yyla.kind ())) - goto yyerrlab; + goto yyerrlab; yyn = -yyn; goto yyreduce; @@ -1820,1219 +1821,1219 @@ namespace xsk { namespace gsc { namespace iw5 { switch (yyn) { case 2: // root: program -#line 244 "parser.ypp" +#line 246 "parser.ypp" { ast = std::move(yystack_[0].value.as < program_ptr > ()); } -#line 1826 "parser.cpp" +#line 1827 "parser.cpp" break; case 3: // root: %empty -#line 245 "parser.ypp" +#line 247 "parser.ypp" { ast = std::make_unique(yylhs.location); } -#line 1832 "parser.cpp" +#line 1833 "parser.cpp" break; case 4: // program: program include -#line 250 "parser.ypp" +#line 252 "parser.ypp" { yylhs.value.as < program_ptr > () = std::move(yystack_[1].value.as < program_ptr > ()); yylhs.value.as < program_ptr > ()->includes.push_back(std::move(yystack_[0].value.as < include_ptr > ())); } -#line 1838 "parser.cpp" +#line 1839 "parser.cpp" break; case 5: // program: program define -#line 252 "parser.ypp" +#line 254 "parser.ypp" { yylhs.value.as < program_ptr > () = std::move(yystack_[1].value.as < program_ptr > ()); yylhs.value.as < program_ptr > ()->definitions.push_back(std::move(yystack_[0].value.as < define_ptr > ())); } -#line 1844 "parser.cpp" +#line 1845 "parser.cpp" break; case 6: // program: include -#line 254 "parser.ypp" +#line 256 "parser.ypp" { yylhs.value.as < program_ptr > () = std::make_unique(yylhs.location); yylhs.value.as < program_ptr > ()->includes.push_back(std::move(yystack_[0].value.as < include_ptr > ())); } -#line 1850 "parser.cpp" +#line 1851 "parser.cpp" break; case 7: // program: define -#line 256 "parser.ypp" +#line 258 "parser.ypp" { yylhs.value.as < program_ptr > () = std::make_unique(yylhs.location); yylhs.value.as < program_ptr > ()->definitions.push_back(std::move(yystack_[0].value.as < define_ptr > ())); } -#line 1856 "parser.cpp" +#line 1857 "parser.cpp" break; case 8: // include: "#include" file ";" -#line 261 "parser.ypp" +#line 263 "parser.ypp" { yylhs.value.as < include_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[1].value.as < file_ptr > ())); } -#line 1862 "parser.cpp" +#line 1863 "parser.cpp" break; case 9: // define: usingtree -#line 265 "parser.ypp" +#line 267 "parser.ypp" { yylhs.value.as < define_ptr > ().as_usingtree = std::move(yystack_[0].value.as < usingtree_ptr > ()); } -#line 1868 "parser.cpp" +#line 1869 "parser.cpp" break; case 10: // define: constant -#line 266 "parser.ypp" +#line 268 "parser.ypp" { yylhs.value.as < define_ptr > ().as_constant = std::move(yystack_[0].value.as < constant_ptr > ()); } -#line 1874 "parser.cpp" +#line 1875 "parser.cpp" break; case 11: // define: thread -#line 267 "parser.ypp" +#line 269 "parser.ypp" { yylhs.value.as < define_ptr > ().as_thread = std::move(yystack_[0].value.as < thread_ptr > ()); } -#line 1880 "parser.cpp" +#line 1881 "parser.cpp" break; case 12: // usingtree: "#using_animtree" "(" string ")" ";" -#line 272 "parser.ypp" +#line 274 "parser.ypp" { yylhs.value.as < usingtree_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < string_ptr > ())); } -#line 1886 "parser.cpp" +#line 1887 "parser.cpp" break; case 13: // constant: name "=" expr ";" -#line 277 "parser.ypp" +#line 279 "parser.ypp" { yylhs.value.as < constant_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[3].value.as < name_ptr > ()), std::move(yystack_[1].value.as < expr_ptr > ())); } -#line 1892 "parser.cpp" +#line 1893 "parser.cpp" break; case 14: // thread: name "(" parameters ")" stmt_block -#line 282 "parser.ypp" +#line 284 "parser.ypp" { yylhs.value.as < thread_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[4].value.as < name_ptr > ()), std::move(yystack_[2].value.as < parameters_ptr > ()), std::move(yystack_[0].value.as < stmt_list_ptr > ())); } -#line 1898 "parser.cpp" +#line 1899 "parser.cpp" break; case 15: // parameters: parameters "," name -#line 287 "parser.ypp" +#line 289 "parser.ypp" { yylhs.value.as < parameters_ptr > () = std::move(yystack_[2].value.as < parameters_ptr > ()); yylhs.value.as < parameters_ptr > ()->list.push_back(std::move(yystack_[0].value.as < name_ptr > ())); } -#line 1904 "parser.cpp" +#line 1905 "parser.cpp" break; case 16: // parameters: name -#line 289 "parser.ypp" +#line 291 "parser.ypp" { yylhs.value.as < parameters_ptr > () = std::make_unique(yylhs.location); yylhs.value.as < parameters_ptr > ()->list.push_back(std::move(yystack_[0].value.as < name_ptr > ())); } -#line 1910 "parser.cpp" +#line 1911 "parser.cpp" break; case 17: // parameters: %empty -#line 291 "parser.ypp" +#line 293 "parser.ypp" { yylhs.value.as < parameters_ptr > () = std::make_unique(yylhs.location); } -#line 1916 "parser.cpp" +#line 1917 "parser.cpp" break; case 18: // stmt: stmt_block -#line 295 "parser.ypp" +#line 297 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_list = std::move(yystack_[0].value.as < stmt_list_ptr > ()); } -#line 1922 "parser.cpp" +#line 1923 "parser.cpp" break; case 19: // stmt: stmt_call -#line 296 "parser.ypp" +#line 298 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_call = std::move(yystack_[0].value.as < stmt_call_ptr > ()); } -#line 1928 "parser.cpp" +#line 1929 "parser.cpp" break; case 20: // stmt: stmt_assign -#line 297 "parser.ypp" +#line 299 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_assign = std::move(yystack_[0].value.as < stmt_assign_ptr > ()); } -#line 1934 "parser.cpp" +#line 1935 "parser.cpp" break; case 21: // stmt: stmt_endon -#line 298 "parser.ypp" +#line 300 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_endon = std::move(yystack_[0].value.as < stmt_endon_ptr > ()); } -#line 1940 "parser.cpp" +#line 1941 "parser.cpp" break; case 22: // stmt: stmt_notify -#line 299 "parser.ypp" +#line 301 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_notify = std::move(yystack_[0].value.as < stmt_notify_ptr > ()); } -#line 1946 "parser.cpp" +#line 1947 "parser.cpp" break; case 23: // stmt: stmt_wait -#line 300 "parser.ypp" +#line 302 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_wait = std::move(yystack_[0].value.as < stmt_wait_ptr > ()); } -#line 1952 "parser.cpp" +#line 1953 "parser.cpp" break; case 24: // stmt: stmt_waittill -#line 301 "parser.ypp" +#line 303 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_waittill = std::move(yystack_[0].value.as < stmt_waittill_ptr > ()); } -#line 1958 "parser.cpp" +#line 1959 "parser.cpp" break; case 25: // stmt: stmt_waittillmatch -#line 302 "parser.ypp" +#line 304 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_waittillmatch = std::move(yystack_[0].value.as < stmt_waittillmatch_ptr > ()); } -#line 1964 "parser.cpp" +#line 1965 "parser.cpp" break; case 26: // stmt: stmt_waittillframeend -#line 303 "parser.ypp" +#line 305 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_waittillframeend = std::move(yystack_[0].value.as < stmt_waittillframeend_ptr > ()); } -#line 1970 "parser.cpp" +#line 1971 "parser.cpp" break; case 27: // stmt: stmt_if -#line 304 "parser.ypp" +#line 306 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_if = std::move(yystack_[0].value.as < stmt_if_ptr > ()); } -#line 1976 "parser.cpp" +#line 1977 "parser.cpp" break; case 28: // stmt: stmt_ifelse -#line 305 "parser.ypp" +#line 307 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_ifelse = std::move(yystack_[0].value.as < stmt_ifelse_ptr > ()); } -#line 1982 "parser.cpp" +#line 1983 "parser.cpp" break; case 29: // stmt: stmt_while -#line 306 "parser.ypp" +#line 308 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_while = std::move(yystack_[0].value.as < stmt_while_ptr > ()); } -#line 1988 "parser.cpp" +#line 1989 "parser.cpp" break; case 30: // stmt: stmt_for -#line 307 "parser.ypp" +#line 309 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_for = std::move(yystack_[0].value.as < stmt_for_ptr > ()); } -#line 1994 "parser.cpp" +#line 1995 "parser.cpp" break; case 31: // stmt: stmt_foreach -#line 308 "parser.ypp" +#line 310 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_foreach = std::move(yystack_[0].value.as < stmt_foreach_ptr > ()); } -#line 2000 "parser.cpp" +#line 2001 "parser.cpp" break; case 32: // stmt: stmt_switch -#line 309 "parser.ypp" +#line 311 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_switch = std::move(yystack_[0].value.as < stmt_switch_ptr > ()); } -#line 2006 "parser.cpp" +#line 2007 "parser.cpp" break; case 33: // stmt: stmt_case -#line 310 "parser.ypp" +#line 312 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_case = std::move(yystack_[0].value.as < stmt_case_ptr > ()); } -#line 2012 "parser.cpp" +#line 2013 "parser.cpp" break; case 34: // stmt: stmt_default -#line 311 "parser.ypp" +#line 313 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_default = std::move(yystack_[0].value.as < stmt_default_ptr > ()); } -#line 2018 "parser.cpp" +#line 2019 "parser.cpp" break; case 35: // stmt: stmt_break -#line 312 "parser.ypp" +#line 314 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_break = std::move(yystack_[0].value.as < stmt_break_ptr > ()); } -#line 2024 "parser.cpp" +#line 2025 "parser.cpp" break; case 36: // stmt: stmt_continue -#line 313 "parser.ypp" +#line 315 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_continue = std::move(yystack_[0].value.as < stmt_continue_ptr > ()); } -#line 2030 "parser.cpp" +#line 2031 "parser.cpp" break; case 37: // stmt: stmt_return -#line 314 "parser.ypp" +#line 316 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_return = std::move(yystack_[0].value.as < stmt_return_ptr > ()); } -#line 2036 "parser.cpp" +#line 2037 "parser.cpp" break; case 38: // stmt: stmt_breakpoint -#line 315 "parser.ypp" +#line 317 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_breakpoint = std::move(yystack_[0].value.as < stmt_breakpoint_ptr > ()); } -#line 2042 "parser.cpp" +#line 2043 "parser.cpp" break; case 39: // stmt: stmt_prof_begin -#line 316 "parser.ypp" +#line 318 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_prof_begin = std::move(yystack_[0].value.as < stmt_prof_begin_ptr > ()); } -#line 2048 "parser.cpp" +#line 2049 "parser.cpp" break; case 40: // stmt: stmt_prof_end -#line 317 "parser.ypp" +#line 319 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_prof_end = std::move(yystack_[0].value.as < stmt_prof_end_ptr > ()); } -#line 2054 "parser.cpp" +#line 2055 "parser.cpp" break; case 41: // stmt_block: "{" stmt_list "}" -#line 321 "parser.ypp" +#line 323 "parser.ypp" { yylhs.value.as < stmt_list_ptr > () = std::move(yystack_[1].value.as < stmt_list_ptr > ()); } -#line 2060 "parser.cpp" +#line 2061 "parser.cpp" break; case 42: // stmt_block: "{" "}" -#line 322 "parser.ypp" +#line 324 "parser.ypp" { yylhs.value.as < stmt_list_ptr > () = std::make_unique(yylhs.location); } -#line 2066 "parser.cpp" +#line 2067 "parser.cpp" break; case 43: // stmt_list: stmt_list stmt -#line 327 "parser.ypp" +#line 329 "parser.ypp" { yylhs.value.as < stmt_list_ptr > () = std::move(yystack_[1].value.as < stmt_list_ptr > ()); yylhs.value.as < stmt_list_ptr > ()->stmts.push_back(std::move(yystack_[0].value.as < stmt_ptr > ())); } -#line 2072 "parser.cpp" +#line 2073 "parser.cpp" break; case 44: // stmt_list: stmt -#line 329 "parser.ypp" +#line 331 "parser.ypp" { yylhs.value.as < stmt_list_ptr > () = std::make_unique(yylhs.location); yylhs.value.as < stmt_list_ptr > ()->stmts.push_back(std::move(yystack_[0].value.as < stmt_ptr > ())); } -#line 2078 "parser.cpp" +#line 2079 "parser.cpp" break; case 45: // stmt_call: expr_call ";" -#line 334 "parser.ypp" +#line 336 "parser.ypp" { yylhs.value.as < stmt_call_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[1].value.as < expr_call_ptr > ())); } -#line 2084 "parser.cpp" +#line 2085 "parser.cpp" break; case 46: // stmt_call: expr_call_thread ";" -#line 336 "parser.ypp" +#line 338 "parser.ypp" { yylhs.value.as < stmt_call_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[1].value.as < expr_call_ptr > ())); } -#line 2090 "parser.cpp" +#line 2091 "parser.cpp" break; case 47: // stmt_assign: expr_assign ";" -#line 341 "parser.ypp" +#line 343 "parser.ypp" { yylhs.value.as < stmt_assign_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[1].value.as < expr_assign_ptr > ())); } -#line 2096 "parser.cpp" +#line 2097 "parser.cpp" break; case 48: // stmt_endon: object "endon" "(" expr ")" ";" -#line 346 "parser.ypp" +#line 348 "parser.ypp" { yylhs.value.as < stmt_endon_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[5].value.as < node_ptr > ()), std::move(yystack_[2].value.as < expr_ptr > ())); } -#line 2102 "parser.cpp" +#line 2103 "parser.cpp" break; case 49: // stmt_notify: object "notify" "(" expr "," expr_arguments ")" ";" -#line 351 "parser.ypp" +#line 353 "parser.ypp" { yylhs.value.as < stmt_notify_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[7].value.as < node_ptr > ()), std::move(yystack_[4].value.as < expr_ptr > ()), std::move(yystack_[2].value.as < expr_arguments_ptr > ())); } -#line 2108 "parser.cpp" +#line 2109 "parser.cpp" break; case 50: // stmt_notify: object "notify" "(" expr ")" ";" -#line 353 "parser.ypp" +#line 355 "parser.ypp" { yylhs.value.as < stmt_notify_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[5].value.as < node_ptr > ()), std::move(yystack_[2].value.as < expr_ptr > ()), std::make_unique(yylhs.location)); } -#line 2114 "parser.cpp" +#line 2115 "parser.cpp" break; case 51: // stmt_wait: "wait" expr ";" -#line 358 "parser.ypp" +#line 360 "parser.ypp" { yylhs.value.as < stmt_wait_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[1].value.as < expr_ptr > ())); } -#line 2120 "parser.cpp" +#line 2121 "parser.cpp" break; case 52: // stmt_waittill: object "waittill" "(" expr "," expr_arguments ")" ";" -#line 363 "parser.ypp" +#line 365 "parser.ypp" { yylhs.value.as < stmt_waittill_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[7].value.as < node_ptr > ()), std::move(yystack_[4].value.as < expr_ptr > ()), std::move(yystack_[2].value.as < expr_arguments_ptr > ())); } -#line 2126 "parser.cpp" +#line 2127 "parser.cpp" break; case 53: // stmt_waittill: object "waittill" "(" expr ")" ";" -#line 365 "parser.ypp" +#line 367 "parser.ypp" { yylhs.value.as < stmt_waittill_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[5].value.as < node_ptr > ()), std::move(yystack_[2].value.as < expr_ptr > ()), std::make_unique(yylhs.location)); } -#line 2132 "parser.cpp" +#line 2133 "parser.cpp" break; case 54: // stmt_waittillmatch: object "waittillmatch" "(" expr "," expr_arguments ")" ";" -#line 370 "parser.ypp" +#line 372 "parser.ypp" { yylhs.value.as < stmt_waittillmatch_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[7].value.as < node_ptr > ()), std::move(yystack_[4].value.as < expr_ptr > ()), std::move(yystack_[2].value.as < expr_arguments_ptr > ())); } -#line 2138 "parser.cpp" +#line 2139 "parser.cpp" break; case 55: // stmt_waittillmatch: object "waittillmatch" "(" expr ")" ";" -#line 372 "parser.ypp" +#line 374 "parser.ypp" { yylhs.value.as < stmt_waittillmatch_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[5].value.as < node_ptr > ()), std::move(yystack_[2].value.as < expr_ptr > ()), std::make_unique(yylhs.location)); } -#line 2144 "parser.cpp" +#line 2145 "parser.cpp" break; case 56: // stmt_waittillframeend: "waittillframeend" ";" -#line 377 "parser.ypp" +#line 379 "parser.ypp" { yylhs.value.as < stmt_waittillframeend_ptr > () = std::make_unique(yylhs.location); } -#line 2150 "parser.cpp" +#line 2151 "parser.cpp" break; case 57: // stmt_if: "if" "(" expr ")" stmt -#line 382 "parser.ypp" +#line 384 "parser.ypp" { yylhs.value.as < stmt_if_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < stmt_ptr > ())); } -#line 2156 "parser.cpp" +#line 2157 "parser.cpp" break; case 58: // stmt_ifelse: "if" "(" expr ")" stmt "else" stmt -#line 387 "parser.ypp" +#line 389 "parser.ypp" { yylhs.value.as < stmt_ifelse_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[4].value.as < expr_ptr > ()), std::move(yystack_[2].value.as < stmt_ptr > ()), std::move(yystack_[0].value.as < stmt_ptr > ())); } -#line 2162 "parser.cpp" +#line 2163 "parser.cpp" break; case 59: // stmt_while: "while" "(" expr ")" stmt -#line 392 "parser.ypp" +#line 394 "parser.ypp" { yylhs.value.as < stmt_while_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < stmt_ptr > ())); } -#line 2168 "parser.cpp" +#line 2169 "parser.cpp" break; case 60: // stmt_for: "for" "(" for_stmt ";" for_expr ";" for_stmt ")" stmt -#line 397 "parser.ypp" +#line 399 "parser.ypp" { yylhs.value.as < stmt_for_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[6].value.as < stmt_ptr > ()), std::move(yystack_[4].value.as < expr_ptr > ()), std::move(yystack_[2].value.as < stmt_ptr > ()), std::move(yystack_[0].value.as < stmt_ptr > ())); } -#line 2174 "parser.cpp" +#line 2175 "parser.cpp" break; case 61: // stmt_foreach: "foreach" "(" name "in" expr ")" stmt -#line 402 "parser.ypp" +#line 404 "parser.ypp" { yylhs.value.as < stmt_foreach_ptr > () = std::make_unique(yylhs.location, expr_ptr(std::move(yystack_[4].value.as < name_ptr > ())), std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < stmt_ptr > ())); } -#line 2180 "parser.cpp" +#line 2181 "parser.cpp" break; case 62: // stmt_foreach: "foreach" "(" name "," name "in" expr ")" stmt -#line 404 "parser.ypp" +#line 406 "parser.ypp" { yylhs.value.as < stmt_foreach_ptr > () = std::make_unique(yylhs.location, expr_ptr(std::move(yystack_[6].value.as < name_ptr > ())), expr_ptr(std::move(yystack_[4].value.as < name_ptr > ())), std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < stmt_ptr > ())); } -#line 2186 "parser.cpp" +#line 2187 "parser.cpp" break; case 63: // stmt_switch: "switch" "(" expr ")" stmt_block -#line 409 "parser.ypp" +#line 411 "parser.ypp" { yylhs.value.as < stmt_switch_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < stmt_list_ptr > ())); } -#line 2192 "parser.cpp" +#line 2193 "parser.cpp" break; case 64: // stmt_case: "case" integer ":" -#line 414 "parser.ypp" +#line 416 "parser.ypp" { yylhs.value.as < stmt_case_ptr > () = std::make_unique(yylhs.location, expr_ptr(std::move(yystack_[1].value.as < integer_ptr > ())), std::make_unique(yylhs.location)); } -#line 2198 "parser.cpp" +#line 2199 "parser.cpp" break; case 65: // stmt_case: "case" string ":" -#line 416 "parser.ypp" +#line 418 "parser.ypp" { yylhs.value.as < stmt_case_ptr > () = std::make_unique(yylhs.location, expr_ptr(std::move(yystack_[1].value.as < string_ptr > ())), std::make_unique(yylhs.location)); } -#line 2204 "parser.cpp" +#line 2205 "parser.cpp" break; case 66: // stmt_default: "default" ":" -#line 421 "parser.ypp" +#line 423 "parser.ypp" { yylhs.value.as < stmt_default_ptr > () = std::make_unique(yylhs.location, std::make_unique(yylhs.location)); } -#line 2210 "parser.cpp" +#line 2211 "parser.cpp" break; case 67: // stmt_break: "break" ";" -#line 426 "parser.ypp" +#line 428 "parser.ypp" { yylhs.value.as < stmt_break_ptr > () = std::make_unique(yylhs.location); } -#line 2216 "parser.cpp" +#line 2217 "parser.cpp" break; case 68: // stmt_continue: "continue" ";" -#line 431 "parser.ypp" +#line 433 "parser.ypp" { yylhs.value.as < stmt_continue_ptr > () = std::make_unique(yylhs.location); } -#line 2222 "parser.cpp" +#line 2223 "parser.cpp" break; case 69: // stmt_return: "return" expr ";" -#line 436 "parser.ypp" +#line 438 "parser.ypp" { yylhs.value.as < stmt_return_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[1].value.as < expr_ptr > ())); } -#line 2228 "parser.cpp" +#line 2229 "parser.cpp" break; case 70: // stmt_return: "return" ";" -#line 438 "parser.ypp" +#line 440 "parser.ypp" { yylhs.value.as < stmt_return_ptr > () = std::make_unique(yylhs.location, std::make_unique(yylhs.location)); } -#line 2234 "parser.cpp" +#line 2235 "parser.cpp" break; case 71: // stmt_breakpoint: "breakpoint" ";" -#line 443 "parser.ypp" +#line 445 "parser.ypp" { yylhs.value.as < stmt_breakpoint_ptr > () = std::make_unique(yylhs.location); } -#line 2240 "parser.cpp" +#line 2241 "parser.cpp" break; case 72: // stmt_prof_begin: "prof_begin" "(" expr_arguments ")" ";" -#line 448 "parser.ypp" +#line 450 "parser.ypp" { yylhs.value.as < stmt_prof_begin_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_arguments_ptr > ())); } -#line 2246 "parser.cpp" +#line 2247 "parser.cpp" break; case 73: // stmt_prof_end: "prof_end" "(" expr_arguments ")" ";" -#line 453 "parser.ypp" +#line 455 "parser.ypp" { yylhs.value.as < stmt_prof_end_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_arguments_ptr > ())); } -#line 2252 "parser.cpp" +#line 2253 "parser.cpp" break; case 74: // for_stmt: expr_assign -#line 457 "parser.ypp" +#line 459 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_list = std::make_unique(yylhs.location); yylhs.value.as < stmt_ptr > ().as_list->stmts.push_back(stmt_ptr(std::make_unique(yylhs.location, std::move(yystack_[0].value.as < expr_assign_ptr > ())))); } -#line 2258 "parser.cpp" +#line 2259 "parser.cpp" break; case 75: // for_stmt: %empty -#line 458 "parser.ypp" +#line 460 "parser.ypp" { yylhs.value.as < stmt_ptr > ().as_node = std::make_unique(yylhs.location); } -#line 2264 "parser.cpp" +#line 2265 "parser.cpp" break; case 76: // for_expr: expr -#line 462 "parser.ypp" +#line 464 "parser.ypp" { yylhs.value.as < expr_ptr > () = std::move(yystack_[0].value.as < expr_ptr > ()); } -#line 2270 "parser.cpp" +#line 2271 "parser.cpp" break; case 77: // for_expr: %empty -#line 463 "parser.ypp" +#line 465 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location); } -#line 2276 "parser.cpp" +#line 2277 "parser.cpp" break; case 78: // expr: expr_compare -#line 467 "parser.ypp" +#line 469 "parser.ypp" { yylhs.value.as < expr_ptr > () = std::move(yystack_[0].value.as < expr_ptr > ()); } -#line 2282 "parser.cpp" +#line 2283 "parser.cpp" break; case 79: // expr: expr_ternary -#line 468 "parser.ypp" +#line 470 "parser.ypp" { yylhs.value.as < expr_ptr > () = std::move(yystack_[0].value.as < expr_ptr > ()); } -#line 2288 "parser.cpp" +#line 2289 "parser.cpp" break; case 80: // expr: expr_binary -#line 469 "parser.ypp" +#line 471 "parser.ypp" { yylhs.value.as < expr_ptr > () = std::move(yystack_[0].value.as < expr_ptr > ()); } -#line 2294 "parser.cpp" +#line 2295 "parser.cpp" break; case 81: // expr: expr_primitive -#line 470 "parser.ypp" +#line 472 "parser.ypp" { yylhs.value.as < expr_ptr > () = std::move(yystack_[0].value.as < expr_ptr > ()); } -#line 2300 "parser.cpp" +#line 2301 "parser.cpp" break; case 82: // expr_assign: "++" object -#line 474 "parser.ypp" +#line 476 "parser.ypp" { yylhs.value.as < expr_assign_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[0].value.as < node_ptr > ())); } -#line 2306 "parser.cpp" +#line 2307 "parser.cpp" break; case 83: // expr_assign: "--" object -#line 475 "parser.ypp" +#line 477 "parser.ypp" { yylhs.value.as < expr_assign_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[0].value.as < node_ptr > ())); } -#line 2312 "parser.cpp" +#line 2313 "parser.cpp" break; case 84: // expr_assign: object "++" -#line 476 "parser.ypp" +#line 478 "parser.ypp" { yylhs.value.as < expr_assign_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[1].value.as < node_ptr > ())); } -#line 2318 "parser.cpp" +#line 2319 "parser.cpp" break; case 85: // expr_assign: object "--" -#line 477 "parser.ypp" +#line 479 "parser.ypp" { yylhs.value.as < expr_assign_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[1].value.as < node_ptr > ())); } -#line 2324 "parser.cpp" +#line 2325 "parser.cpp" break; case 86: // expr_assign: object "=" expr -#line 478 "parser.ypp" +#line 480 "parser.ypp" { yylhs.value.as < expr_assign_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < node_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2330 "parser.cpp" +#line 2331 "parser.cpp" break; case 87: // expr_assign: object "|=" expr -#line 479 "parser.ypp" +#line 481 "parser.ypp" { yylhs.value.as < expr_assign_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < node_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2336 "parser.cpp" +#line 2337 "parser.cpp" break; case 88: // expr_assign: object "&=" expr -#line 480 "parser.ypp" +#line 482 "parser.ypp" { yylhs.value.as < expr_assign_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < node_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2342 "parser.cpp" +#line 2343 "parser.cpp" break; case 89: // expr_assign: object "^=" expr -#line 481 "parser.ypp" +#line 483 "parser.ypp" { yylhs.value.as < expr_assign_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < node_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2348 "parser.cpp" +#line 2349 "parser.cpp" break; case 90: // expr_assign: object "<<=" expr -#line 482 "parser.ypp" +#line 484 "parser.ypp" { yylhs.value.as < expr_assign_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < node_ptr > ()),std::move( yystack_[0].value.as < expr_ptr > ())); } -#line 2354 "parser.cpp" +#line 2355 "parser.cpp" break; case 91: // expr_assign: object ">>=" expr -#line 483 "parser.ypp" +#line 485 "parser.ypp" { yylhs.value.as < expr_assign_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < node_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2360 "parser.cpp" +#line 2361 "parser.cpp" break; case 92: // expr_assign: object "+=" expr -#line 484 "parser.ypp" +#line 486 "parser.ypp" { yylhs.value.as < expr_assign_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < node_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2366 "parser.cpp" +#line 2367 "parser.cpp" break; case 93: // expr_assign: object "-=" expr -#line 485 "parser.ypp" +#line 487 "parser.ypp" { yylhs.value.as < expr_assign_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < node_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2372 "parser.cpp" +#line 2373 "parser.cpp" break; case 94: // expr_assign: object "*=" expr -#line 486 "parser.ypp" +#line 488 "parser.ypp" { yylhs.value.as < expr_assign_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < node_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2378 "parser.cpp" +#line 2379 "parser.cpp" break; case 95: // expr_assign: object "/=" expr -#line 487 "parser.ypp" +#line 489 "parser.ypp" { yylhs.value.as < expr_assign_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < node_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2384 "parser.cpp" +#line 2385 "parser.cpp" break; case 96: // expr_assign: object "%=" expr -#line 488 "parser.ypp" +#line 490 "parser.ypp" { yylhs.value.as < expr_assign_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < node_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2390 "parser.cpp" +#line 2391 "parser.cpp" break; case 97: // expr_compare: expr "||" expr -#line 492 "parser.ypp" +#line 494 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2396 "parser.cpp" +#line 2397 "parser.cpp" break; case 98: // expr_compare: expr "&&" expr -#line 493 "parser.ypp" +#line 495 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2402 "parser.cpp" +#line 2403 "parser.cpp" break; case 99: // expr_compare: expr "==" expr -#line 494 "parser.ypp" +#line 496 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2408 "parser.cpp" +#line 2409 "parser.cpp" break; case 100: // expr_compare: expr "!=" expr -#line 495 "parser.ypp" +#line 497 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2414 "parser.cpp" +#line 2415 "parser.cpp" break; case 101: // expr_compare: expr "<=" expr -#line 496 "parser.ypp" +#line 498 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2420 "parser.cpp" +#line 2421 "parser.cpp" break; case 102: // expr_compare: expr ">=" expr -#line 497 "parser.ypp" +#line 499 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2426 "parser.cpp" +#line 2427 "parser.cpp" break; case 103: // expr_compare: expr "<" expr -#line 498 "parser.ypp" +#line 500 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2432 "parser.cpp" +#line 2433 "parser.cpp" break; case 104: // expr_compare: expr ">" expr -#line 499 "parser.ypp" +#line 501 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2438 "parser.cpp" +#line 2439 "parser.cpp" break; case 105: // expr_ternary: expr "?" expr ":" expr -#line 503 "parser.ypp" +#line 505 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[4].value.as < expr_ptr > ()), std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2444 "parser.cpp" +#line 2445 "parser.cpp" break; case 106: // expr_binary: expr "|" expr -#line 507 "parser.ypp" +#line 509 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2450 "parser.cpp" +#line 2451 "parser.cpp" break; case 107: // expr_binary: expr "&" expr -#line 508 "parser.ypp" +#line 510 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2456 "parser.cpp" +#line 2457 "parser.cpp" break; case 108: // expr_binary: expr "^" expr -#line 509 "parser.ypp" +#line 511 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2462 "parser.cpp" +#line 2463 "parser.cpp" break; case 109: // expr_binary: expr "<<" expr -#line 510 "parser.ypp" +#line 512 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2468 "parser.cpp" +#line 2469 "parser.cpp" break; case 110: // expr_binary: expr ">>" expr -#line 511 "parser.ypp" +#line 513 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2474 "parser.cpp" +#line 2475 "parser.cpp" break; case 111: // expr_binary: expr "+" expr -#line 512 "parser.ypp" +#line 514 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2480 "parser.cpp" +#line 2481 "parser.cpp" break; case 112: // expr_binary: expr "-" expr -#line 513 "parser.ypp" +#line 515 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2486 "parser.cpp" +#line 2487 "parser.cpp" break; case 113: // expr_binary: expr "*" expr -#line 514 "parser.ypp" +#line 516 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2492 "parser.cpp" +#line 2493 "parser.cpp" break; case 114: // expr_binary: expr "/" expr -#line 515 "parser.ypp" +#line 517 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2498 "parser.cpp" +#line 2499 "parser.cpp" break; case 115: // expr_binary: expr "%" expr -#line 516 "parser.ypp" +#line 518 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < expr_ptr > ()), std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2504 "parser.cpp" +#line 2505 "parser.cpp" break; case 116: // expr_primitive: "(" expr ")" -#line 520 "parser.ypp" +#line 522 "parser.ypp" { yylhs.value.as < expr_ptr > () = std::move(yystack_[1].value.as < expr_ptr > ()); } -#line 2510 "parser.cpp" +#line 2511 "parser.cpp" break; case 117: // expr_primitive: "~" expr -#line 521 "parser.ypp" +#line 523 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2516 "parser.cpp" +#line 2517 "parser.cpp" break; case 118: // expr_primitive: "!" expr -#line 522 "parser.ypp" +#line 524 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::make_unique(yylhs.location, std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2522 "parser.cpp" +#line 2523 "parser.cpp" break; case 119: // expr_primitive: expr_call -#line 523 "parser.ypp" +#line 525 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < expr_call_ptr > ()); } -#line 2528 "parser.cpp" +#line 2529 "parser.cpp" break; case 120: // expr_primitive: expr_call_thread -#line 524 "parser.ypp" +#line 526 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < expr_call_ptr > ()); } -#line 2534 "parser.cpp" +#line 2535 "parser.cpp" break; case 121: // expr_primitive: expr_call_childthread -#line 525 "parser.ypp" +#line 527 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < expr_call_ptr > ()); } -#line 2540 "parser.cpp" +#line 2541 "parser.cpp" break; case 122: // expr_primitive: expr_function -#line 526 "parser.ypp" +#line 528 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < node_ptr > ()); } -#line 2546 "parser.cpp" +#line 2547 "parser.cpp" break; case 123: // expr_primitive: expr_add_array -#line 527 "parser.ypp" +#line 529 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < node_ptr > ()); } -#line 2552 "parser.cpp" +#line 2553 "parser.cpp" break; case 124: // expr_primitive: expr_array -#line 528 "parser.ypp" +#line 530 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < node_ptr > ()); } -#line 2558 "parser.cpp" +#line 2559 "parser.cpp" break; case 125: // expr_primitive: expr_field -#line 529 "parser.ypp" +#line 531 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < node_ptr > ()); } -#line 2564 "parser.cpp" +#line 2565 "parser.cpp" break; case 126: // expr_primitive: expr_size -#line 530 "parser.ypp" +#line 532 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < node_ptr > ()); } -#line 2570 "parser.cpp" +#line 2571 "parser.cpp" break; case 127: // expr_primitive: thisthread -#line 531 "parser.ypp" +#line 533 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < thisthread_ptr > ()); } -#line 2576 "parser.cpp" +#line 2577 "parser.cpp" break; case 128: // expr_primitive: empty_array -#line 532 "parser.ypp" +#line 534 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < empty_array_ptr > ()); } -#line 2582 "parser.cpp" +#line 2583 "parser.cpp" break; case 129: // expr_primitive: undefined -#line 533 "parser.ypp" +#line 535 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < undefined_ptr > ()); } -#line 2588 "parser.cpp" +#line 2589 "parser.cpp" break; case 130: // expr_primitive: game -#line 534 "parser.ypp" +#line 536 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < game_ptr > ()); } -#line 2594 "parser.cpp" +#line 2595 "parser.cpp" break; case 131: // expr_primitive: self -#line 535 "parser.ypp" +#line 537 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < self_ptr > ()); } -#line 2600 "parser.cpp" +#line 2601 "parser.cpp" break; case 132: // expr_primitive: anim -#line 536 "parser.ypp" +#line 538 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < anim_ptr > ()); } -#line 2606 "parser.cpp" +#line 2607 "parser.cpp" break; case 133: // expr_primitive: level -#line 537 "parser.ypp" +#line 539 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < level_ptr > ()); } -#line 2612 "parser.cpp" +#line 2613 "parser.cpp" break; case 134: // expr_primitive: animation -#line 538 "parser.ypp" +#line 540 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < animation_ptr > ()); } -#line 2618 "parser.cpp" +#line 2619 "parser.cpp" break; case 135: // expr_primitive: animtree -#line 539 "parser.ypp" +#line 541 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < animtree_ptr > ()); } -#line 2624 "parser.cpp" +#line 2625 "parser.cpp" break; case 136: // expr_primitive: name -#line 540 "parser.ypp" +#line 542 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < name_ptr > ()); } -#line 2630 "parser.cpp" +#line 2631 "parser.cpp" break; case 137: // expr_primitive: istring -#line 541 "parser.ypp" +#line 543 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < istring_ptr > ()); } -#line 2636 "parser.cpp" +#line 2637 "parser.cpp" break; case 138: // expr_primitive: string -#line 542 "parser.ypp" +#line 544 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < string_ptr > ()); } -#line 2642 "parser.cpp" +#line 2643 "parser.cpp" break; case 139: // expr_primitive: color -#line 543 "parser.ypp" +#line 545 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < color_ptr > ()); } -#line 2648 "parser.cpp" +#line 2649 "parser.cpp" break; case 140: // expr_primitive: vector -#line 544 "parser.ypp" +#line 546 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < vector_ptr > ()); } -#line 2654 "parser.cpp" +#line 2655 "parser.cpp" break; case 141: // expr_primitive: float -#line 545 "parser.ypp" +#line 547 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < float_ptr > ()); } -#line 2660 "parser.cpp" +#line 2661 "parser.cpp" break; case 142: // expr_primitive: integer -#line 546 "parser.ypp" +#line 548 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < integer_ptr > ()); } -#line 2666 "parser.cpp" +#line 2667 "parser.cpp" break; case 143: // expr_primitive: false -#line 547 "parser.ypp" +#line 549 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < false_ptr > ()); } -#line 2672 "parser.cpp" +#line 2673 "parser.cpp" break; case 144: // expr_primitive: true -#line 548 "parser.ypp" +#line 550 "parser.ypp" { yylhs.value.as < expr_ptr > ().as_node = std::move(yystack_[0].value.as < true_ptr > ()); } -#line 2678 "parser.cpp" +#line 2679 "parser.cpp" break; case 145: // expr_call: expr_call_function -#line 552 "parser.ypp" +#line 554 "parser.ypp" { yylhs.value.as < expr_call_ptr > () = std::make_unique(yylhs.location, false, false, std::make_unique(yylhs.location), std::move(yystack_[0].value.as < expr_call_type_ptr > ())); } -#line 2684 "parser.cpp" +#line 2685 "parser.cpp" break; case 146: // expr_call: expr_call_pointer -#line 553 "parser.ypp" +#line 555 "parser.ypp" { yylhs.value.as < expr_call_ptr > () = std::make_unique(yylhs.location, false, false, std::make_unique(yylhs.location), std::move(yystack_[0].value.as < expr_call_type_ptr > ())); } -#line 2690 "parser.cpp" +#line 2691 "parser.cpp" break; case 147: // expr_call: object expr_call_function -#line 554 "parser.ypp" +#line 556 "parser.ypp" { yylhs.value.as < expr_call_ptr > () = std::make_unique(yylhs.location, false, false, std::move(yystack_[1].value.as < node_ptr > ()), std::move(yystack_[0].value.as < expr_call_type_ptr > ())); } -#line 2696 "parser.cpp" +#line 2697 "parser.cpp" break; case 148: // expr_call: object expr_call_pointer -#line 555 "parser.ypp" +#line 557 "parser.ypp" { yylhs.value.as < expr_call_ptr > () = std::make_unique(yylhs.location, false, false, std::move(yystack_[1].value.as < node_ptr > ()), std::move(yystack_[0].value.as < expr_call_type_ptr > ())); } -#line 2702 "parser.cpp" +#line 2703 "parser.cpp" break; case 149: // expr_call_thread: "thread" expr_call_function -#line 559 "parser.ypp" +#line 561 "parser.ypp" { yylhs.value.as < expr_call_ptr > () = std::make_unique(yylhs.location, true, false, std::make_unique(yylhs.location), std::move(yystack_[0].value.as < expr_call_type_ptr > ())); } -#line 2708 "parser.cpp" +#line 2709 "parser.cpp" break; case 150: // expr_call_thread: "thread" expr_call_pointer -#line 560 "parser.ypp" +#line 562 "parser.ypp" { yylhs.value.as < expr_call_ptr > () = std::make_unique(yylhs.location, true, false, std::make_unique(yylhs.location), std::move(yystack_[0].value.as < expr_call_type_ptr > ())); } -#line 2714 "parser.cpp" +#line 2715 "parser.cpp" break; case 151: // expr_call_thread: object "thread" expr_call_function -#line 561 "parser.ypp" +#line 563 "parser.ypp" { yylhs.value.as < expr_call_ptr > () = std::make_unique(yylhs.location, true, false, std::move(yystack_[2].value.as < node_ptr > ()), std::move(yystack_[0].value.as < expr_call_type_ptr > ())); } -#line 2720 "parser.cpp" +#line 2721 "parser.cpp" break; case 152: // expr_call_thread: object "thread" expr_call_pointer -#line 562 "parser.ypp" +#line 564 "parser.ypp" { yylhs.value.as < expr_call_ptr > () = std::make_unique(yylhs.location, true, false, std::move(yystack_[2].value.as < node_ptr > ()), std::move(yystack_[0].value.as < expr_call_type_ptr > ())); } -#line 2726 "parser.cpp" +#line 2727 "parser.cpp" break; case 153: // expr_call_childthread: "childthread" expr_call_function -#line 566 "parser.ypp" +#line 568 "parser.ypp" { yylhs.value.as < expr_call_ptr > () = std::make_unique(yylhs.location, false, true, std::make_unique(yylhs.location), std::move(yystack_[0].value.as < expr_call_type_ptr > ())); } -#line 2732 "parser.cpp" +#line 2733 "parser.cpp" break; case 154: // expr_call_childthread: "childthread" expr_call_pointer -#line 567 "parser.ypp" +#line 569 "parser.ypp" { yylhs.value.as < expr_call_ptr > () = std::make_unique(yylhs.location, false, true, std::make_unique(yylhs.location), std::move(yystack_[0].value.as < expr_call_type_ptr > ())); } -#line 2738 "parser.cpp" +#line 2739 "parser.cpp" break; case 155: // expr_call_childthread: object "childthread" expr_call_function -#line 568 "parser.ypp" +#line 570 "parser.ypp" { yylhs.value.as < expr_call_ptr > () = std::make_unique(yylhs.location, false, true, std::move(yystack_[2].value.as < node_ptr > ()), std::move(yystack_[0].value.as < expr_call_type_ptr > ())); } -#line 2744 "parser.cpp" +#line 2745 "parser.cpp" break; case 156: // expr_call_childthread: object "childthread" expr_call_pointer -#line 569 "parser.ypp" +#line 571 "parser.ypp" { yylhs.value.as < expr_call_ptr > () = std::make_unique(yylhs.location, false, true, std::move(yystack_[2].value.as < node_ptr > ()), std::move(yystack_[0].value.as < expr_call_type_ptr > ())); } -#line 2750 "parser.cpp" +#line 2751 "parser.cpp" break; case 157: // expr_call_function: name "(" expr_arguments ")" -#line 574 "parser.ypp" +#line 576 "parser.ypp" {yylhs.value.as < expr_call_type_ptr > ().as_func = std::make_unique(yylhs.location, std::make_unique(), std::move(yystack_[3].value.as < name_ptr > ()), std::move(yystack_[1].value.as < expr_arguments_ptr > ())); } -#line 2756 "parser.cpp" +#line 2757 "parser.cpp" break; case 158: // expr_call_function: file "::" name "(" expr_arguments ")" -#line 576 "parser.ypp" +#line 578 "parser.ypp" { yylhs.value.as < expr_call_type_ptr > ().as_func = std::make_unique(yylhs.location, std::move(yystack_[5].value.as < file_ptr > ()), std::move(yystack_[3].value.as < name_ptr > ()), std::move(yystack_[1].value.as < expr_arguments_ptr > ())); } -#line 2762 "parser.cpp" +#line 2763 "parser.cpp" break; case 159: // expr_call_pointer: "[" "[" expr "]" "]" "(" expr_arguments ")" -#line 581 "parser.ypp" +#line 583 "parser.ypp" { yylhs.value.as < expr_call_type_ptr > ().as_pointer = std::make_unique(yylhs.location, false, std::move(yystack_[5].value.as < expr_ptr > ()), std::move(yystack_[1].value.as < expr_arguments_ptr > ())); } -#line 2768 "parser.cpp" +#line 2769 "parser.cpp" break; case 160: // expr_call_pointer: "call" "[" "[" expr "]" "]" "(" expr_arguments ")" -#line 583 "parser.ypp" +#line 585 "parser.ypp" { yylhs.value.as < expr_call_type_ptr > ().as_pointer = std::make_unique(yylhs.location, true, std::move(yystack_[5].value.as < expr_ptr > ()), std::move(yystack_[1].value.as < expr_arguments_ptr > ())); } -#line 2774 "parser.cpp" +#line 2775 "parser.cpp" break; case 161: // expr_arguments: expr_arguments_filled -#line 587 "parser.ypp" +#line 589 "parser.ypp" { yylhs.value.as < expr_arguments_ptr > () = std::move(yystack_[0].value.as < expr_arguments_ptr > ()); } -#line 2780 "parser.cpp" +#line 2781 "parser.cpp" break; case 162: // expr_arguments: expr_arguments_empty -#line 588 "parser.ypp" +#line 590 "parser.ypp" { yylhs.value.as < expr_arguments_ptr > () = std::move(yystack_[0].value.as < expr_arguments_ptr > ()); } -#line 2786 "parser.cpp" +#line 2787 "parser.cpp" break; case 163: // expr_arguments_filled: expr_arguments_filled "," expr -#line 593 "parser.ypp" +#line 595 "parser.ypp" { yylhs.value.as < expr_arguments_ptr > () = std::move(yystack_[2].value.as < expr_arguments_ptr > ()); yylhs.value.as < expr_arguments_ptr > ()->list.push_back(std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2792 "parser.cpp" +#line 2793 "parser.cpp" break; case 164: // expr_arguments_filled: expr -#line 595 "parser.ypp" +#line 597 "parser.ypp" { yylhs.value.as < expr_arguments_ptr > () = std::make_unique(yylhs.location); yylhs.value.as < expr_arguments_ptr > ()->list.push_back(std::move(yystack_[0].value.as < expr_ptr > ())); } -#line 2798 "parser.cpp" +#line 2799 "parser.cpp" break; case 165: // expr_arguments_empty: %empty -#line 600 "parser.ypp" +#line 602 "parser.ypp" { yylhs.value.as < expr_arguments_ptr > () = std::make_unique(yylhs.location); } -#line 2804 "parser.cpp" +#line 2805 "parser.cpp" break; case 166: // expr_function: "::" name -#line 605 "parser.ypp" +#line 607 "parser.ypp" { yylhs.value.as < node_ptr > () = std::make_unique(yylhs.location, std::make_unique(yylhs.location), std::move(yystack_[0].value.as < name_ptr > ())); } -#line 2810 "parser.cpp" +#line 2811 "parser.cpp" break; case 167: // expr_function: file "::" name -#line 607 "parser.ypp" +#line 609 "parser.ypp" { yylhs.value.as < node_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < file_ptr > ()), std::move(yystack_[0].value.as < name_ptr > ())); } -#line 2816 "parser.cpp" +#line 2817 "parser.cpp" break; case 168: // expr_add_array: "[" expr_arguments_filled "]" -#line 612 "parser.ypp" +#line 614 "parser.ypp" { yylhs.value.as < node_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[1].value.as < expr_arguments_ptr > ())); } -#line 2822 "parser.cpp" +#line 2823 "parser.cpp" break; case 169: // expr_array: object "[" expr "]" -#line 617 "parser.ypp" +#line 619 "parser.ypp" { yylhs.value.as < node_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[3].value.as < node_ptr > ()), std::move(yystack_[1].value.as < expr_ptr > ())); } -#line 2828 "parser.cpp" +#line 2829 "parser.cpp" break; case 170: // expr_field: object "." name -#line 622 "parser.ypp" +#line 624 "parser.ypp" { yylhs.value.as < node_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[2].value.as < node_ptr > ()), std::move(yystack_[0].value.as < name_ptr > ())); } -#line 2834 "parser.cpp" +#line 2835 "parser.cpp" break; case 171: // expr_size: object ".size" -#line 627 "parser.ypp" +#line 629 "parser.ypp" { yylhs.value.as < node_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[1].value.as < node_ptr > ())); } -#line 2840 "parser.cpp" +#line 2841 "parser.cpp" break; case 172: // object: expr_call -#line 631 "parser.ypp" +#line 633 "parser.ypp" { yylhs.value.as < node_ptr > () = std::move(yystack_[0].value.as < expr_call_ptr > ()); } -#line 2846 "parser.cpp" +#line 2847 "parser.cpp" break; case 173: // object: expr_array -#line 632 "parser.ypp" +#line 634 "parser.ypp" { yylhs.value.as < node_ptr > () = std::move(yystack_[0].value.as < node_ptr > ()); } -#line 2852 "parser.cpp" +#line 2853 "parser.cpp" break; case 174: // object: expr_field -#line 633 "parser.ypp" +#line 635 "parser.ypp" { yylhs.value.as < node_ptr > () = std::move(yystack_[0].value.as < node_ptr > ()); } -#line 2858 "parser.cpp" +#line 2859 "parser.cpp" break; case 175: // object: game -#line 634 "parser.ypp" +#line 636 "parser.ypp" { yylhs.value.as < node_ptr > () = std::move(yystack_[0].value.as < game_ptr > ()); } -#line 2864 "parser.cpp" +#line 2865 "parser.cpp" break; case 176: // object: self -#line 635 "parser.ypp" +#line 637 "parser.ypp" { yylhs.value.as < node_ptr > () = std::move(yystack_[0].value.as < self_ptr > ()); } -#line 2870 "parser.cpp" +#line 2871 "parser.cpp" break; case 177: // object: anim -#line 636 "parser.ypp" +#line 638 "parser.ypp" { yylhs.value.as < node_ptr > () = std::move(yystack_[0].value.as < anim_ptr > ()); } -#line 2876 "parser.cpp" +#line 2877 "parser.cpp" break; case 178: // object: level -#line 637 "parser.ypp" +#line 639 "parser.ypp" { yylhs.value.as < node_ptr > () = std::move(yystack_[0].value.as < level_ptr > ()); } -#line 2882 "parser.cpp" +#line 2883 "parser.cpp" break; case 179: // object: name -#line 638 "parser.ypp" +#line 640 "parser.ypp" { yylhs.value.as < node_ptr > () = std::move(yystack_[0].value.as < name_ptr > ()); } -#line 2888 "parser.cpp" +#line 2889 "parser.cpp" break; case 180: // float: "-" "float" -#line 642 "parser.ypp" +#line 644 "parser.ypp" { yylhs.value.as < float_ptr > () = std::make_unique(yylhs.location, "-" + yystack_[0].value.as < std::string > ()); } -#line 2894 "parser.cpp" +#line 2895 "parser.cpp" break; case 181: // float: "float" -#line 643 "parser.ypp" +#line 645 "parser.ypp" { yylhs.value.as < float_ptr > () = std::make_unique(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 2900 "parser.cpp" +#line 2901 "parser.cpp" break; case 182: // integer: "-" "int" -#line 647 "parser.ypp" +#line 649 "parser.ypp" { yylhs.value.as < integer_ptr > () = std::make_unique(yylhs.location, "-" + yystack_[0].value.as < std::string > ()); } -#line 2906 "parser.cpp" +#line 2907 "parser.cpp" break; case 183: // integer: "int" -#line 648 "parser.ypp" +#line 650 "parser.ypp" { yylhs.value.as < integer_ptr > () = std::make_unique(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 2912 "parser.cpp" +#line 2913 "parser.cpp" break; case 184: // integer: "octal int" -#line 649 "parser.ypp" +#line 651 "parser.ypp" { yylhs.value.as < integer_ptr > () = std::make_unique(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 2918 "parser.cpp" +#line 2919 "parser.cpp" break; case 185: // integer: "binary int" -#line 650 "parser.ypp" +#line 652 "parser.ypp" { yylhs.value.as < integer_ptr > () = std::make_unique(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 2924 "parser.cpp" +#line 2925 "parser.cpp" break; case 186: // integer: "hexadecimal int" -#line 651 "parser.ypp" +#line 653 "parser.ypp" { yylhs.value.as < integer_ptr > () = std::make_unique(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 2930 "parser.cpp" +#line 2931 "parser.cpp" break; case 187: // thisthread: "thisthread" -#line 654 "parser.ypp" +#line 656 "parser.ypp" { yylhs.value.as < thisthread_ptr > () = std::make_unique(yylhs.location); } -#line 2936 "parser.cpp" +#line 2937 "parser.cpp" break; case 188: // empty_array: "[" "]" -#line 655 "parser.ypp" +#line 657 "parser.ypp" { yylhs.value.as < empty_array_ptr > () = std::make_unique(yylhs.location); } -#line 2942 "parser.cpp" +#line 2943 "parser.cpp" break; case 189: // undefined: "undefined" -#line 656 "parser.ypp" +#line 658 "parser.ypp" { yylhs.value.as < undefined_ptr > () = std::make_unique(yylhs.location); } -#line 2948 "parser.cpp" +#line 2949 "parser.cpp" break; case 190: // game: "game" -#line 657 "parser.ypp" +#line 659 "parser.ypp" { yylhs.value.as < game_ptr > () = std::make_unique(yylhs.location); } -#line 2954 "parser.cpp" +#line 2955 "parser.cpp" break; case 191: // self: "self" -#line 658 "parser.ypp" +#line 660 "parser.ypp" { yylhs.value.as < self_ptr > () = std::make_unique(yylhs.location); } -#line 2960 "parser.cpp" +#line 2961 "parser.cpp" break; case 192: // anim: "anim" -#line 659 "parser.ypp" +#line 661 "parser.ypp" { yylhs.value.as < anim_ptr > () = std::make_unique(yylhs.location); } -#line 2966 "parser.cpp" +#line 2967 "parser.cpp" break; case 193: // level: "level" -#line 660 "parser.ypp" +#line 662 "parser.ypp" { yylhs.value.as < level_ptr > () = std::make_unique(yylhs.location); } -#line 2972 "parser.cpp" +#line 2973 "parser.cpp" break; case 194: // animation: "%" "identifier" -#line 661 "parser.ypp" +#line 663 "parser.ypp" { yylhs.value.as < animation_ptr > () = std::make_unique(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 2978 "parser.cpp" +#line 2979 "parser.cpp" break; case 195: // animtree: "#animtree" -#line 662 "parser.ypp" +#line 664 "parser.ypp" { yylhs.value.as < animtree_ptr > () = std::make_unique(yylhs.location); } -#line 2984 "parser.cpp" +#line 2985 "parser.cpp" break; case 196: // name: "identifier" -#line 663 "parser.ypp" +#line 665 "parser.ypp" { yylhs.value.as < name_ptr > () = std::make_unique(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 2990 "parser.cpp" +#line 2991 "parser.cpp" break; case 197: // file: "file path" -#line 664 "parser.ypp" +#line 666 "parser.ypp" { yylhs.value.as < file_ptr > () = std::make_unique(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 2996 "parser.cpp" +#line 2997 "parser.cpp" break; case 198: // istring: "localized string" -#line 665 "parser.ypp" +#line 667 "parser.ypp" { yylhs.value.as < istring_ptr > () = std::make_unique(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 3002 "parser.cpp" +#line 3003 "parser.cpp" break; case 199: // string: "string literal" -#line 666 "parser.ypp" +#line 668 "parser.ypp" { yylhs.value.as < string_ptr > () = std::make_unique(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 3008 "parser.cpp" +#line 3009 "parser.cpp" break; case 200: // color: "color" -#line 667 "parser.ypp" +#line 669 "parser.ypp" { yylhs.value.as < color_ptr > () = std::make_unique(yylhs.location, yystack_[0].value.as < std::string > ()); } -#line 3014 "parser.cpp" +#line 3015 "parser.cpp" break; case 201: // vector: "(" expr "," expr "," expr ")" -#line 668 "parser.ypp" +#line 670 "parser.ypp" { yylhs.value.as < vector_ptr > () = std::make_unique(yylhs.location, std::move(yystack_[5].value.as < expr_ptr > ()), std::move(yystack_[3].value.as < expr_ptr > ()), std::move(yystack_[1].value.as < expr_ptr > ())); } -#line 3020 "parser.cpp" +#line 3021 "parser.cpp" break; case 202: // false: "false" -#line 669 "parser.ypp" +#line 671 "parser.ypp" { yylhs.value.as < false_ptr > () = std::make_unique(yylhs.location); } -#line 3026 "parser.cpp" +#line 3027 "parser.cpp" break; case 203: // true: "true" -#line 670 "parser.ypp" +#line 672 "parser.ypp" { yylhs.value.as < true_ptr > () = std::make_unique(yylhs.location); } -#line 3032 "parser.cpp" +#line 3033 "parser.cpp" break; -#line 3036 "parser.cpp" +#line 3037 "parser.cpp" default: break; @@ -3291,6 +3292,8 @@ namespace xsk { namespace gsc { namespace iw5 { } + + bool parser::yy_lac_check_ (symbol_kind_type yytoken) const { @@ -3395,7 +3398,9 @@ namespace xsk { namespace gsc { namespace iw5 { follows. If no initial context is currently established for the current lookahead, then check if that lookahead can eventually be shifted if syntactic actions continue from the current context. */ - if (!yy_lac_established_) + if (yy_lac_established_) + return true; + else { #if IW5DEBUG YYCDEBUG << "LAC: initial context established for " @@ -3404,12 +3409,11 @@ namespace xsk { namespace gsc { namespace iw5 { yy_lac_established_ = true; return yy_lac_check_ (yytoken); } - return true; } // Discard any previous initial lookahead context. void - parser::yy_lac_discard_ (const char* evt) + parser::yy_lac_discard_ (const char* event) { /* Discard any previous initial lookahead context because of Event, which may be a lookahead change or an invalidation of the currently @@ -3425,11 +3429,12 @@ namespace xsk { namespace gsc { namespace iw5 { if (yy_lac_established_) { YYCDEBUG << "LAC: initial context discarded due to " - << evt << '\n'; + << event << '\n'; yy_lac_established_ = false; } } + int parser::yy_syntax_error_arguments_ (const context& yyctx, symbol_kind_type yyarg[], int yyargn) const @@ -4104,27 +4109,27 @@ namespace xsk { namespace gsc { namespace iw5 { const short parser::yyrline_[] = { - 0, 244, 244, 245, 249, 251, 253, 255, 260, 265, - 266, 267, 271, 276, 281, 286, 288, 291, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, - 317, 321, 322, 326, 328, 333, 335, 340, 345, 350, - 352, 357, 362, 364, 369, 371, 376, 381, 386, 391, - 396, 401, 403, 408, 413, 415, 420, 425, 430, 435, - 437, 442, 447, 452, 457, 458, 462, 463, 467, 468, - 469, 470, 474, 475, 476, 477, 478, 479, 480, 481, - 482, 483, 484, 485, 486, 487, 488, 492, 493, 494, - 495, 496, 497, 498, 499, 503, 507, 508, 509, 510, - 511, 512, 513, 514, 515, 516, 520, 521, 522, 523, - 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, - 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, - 544, 545, 546, 547, 548, 552, 553, 554, 555, 559, - 560, 561, 562, 566, 567, 568, 569, 573, 575, 580, - 582, 587, 588, 592, 594, 600, 604, 606, 611, 616, - 621, 626, 631, 632, 633, 634, 635, 636, 637, 638, - 642, 643, 647, 648, 649, 650, 651, 654, 655, 656, - 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, - 667, 668, 669, 670 + 0, 246, 246, 247, 251, 253, 255, 257, 262, 267, + 268, 269, 273, 278, 283, 288, 290, 293, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 323, 324, 328, 330, 335, 337, 342, 347, 352, + 354, 359, 364, 366, 371, 373, 378, 383, 388, 393, + 398, 403, 405, 410, 415, 417, 422, 427, 432, 437, + 439, 444, 449, 454, 459, 460, 464, 465, 469, 470, + 471, 472, 476, 477, 478, 479, 480, 481, 482, 483, + 484, 485, 486, 487, 488, 489, 490, 494, 495, 496, + 497, 498, 499, 500, 501, 505, 509, 510, 511, 512, + 513, 514, 515, 516, 517, 518, 522, 523, 524, 525, + 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, + 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, + 546, 547, 548, 549, 550, 554, 555, 556, 557, 561, + 562, 563, 564, 568, 569, 570, 571, 575, 577, 582, + 584, 589, 590, 594, 596, 602, 606, 608, 613, 618, + 623, 628, 633, 634, 635, 636, 637, 638, 639, 640, + 644, 645, 649, 650, 651, 652, 653, 656, 657, 658, + 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, + 669, 670, 671, 672 }; void @@ -4157,9 +4162,9 @@ namespace xsk { namespace gsc { namespace iw5 { #line 13 "parser.ypp" } } } // xsk::gsc::iw5 -#line 4161 "parser.cpp" +#line 4166 "parser.cpp" -#line 672 "parser.ypp" +#line 674 "parser.ypp" void xsk::gsc::iw5::parser::error(const xsk::gsc::location& loc, const std::string& msg) diff --git a/src/iw5/xsk/parser.hpp b/src/iw5/xsk/parser.hpp index ec56fc04..eecabd63 100644 --- a/src/iw5/xsk/parser.hpp +++ b/src/iw5/xsk/parser.hpp @@ -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++ @@ -15,7 +15,7 @@ // GNU General Public License for more details. // You should have received a copy of the GNU General Public License -// along with this program. If not, see . +// along with this program. If not, see . // As a special exception, you may create a larger work that contains // part or all of the Bison parser skeleton and distribute that work @@ -45,11 +45,11 @@ #ifndef YY_IW5_PARSER_HPP_INCLUDED # define YY_IW5_PARSER_HPP_INCLUDED // "%code requires" blocks. -#line 33 "parser.ypp" +#line 35 "parser.ypp" #include "iw5.hpp" 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" @@ -127,12 +127,18 @@ typedef void *yyscan_t; # define YY_USE(E) /* empty */ #endif -#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* 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 ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# endif # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else @@ -194,7 +200,7 @@ typedef void *yyscan_t; #line 13 "parser.ypp" 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 { 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. /// /// Sort of a variant, but does not keep track of the nature /// of the stored data, since that knowledge is available /// via the current parser state. - class semantic_type + class value_type { public: /// Type of *this. - typedef semantic_type self_type; + typedef value_type self_type; /// Empty construction. - semantic_type () YY_NOEXCEPT - : yybuffer_ () + value_type () YY_NOEXCEPT + : yyraw_ () , yytypeid_ (YY_NULLPTR) {} /// Construct and fill. template - semantic_type (YY_RVREF (T) t) + value_type (YY_RVREF (T) t) : yytypeid_ (&typeid (T)) { IW5_ASSERT (sizeof (T) <= size); @@ -232,13 +243,13 @@ namespace xsk { namespace gsc { namespace iw5 { #if 201103L <= YY_CPLUSPLUS /// Non copyable. - semantic_type (const self_type&) = delete; + value_type (const self_type&) = delete; /// Non copyable. self_type& operator= (const self_type&) = delete; #endif /// Destruction, allowed only if empty. - ~semantic_type () YY_NOEXCEPT + ~value_type () YY_NOEXCEPT { IW5_ASSERT (!yytypeid_); } @@ -382,7 +393,7 @@ namespace xsk { namespace gsc { namespace iw5 { private: #if YY_CPLUSPLUS < 201103L /// Non copyable. - semantic_type (const self_type&); + value_type (const self_type&); /// Non copyable. self_type& operator= (const self_type&); #endif @@ -392,7 +403,7 @@ namespace xsk { namespace gsc { namespace iw5 { T* yyas_ () YY_NOEXCEPT { - void *yyp = yybuffer_.yyraw; + void *yyp = yyraw_; return static_cast (yyp); } @@ -401,7 +412,7 @@ namespace xsk { namespace gsc { namespace iw5 { const T* yyas_ () const YY_NOEXCEPT { - const void *yyp = yybuffer_.yyraw; + const void *yyp = yyraw_; return static_cast (yyp); } @@ -613,18 +624,19 @@ namespace xsk { namespace gsc { namespace iw5 { union { /// Strongest alignment constraints. - long double yyalign_me; + long double yyalign_me_; /// A buffer large enough to store any of the semantic values. - char yyraw[size]; - } yybuffer_; + char yyraw_[size]; + }; /// Whether the content is built: if defined, the name of the stored type. const std::type_info *yytypeid_; }; -#else - typedef IW5STYPE semantic_type; #endif + /// Backward compatibility (Bison 3.8). + typedef value_type semantic_type; + /// Symbol locations. typedef xsk::gsc::location location_type; @@ -761,7 +773,7 @@ namespace xsk { namespace gsc { namespace iw5 { }; /// 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). typedef token_kind_type token_type; @@ -973,7 +985,7 @@ namespace xsk { namespace gsc { namespace iw5 { typedef Base super_type; /// Default constructor. - basic_symbol () + basic_symbol () YY_NOEXCEPT : value () , location () {} @@ -2068,6 +2080,8 @@ namespace xsk { namespace gsc { namespace iw5 { clear (); } + + /// Destroy contents, and record that is empty. void clear () YY_NOEXCEPT { @@ -2361,7 +2375,7 @@ switch (yykind) void move (basic_symbol& s); /// The semantic value. - semantic_type value; + value_type value; /// The location. location_type location; @@ -2376,22 +2390,24 @@ switch (yykind) /// Type access provider for token (enum) based symbols. 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. 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. - by_kind (kind_type t); + by_kind (kind_type t) YY_NOEXCEPT; + + /// Record that this symbol is empty. void clear () YY_NOEXCEPT; @@ -2421,35 +2437,39 @@ switch (yykind) typedef basic_symbol super_type; /// Empty symbol. - symbol_type () {} + symbol_type () YY_NOEXCEPT {} /// Constructor for valueless symbols, and symbols from each type. #if 201103L <= YY_CPLUSPLUS 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 symbol_type (int tok, const location_type& l) - : super_type(token_type (tok), l) + : super_type (token_kind_type (tok), l) #endif { +#if !defined _MSC_VER || defined __clang__ IW5_ASSERT (tok == token::IW5EOF || (token::IW5error <= tok && tok <= token::MOD) || (token::ADD_ARRAY <= tok && tok <= token::POSTDEC)); +#endif } #if 201103L <= YY_CPLUSPLUS 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 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 { +#if !defined _MSC_VER || defined __clang__ IW5_ASSERT ((token::FILE <= tok && tok <= token::INT_HEX)); +#endif } }; /// 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 (); #if 201103L <= YY_CPLUSPLUS @@ -2493,7 +2513,7 @@ switch (yykind) /// YYSYMBOL. No bounds checking. 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 static symbol_type @@ -4095,19 +4115,19 @@ switch (yykind) /// Whether the given \c yypact_ value indicates a defaulted state. /// \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. /// \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 yytable_ninf_; /// Convert a scanner token kind \a t to a symbol kind. /// In theory \a t should be a token_kind_type, but character literals - /// are valid, yet not members of the token_type enum. - static symbol_kind_type yytranslate_ (int t); + /// are valid, yet not members of the token_kind_type enum. + static symbol_kind_type yytranslate_ (int t) YY_NOEXCEPT; @@ -4134,14 +4154,14 @@ switch (yykind) static const short yycheck_[]; - // YYSTOS[STATE-NUM] -- The (internal number of the) accessing - // symbol of state STATE-NUM. + // YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of + // state STATE-NUM. 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_[]; - // 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_[]; @@ -4240,7 +4260,7 @@ switch (yykind) typedef typename S::size_type size_type; typedef typename std::ptrdiff_t index_type; - stack (size_type n = 200) + stack (size_type n = 200) YY_NOEXCEPT : seq_ (n) {} @@ -4319,7 +4339,7 @@ switch (yykind) class slice { public: - slice (const stack& stack, index_type range) + slice (const stack& stack, index_type range) YY_NOEXCEPT : stack_ (stack) , range_ (range) {} @@ -4378,7 +4398,7 @@ switch (yykind) void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym); /// Pop \a n symbols from the stack. - void yypop_ (int n = 1); + void yypop_ (int n = 1) YY_NOEXCEPT; /// Constants. enum @@ -4393,12 +4413,13 @@ switch (yykind) yyscan_t yyscanner; xsk::gsc::location& loc; xsk::gsc::program_ptr& ast; + xsk::gsc::dev_blocks devblock_mode; }; inline parser::symbol_kind_type - parser::yytranslate_ (int t) + parser::yytranslate_ (int t) YY_NOEXCEPT { return static_cast (t); } @@ -4674,6 +4695,7 @@ switch (yykind) + template parser::symbol_kind_type parser::basic_symbol::type_get () const YY_NOEXCEPT @@ -4681,6 +4703,7 @@ switch (yykind) return this->kind (); } + template bool parser::basic_symbol::empty () const YY_NOEXCEPT @@ -4958,13 +4981,13 @@ switch (yykind) // by_kind. inline - parser::by_kind::by_kind () + parser::by_kind::by_kind () YY_NOEXCEPT : kind_ (symbol_kind::S_YYEMPTY) {} #if 201103L <= YY_CPLUSPLUS inline - parser::by_kind::by_kind (by_kind&& that) + parser::by_kind::by_kind (by_kind&& that) YY_NOEXCEPT : kind_ (that.kind_) { that.clear (); @@ -4972,15 +4995,17 @@ switch (yykind) #endif inline - parser::by_kind::by_kind (const by_kind& that) + parser::by_kind::by_kind (const by_kind& that) YY_NOEXCEPT : kind_ (that.kind_) {} inline - parser::by_kind::by_kind (token_kind_type t) + parser::by_kind::by_kind (token_kind_type t) YY_NOEXCEPT : kind_ (yytranslate_ (t)) {} + + inline void parser::by_kind::clear () YY_NOEXCEPT @@ -5003,6 +5028,7 @@ switch (yykind) return kind_; } + inline parser::symbol_kind_type parser::by_kind::type_get () const YY_NOEXCEPT @@ -5010,9 +5036,10 @@ switch (yykind) return this->kind (); } + #line 13 "parser.ypp" } } } // xsk::gsc::iw5 -#line 5016 "parser.hpp" +#line 5043 "parser.hpp" diff --git a/src/tool/xsk/main.cpp b/src/tool/xsk/main.cpp index 1287c975..9dfd3c88 100644 --- a/src/tool/xsk/main.cpp +++ b/src/tool/xsk/main.cpp @@ -1,628 +1,628 @@ -// Copyright 2021 xensik. All rights reserved. -// -// Use of this source code is governed by a GNU GPLv3 license -// that can be found in the LICENSE file. - -#include "stdafx.hpp" - -#include "iw5/xsk/iw5.hpp" -#include "iw6/xsk/iw6.hpp" -#include "iw7/xsk/iw7.hpp" -#include "iw8/xsk/iw8.hpp" -#include "s1/xsk/s1.hpp" -#include "s2/xsk/s2.hpp" -#include "s4/xsk/s4.hpp" -#include "h1/xsk/h1.hpp" -#include "h2/xsk/h2.hpp" - -namespace xsk::gsc -{ - -enum class mode { __, ASM, DISASM, COMP, DECOMP }; -enum class game { __, IW5, IW6, IW7, IW8, S1, S2, S4, H1, H2 }; - -std::map modes = -{ - { "-asm", mode::ASM }, - { "-disasm", mode::DISASM }, - { "-comp", mode::COMP }, - { "-decomp", mode::DECOMP }, -}; - -std::map games = -{ - { "-iw5", game::IW5 }, - { "-iw6", game::IW6 }, - { "-iw7", game::IW7 }, - { "-iw8", game::IW8 }, - { "-s1", game::S1 }, - { "-s2", game::S2 }, - { "-s4", game::S4 }, - { "-h1", game::H1 }, - { "-h2", game::H2 }, -}; - -auto overwrite_prompt(const std::string& file) -> bool -{ - auto overwrite = true; - - if (utils::file::exists(file)) - { - do - { - std::cout << "File \"" << file << "\" already exists, overwrite? [Y/n]: "; - auto result = std::getchar(); - - if (result == '\n' || result == 'Y' || result == 'y') - { - break; - } - else if (result == 'N' || result == 'n') - { - overwrite = false; - break; - } - } while (true); - } - - return overwrite; -} - -auto choose_resolver_file_name(uint32_t id, game& game) -> std::string -{ - switch (game) - { - case game::IW5: return iw5::resolver::file_name(static_cast(id)); - case game::IW6: return iw6::resolver::file_name(static_cast(id)); - case game::IW7: return iw7::resolver::file_name(id); - case game::IW8: return iw8::resolver::file_name(id); - case game::S1: return s1::resolver::file_name(static_cast(id)); - case game::S2: return s2::resolver::file_name(static_cast(id)); - case game::S4: return s4::resolver::file_name(id); - case game::H1: return h1::resolver::file_name(static_cast(id)); - case game::H2: return h2::resolver::file_name(static_cast(id)); - default: return ""; - } -} - -void assemble_file(gsc::assembler& assembler, std::string file, bool zonetool) -{ - try - { - const auto ext = std::string(".gscasm"); - const auto extpos = file.find(ext); - - if (extpos != std::string::npos) - { - file.replace(extpos, ext.length(), ""); - } - - auto data = utils::file::read(file + ext); - - assembler.assemble(file, data); - - if (overwrite_prompt(file + (zonetool ? ".cgsc" : ".gscbin"))) - { - if(zonetool) - { - utils::file::save(file + ".cgsc", assembler.output_script()); - utils::file::save(file + ".cgsc.stack", assembler.output_stack()); - std::cout << "assembled " << file << ".cgsc\n"; - } - else - { - gsc::asset script; - - auto uncompressed = assembler.output_stack(); - auto compressed = utils::zlib::compress(uncompressed); - - script.name = file; - script.bytecode = assembler.output_script(); - script.buffer = std::move(compressed); - script.len = uncompressed.size(); - script.compressedLen = script.buffer.size(); - script.bytecodeLen = script.bytecode.size(); - - auto output = script.serialize(); - utils::file::save(file + ".gscbin", output); - std::cout << "assembled " << file << ".gscbin\n"; - } - } - } - catch(const std::exception& e) - { - std::cerr << e.what() << '\n'; - } -} - -void disassemble_file(gsc::disassembler& disassembler, std::string file, game& game, bool zonetool) -{ - try - { - if(zonetool) - { - if (file.find(".stack") != std::string::npos) - { - std::cerr << "Cannot disassemble stack files\n"; - return; - } - - const auto ext = std::string(".cgsc"); - const auto extpos = file.find(ext); - - if (extpos != std::string::npos) - { - file.replace(extpos, ext.length(), ""); - } - - auto script = utils::file::read(file + ".cgsc"); - auto stack = utils::file::read(file + ".cgsc.stack"); - - disassembler.disassemble(file, script, stack); - } - else - { - const auto ext = std::string(".gscbin"); - const auto extpos = file.find(ext); - - if (extpos != std::string::npos) - { - file.replace(extpos, ext.length(), ""); - } - - auto data = utils::file::read(file + ext); - - gsc::asset script; - - script.deserialize(data); - - auto stack = utils::zlib::decompress(script.buffer, script.len); - - disassembler.disassemble(file, script.bytecode, stack); - } - - auto scriptid = std::filesystem::path(file).filename().string(); - - if (!isdigit(scriptid.data()[0])) - { - utils::file::save(file + ".gscasm", disassembler.output_data()); - std::cout << "disassembled " << file << ".gscasm\n"; - } - else - { - auto filename = choose_resolver_file_name(std::atoi(scriptid.data()), game); - auto count = file.find(scriptid); - - if (count != std::string::npos) - { - if (!filename.empty()) - { - file.erase(count, scriptid.length()); - } - } - - utils::file::save(file + filename + ".gscasm", disassembler.output_data()); - std::cout << "disassembled " << file << filename << ".gscasm\n"; - } - } - catch(const std::exception& e) - { - std::cerr << e.what() << '\n'; - } -} - -void compile_file(gsc::assembler& assembler, gsc::compiler& compiler, std::string file, bool zonetool) -{ - try - { - const auto ext = std::string(".gsc"); - const auto extpos = file.find(ext); - - if (extpos != std::string::npos) - { - file.replace(extpos, ext.length(), ""); - } - - auto data = utils::file::read(file + ext); - compiler.set_readf_callback(utils::file::read); - compiler.compile(file, data); - - auto assembly = compiler.output(); - - assembler.assemble(file, assembly); - - if (overwrite_prompt(file + (zonetool ? ".cgsc" : ".gscbin"))) - { - if(zonetool) - { - utils::file::save(file + ".cgsc", assembler.output_script()); - utils::file::save(file + ".cgsc.stack", assembler.output_stack()); - std::cout << "compiled " << file << ".cgsc\n"; - } - else - { - gsc::asset script; - - auto uncompressed = assembler.output_stack(); - auto compressed = utils::zlib::compress(uncompressed); - - script.name = file; - script.bytecode = assembler.output_script(); - script.buffer = std::move(compressed); - script.len = uncompressed.size(); - script.compressedLen = script.buffer.size(); - script.bytecodeLen = script.bytecode.size(); - - auto output = script.serialize(); - utils::file::save(file + ".gscbin", output); - std::cout << "compiled " << file << ".gscbin\n"; - } - } - } - catch(const std::exception& e) - { - std::cerr << e.what() << '\n'; - } -} - -void decompile_file(gsc::disassembler& disassembler, gsc::decompiler& decompiler, std::string file, game& game, bool zonetool) -{ - try - { - if(zonetool) - { - if (file.find(".stack") != std::string::npos) - { - std::cerr << "Cannot disassemble stack files\n"; - return; - } - - const auto ext = std::string(".cgsc"); - const auto extpos = file.find(ext); - - if (extpos != std::string::npos) - { - file.replace(extpos, ext.length(), ""); - } - - auto script = utils::file::read(file + ".cgsc"); - auto stack = utils::file::read(file + ".cgsc.stack"); - - disassembler.disassemble(file, script, stack); - } - else - { - const auto ext = std::string(".gscbin"); - const auto extpos = file.find(ext); - - if (extpos != std::string::npos) - { - file.replace(extpos, ext.length(), ""); - } - - auto data = utils::file::read(file + ext); - - gsc::asset script; - - script.deserialize(data); - - auto stack = utils::zlib::decompress(script.buffer, script.len); - - disassembler.disassemble(file, script.bytecode, stack); - } - - auto output = disassembler.output(); - - decompiler.decompile(file, output); - - auto scriptid = std::filesystem::path(file).filename().string(); - - if (!isdigit(scriptid.data()[0])) - { - utils::file::save(file + ".gsc", decompiler.output()); - std::cout << "decompiled " << file << ".gsc\n"; - } - else - { - auto filename = choose_resolver_file_name(std::atoi(scriptid.data()), game); - auto count = file.find(scriptid); - - if (count != std::string::npos) - { - if (!filename.empty()) - { - file.erase(count, scriptid.length()); - } - } - - utils::file::save(file + filename + ".gsc", decompiler.output()); - std::cout << "decompiled " << file << filename << ".gsc\n"; - } - } - catch(const std::exception& e) - { - std::cerr << e.what() << '\n'; - } -} - -int parse_flags(int argc, char** argv, game& game, mode& mode, bool& zonetool) -{ - if (argc != 4) return 1; - - std::string arg = utils::string::to_lower(argv[1]); - - const auto it1 = games.find(arg); - - if (it1 != games.end()) - { - game = it1->second; - } - else - { - std::cout << "Unknown game '" << argv[1] << "'.\n\n"; - return 1; - } - - arg = utils::string::to_lower(argv[2]); - - if(arg.at(1) == 'z') - { - arg.erase(arg.begin() + 1); - zonetool = true; - } - - const auto it2 = modes.find(arg); - - if (it2 != modes.end()) - { - mode = it2->second; - } - else - { - std::cout << "Unknown mode '" << argv[2] << "'.\n\n"; - return 1; - } - - return 0; -} - -void print_usage() -{ - std::cout << "usage: gsc-tool.exe \n"; - std::cout << " * games: -iw5, -iw6, -iw7, -iw8, -s1, -s2, -s4, -h1, -h2\n"; - std::cout << " * modes: -asm, -disasm, -comp, -decomp\n"; -} - -std::uint32_t main(std::uint32_t argc, char** argv) -{ - std::string file = utils::string::fordslash(argv[argc - 1]); - mode mode = mode::__; - game game = game::__; - bool zonetool = false; - - if (parse_flags(argc, argv, game, mode, zonetool)) - { - print_usage(); - return 0; - } - - if (mode == mode::ASM) - { - if( game == game::IW5) - { - gsc::iw5::assembler assembler; - assemble_file(assembler, file, zonetool); - } - else if (game == game::IW6) - { - iw6::assembler assembler; - assemble_file(assembler, file, zonetool); - } - else if (game == game::IW7) - { - iw7::assembler assembler; - assemble_file(assembler, file, zonetool); - } - else if (game == game::IW8) - { - iw8::assembler assembler; - assemble_file(assembler, file, zonetool); - } - else if (game == game::S1) - { - s1::assembler assembler; - assemble_file(assembler, file, zonetool); - } - else if (game == game::S2) - { - s2::assembler assembler; - assemble_file(assembler, file, zonetool); - } - else if (game == game::S4) - { - s4::assembler assembler; - assemble_file(assembler, file, zonetool); - } - else if (game == game::H1) - { - h1::assembler assembler; - assemble_file(assembler, file, zonetool); - } - else if (game == game::H2) - { - h2::assembler assembler; - assemble_file(assembler, file, zonetool); - } - } - else if (mode == mode::DISASM) - { - if (game == game::IW5) - { - gsc::iw5::disassembler disassembler; - disassemble_file(disassembler, file, game, zonetool); - } - else if (game == game::IW6) - { - iw6::disassembler disassembler; - disassemble_file(disassembler, file, game, zonetool); - } - else if (game == game::IW7) - { - iw7::disassembler disassembler; - disassemble_file(disassembler, file, game, zonetool); - } - else if (game == game::IW8) - { - iw8::disassembler disassembler; - disassemble_file(disassembler, file, game, zonetool); - } - else if (game == game::S1) - { - s1::disassembler disassembler; - disassemble_file(disassembler, file, game, zonetool); - } - else if (game == game::S2) - { - s2::disassembler disassembler; - disassemble_file(disassembler, file, game, zonetool); - } - else if (game == game::S4) - { - s4::disassembler disassembler; - disassemble_file(disassembler, file, game, zonetool); - } - else if (game == game::H1) - { - h1::disassembler disassembler; - disassemble_file(disassembler, file, game, zonetool); - } - else if (game == game::H2) - { - h2::disassembler disassembler; - disassemble_file(disassembler, file, game, zonetool); - } - } - else if (mode == mode::COMP) - { - if (game == game::IW5) - { - gsc::iw5::assembler assembler; - gsc::iw5::compiler compiler; - compile_file(assembler, compiler, file ,zonetool); - } - else if (game == game::IW6) - { - iw6::assembler assembler; - iw6::compiler compiler; - compile_file(assembler, compiler, file ,zonetool); - } - else if (game == game::IW7) - { - iw7::assembler assembler; - iw7::compiler compiler; - compile_file(assembler, compiler, file ,zonetool); - } - else if (game == game::IW8) - { - iw8::assembler assembler; - iw8::compiler compiler; - compile_file(assembler, compiler, file ,zonetool); - } - else if (game == game::S1) - { - s1::assembler assembler; - s1::compiler compiler; - compile_file(assembler, compiler, file ,zonetool); - } - else if (game == game::S2) - { - s2::assembler assembler; - s2::compiler compiler; - compile_file(assembler, compiler, file ,zonetool); - } - else if (game == game::S4) - { - s4::assembler assembler; - s4::compiler compiler; - compile_file(assembler, compiler, file ,zonetool); - } - else if (game == game::H1) - { - h1::assembler assembler; - h1::compiler compiler; - compile_file(assembler, compiler, file ,zonetool); - } - else if (game == game::H2) - { - h2::assembler assembler; - h2::compiler compiler; - compile_file(assembler, compiler, file ,zonetool); - } - } - else if (mode == mode::DECOMP) - { - if (game == game::IW5) - { - iw5::disassembler disassembler; - iw5::decompiler decompiler; - decompile_file(disassembler, decompiler, file, game, zonetool); - } - else if (game == game::IW6) - { - iw6::disassembler disassembler; - iw6::decompiler decompiler; - decompile_file(disassembler, decompiler, file, game, zonetool); - } - else if (game == game::IW7) - { - iw7::disassembler disassembler; - iw7::decompiler decompiler; - decompile_file(disassembler, decompiler, file, game, zonetool); - } - else if (game == game::IW8) - { - iw8::disassembler disassembler; - iw8::decompiler decompiler; - decompile_file(disassembler, decompiler, file, game, zonetool); - } - else if (game == game::S1) - { - s1::disassembler disassembler; - s1::decompiler decompiler; - decompile_file(disassembler, decompiler, file, game, zonetool); - } - else if (game == game::S2) - { - s2::disassembler disassembler; - s2::decompiler decompiler; - decompile_file(disassembler, decompiler, file, game, zonetool); - } - else if (game == game::S4) - { - s4::disassembler disassembler; - s4::decompiler decompiler; - decompile_file(disassembler, decompiler, file, game, zonetool); - } - else if (game == game::H1) - { - h1::disassembler disassembler; - h1::decompiler decompiler; - decompile_file(disassembler, decompiler, file, game, zonetool); - } - else if (game == game::H2) - { - h2::disassembler disassembler; - h2::decompiler decompiler; - decompile_file(disassembler, decompiler, file, game, zonetool); - } - } - - return 0; -} - -} // namespace xsk::gsc - -int main(int argc, char** argv) -{ - xsk::gsc::main(argc, argv); -} +// Copyright 2021 xensik. All rights reserved. +// +// Use of this source code is governed by a GNU GPLv3 license +// that can be found in the LICENSE file. + +#include "stdafx.hpp" + +#include "iw5/xsk/iw5.hpp" +#include "iw6/xsk/iw6.hpp" +#include "iw7/xsk/iw7.hpp" +#include "iw8/xsk/iw8.hpp" +#include "s1/xsk/s1.hpp" +#include "s2/xsk/s2.hpp" +#include "s4/xsk/s4.hpp" +#include "h1/xsk/h1.hpp" +#include "h2/xsk/h2.hpp" + +namespace xsk::gsc +{ + +enum class mode { __, ASM, DISASM, COMP, DECOMP }; +enum class game { __, IW5, IW6, IW7, IW8, S1, S2, S4, H1, H2 }; + +std::map modes = +{ + { "-asm", mode::ASM }, + { "-disasm", mode::DISASM }, + { "-comp", mode::COMP }, + { "-decomp", mode::DECOMP }, +}; + +std::map games = +{ + { "-iw5", game::IW5 }, + { "-iw6", game::IW6 }, + { "-iw7", game::IW7 }, + { "-iw8", game::IW8 }, + { "-s1", game::S1 }, + { "-s2", game::S2 }, + { "-s4", game::S4 }, + { "-h1", game::H1 }, + { "-h2", game::H2 }, +}; + +auto overwrite_prompt(const std::string& file) -> bool +{ + auto overwrite = true; + + if (utils::file::exists(file)) + { + do + { + std::cout << "File \"" << file << "\" already exists, overwrite? [Y/n]: "; + auto result = std::getchar(); + + if (result == '\n' || result == 'Y' || result == 'y') + { + break; + } + else if (result == 'N' || result == 'n') + { + overwrite = false; + break; + } + } while (true); + } + + return overwrite; +} + +auto choose_resolver_file_name(uint32_t id, game& game) -> std::string +{ + switch (game) + { + case game::IW5: return iw5::resolver::file_name(static_cast(id)); + case game::IW6: return iw6::resolver::file_name(static_cast(id)); + case game::IW7: return iw7::resolver::file_name(id); + case game::IW8: return iw8::resolver::file_name(id); + case game::S1: return s1::resolver::file_name(static_cast(id)); + case game::S2: return s2::resolver::file_name(static_cast(id)); + case game::S4: return s4::resolver::file_name(id); + case game::H1: return h1::resolver::file_name(static_cast(id)); + case game::H2: return h2::resolver::file_name(static_cast(id)); + default: return ""; + } +} + +void assemble_file(gsc::assembler& assembler, std::string file, bool zonetool) +{ + try + { + const auto ext = std::string(".gscasm"); + const auto extpos = file.find(ext); + + if (extpos != std::string::npos) + { + file.replace(extpos, ext.length(), ""); + } + + auto data = utils::file::read(file + ext); + + assembler.assemble(file, data); + + if (overwrite_prompt(file + (zonetool ? ".cgsc" : ".gscbin"))) + { + if(zonetool) + { + utils::file::save(file + ".cgsc", assembler.output_script()); + utils::file::save(file + ".cgsc.stack", assembler.output_stack()); + std::cout << "assembled " << file << ".cgsc\n"; + } + else + { + gsc::asset script; + + auto uncompressed = assembler.output_stack(); + auto compressed = utils::zlib::compress(uncompressed); + + script.name = file; + script.bytecode = assembler.output_script(); + script.buffer = std::move(compressed); + script.len = uncompressed.size(); + script.compressedLen = script.buffer.size(); + script.bytecodeLen = script.bytecode.size(); + + auto output = script.serialize(); + utils::file::save(file + ".gscbin", output); + std::cout << "assembled " << file << ".gscbin\n"; + } + } + } + catch(const std::exception& e) + { + std::cerr << e.what() << '\n'; + } +} + +void disassemble_file(gsc::disassembler& disassembler, std::string file, game& game, bool zonetool) +{ + try + { + if(zonetool) + { + if (file.find(".stack") != std::string::npos) + { + std::cerr << "Cannot disassemble stack files\n"; + return; + } + + const auto ext = std::string(".cgsc"); + const auto extpos = file.find(ext); + + if (extpos != std::string::npos) + { + file.replace(extpos, ext.length(), ""); + } + + auto script = utils::file::read(file + ".cgsc"); + auto stack = utils::file::read(file + ".cgsc.stack"); + + disassembler.disassemble(file, script, stack); + } + else + { + const auto ext = std::string(".gscbin"); + const auto extpos = file.find(ext); + + if (extpos != std::string::npos) + { + file.replace(extpos, ext.length(), ""); + } + + auto data = utils::file::read(file + ext); + + gsc::asset script; + + script.deserialize(data); + + auto stack = utils::zlib::decompress(script.buffer, script.len); + + disassembler.disassemble(file, script.bytecode, stack); + } + + auto scriptid = std::filesystem::path(file).filename().string(); + + if (!isdigit(scriptid.data()[0])) + { + utils::file::save(file + ".gscasm", disassembler.output_data()); + std::cout << "disassembled " << file << ".gscasm\n"; + } + else + { + auto filename = choose_resolver_file_name(std::atoi(scriptid.data()), game); + auto count = file.find(scriptid); + + if (count != std::string::npos) + { + if (!filename.empty()) + { + file.erase(count, scriptid.length()); + } + } + + utils::file::save(file + filename + ".gscasm", disassembler.output_data()); + std::cout << "disassembled " << file << filename << ".gscasm\n"; + } + } + catch(const std::exception& e) + { + std::cerr << e.what() << '\n'; + } +} + +void compile_file(gsc::assembler& assembler, gsc::compiler& compiler, std::string file, bool zonetool) +{ + try + { + const auto ext = std::string(".gsc"); + const auto extpos = file.find(ext); + + if (extpos != std::string::npos) + { + file.replace(extpos, ext.length(), ""); + } + + auto data = utils::file::read(file + ext); + compiler.set_readf_callback(utils::file::read); + compiler.compile(file, data); + + auto assembly = compiler.output(); + + assembler.assemble(file, assembly); + + if (overwrite_prompt(file + (zonetool ? ".cgsc" : ".gscbin"))) + { + if(zonetool) + { + utils::file::save(file + ".cgsc", assembler.output_script()); + utils::file::save(file + ".cgsc.stack", assembler.output_stack()); + std::cout << "compiled " << file << ".cgsc\n"; + } + else + { + gsc::asset script; + + auto uncompressed = assembler.output_stack(); + auto compressed = utils::zlib::compress(uncompressed); + + script.name = file; + script.bytecode = assembler.output_script(); + script.buffer = std::move(compressed); + script.len = uncompressed.size(); + script.compressedLen = script.buffer.size(); + script.bytecodeLen = script.bytecode.size(); + + auto output = script.serialize(); + utils::file::save(file + ".gscbin", output); + std::cout << "compiled " << file << ".gscbin\n"; + } + } + } + catch(const std::exception& e) + { + std::cerr << e.what() << '\n'; + } +} + +void decompile_file(gsc::disassembler& disassembler, gsc::decompiler& decompiler, std::string file, game& game, bool zonetool) +{ + try + { + if(zonetool) + { + if (file.find(".stack") != std::string::npos) + { + std::cerr << "Cannot disassemble stack files\n"; + return; + } + + const auto ext = std::string(".cgsc"); + const auto extpos = file.find(ext); + + if (extpos != std::string::npos) + { + file.replace(extpos, ext.length(), ""); + } + + auto script = utils::file::read(file + ".cgsc"); + auto stack = utils::file::read(file + ".cgsc.stack"); + + disassembler.disassemble(file, script, stack); + } + else + { + const auto ext = std::string(".gscbin"); + const auto extpos = file.find(ext); + + if (extpos != std::string::npos) + { + file.replace(extpos, ext.length(), ""); + } + + auto data = utils::file::read(file + ext); + + gsc::asset script; + + script.deserialize(data); + + auto stack = utils::zlib::decompress(script.buffer, script.len); + + disassembler.disassemble(file, script.bytecode, stack); + } + + auto output = disassembler.output(); + + decompiler.decompile(file, output); + + auto scriptid = std::filesystem::path(file).filename().string(); + + if (!isdigit(scriptid.data()[0])) + { + utils::file::save(file + ".gsc", decompiler.output()); + std::cout << "decompiled " << file << ".gsc\n"; + } + else + { + auto filename = choose_resolver_file_name(std::atoi(scriptid.data()), game); + auto count = file.find(scriptid); + + if (count != std::string::npos) + { + if (!filename.empty()) + { + file.erase(count, scriptid.length()); + } + } + + utils::file::save(file + filename + ".gsc", decompiler.output()); + std::cout << "decompiled " << file << filename << ".gsc\n"; + } + } + catch(const std::exception& e) + { + std::cerr << e.what() << '\n'; + } +} + +int parse_flags(int argc, char** argv, game& game, mode& mode, bool& zonetool) +{ + if (argc != 4) return 1; + + std::string arg = utils::string::to_lower(argv[1]); + + const auto it1 = games.find(arg); + + if (it1 != games.end()) + { + game = it1->second; + } + else + { + std::cout << "Unknown game '" << argv[1] << "'.\n\n"; + return 1; + } + + arg = utils::string::to_lower(argv[2]); + + if(arg.at(1) == 'z') + { + arg.erase(arg.begin() + 1); + zonetool = true; + } + + const auto it2 = modes.find(arg); + + if (it2 != modes.end()) + { + mode = it2->second; + } + else + { + std::cout << "Unknown mode '" << argv[2] << "'.\n\n"; + return 1; + } + + return 0; +} + +void print_usage() +{ + std::cout << "usage: gsc-tool.exe \n"; + std::cout << " * games: -iw5, -iw6, -iw7, -iw8, -s1, -s2, -s4, -h1, -h2\n"; + std::cout << " * modes: -asm, -disasm, -comp, -decomp\n"; +} + +std::uint32_t main(std::uint32_t argc, char** argv) +{ + std::string file = utils::string::fordslash(argv[argc - 1]); + mode mode = mode::__; + game game = game::__; + bool zonetool = false; + + if (parse_flags(argc, argv, game, mode, zonetool)) + { + print_usage(); + return 0; + } + + if (mode == mode::ASM) + { + if( game == game::IW5) + { + gsc::iw5::assembler assembler; + assemble_file(assembler, file, zonetool); + } + else if (game == game::IW6) + { + iw6::assembler assembler; + assemble_file(assembler, file, zonetool); + } + else if (game == game::IW7) + { + iw7::assembler assembler; + assemble_file(assembler, file, zonetool); + } + else if (game == game::IW8) + { + iw8::assembler assembler; + assemble_file(assembler, file, zonetool); + } + else if (game == game::S1) + { + s1::assembler assembler; + assemble_file(assembler, file, zonetool); + } + else if (game == game::S2) + { + s2::assembler assembler; + assemble_file(assembler, file, zonetool); + } + else if (game == game::S4) + { + s4::assembler assembler; + assemble_file(assembler, file, zonetool); + } + else if (game == game::H1) + { + h1::assembler assembler; + assemble_file(assembler, file, zonetool); + } + else if (game == game::H2) + { + h2::assembler assembler; + assemble_file(assembler, file, zonetool); + } + } + else if (mode == mode::DISASM) + { + if (game == game::IW5) + { + gsc::iw5::disassembler disassembler; + disassemble_file(disassembler, file, game, zonetool); + } + else if (game == game::IW6) + { + iw6::disassembler disassembler; + disassemble_file(disassembler, file, game, zonetool); + } + else if (game == game::IW7) + { + iw7::disassembler disassembler; + disassemble_file(disassembler, file, game, zonetool); + } + else if (game == game::IW8) + { + iw8::disassembler disassembler; + disassemble_file(disassembler, file, game, zonetool); + } + else if (game == game::S1) + { + s1::disassembler disassembler; + disassemble_file(disassembler, file, game, zonetool); + } + else if (game == game::S2) + { + s2::disassembler disassembler; + disassemble_file(disassembler, file, game, zonetool); + } + else if (game == game::S4) + { + s4::disassembler disassembler; + disassemble_file(disassembler, file, game, zonetool); + } + else if (game == game::H1) + { + h1::disassembler disassembler; + disassemble_file(disassembler, file, game, zonetool); + } + else if (game == game::H2) + { + h2::disassembler disassembler; + disassemble_file(disassembler, file, game, zonetool); + } + } + else if (mode == mode::COMP) + { + if (game == game::IW5) + { + gsc::iw5::assembler assembler; + gsc::iw5::compiler compiler(gsc::dev_blocks::off); + compile_file(assembler, compiler, file ,zonetool); + } + else if (game == game::IW6) + { + iw6::assembler assembler; + iw6::compiler compiler; + compile_file(assembler, compiler, file ,zonetool); + } + else if (game == game::IW7) + { + iw7::assembler assembler; + iw7::compiler compiler; + compile_file(assembler, compiler, file ,zonetool); + } + else if (game == game::IW8) + { + iw8::assembler assembler; + iw8::compiler compiler; + compile_file(assembler, compiler, file ,zonetool); + } + else if (game == game::S1) + { + s1::assembler assembler; + s1::compiler compiler; + compile_file(assembler, compiler, file ,zonetool); + } + else if (game == game::S2) + { + s2::assembler assembler; + s2::compiler compiler; + compile_file(assembler, compiler, file ,zonetool); + } + else if (game == game::S4) + { + s4::assembler assembler; + s4::compiler compiler; + compile_file(assembler, compiler, file ,zonetool); + } + else if (game == game::H1) + { + h1::assembler assembler; + h1::compiler compiler; + compile_file(assembler, compiler, file ,zonetool); + } + else if (game == game::H2) + { + h2::assembler assembler; + h2::compiler compiler; + compile_file(assembler, compiler, file ,zonetool); + } + } + else if (mode == mode::DECOMP) + { + if (game == game::IW5) + { + iw5::disassembler disassembler; + iw5::decompiler decompiler; + decompile_file(disassembler, decompiler, file, game, zonetool); + } + else if (game == game::IW6) + { + iw6::disassembler disassembler; + iw6::decompiler decompiler; + decompile_file(disassembler, decompiler, file, game, zonetool); + } + else if (game == game::IW7) + { + iw7::disassembler disassembler; + iw7::decompiler decompiler; + decompile_file(disassembler, decompiler, file, game, zonetool); + } + else if (game == game::IW8) + { + iw8::disassembler disassembler; + iw8::decompiler decompiler; + decompile_file(disassembler, decompiler, file, game, zonetool); + } + else if (game == game::S1) + { + s1::disassembler disassembler; + s1::decompiler decompiler; + decompile_file(disassembler, decompiler, file, game, zonetool); + } + else if (game == game::S2) + { + s2::disassembler disassembler; + s2::decompiler decompiler; + decompile_file(disassembler, decompiler, file, game, zonetool); + } + else if (game == game::S4) + { + s4::disassembler disassembler; + s4::decompiler decompiler; + decompile_file(disassembler, decompiler, file, game, zonetool); + } + else if (game == game::H1) + { + h1::disassembler disassembler; + h1::decompiler decompiler; + decompile_file(disassembler, decompiler, file, game, zonetool); + } + else if (game == game::H2) + { + h2::disassembler disassembler; + h2::decompiler decompiler; + decompile_file(disassembler, decompiler, file, game, zonetool); + } + } + + return 0; +} + +} // namespace xsk::gsc + +int main(int argc, char** argv) +{ + xsk::gsc::main(argc, argv); +} diff --git a/src/utils/xsk/gsc/devblocks.hpp b/src/utils/xsk/gsc/devblocks.hpp new file mode 100644 index 00000000..0487b3cd --- /dev/null +++ b/src/utils/xsk/gsc/devblocks.hpp @@ -0,0 +1,10 @@ +#pragma once + +namespace xsk::gsc +{ + enum class dev_blocks + { + on, + off + }; +} diff --git a/src/utils/xsk/utils.hpp b/src/utils/xsk/utils.hpp index 86160a5e..318a24e0 100644 --- a/src/utils/xsk/utils.hpp +++ b/src/utils/xsk/utils.hpp @@ -1,27 +1,28 @@ -// Copyright 2021 xensik. All rights reserved. -// -// Use of this source code is governed by a GNU GPLv3 license -// that can be found in the LICENSE file. - -#pragma once - -// Utility -#include "file.hpp" -#include "string.hpp" -#include "byte_buffer.hpp" -#include "compression.hpp" - -// GSC Types -#include "gsc/pair.hpp" -#include "gsc/asset.hpp" -#include "gsc/assembly.hpp" -#include "gsc/context.hpp" -#include "gsc/location.hpp" -#include "gsc/nodetree.hpp" - -// GSC Interfaces -#include "gsc/interfaces/exception.hpp" -#include "gsc/interfaces/assembler.hpp" -#include "gsc/interfaces/disassembler.hpp" -#include "gsc/interfaces/compiler.hpp" -#include "gsc/interfaces/decompiler.hpp" +// Copyright 2021 xensik. All rights reserved. +// +// Use of this source code is governed by a GNU GPLv3 license +// that can be found in the LICENSE file. + +#pragma once + +// Utility +#include "file.hpp" +#include "string.hpp" +#include "byte_buffer.hpp" +#include "compression.hpp" + +// GSC Types +#include "gsc/devblocks.hpp" +#include "gsc/pair.hpp" +#include "gsc/asset.hpp" +#include "gsc/assembly.hpp" +#include "gsc/context.hpp" +#include "gsc/location.hpp" +#include "gsc/nodetree.hpp" + +// GSC Interfaces +#include "gsc/interfaces/exception.hpp" +#include "gsc/interfaces/assembler.hpp" +#include "gsc/interfaces/disassembler.hpp" +#include "gsc/interfaces/compiler.hpp" +#include "gsc/interfaces/decompiler.hpp"