add treyarch const locals

This commit is contained in:
xensik 2022-10-20 17:19:34 +02:00
parent e5d6196da1
commit 9b7ee7971d
8 changed files with 1722 additions and 1730 deletions

View File

@ -89,6 +89,7 @@ xsk::arc::t6::parser::symbol_type T6lex(xsk::arc::t6::lexer& lexer);
%token SELF "self" %token SELF "self"
%token ANIM "anim" %token ANIM "anim"
%token LEVEL "level" %token LEVEL "level"
%token CONST "const"
%token GETNEXTARRAYKEY "getnextarraykey" %token GETNEXTARRAYKEY "getnextarraykey"
%token GETFIRSTARRAYKEY "getfirstarraykey" %token GETFIRSTARRAYKEY "getfirstarraykey"
%token GETDVARCOLORALPHA "getdvarcoloralpha" %token GETDVARCOLORALPHA "getdvarcoloralpha"
@ -165,7 +166,6 @@ xsk::arc::t6::parser::symbol_type T6lex(xsk::arc::t6::lexer& lexer);
%type <ast::include::ptr> include %type <ast::include::ptr> include
%type <ast::decl> declaration %type <ast::decl> declaration
%type <ast::decl_usingtree::ptr> decl_usingtree %type <ast::decl_usingtree::ptr> decl_usingtree
%type <ast::decl_constant::ptr> decl_constant
%type <ast::decl_thread::ptr> decl_thread %type <ast::decl_thread::ptr> decl_thread
%type <ast::stmt> stmt %type <ast::stmt> stmt
%type <ast::stmt> stmt_or_dev %type <ast::stmt> stmt_or_dev
@ -175,6 +175,7 @@ xsk::arc::t6::parser::symbol_type T6lex(xsk::arc::t6::lexer& lexer);
%type <ast::stmt_list::ptr> stmt_block %type <ast::stmt_list::ptr> stmt_block
%type <ast::stmt_expr::ptr> stmt_expr %type <ast::stmt_expr::ptr> stmt_expr
%type <ast::stmt_call::ptr> stmt_call %type <ast::stmt_call::ptr> stmt_call
%type <ast::stmt_const::ptr> stmt_const
%type <ast::stmt_assign::ptr> stmt_assign %type <ast::stmt_assign::ptr> stmt_assign
%type <ast::stmt_endon::ptr> stmt_endon %type <ast::stmt_endon::ptr> stmt_endon
%type <ast::stmt_notify::ptr> stmt_notify %type <ast::stmt_notify::ptr> stmt_notify
@ -323,7 +324,6 @@ declaration
: DEVBEGIN { $$.as_dev_begin = std::make_unique<ast::decl_dev_begin>(@$); } : DEVBEGIN { $$.as_dev_begin = std::make_unique<ast::decl_dev_begin>(@$); }
| DEVEND { $$.as_dev_end = std::make_unique<ast::decl_dev_end>(@$); } | DEVEND { $$.as_dev_end = std::make_unique<ast::decl_dev_end>(@$); }
| decl_usingtree { $$.as_usingtree = std::move($1); } | decl_usingtree { $$.as_usingtree = std::move($1); }
| decl_constant { $$.as_constant = std::move($1); }
| decl_thread { $$.as_thread = std::move($1); } | decl_thread { $$.as_thread = std::move($1); }
; ;
@ -332,11 +332,6 @@ decl_usingtree
{ lexer.ban_header(@$); $$ = std::make_unique<ast::decl_usingtree>(@$, std::move($3)); } { lexer.ban_header(@$); $$ = std::make_unique<ast::decl_usingtree>(@$, std::move($3)); }
; ;
decl_constant
: expr_identifier ASSIGN expr SEMICOLON
{ $$ = std::make_unique<ast::decl_constant>(@$, std::move($1), std::move($3)); }
;
decl_thread decl_thread
: expr_identifier LPAREN expr_parameters RPAREN stmt_block : expr_identifier LPAREN expr_parameters RPAREN stmt_block
{ lexer.ban_header(@$); $$ = std::make_unique<ast::decl_thread>(@$, std::move($1), std::move($3), std::move($5), export_flags::none); } { lexer.ban_header(@$); $$ = std::make_unique<ast::decl_thread>(@$, std::move($1), std::move($3), std::move($5), export_flags::none); }
@ -349,6 +344,7 @@ decl_thread
stmt stmt
: stmt_block { $$.as_list = std::move($1); } : stmt_block { $$.as_list = std::move($1); }
| stmt_call { $$.as_call = std::move($1); } | stmt_call { $$.as_call = std::move($1); }
| stmt_const { $$.as_const = std::move($1); }
| stmt_assign { $$.as_assign = std::move($1); } | stmt_assign { $$.as_assign = std::move($1); }
| stmt_endon { $$.as_endon = std::move($1); } | stmt_endon { $$.as_endon = std::move($1); }
| stmt_notify { $$.as_notify = std::move($1); } | stmt_notify { $$.as_notify = std::move($1); }
@ -419,6 +415,11 @@ stmt_call
{ $$ = std::make_unique<ast::stmt_call>(@$, ast::expr(std::move($1))); } { $$ = std::make_unique<ast::stmt_call>(@$, ast::expr(std::move($1))); }
; ;
stmt_const
: CONST expr_identifier ASSIGN expr SEMICOLON
{ $$ = std::make_unique<ast::stmt_const>(@$, std::move($2), std::move($4)); }
;
stmt_assign stmt_assign
: expr_assign SEMICOLON : expr_assign SEMICOLON
{ $$ = std::make_unique<ast::stmt_assign>(@$, std::move($1)); } { $$ = std::make_unique<ast::stmt_assign>(@$, std::move($1)); }

View File

