Add devblock support in IW5
This commit is contained in:
parent
a015ab8708
commit
b3f47d640d
@ -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/
|
||||
|
@ -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)
|
||||
<COMMENT_BLOCK_STATE>\n { loc.lines(yyleng); loc.step(); }
|
||||
<COMMENT_BLOCK_STATE>"*/" { BEGIN(INITIAL); }
|
||||
|
||||
"/#" { BEGIN(DEVELOPER_BLOCK_STATE); }
|
||||
<DEVELOPER_BLOCK_STATE>.
|
||||
<DEVELOPER_BLOCK_STATE>\n { loc.lines(yyleng); loc.step(); }
|
||||
<DEVELOPER_BLOCK_STATE>"#/" { 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 */
|
||||
<DEVBLOCK_OFF_STATE>.
|
||||
<DEVBLOCK_OFF_STATE>\n { loc.lines(yyleng); loc.step(); }
|
||||
/* always exit devblock state when seeing #/ */
|
||||
<DEVBLOCK_OFF_STATE,DEVBLOCK_ON_STATE>"#/" { BEGIN(INITIAL); }
|
||||
|
||||
/* for better errors */
|
||||
<INITIAL>"*/" { throw iw5::parser::syntax_error(loc, "unmatched multiline comment end ('*/')"); }
|
||||
<INITIAL>"#/" { throw iw5::parser::syntax_error(loc, "unmatched devblock end ('#/')"); }
|
||||
|
||||
"breakpoint" { return iw5::parser::make_BREAKPOINT(loc); }
|
||||
"prof_begin" { return iw5::parser::make_PROFBEGIN(loc); }
|
||||
|
@ -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"
|
||||
|
@ -46,7 +46,7 @@ auto compiler::parse_buffer(const std::string& file, std::vector<std::uint8_t>&
|
||||
|
||||
YY_BUFFER_STATE yybuffer = iw5__scan_buffer(reinterpret_cast<char*>(data.data()), data.size(), scanner);
|
||||
|
||||
parser parser(scanner, loc, result);
|
||||
parser parser(scanner, loc, result, m_devblocks);
|
||||
|
||||
if(parser.parse() || result == nullptr)
|
||||
{
|
||||
|
@ -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<gsc::function_ptr> assembly_;
|
||||
gsc::function_ptr function_;
|
||||
std::uint32_t index_;
|
||||
std::uint32_t label_idx_;
|
||||
std::uint8_t stack_idx_;
|
||||
std::vector<std::string> local_stack_;
|
||||
std::vector<std::string> local_functions_;
|
||||
std::vector<include_t> includes_;
|
||||
std::vector<animtree_t> animtrees_;
|
||||
std::unordered_map<std::string, gsc::expr_ptr> constants_;
|
||||
std::function<std::vector<std::uint8_t>(const std::string&)> callback_readf_;
|
||||
std::vector<gsc::context*> break_ctxs_;
|
||||
std::vector<gsc::context*> continue_ctxs_;
|
||||
bool can_break_;
|
||||
bool can_continue_;
|
||||
|
||||
public:
|
||||
auto output() -> std::vector<gsc::function_ptr>;
|
||||
void compile(const std::string& file, std::vector<std::uint8_t>& data);
|
||||
void set_readf_callback(std::function<std::vector<std::uint8_t>(const std::string&)> func);
|
||||
|
||||
private:
|
||||
auto parse_buffer(const std::string& file, std::vector<std::uint8_t>& data) -> gsc::program_ptr;
|
||||
auto parse_file(const std::string& file) -> gsc::program_ptr;
|
||||
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<std::string>& 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<gsc::function_ptr> assembly_;
|
||||
gsc::function_ptr function_;
|
||||
std::uint32_t index_;
|
||||
std::uint32_t label_idx_;
|
||||
std::uint8_t stack_idx_;
|
||||
std::vector<std::string> local_stack_;
|
||||
std::vector<std::string> local_functions_;
|
||||
std::vector<include_t> includes_;
|
||||
std::vector<animtree_t> animtrees_;
|
||||
std::unordered_map<std::string, gsc::expr_ptr> constants_;
|
||||
std::function<std::vector<std::uint8_t>(const std::string&)> callback_readf_;
|
||||
std::vector<gsc::context*> break_ctxs_;
|
||||
std::vector<gsc::context*> continue_ctxs_;
|
||||
bool can_break_;
|
||||
bool can_continue_;
|
||||
|
||||
public:
|
||||
compiler(gsc::dev_blocks devblocks);
|
||||
|
||||
auto output() -> std::vector<gsc::function_ptr>;
|
||||
void compile(const std::string& file, std::vector<std::uint8_t>& data);
|
||||
void set_readf_callback(std::function<std::vector<std::uint8_t>(const std::string&)> func);
|
||||
|
||||
private:
|
||||
auto parse_buffer(const std::string& file, std::vector<std::uint8_t>& data) -> gsc::program_ptr;
|
||||
auto parse_file(const std::string& file) -> gsc::program_ptr;
|
||||
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<std::string>& 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
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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 */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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 <http://www.gnu.org/licenses/>.
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// As a special exception, you may create a larger work that contains
|
||||
// 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 <typename T>
|
||||
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<T*> (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<const T*> (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<by_kind> 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<symbol_kind_type> (t);
|
||||
}
|
||||
@ -4674,6 +4695,7 @@ switch (yykind)
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Base>
|
||||
parser::symbol_kind_type
|
||||
parser::basic_symbol<Base>::type_get () const YY_NOEXCEPT
|
||||
@ -4681,6 +4703,7 @@ switch (yykind)
|
||||
return this->kind ();
|
||||
}
|
||||
|
||||
|
||||
template <typename Base>
|
||||
bool
|
||||
parser::basic_symbol<Base>::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"
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
10
src/utils/xsk/gsc/devblocks.hpp
Normal file
10
src/utils/xsk/gsc/devblocks.hpp
Normal file
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
namespace xsk::gsc
|
||||
{
|
||||
enum class dev_blocks
|
||||
{
|
||||
on,
|
||||
off
|
||||
};
|
||||
}
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user