@ -78,7 +78,6 @@ void compiler::compile_program(const ast::program::ptr& program)
assembly_ = std::make_unique<assembly>(); assembly_ = std::make_unique<assembly>();
includes_.clear(); includes_.clear();
animtrees_.clear(); animtrees_.clear();
constants_.clear();
local_functions_.clear(); local_functions_.clear();
index_ = 0; index_ = 0;
developer_thread_ = false; developer_thread_ = false;
@ -132,9 +131,6 @@ void compiler::emit_declaration(const ast::decl& decl)
case ast::kind::decl_usingtree: case ast::kind::decl_usingtree:
emit_decl_usingtree(decl.as_usingtree); emit_decl_usingtree(decl.as_usingtree);
break; break;
case ast::kind::decl_constant:
emit_decl_constant(decl.as_constant);
break;
case ast::kind::decl_thread: case ast::kind::decl_thread:
emit_decl_thread(decl.as_thread); emit_decl_thread(decl.as_thread);
break; break;
@ -153,16 +149,6 @@ void compiler::emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree)
animtrees_.push_back({ animtree->name->value, false }); animtrees_.push_back({ animtree->name->value, false });
} }
void compiler::emit_decl_constant(const ast::decl_constant::ptr& constant)
{
const auto itr = constants_.find(constant->name->value);
if (itr != constants_.end())
throw comp_error(constant->loc(), "duplicated constant '" + constant->name->value + "'");
constants_.insert({ constant->name->value, std::move(constant->value) });
}
void compiler::emit_decl_thread(const ast::decl_thread::ptr& thread) void compiler::emit_decl_thread(const ast::decl_thread::ptr& thread)
{ {
function_ = std::make_unique<function>(); function_ = std::make_unique<function>();
@ -176,6 +162,7 @@ void compiler::emit_decl_thread(const ast::decl_thread::ptr& thread)
can_break_ = false; can_break_ = false;
can_continue_ = false; can_continue_ = false;
local_stack_.clear(); local_stack_.clear();
constants_.clear();
blocks_.clear(); blocks_.clear();
process_thread(thread); process_thread(thread);
@ -210,6 +197,9 @@ void compiler::emit_stmt(const ast::stmt& stmt)
case ast::kind::stmt_call: case ast::kind::stmt_call:
emit_stmt_call(stmt.as_call); emit_stmt_call(stmt.as_call);
break; break;
case ast::kind::stmt_const:
emit_stmt_const(stmt.as_const);
break;
case ast::kind::stmt_assign: case ast::kind::stmt_assign:
emit_stmt_assign(stmt.as_assign); emit_stmt_assign(stmt.as_assign);
break; break;
@ -338,6 +328,19 @@ void compiler::emit_stmt_call(const ast::stmt_call::ptr& stmt)
throw comp_error(stmt->loc(), "unknown call statement expression"); throw comp_error(stmt->loc(), "unknown call statement expression");
} }
void compiler::emit_stmt_const(const ast::stmt_const::ptr& stmt)
{
const auto itr = constants_.find(stmt->lvalue->value);
if (itr != constants_.end())
throw comp_error(stmt->loc(), "duplicated constant '" + stmt->lvalue->value + "'");
if (std::find(local_stack_.begin(), local_stack_.end(), stmt->lvalue->value) != local_stack_.end())
throw comp_error(stmt->loc(), "constant already defined as local variable '" + stmt->lvalue->value + "'");
constants_.insert({ stmt->lvalue->value, std::move(stmt->rvalue) });
}
void compiler::emit_stmt_assign(const ast::stmt_assign::ptr& stmt) void compiler::emit_stmt_assign(const ast::stmt_assign::ptr& stmt)
{ {
switch (stmt->expr.kind()) switch (stmt->expr.kind())
@ -2043,6 +2046,7 @@ void compiler::process_stmt(const ast::stmt& stmt)
process_stmt_switch(stmt.as_switch); process_stmt_switch(stmt.as_switch);
break; break;
case ast::kind::stmt_call: case ast::kind::stmt_call:
case ast::kind::stmt_const:
case ast::kind::stmt_endon: case ast::kind::stmt_endon:
case ast::kind::stmt_notify: case ast::kind::stmt_notify:
case ast::kind::stmt_wait: case ast::kind::stmt_wait:

View File

@ -43,13 +43,13 @@ private:
void emit_include(const ast::include::ptr& include); void emit_include(const ast::include::ptr& include);
void emit_declaration(const ast::decl& decl); void emit_declaration(const ast::decl& decl);
void emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree); void emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree);
void emit_decl_constant(const ast::decl_constant::ptr& constant);
void emit_decl_thread(const ast::decl_thread::ptr& thread); void emit_decl_thread(const ast::decl_thread::ptr& thread);
void emit_stmt(const ast::stmt& stmt); void emit_stmt(const ast::stmt& stmt);
void emit_stmt_list(const ast::stmt_list::ptr& stmt); void emit_stmt_list(const ast::stmt_list::ptr& stmt);
void emit_stmt_dev(const ast::stmt_dev::ptr& stmt); void emit_stmt_dev(const ast::stmt_dev::ptr& stmt);
void emit_stmt_expr(const ast::stmt_expr::ptr& stmt); void emit_stmt_expr(const ast::stmt_expr::ptr& stmt);
void emit_stmt_call(const ast::stmt_call::ptr& stmt); void emit_stmt_call(const ast::stmt_call::ptr& stmt);
void emit_stmt_const(const ast::stmt_const::ptr& stmt);
void emit_stmt_assign(const ast::stmt_assign::ptr& stmt); void emit_stmt_assign(const ast::stmt_assign::ptr& stmt);
void emit_stmt_endon(const ast::stmt_endon::ptr& stmt); void emit_stmt_endon(const ast::stmt_endon::ptr& stmt);
void emit_stmt_notify(const ast::stmt_notify::ptr& stmt); void emit_stmt_notify(const ast::stmt_notify::ptr& stmt);

View File

@ -62,6 +62,7 @@ const std::unordered_map<std::string_view, parser::token::token_kind_type> keywo
{ "self", parser::token::SELF }, { "self", parser::token::SELF },
{ "anim", parser::token::ANIM }, { "anim", parser::token::ANIM },
{ "level", parser::token::LEVEL }, { "level", parser::token::LEVEL },
{ "const", parser::token::CONST },
{ "isdefined", parser::token::ISDEFINED }, { "isdefined", parser::token::ISDEFINED },
{ "vectorscale", parser::token::VECTORSCALE }, { "vectorscale", parser::token::VECTORSCALE },
{ "anglestoup", parser::token::ANGLESTOUP }, { "anglestoup", parser::token::ANGLESTOUP },

File diff suppressed because it is too large Load Diff

View File

@ -429,14 +429,11 @@ namespace xsk { namespace arc { namespace t6 {
// declaration // declaration
char dummy2[sizeof (ast::decl)]; char dummy2[sizeof (ast::decl)];
// decl_constant
char dummy3[sizeof (ast::decl_constant::ptr)];
// decl_thread // decl_thread
char dummy4[sizeof (ast::decl_thread::ptr)]; char dummy3[sizeof (ast::decl_thread::ptr)];
// decl_usingtree // decl_usingtree
char dummy5[sizeof (ast::decl_usingtree::ptr)]; char dummy4[sizeof (ast::decl_usingtree::ptr)];
// expr // expr
// expr_or_empty // expr_or_empty
@ -449,178 +446,181 @@ namespace xsk { namespace arc { namespace t6 {
// expr_parameters_default // expr_parameters_default
// expr_literal // expr_literal
// expr_object // expr_object
char dummy6[sizeof (ast::expr)]; char dummy5[sizeof (ast::expr)];
// expr_abs // expr_abs
char dummy7[sizeof (ast::expr_abs::ptr)]; char dummy6[sizeof (ast::expr_abs::ptr)];
// expr_angleclamp180 // expr_angleclamp180
char dummy8[sizeof (ast::expr_angleclamp180::ptr)]; char dummy7[sizeof (ast::expr_angleclamp180::ptr)];
// expr_anglestoforward // expr_anglestoforward
char dummy9[sizeof (ast::expr_anglestoforward::ptr)]; char dummy8[sizeof (ast::expr_anglestoforward::ptr)];
// expr_anglestoright // expr_anglestoright
char dummy10[sizeof (ast::expr_anglestoright::ptr)]; char dummy9[sizeof (ast::expr_anglestoright::ptr)];
// expr_anglestoup // expr_anglestoup
char dummy11[sizeof (ast::expr_anglestoup::ptr)]; char dummy10[sizeof (ast::expr_anglestoup::ptr)];
// expr_anim // expr_anim
char dummy12[sizeof (ast::expr_anim::ptr)]; char dummy11[sizeof (ast::expr_anim::ptr)];
// expr_animation // expr_animation
char dummy13[sizeof (ast::expr_animation::ptr)]; char dummy12[sizeof (ast::expr_animation::ptr)];
// expr_animtree // expr_animtree
char dummy14[sizeof (ast::expr_animtree::ptr)]; char dummy13[sizeof (ast::expr_animtree::ptr)];
// expr_arguments // expr_arguments
// expr_arguments_no_empty // expr_arguments_no_empty
char dummy15[sizeof (ast::expr_arguments::ptr)]; char dummy14[sizeof (ast::expr_arguments::ptr)];
// expr_array // expr_array
char dummy16[sizeof (ast::expr_array::ptr)]; char dummy15[sizeof (ast::expr_array::ptr)];
// expr_call // expr_call
char dummy17[sizeof (ast::expr_call::ptr)]; char dummy16[sizeof (ast::expr_call::ptr)];
// expr_complement // expr_complement
char dummy18[sizeof (ast::expr_complement::ptr)]; char dummy17[sizeof (ast::expr_complement::ptr)];
// expr_empty_array // expr_empty_array
char dummy19[sizeof (ast::expr_empty_array::ptr)]; char dummy18[sizeof (ast::expr_empty_array::ptr)];
// expr_false // expr_false
char dummy20[sizeof (ast::expr_false::ptr)]; char dummy19[sizeof (ast::expr_false::ptr)];
// expr_field // expr_field
char dummy21[sizeof (ast::expr_field::ptr)]; char dummy20[sizeof (ast::expr_field::ptr)];
// expr_float // expr_float
char dummy22[sizeof (ast::expr_float::ptr)]; char dummy21[sizeof (ast::expr_float::ptr)];
// expr_game // expr_game
char dummy23[sizeof (ast::expr_game::ptr)]; char dummy22[sizeof (ast::expr_game::ptr)];
// expr_getdvar // expr_getdvar
char dummy24[sizeof (ast::expr_getdvar::ptr)]; char dummy23[sizeof (ast::expr_getdvar::ptr)];
// expr_getdvarcoloralpha // expr_getdvarcoloralpha
char dummy25[sizeof (ast::expr_getdvarcoloralpha::ptr)]; char dummy24[sizeof (ast::expr_getdvarcoloralpha::ptr)];
// expr_getdvarcolorblue // expr_getdvarcolorblue
char dummy26[sizeof (ast::expr_getdvarcolorblue::ptr)]; char dummy25[sizeof (ast::expr_getdvarcolorblue::ptr)];
// expr_getdvarcolorgreen // expr_getdvarcolorgreen
char dummy27[sizeof (ast::expr_getdvarcolorgreen::ptr)]; char dummy26[sizeof (ast::expr_getdvarcolorgreen::ptr)];
// expr_getdvarcolorred // expr_getdvarcolorred
char dummy28[sizeof (ast::expr_getdvarcolorred::ptr)]; char dummy27[sizeof (ast::expr_getdvarcolorred::ptr)];
// expr_getdvarfloat // expr_getdvarfloat
char dummy29[sizeof (ast::expr_getdvarfloat::ptr)]; char dummy28[sizeof (ast::expr_getdvarfloat::ptr)];
// expr_getdvarint // expr_getdvarint
char dummy30[sizeof (ast::expr_getdvarint::ptr)]; char dummy29[sizeof (ast::expr_getdvarint::ptr)];
// expr_getdvarvector // expr_getdvarvector
char dummy31[sizeof (ast::expr_getdvarvector::ptr)]; char dummy30[sizeof (ast::expr_getdvarvector::ptr)];
// expr_getfirstarraykey // expr_getfirstarraykey
char dummy32[sizeof (ast::expr_getfirstarraykey::ptr)]; char dummy31[sizeof (ast::expr_getfirstarraykey::ptr)];
// expr_getnextarraykey // expr_getnextarraykey
char dummy33[sizeof (ast::expr_getnextarraykey::ptr)]; char dummy32[sizeof (ast::expr_getnextarraykey::ptr)];
// expr_gettime // expr_gettime
char dummy34[sizeof (ast::expr_gettime::ptr)]; char dummy33[sizeof (ast::expr_gettime::ptr)];
// expr_hash // expr_hash
char dummy35[sizeof (ast::expr_hash::ptr)]; char dummy34[sizeof (ast::expr_hash::ptr)];
// expr_identifier_nosize // expr_identifier_nosize
// expr_identifier // expr_identifier
char dummy36[sizeof (ast::expr_identifier::ptr)]; char dummy35[sizeof (ast::expr_identifier::ptr)];
// expr_integer // expr_integer
char dummy37[sizeof (ast::expr_integer::ptr)]; char dummy36[sizeof (ast::expr_integer::ptr)];
// expr_isdefined // expr_isdefined
char dummy38[sizeof (ast::expr_isdefined::ptr)]; char dummy37[sizeof (ast::expr_isdefined::ptr)];
// expr_istring // expr_istring
char dummy39[sizeof (ast::expr_istring::ptr)]; char dummy38[sizeof (ast::expr_istring::ptr)];
// expr_level // expr_level
char dummy40[sizeof (ast::expr_level::ptr)]; char dummy39[sizeof (ast::expr_level::ptr)];
// expr_method // expr_method
char dummy41[sizeof (ast::expr_method::ptr)]; char dummy40[sizeof (ast::expr_method::ptr)];
// expr_negate // expr_negate
char dummy42[sizeof (ast::expr_negate::ptr)]; char dummy41[sizeof (ast::expr_negate::ptr)];
// expr_not // expr_not
char dummy43[sizeof (ast::expr_not::ptr)]; char dummy42[sizeof (ast::expr_not::ptr)];
// expr_parameters // expr_parameters
char dummy44[sizeof (ast::expr_parameters::ptr)]; char dummy43[sizeof (ast::expr_parameters::ptr)];
// expr_paren // expr_paren
char dummy45[sizeof (ast::expr_paren::ptr)]; char dummy44[sizeof (ast::expr_paren::ptr)];
// expr_path // expr_path
char dummy46[sizeof (ast::expr_path::ptr)]; char dummy45[sizeof (ast::expr_path::ptr)];
// expr_reference // expr_reference
char dummy47[sizeof (ast::expr_reference::ptr)]; char dummy46[sizeof (ast::expr_reference::ptr)];
// expr_self // expr_self
char dummy48[sizeof (ast::expr_self::ptr)]; char dummy47[sizeof (ast::expr_self::ptr)];
// expr_size // expr_size
char dummy49[sizeof (ast::expr_size::ptr)]; char dummy48[sizeof (ast::expr_size::ptr)];
// expr_string // expr_string
char dummy50[sizeof (ast::expr_string::ptr)]; char dummy49[sizeof (ast::expr_string::ptr)];
// expr_true // expr_true
char dummy51[sizeof (ast::expr_true::ptr)]; char dummy50[sizeof (ast::expr_true::ptr)];
// expr_undefined // expr_undefined
char dummy52[sizeof (ast::expr_undefined::ptr)]; char dummy51[sizeof (ast::expr_undefined::ptr)];
// expr_vector // expr_vector
char dummy53[sizeof (ast::expr_vector::ptr)]; char dummy52[sizeof (ast::expr_vector::ptr)];
// expr_vectorscale // expr_vectorscale
char dummy54[sizeof (ast::expr_vectorscale::ptr)]; char dummy53[sizeof (ast::expr_vectorscale::ptr)];
// expr_vectortoangles // expr_vectortoangles
char dummy55[sizeof (ast::expr_vectortoangles::ptr)]; char dummy54[sizeof (ast::expr_vectortoangles::ptr)];
// include // include
char dummy56[sizeof (ast::include::ptr)]; char dummy55[sizeof (ast::include::ptr)];
// program // program
char dummy57[sizeof (ast::program::ptr)]; char dummy56[sizeof (ast::program::ptr)];
// stmt // stmt
// stmt_or_dev // stmt_or_dev
char dummy58[sizeof (ast::stmt)]; char dummy57[sizeof (ast::stmt)];
// stmt_assign // stmt_assign
char dummy59[sizeof (ast::stmt_assign::ptr)]; char dummy58[sizeof (ast::stmt_assign::ptr)];
// stmt_break // stmt_break
char dummy60[sizeof (ast::stmt_break::ptr)]; char dummy59[sizeof (ast::stmt_break::ptr)];
// stmt_call // stmt_call
char dummy61[sizeof (ast::stmt_call::ptr)]; char dummy60[sizeof (ast::stmt_call::ptr)];
// stmt_case // stmt_case
char dummy62[sizeof (ast::stmt_case::ptr)]; char dummy61[sizeof (ast::stmt_case::ptr)];
// stmt_const
char dummy62[sizeof (ast::stmt_const::ptr)];
// stmt_continue // stmt_continue
char dummy63[sizeof (ast::stmt_continue::ptr)]; char dummy63[sizeof (ast::stmt_continue::ptr)];
@ -793,86 +793,87 @@ namespace xsk { namespace arc { namespace t6 {
SELF = 46, // "self" SELF = 46, // "self"
ANIM = 47, // "anim" ANIM = 47, // "anim"
LEVEL = 48, // "level" LEVEL = 48, // "level"
GETNEXTARRAYKEY = 49, // "getnextarraykey" CONST = 49, // "const"
GETFIRSTARRAYKEY = 50, // "getfirstarraykey" GETNEXTARRAYKEY = 50, // "getnextarraykey"
GETDVARCOLORALPHA = 51, // "getdvarcoloralpha" GETFIRSTARRAYKEY = 51, // "getfirstarraykey"
GETDVARCOLORBLUE = 52, // "getdvarcolorblue" GETDVARCOLORALPHA = 52, // "getdvarcoloralpha"
GETDVARCOLORGREEN = 53, // "getdvarcolorgreen" GETDVARCOLORBLUE = 53, // "getdvarcolorblue"
GETDVARCOLORRED = 54, // "getdvarcolorred" GETDVARCOLORGREEN = 54, // "getdvarcolorgreen"
GETDVARVECTOR = 55, // "getdvarvector" GETDVARCOLORRED = 55, // "getdvarcolorred"
GETDVARFLOAT = 56, // "getdvarfloat" GETDVARVECTOR = 56, // "getdvarvector"
GETDVARINT = 57, // "getdvarint" GETDVARFLOAT = 57, // "getdvarfloat"
GETDVAR = 58, // "getdvar" GETDVARINT = 58, // "getdvarint"
GETTIME = 59, // "gettime" GETDVAR = 59, // "getdvar"
ABS = 60, // "abs" GETTIME = 60, // "gettime"
VECTORTOANGLES = 61, // "vectortoangles" ABS = 61, // "abs"
ANGLECLAMP180 = 62, // "angleclamp180" VECTORTOANGLES = 62, // "vectortoangles"
ANGLESTOFORWARD = 63, // "anglestoforward" ANGLECLAMP180 = 63, // "angleclamp180"
ANGLESTORIGHT = 64, // "anglestoright" ANGLESTOFORWARD = 64, // "anglestoforward"
ANGLESTOUP = 65, // "anglestoup" ANGLESTORIGHT = 65, // "anglestoright"
VECTORSCALE = 66, // "vectorscale" ANGLESTOUP = 66, // "anglestoup"
ISDEFINED = 67, // "isdefined" VECTORSCALE = 67, // "vectorscale"
LPAREN = 68, // "(" ISDEFINED = 68, // "isdefined"
RPAREN = 69, // ")" LPAREN = 69, // "("
LBRACE = 70, // "{" RPAREN = 70, // ")"
RBRACE = 71, // "}" LBRACE = 71, // "{"
LBRACKET = 72, // "[" RBRACE = 72, // "}"
RBRACKET = 73, // "]" LBRACKET = 73, // "["
COMMA = 74, // "," RBRACKET = 74, // "]"
DOT = 75, // "." COMMA = 75, // ","
DOUBLECOLON = 76, // "::" DOT = 76, // "."
COLON = 77, // ":" DOUBLECOLON = 77, // "::"
SEMICOLON = 78, // ";" COLON = 78, // ":"
QMARK = 79, // "?" SEMICOLON = 79, // ";"
INCREMENT = 80, // "++" QMARK = 80, // "?"
DECREMENT = 81, // "--" INCREMENT = 81, // "++"
LSHIFT = 82, // "<<" DECREMENT = 82, // "--"
RSHIFT = 83, // ">>" LSHIFT = 83, // "<<"
OR = 84, // "||" RSHIFT = 84, // ">>"
AND = 85, // "&&" OR = 85, // "||"
EQUALITY = 86, // "==" AND = 86, // "&&"
INEQUALITY = 87, // "!=" EQUALITY = 87, // "=="
LESS_EQUAL = 88, // "<=" INEQUALITY = 88, // "!="
GREATER_EQUAL = 89, // ">=" LESS_EQUAL = 89, // "<="
LESS = 90, // "<" GREATER_EQUAL = 90, // ">="
GREATER = 91, // ">" LESS = 91, // "<"
NOT = 92, // "!" GREATER = 92, // ">"
COMPLEMENT = 93, // "~" NOT = 93, // "!"
ASSIGN = 94, // "=" COMPLEMENT = 94, // "~"
ASSIGN_ADD = 95, // "+=" ASSIGN = 95, // "="
ASSIGN_SUB = 96, // "-=" ASSIGN_ADD = 96, // "+="
ASSIGN_MUL = 97, // "*=" ASSIGN_SUB = 97, // "-="
ASSIGN_DIV = 98, // "/=" ASSIGN_MUL = 98, // "*="
ASSIGN_MOD = 99, // "%=" ASSIGN_DIV = 99, // "/="
ASSIGN_BW_OR = 100, // "|=" ASSIGN_MOD = 100, // "%="
ASSIGN_BW_AND = 101, // "&=" ASSIGN_BW_OR = 101, // "|="
ASSIGN_BW_EXOR = 102, // "^=" ASSIGN_BW_AND = 102, // "&="
ASSIGN_RSHIFT = 103, // ">>=" ASSIGN_BW_EXOR = 103, // "^="
ASSIGN_LSHIFT = 104, // "<<=" ASSIGN_RSHIFT = 104, // ">>="
BITWISE_OR = 105, // "|" ASSIGN_LSHIFT = 105, // "<<="
BITWISE_AND = 106, // "&" BITWISE_OR = 106, // "|"
BITWISE_EXOR = 107, // "^" BITWISE_AND = 107, // "&"
ADD = 108, // "+" BITWISE_EXOR = 108, // "^"
SUB = 109, // "-" ADD = 109, // "+"
MUL = 110, // "*" SUB = 110, // "-"
DIV = 111, // "/" MUL = 111, // "*"
MOD = 112, // "%" DIV = 112, // "/"
PATH = 113, // "path" MOD = 113, // "%"
IDENTIFIER = 114, // "identifier" PATH = 114, // "path"
STRING = 115, // "string literal" IDENTIFIER = 115, // "identifier"
ISTRING = 116, // "localized string" STRING = 116, // "string literal"
HASH = 117, // "hash" ISTRING = 117, // "localized string"
FLOAT = 118, // "float" HASH = 118, // "hash"
INTEGER = 119, // "integer" FLOAT = 119, // "float"
SIZEOF = 120, // SIZEOF INTEGER = 120, // "integer"
THEN = 121, // THEN SIZEOF = 121, // SIZEOF
TERN = 122, // TERN THEN = 122, // THEN
NEG = 123, // NEG TERN = 123, // TERN
ANIMREF = 124, // ANIMREF NEG = 124, // NEG
PREINC = 125, // PREINC ANIMREF = 125, // ANIMREF
PREDEC = 126, // PREDEC PREINC = 126, // PREINC
POSTINC = 127, // POSTINC PREDEC = 127, // PREDEC
POSTDEC = 128 // POSTDEC POSTINC = 128, // POSTINC
POSTDEC = 129 // POSTDEC
}; };
/// Backward compatibility alias (Bison 3.6). /// Backward compatibility alias (Bison 3.6).
typedef token_kind_type yytokentype; typedef token_kind_type yytokentype;
@ -889,7 +890,7 @@ namespace xsk { namespace arc { namespace t6 {
{ {
enum symbol_kind_type enum symbol_kind_type
{ {
YYNTOKENS = 129, ///< Number of tokens. YYNTOKENS = 130, ///< Number of tokens.
S_YYEMPTY = -2, S_YYEMPTY = -2,
S_YYEOF = 0, // "end of file" S_YYEOF = 0, // "end of file"
S_YYerror = 1, // error S_YYerror = 1, // error
@ -940,94 +941,94 @@ namespace xsk { namespace arc { namespace t6 {
S_SELF = 46, // "self" S_SELF = 46, // "self"
S_ANIM = 47, // "anim" S_ANIM = 47, // "anim"
S_LEVEL = 48, // "level" S_LEVEL = 48, // "level"
S_GETNEXTARRAYKEY = 49, // "getnextarraykey" S_CONST = 49, // "const"
S_GETFIRSTARRAYKEY = 50, // "getfirstarraykey" S_GETNEXTARRAYKEY = 50, // "getnextarraykey"
S_GETDVARCOLORALPHA = 51, // "getdvarcoloralpha" S_GETFIRSTARRAYKEY = 51, // "getfirstarraykey"
S_GETDVARCOLORBLUE = 52, // "getdvarcolorblue" S_GETDVARCOLORALPHA = 52, // "getdvarcoloralpha"
S_GETDVARCOLORGREEN = 53, // "getdvarcolorgreen" S_GETDVARCOLORBLUE = 53, // "getdvarcolorblue"
S_GETDVARCOLORRED = 54, // "getdvarcolorred" S_GETDVARCOLORGREEN = 54, // "getdvarcolorgreen"
S_GETDVARVECTOR = 55, // "getdvarvector" S_GETDVARCOLORRED = 55, // "getdvarcolorred"
S_GETDVARFLOAT = 56, // "getdvarfloat" S_GETDVARVECTOR = 56, // "getdvarvector"
S_GETDVARINT = 57, // "getdvarint" S_GETDVARFLOAT = 57, // "getdvarfloat"
S_GETDVAR = 58, // "getdvar" S_GETDVARINT = 58, // "getdvarint"
S_GETTIME = 59, // "gettime" S_GETDVAR = 59, // "getdvar"
S_ABS = 60, // "abs" S_GETTIME = 60, // "gettime"
S_VECTORTOANGLES = 61, // "vectortoangles" S_ABS = 61, // "abs"
S_ANGLECLAMP180 = 62, // "angleclamp180" S_VECTORTOANGLES = 62, // "vectortoangles"
S_ANGLESTOFORWARD = 63, // "anglestoforward" S_ANGLECLAMP180 = 63, // "angleclamp180"
S_ANGLESTORIGHT = 64, // "anglestoright" S_ANGLESTOFORWARD = 64, // "anglestoforward"
S_ANGLESTOUP = 65, // "anglestoup" S_ANGLESTORIGHT = 65, // "anglestoright"
S_VECTORSCALE = 66, // "vectorscale" S_ANGLESTOUP = 66, // "anglestoup"
S_ISDEFINED = 67, // "isdefined" S_VECTORSCALE = 67, // "vectorscale"
S_LPAREN = 68, // "(" S_ISDEFINED = 68, // "isdefined"
S_RPAREN = 69, // ")" S_LPAREN = 69, // "("
S_LBRACE = 70, // "{" S_RPAREN = 70, // ")"
S_RBRACE = 71, // "}" S_LBRACE = 71, // "{"
S_LBRACKET = 72, // "[" S_RBRACE = 72, // "}"
S_RBRACKET = 73, // "]" S_LBRACKET = 73, // "["
S_COMMA = 74, // "," S_RBRACKET = 74, // "]"
S_DOT = 75, // "." S_COMMA = 75, // ","
S_DOUBLECOLON = 76, // "::" S_DOT = 76, // "."
S_COLON = 77, // ":" S_DOUBLECOLON = 77, // "::"
S_SEMICOLON = 78, // ";" S_COLON = 78, // ":"
S_QMARK = 79, // "?" S_SEMICOLON = 79, // ";"
S_INCREMENT = 80, // "++" S_QMARK = 80, // "?"
S_DECREMENT = 81, // "--" S_INCREMENT = 81, // "++"
S_LSHIFT = 82, // "<<" S_DECREMENT = 82, // "--"
S_RSHIFT = 83, // ">>" S_LSHIFT = 83, // "<<"
S_OR = 84, // "||" S_RSHIFT = 84, // ">>"
S_AND = 85, // "&&" S_OR = 85, // "||"
S_EQUALITY = 86, // "==" S_AND = 86, // "&&"
S_INEQUALITY = 87, // "!=" S_EQUALITY = 87, // "=="
S_LESS_EQUAL = 88, // "<=" S_INEQUALITY = 88, // "!="
S_GREATER_EQUAL = 89, // ">=" S_LESS_EQUAL = 89, // "<="
S_LESS = 90, // "<" S_GREATER_EQUAL = 90, // ">="
S_GREATER = 91, // ">" S_LESS = 91, // "<"
S_NOT = 92, // "!" S_GREATER = 92, // ">"
S_COMPLEMENT = 93, // "~" S_NOT = 93, // "!"
S_ASSIGN = 94, // "=" S_COMPLEMENT = 94, // "~"
S_ASSIGN_ADD = 95, // "+=" S_ASSIGN = 95, // "="
S_ASSIGN_SUB = 96, // "-=" S_ASSIGN_ADD = 96, // "+="
S_ASSIGN_MUL = 97, // "*=" S_ASSIGN_SUB = 97, // "-="
S_ASSIGN_DIV = 98, // "/=" S_ASSIGN_MUL = 98, // "*="
S_ASSIGN_MOD = 99, // "%=" S_ASSIGN_DIV = 99, // "/="
S_ASSIGN_BW_OR = 100, // "|=" S_ASSIGN_MOD = 100, // "%="
S_ASSIGN_BW_AND = 101, // "&=" S_ASSIGN_BW_OR = 101, // "|="
S_ASSIGN_BW_EXOR = 102, // "^=" S_ASSIGN_BW_AND = 102, // "&="
S_ASSIGN_RSHIFT = 103, // ">>=" S_ASSIGN_BW_EXOR = 103, // "^="
S_ASSIGN_LSHIFT = 104, // "<<=" S_ASSIGN_RSHIFT = 104, // ">>="
S_BITWISE_OR = 105, // "|" S_ASSIGN_LSHIFT = 105, // "<<="
S_BITWISE_AND = 106, // "&" S_BITWISE_OR = 106, // "|"
S_BITWISE_EXOR = 107, // "^" S_BITWISE_AND = 107, // "&"
S_ADD = 108, // "+" S_BITWISE_EXOR = 108, // "^"
S_SUB = 109, // "-" S_ADD = 109, // "+"
S_MUL = 110, // "*" S_SUB = 110, // "-"
S_DIV = 111, // "/" S_MUL = 111, // "*"
S_MOD = 112, // "%" S_DIV = 112, // "/"
S_PATH = 113, // "path" S_MOD = 113, // "%"
S_IDENTIFIER = 114, // "identifier" S_PATH = 114, // "path"
S_STRING = 115, // "string literal" S_IDENTIFIER = 115, // "identifier"
S_ISTRING = 116, // "localized string" S_STRING = 116, // "string literal"
S_HASH = 117, // "hash" S_ISTRING = 117, // "localized string"
S_FLOAT = 118, // "float" S_HASH = 118, // "hash"
S_INTEGER = 119, // "integer" S_FLOAT = 119, // "float"
S_SIZEOF = 120, // SIZEOF S_INTEGER = 120, // "integer"
S_THEN = 121, // THEN S_SIZEOF = 121, // SIZEOF
S_TERN = 122, // TERN S_THEN = 122, // THEN
S_NEG = 123, // NEG S_TERN = 123, // TERN
S_ANIMREF = 124, // ANIMREF S_NEG = 124, // NEG
S_PREINC = 125, // PREINC S_ANIMREF = 125, // ANIMREF
S_PREDEC = 126, // PREDEC S_PREINC = 126, // PREINC
S_POSTINC = 127, // POSTINC S_PREDEC = 127, // PREDEC
S_POSTDEC = 128, // POSTDEC S_POSTINC = 128, // POSTINC
S_YYACCEPT = 129, // $accept S_POSTDEC = 129, // POSTDEC
S_root = 130, // root S_YYACCEPT = 130, // $accept
S_program = 131, // program S_root = 131, // root
S_inline = 132, // inline S_program = 132, // program
S_include = 133, // include S_inline = 133, // inline
S_declaration = 134, // declaration S_include = 134, // include
S_decl_usingtree = 135, // decl_usingtree S_declaration = 135, // declaration
S_decl_constant = 136, // decl_constant S_decl_usingtree = 136, // decl_usingtree
S_decl_thread = 137, // decl_thread S_decl_thread = 137, // decl_thread
S_stmt = 138, // stmt S_stmt = 138, // stmt
S_stmt_or_dev = 139, // stmt_or_dev S_stmt_or_dev = 139, // stmt_or_dev
@ -1037,91 +1038,92 @@ namespace xsk { namespace arc { namespace t6 {
S_stmt_block = 143, // stmt_block S_stmt_block = 143, // stmt_block
S_stmt_expr = 144, // stmt_expr S_stmt_expr = 144, // stmt_expr
S_stmt_call = 145, // stmt_call S_stmt_call = 145, // stmt_call
S_stmt_assign = 146, // stmt_assign S_stmt_const = 146, // stmt_const
S_stmt_endon = 147, // stmt_endon S_stmt_assign = 147, // stmt_assign
S_stmt_notify = 148, // stmt_notify S_stmt_endon = 148, // stmt_endon
S_stmt_wait = 149, // stmt_wait S_stmt_notify = 149, // stmt_notify
S_stmt_waittill = 150, // stmt_waittill S_stmt_wait = 150, // stmt_wait
S_stmt_waittillmatch = 151, // stmt_waittillmatch S_stmt_waittill = 151, // stmt_waittill
S_stmt_waittillframeend = 152, // stmt_waittillframeend S_stmt_waittillmatch = 152, // stmt_waittillmatch
S_stmt_if = 153, // stmt_if S_stmt_waittillframeend = 153, // stmt_waittillframeend
S_stmt_ifelse = 154, // stmt_ifelse S_stmt_if = 154, // stmt_if
S_stmt_while = 155, // stmt_while S_stmt_ifelse = 155, // stmt_ifelse
S_stmt_dowhile = 156, // stmt_dowhile S_stmt_while = 156, // stmt_while
S_stmt_for = 157, // stmt_for S_stmt_dowhile = 157, // stmt_dowhile
S_stmt_foreach = 158, // stmt_foreach S_stmt_for = 158, // stmt_for
S_stmt_switch = 159, // stmt_switch S_stmt_foreach = 159, // stmt_foreach
S_stmt_case = 160, // stmt_case S_stmt_switch = 160, // stmt_switch
S_stmt_default = 161, // stmt_default S_stmt_case = 161, // stmt_case
S_stmt_break = 162, // stmt_break S_stmt_default = 162, // stmt_default
S_stmt_continue = 163, // stmt_continue S_stmt_break = 163, // stmt_break
S_stmt_return = 164, // stmt_return S_stmt_continue = 164, // stmt_continue
S_stmt_prof_begin = 165, // stmt_prof_begin S_stmt_return = 165, // stmt_return
S_stmt_prof_end = 166, // stmt_prof_end S_stmt_prof_begin = 166, // stmt_prof_begin
S_expr = 167, // expr S_stmt_prof_end = 167, // stmt_prof_end
S_expr_or_empty = 168, // expr_or_empty S_expr = 168, // expr
S_expr_assign = 169, // expr_assign S_expr_or_empty = 169, // expr_or_empty
S_expr_increment = 170, // expr_increment S_expr_assign = 170, // expr_assign
S_expr_decrement = 171, // expr_decrement S_expr_increment = 171, // expr_increment
S_expr_ternary = 172, // expr_ternary S_expr_decrement = 172, // expr_decrement
S_expr_binary = 173, // expr_binary S_expr_ternary = 173, // expr_ternary
S_expr_primitive = 174, // expr_primitive S_expr_binary = 174, // expr_binary
S_expr_complement = 175, // expr_complement S_expr_primitive = 175, // expr_primitive
S_expr_negate = 176, // expr_negate S_expr_complement = 176, // expr_complement
S_expr_not = 177, // expr_not S_expr_negate = 177, // expr_negate
S_expr_call = 178, // expr_call S_expr_not = 178, // expr_not
S_expr_method = 179, // expr_method S_expr_call = 179, // expr_call
S_expr_function = 180, // expr_function S_expr_method = 180, // expr_method
S_expr_pointer = 181, // expr_pointer S_expr_function = 181, // expr_function
S_expr_parameters = 182, // expr_parameters S_expr_pointer = 182, // expr_pointer
S_expr_parameters_default = 183, // expr_parameters_default S_expr_parameters = 183, // expr_parameters
S_expr_literal = 184, // expr_literal S_expr_parameters_default = 184, // expr_parameters_default
S_expr_arguments = 185, // expr_arguments S_expr_literal = 185, // expr_literal
S_expr_arguments_no_empty = 186, // expr_arguments_no_empty S_expr_arguments = 186, // expr_arguments
S_expr_getnextarraykey = 187, // expr_getnextarraykey S_expr_arguments_no_empty = 187, // expr_arguments_no_empty
S_expr_getfirstarraykey = 188, // expr_getfirstarraykey S_expr_getnextarraykey = 188, // expr_getnextarraykey
S_expr_getdvarcoloralpha = 189, // expr_getdvarcoloralpha S_expr_getfirstarraykey = 189, // expr_getfirstarraykey
S_expr_getdvarcolorblue = 190, // expr_getdvarcolorblue S_expr_getdvarcoloralpha = 190, // expr_getdvarcoloralpha
S_expr_getdvarcolorgreen = 191, // expr_getdvarcolorgreen S_expr_getdvarcolorblue = 191, // expr_getdvarcolorblue
S_expr_getdvarcolorred = 192, // expr_getdvarcolorred S_expr_getdvarcolorgreen = 192, // expr_getdvarcolorgreen
S_expr_getdvarvector = 193, // expr_getdvarvector S_expr_getdvarcolorred = 193, // expr_getdvarcolorred
S_expr_getdvarfloat = 194, // expr_getdvarfloat S_expr_getdvarvector = 194, // expr_getdvarvector
S_expr_getdvarint = 195, // expr_getdvarint S_expr_getdvarfloat = 195, // expr_getdvarfloat
S_expr_getdvar = 196, // expr_getdvar S_expr_getdvarint = 196, // expr_getdvarint
S_expr_gettime = 197, // expr_gettime S_expr_getdvar = 197, // expr_getdvar
S_expr_abs = 198, // expr_abs S_expr_gettime = 198, // expr_gettime
S_expr_vectortoangles = 199, // expr_vectortoangles S_expr_abs = 199, // expr_abs
S_expr_angleclamp180 = 200, // expr_angleclamp180 S_expr_vectortoangles = 200, // expr_vectortoangles
S_expr_anglestoforward = 201, // expr_anglestoforward S_expr_angleclamp180 = 201, // expr_angleclamp180
S_expr_anglestoright = 202, // expr_anglestoright S_expr_anglestoforward = 202, // expr_anglestoforward
S_expr_anglestoup = 203, // expr_anglestoup S_expr_anglestoright = 203, // expr_anglestoright
S_expr_vectorscale = 204, // expr_vectorscale S_expr_anglestoup = 204, // expr_anglestoup
S_expr_isdefined = 205, // expr_isdefined S_expr_vectorscale = 205, // expr_vectorscale
S_expr_reference = 206, // expr_reference S_expr_isdefined = 206, // expr_isdefined
S_expr_array = 207, // expr_array S_expr_reference = 207, // expr_reference
S_expr_field = 208, // expr_field S_expr_array = 208, // expr_array
S_expr_size = 209, // expr_size S_expr_field = 209, // expr_field
S_expr_paren = 210, // expr_paren S_expr_size = 210, // expr_size
S_expr_object = 211, // expr_object S_expr_paren = 211, // expr_paren
S_expr_empty_array = 212, // expr_empty_array S_expr_object = 212, // expr_object
S_expr_undefined = 213, // expr_undefined S_expr_empty_array = 213, // expr_empty_array
S_expr_game = 214, // expr_game S_expr_undefined = 214, // expr_undefined
S_expr_self = 215, // expr_self S_expr_game = 215, // expr_game
S_expr_anim = 216, // expr_anim S_expr_self = 216, // expr_self
S_expr_level = 217, // expr_level S_expr_anim = 217, // expr_anim
S_expr_animation = 218, // expr_animation S_expr_level = 218, // expr_level
S_expr_animtree = 219, // expr_animtree S_expr_animation = 219, // expr_animation
S_expr_identifier_nosize = 220, // expr_identifier_nosize S_expr_animtree = 220, // expr_animtree
S_expr_identifier = 221, // expr_identifier S_expr_identifier_nosize = 221, // expr_identifier_nosize
S_expr_path = 222, // expr_path S_expr_identifier = 222, // expr_identifier
S_expr_istring = 223, // expr_istring S_expr_path = 223, // expr_path
S_expr_string = 224, // expr_string S_expr_istring = 224, // expr_istring
S_expr_vector = 225, // expr_vector S_expr_string = 225, // expr_string
S_expr_hash = 226, // expr_hash S_expr_vector = 226, // expr_vector
S_expr_float = 227, // expr_float S_expr_hash = 227, // expr_hash
S_expr_integer = 228, // expr_integer S_expr_float = 228, // expr_float
S_expr_false = 229, // expr_false S_expr_integer = 229, // expr_integer
S_expr_true = 230 // expr_true S_expr_false = 230, // expr_false
S_expr_true = 231 // expr_true
}; };
}; };
@ -1167,10 +1169,6 @@ namespace xsk { namespace arc { namespace t6 {
value.move< ast::decl > (std::move (that.value)); value.move< ast::decl > (std::move (that.value));
break; break;
case symbol_kind::S_decl_constant: // decl_constant
value.move< ast::decl_constant::ptr > (std::move (that.value));
break;
case symbol_kind::S_decl_thread: // decl_thread case symbol_kind::S_decl_thread: // decl_thread
value.move< ast::decl_thread::ptr > (std::move (that.value)); value.move< ast::decl_thread::ptr > (std::move (that.value));
break; break;
@ -1420,6 +1418,10 @@ namespace xsk { namespace arc { namespace t6 {
value.move< ast::stmt_case::ptr > (std::move (that.value)); value.move< ast::stmt_case::ptr > (std::move (that.value));
break; break;
case symbol_kind::S_stmt_const: // stmt_const
value.move< ast::stmt_const::ptr > (std::move (that.value));
break;
case symbol_kind::S_stmt_continue: // stmt_continue case symbol_kind::S_stmt_continue: // stmt_continue
value.move< ast::stmt_continue::ptr > (std::move (that.value)); value.move< ast::stmt_continue::ptr > (std::move (that.value));
break; break;
@ -1567,20 +1569,6 @@ namespace xsk { namespace arc { namespace t6 {
{} {}
#endif #endif
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, ast::decl_constant::ptr&& v, location_type&& l)
: Base (t)
, value (std::move (v))
, location (std::move (l))
{}
#else
basic_symbol (typename Base::kind_type t, const ast::decl_constant::ptr& v, const location_type& l)
: Base (t)
, value (v)
, location (l)
{}
#endif
#if 201103L <= YY_CPLUSPLUS #if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, ast::decl_thread::ptr&& v, location_type&& l) basic_symbol (typename Base::kind_type t, ast::decl_thread::ptr&& v, location_type&& l)
: Base (t) : Base (t)
@ -2407,6 +2395,20 @@ namespace xsk { namespace arc { namespace t6 {
{} {}
#endif #endif
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, ast::stmt_const::ptr&& v, location_type&& l)
: Base (t)
, value (std::move (v))
, location (std::move (l))
{}
#else
basic_symbol (typename Base::kind_type t, const ast::stmt_const::ptr& v, const location_type& l)
: Base (t)
, value (v)
, location (l)
{}
#endif
#if 201103L <= YY_CPLUSPLUS #if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, ast::stmt_continue::ptr&& v, location_type&& l) basic_symbol (typename Base::kind_type t, ast::stmt_continue::ptr&& v, location_type&& l)
: Base (t) : Base (t)
@ -2748,10 +2750,6 @@ switch (yykind)
value.template destroy< ast::decl > (); value.template destroy< ast::decl > ();
break; break;
case symbol_kind::S_decl_constant: // decl_constant
value.template destroy< ast::decl_constant::ptr > ();
break;
case symbol_kind::S_decl_thread: // decl_thread case symbol_kind::S_decl_thread: // decl_thread
value.template destroy< ast::decl_thread::ptr > (); value.template destroy< ast::decl_thread::ptr > ();
break; break;
@ -3001,6 +2999,10 @@ switch (yykind)
value.template destroy< ast::stmt_case::ptr > (); value.template destroy< ast::stmt_case::ptr > ();
break; break;
case symbol_kind::S_stmt_const: // stmt_const
value.template destroy< ast::stmt_const::ptr > ();
break;
case symbol_kind::S_stmt_continue: // stmt_continue case symbol_kind::S_stmt_continue: // stmt_continue
value.template destroy< ast::stmt_continue::ptr > (); value.template destroy< ast::stmt_continue::ptr > ();
break; break;
@ -3994,6 +3996,21 @@ switch (yykind)
return symbol_type (token::LEVEL, l); return symbol_type (token::LEVEL, l);
} }
#endif #endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_CONST (location_type l)
{
return symbol_type (token::CONST, std::move (l));
}
#else
static
symbol_type
make_CONST (const location_type& l)
{
return symbol_type (token::CONST, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS #if 201103L <= YY_CPLUSPLUS
static static
symbol_type symbol_type
@ -5538,9 +5555,9 @@ switch (yykind)
/// Constants. /// Constants.
enum enum
{ {
yylast_ = 3663, ///< Last index in yytable_. yylast_ = 3493, ///< Last index in yytable_.
yynnts_ = 102, ///< Number of nonterminal symbols. yynnts_ = 102, ///< Number of nonterminal symbols.
yyfinal_ = 26 ///< Termination state number. yyfinal_ = 25 ///< Termination state number.
}; };
@ -5575,10 +5592,6 @@ switch (yykind)
value.copy< ast::decl > (YY_MOVE (that.value)); value.copy< ast::decl > (YY_MOVE (that.value));
break; break;
case symbol_kind::S_decl_constant: // decl_constant
value.copy< ast::decl_constant::ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_decl_thread: // decl_thread case symbol_kind::S_decl_thread: // decl_thread
value.copy< ast::decl_thread::ptr > (YY_MOVE (that.value)); value.copy< ast::decl_thread::ptr > (YY_MOVE (that.value));
break; break;
@ -5828,6 +5841,10 @@ switch (yykind)
value.copy< ast::stmt_case::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_case::ptr > (YY_MOVE (that.value));
break; break;
case symbol_kind::S_stmt_const: // stmt_const
value.copy< ast::stmt_const::ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_stmt_continue: // stmt_continue case symbol_kind::S_stmt_continue: // stmt_continue
value.copy< ast::stmt_continue::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_continue::ptr > (YY_MOVE (that.value));
break; break;
@ -5964,10 +5981,6 @@ switch (yykind)
value.move< ast::decl > (YY_MOVE (s.value)); value.move< ast::decl > (YY_MOVE (s.value));
break; break;
case symbol_kind::S_decl_constant: // decl_constant
value.move< ast::decl_constant::ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_decl_thread: // decl_thread case symbol_kind::S_decl_thread: // decl_thread
value.move< ast::decl_thread::ptr > (YY_MOVE (s.value)); value.move< ast::decl_thread::ptr > (YY_MOVE (s.value));
break; break;
@ -6217,6 +6230,10 @@ switch (yykind)
value.move< ast::stmt_case::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_case::ptr > (YY_MOVE (s.value));
break; break;
case symbol_kind::S_stmt_const: // stmt_const
value.move< ast::stmt_const::ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_stmt_continue: // stmt_continue case symbol_kind::S_stmt_continue: // stmt_continue
value.move< ast::stmt_continue::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_continue::ptr > (YY_MOVE (s.value));
break; break;
@ -6380,7 +6397,7 @@ switch (yykind)
#line 13 "parser.ypp" #line 13 "parser.ypp"
} } } // xsk::arc::t6 } } } // xsk::arc::t6
#line 6384 "parser.hpp" #line 6401 "parser.hpp"

View File

@ -415,6 +415,9 @@ stmt_expr::stmt_expr(const location& loc, ast::expr expr) : node(kind::stmt_expr
stmt_call::stmt_call(ast::expr expr) : node(kind::stmt_call), expr(std::move(expr)) {} stmt_call::stmt_call(ast::expr expr) : node(kind::stmt_call), expr(std::move(expr)) {}
stmt_call::stmt_call(const location& loc, ast::expr expr) : node(kind::stmt_call, loc), expr(std::move(expr)) {} stmt_call::stmt_call(const location& loc, ast::expr expr) : node(kind::stmt_call, loc), expr(std::move(expr)) {}
stmt_const::stmt_const(expr_identifier::ptr lvalue, expr rvalue) : node(kind::stmt_const), lvalue(std::move(lvalue)), rvalue(std::move(rvalue)) {}
stmt_const::stmt_const(const location& loc, expr_identifier::ptr lvalue, expr rvalue) : node(kind::stmt_const, loc), lvalue(std::move(lvalue)), rvalue(std::move(rvalue)) {}
stmt_assign::stmt_assign(ast::expr expr) : node(kind::stmt_assign), expr(std::move(expr)) {} stmt_assign::stmt_assign(ast::expr expr) : node(kind::stmt_assign), expr(std::move(expr)) {}
stmt_assign::stmt_assign(const location& loc, ast::expr expr) : node(kind::stmt_assign, loc), expr(std::move(expr)) {} stmt_assign::stmt_assign(const location& loc, ast::expr expr) : node(kind::stmt_assign, loc), expr(std::move(expr)) {}
@ -492,9 +495,6 @@ stmt_prof_end::stmt_prof_end(const location& loc, expr_arguments::ptr args) : no
decl_thread::decl_thread(expr_identifier::ptr name, expr_parameters::ptr params, stmt_list::ptr stmt, export_flags flags) : node(kind::decl_thread), name(std::move(name)), params(std::move(params)), stmt(std::move(stmt)), flags(flags) {} decl_thread::decl_thread(expr_identifier::ptr name, expr_parameters::ptr params, stmt_list::ptr stmt, export_flags flags) : node(kind::decl_thread), name(std::move(name)), params(std::move(params)), stmt(std::move(stmt)), flags(flags) {}
decl_thread::decl_thread(const location& loc, expr_identifier::ptr name, expr_parameters::ptr params, stmt_list::ptr stmt, export_flags flags) : node(kind::decl_thread, loc), name(std::move(name)), params(std::move(params)), stmt(std::move(stmt)), flags(flags) {} decl_thread::decl_thread(const location& loc, expr_identifier::ptr name, expr_parameters::ptr params, stmt_list::ptr stmt, export_flags flags) : node(kind::decl_thread, loc), name(std::move(name)), params(std::move(params)), stmt(std::move(stmt)), flags(flags) {}
decl_constant::decl_constant(expr_identifier::ptr name, expr value) : node(kind::decl_constant), name(std::move(name)), value(std::move(value)) {}
decl_constant::decl_constant(const location& loc, expr_identifier::ptr name, expr value) : node(kind::decl_constant, loc), name(std::move(name)), value(std::move(value)) {}
decl_usingtree::decl_usingtree(expr_string::ptr name) : node(kind::decl_usingtree), name(std::move(name)) {} decl_usingtree::decl_usingtree(expr_string::ptr name) : node(kind::decl_usingtree), name(std::move(name)) {}
decl_usingtree::decl_usingtree(const location& loc, expr_string::ptr name) : node(kind::decl_usingtree, loc), name(std::move(name)) {} decl_usingtree::decl_usingtree(const location& loc, expr_string::ptr name) : node(kind::decl_usingtree, loc), name(std::move(name)) {}
@ -1086,6 +1086,11 @@ auto stmt_call::print() const -> std::string
return expr.print() + ";"; return expr.print() + ";";
}; };
auto stmt_const::print() const -> std::string
{
return "const "s + lvalue->print() + " = " + rvalue.print() + ";";
};
auto stmt_assign::print() const -> std::string auto stmt_assign::print() const -> std::string
{ {
return expr.print() + ";"; return expr.print() + ";";
@ -1382,11 +1387,6 @@ auto decl_thread::print() const -> std::string
return data; return data;
} }
auto decl_constant::print() const -> std::string
{
return name->print() + " = "s + value.print() + ";\n";
}
auto decl_usingtree::print() const -> std::string auto decl_usingtree::print() const -> std::string
{ {
return "#using_animtree"s + "(" + name->print() + ");\n"; return "#using_animtree"s + "(" + name->print() + ");\n";
@ -1846,6 +1846,7 @@ stmt::~stmt()
case kind::stmt_dev: as_dev.~unique_ptr(); return; case kind::stmt_dev: as_dev.~unique_ptr(); return;
case kind::stmt_expr: as_expr.~unique_ptr(); return; case kind::stmt_expr: as_expr.~unique_ptr(); return;
case kind::stmt_call: as_call.~unique_ptr(); return; case kind::stmt_call: as_call.~unique_ptr(); return;
case kind::stmt_const: as_const.~unique_ptr(); return;
case kind::stmt_assign: as_assign.~unique_ptr(); return; case kind::stmt_assign: as_assign.~unique_ptr(); return;
case kind::stmt_endon: as_endon.~unique_ptr(); return; case kind::stmt_endon: as_endon.~unique_ptr(); return;
case kind::stmt_notify: as_notify.~unique_ptr(); return; case kind::stmt_notify: as_notify.~unique_ptr(); return;
@ -1929,7 +1930,6 @@ decl::~decl()
case kind::decl_dev_begin: as_dev_begin.~unique_ptr(); return; case kind::decl_dev_begin: as_dev_begin.~unique_ptr(); return;
case kind::decl_dev_end: as_dev_end.~unique_ptr(); return; case kind::decl_dev_end: as_dev_end.~unique_ptr(); return;
case kind::decl_thread: as_thread.~unique_ptr(); return; case kind::decl_thread: as_thread.~unique_ptr(); return;
case kind::decl_constant: as_constant.~unique_ptr(); return;
case kind::decl_usingtree: as_usingtree.~unique_ptr(); return; case kind::decl_usingtree: as_usingtree.~unique_ptr(); return;
default: return; default: return;
} }

View File

@ -98,6 +98,7 @@ enum class kind
stmt_dev, stmt_dev,
stmt_expr, stmt_expr,
stmt_call, stmt_call,
stmt_const,
stmt_assign, stmt_assign,
stmt_endon, stmt_endon,
stmt_notify, stmt_notify,
@ -122,7 +123,6 @@ enum class kind
stmt_prof_begin, stmt_prof_begin,
stmt_prof_end, stmt_prof_end,
decl_thread, decl_thread,
decl_constant,
decl_usingtree, decl_usingtree,
decl_dev_begin, decl_dev_begin,
decl_dev_end, decl_dev_end,
@ -232,6 +232,7 @@ struct stmt_list;
struct stmt_dev; struct stmt_dev;
struct stmt_expr; struct stmt_expr;
struct stmt_call; struct stmt_call;
struct stmt_const;
struct stmt_assign; struct stmt_assign;
struct stmt_endon; struct stmt_endon;
struct stmt_notify; struct stmt_notify;
@ -256,7 +257,6 @@ struct stmt_breakpoint;
struct stmt_prof_begin; struct stmt_prof_begin;
struct stmt_prof_end; struct stmt_prof_end;
struct decl_thread; struct decl_thread;
struct decl_constant;
struct decl_usingtree; struct decl_usingtree;
struct decl_dev_begin; struct decl_dev_begin;
struct decl_dev_end; struct decl_dev_end;
@ -405,6 +405,7 @@ union stmt
std::unique_ptr<stmt_dev> as_dev; std::unique_ptr<stmt_dev> as_dev;
std::unique_ptr<stmt_expr> as_expr; std::unique_ptr<stmt_expr> as_expr;
std::unique_ptr<stmt_call> as_call; std::unique_ptr<stmt_call> as_call;
std::unique_ptr<stmt_const> as_const;
std::unique_ptr<stmt_assign> as_assign; std::unique_ptr<stmt_assign> as_assign;
std::unique_ptr<stmt_endon> as_endon; std::unique_ptr<stmt_endon> as_endon;
std::unique_ptr<stmt_notify> as_notify; std::unique_ptr<stmt_notify> as_notify;
@ -459,7 +460,6 @@ union decl
std::unique_ptr<decl_dev_begin> as_dev_begin; std::unique_ptr<decl_dev_begin> as_dev_begin;
std::unique_ptr<decl_dev_end> as_dev_end; std::unique_ptr<decl_dev_end> as_dev_end;
std::unique_ptr<decl_usingtree> as_usingtree; std::unique_ptr<decl_usingtree> as_usingtree;
std::unique_ptr<decl_constant> as_constant;
std::unique_ptr<decl_thread> as_thread; std::unique_ptr<decl_thread> as_thread;
decl(); decl();
@ -1457,6 +1457,18 @@ struct stmt_call : public node
auto print() const -> std::string override; auto print() const -> std::string override;
}; };
struct stmt_const : public node
{
using ptr = std::unique_ptr<stmt_const>;
expr_identifier::ptr lvalue;
expr rvalue;
stmt_const(expr_identifier::ptr lvalue, expr rvalue);
stmt_const(const location& loc, expr_identifier::ptr lvalue, expr rvalue);
auto print() const -> std::string override;
};
struct stmt_assign : public node struct stmt_assign : public node
{ {
using ptr = std::unique_ptr<stmt_assign>; using ptr = std::unique_ptr<stmt_assign>;
@ -1763,18 +1775,6 @@ struct decl_thread : public node
auto print() const -> std::string override; auto print() const -> std::string override;
}; };
struct decl_constant : public node
{
using ptr = std::unique_ptr<decl_constant>;
expr_identifier::ptr name;
expr value;
decl_constant(expr_identifier::ptr name, expr value);
decl_constant(const location& loc, expr_identifier::ptr name, expr value);
auto print() const -> std::string override;
};
struct decl_usingtree : public node struct decl_usingtree : public node
{ {
using ptr = std::unique_ptr<decl_usingtree>; using ptr = std::unique_ptr<decl_usingtree>;