enhance developer mode

This commit is contained in:
xensik 2021-12-31 15:22:21 +01:00
parent 454d3e23fb
commit 9dbdd37f15
65 changed files with 21605 additions and 20013 deletions

View File

@ -36,9 +36,9 @@ RGX_INT_HEX 0[xX][0-9a-fA-F]+
RGX_INT_DEC [0-9]+ RGX_INT_DEC [0-9]+
RGX_DEFAULT (.|\n) RGX_DEFAULT (.|\n)
%x COMMENT_BLOCK_STATE %x COMMENT_STATE
%s DEVBLOCK_ON_STATE %x DEV_OFF_STATE
%x DEVBLOCK_OFF_STATE %s DEV_ON_STATE
%% %%
@ -47,22 +47,26 @@ RGX_DEFAULT (.|\n)
%} %}
[ \t\r] { ctx->loc.step(); } [ \t\r] { ctx->loc.step(); }
\n { ctx->loc.lines(yyleng); ctx->loc.step(); } \n { ctx->loc.lines(yyleng); ctx->loc.step(); }
"//".* "//".*
"/*" { BEGIN(COMMENT_BLOCK_STATE); } "/*" { BEGIN(COMMENT_STATE); }
<COMMENT_BLOCK_STATE>. <COMMENT_STATE>.
<COMMENT_BLOCK_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); } <COMMENT_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<COMMENT_BLOCK_STATE>"*/" { BEGIN(INITIAL); } <COMMENT_STATE>"*/" { BEGIN(INITIAL); }
<COMMENT_STATE><<EOF>> { throw h1::parser::syntax_error(ctx->loc, "unmatched multiline comment start ('/*')"); }
"/#" { BEGIN(ctx->mode == xsk::gsc::build::dev ? DEVBLOCK_ON_STATE : DEVBLOCK_OFF_STATE); }
<DEVBLOCK_OFF_STATE>.
<DEVBLOCK_OFF_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<DEVBLOCK_OFF_STATE,DEVBLOCK_ON_STATE>"#/" { BEGIN(INITIAL); }
<INITIAL>"*/" { throw h1::parser::syntax_error(ctx->loc, "unmatched multiline comment end ('*/')"); } <INITIAL>"*/" { throw h1::parser::syntax_error(ctx->loc, "unmatched multiline comment end ('*/')"); }
<DEV_ON_STATE>"/#" { throw h1::parser::syntax_error(ctx->loc, "cannot recurse devblock ('/#')"); }
<DEV_ON_STATE>"#/" { BEGIN(INITIAL); return h1::parser::make_DEVEND(ctx->loc); }
<DEV_ON_STATE><<EOF>> { throw h1::parser::syntax_error(ctx->loc, "unmatched devblock start ('/#')"); }
"/#" { BEGIN(ctx->mode == xsk::gsc::build::dev ? DEV_ON_STATE : DEV_OFF_STATE); if(ctx->mode == xsk::gsc::build::dev) return h1::parser::make_DEVBEGIN(ctx->loc); }
<DEV_OFF_STATE>.
<DEV_OFF_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<DEV_OFF_STATE>"#/" { BEGIN(INITIAL); }
<DEV_OFF_STATE><<EOF>> { throw h1::parser::syntax_error(ctx->loc, "unmatched devblock start ('/#')"); }
<INITIAL>"#/" { throw h1::parser::syntax_error(ctx->loc, "unmatched devblock end ('#/')"); } <INITIAL>"#/" { throw h1::parser::syntax_error(ctx->loc, "unmatched devblock end ('#/')"); }
"#inline" { return h1::parser::make_INLINE(ctx->loc); } "#inline" { return h1::parser::make_INLINE(ctx->loc); }

View File

@ -45,6 +45,8 @@ using namespace xsk::gsc;
xsk::gsc::h1::parser::symbol_type H1lex(yyscan_t yyscanner, xsk::gsc::context* ctx); xsk::gsc::h1::parser::symbol_type H1lex(yyscan_t yyscanner, xsk::gsc::context* ctx);
} }
%token DEVBEGIN "/#"
%token DEVEND "#/"
%token INLINE "#inline" %token INLINE "#inline"
%token INCLUDE "#include" %token INCLUDE "#include"
%token USINGTREE "#using_animtree" %token USINGTREE "#using_animtree"
@ -147,6 +149,7 @@ xsk::gsc::h1::parser::symbol_type H1lex(yyscan_t yyscanner, xsk::gsc::context* c
%type <ast::decl_constant::ptr> decl_constant %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_list::ptr> stmt_dev
%type <ast::stmt_list::ptr> stmt_block %type <ast::stmt_list::ptr> stmt_block
%type <ast::stmt_list::ptr> stmt_list %type <ast::stmt_list::ptr> stmt_list
%type <ast::stmt_expr::ptr> stmt_expr %type <ast::stmt_expr::ptr> stmt_expr
@ -277,7 +280,9 @@ include
; ;
declaration declaration
: decl_usingtree { $$.as_usingtree = std::move($1); } : DEVBEGIN { $$.as_dev_begin = std::make_unique<ast::decl_dev_begin>(@$); }
| DEVEND { $$.as_dev_end = std::make_unique<ast::decl_dev_end>(@$); }
| decl_usingtree { $$.as_usingtree = std::move($1); }
| decl_constant { $$.as_constant = std::move($1); } | decl_constant { $$.as_constant = std::move($1); }
| decl_thread { $$.as_thread = std::move($1); } | decl_thread { $$.as_thread = std::move($1); }
; ;
@ -298,7 +303,8 @@ decl_thread
; ;
stmt stmt
: stmt_block { $$.as_list = std::move($1); } : stmt_dev { $$.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_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); }
@ -325,6 +331,11 @@ stmt
| stmt_prof_end { $$.as_prof_end = std::move($1); } | stmt_prof_end { $$.as_prof_end = std::move($1); }
; ;
stmt_dev
: DEVBEGIN stmt_list DEVEND { $$ = std::move($2); }
| DEVBEGIN DEVEND { $$ = std::make_unique<ast::stmt_list>(@$); }
;
stmt_block stmt_block
: LBRACE stmt_list RBRACE { $$ = std::move($2); } : LBRACE stmt_list RBRACE { $$ = std::move($2); }
| LBRACE RBRACE { $$ = std::make_unique<ast::stmt_list>(@$); } | LBRACE RBRACE { $$ = std::make_unique<ast::stmt_list>(@$); }

View File

@ -36,9 +36,9 @@ RGX_INT_HEX 0[xX][0-9a-fA-F]+
RGX_INT_DEC [0-9]+ RGX_INT_DEC [0-9]+
RGX_DEFAULT (.|\n) RGX_DEFAULT (.|\n)
%x COMMENT_BLOCK_STATE %x COMMENT_STATE
%s DEVBLOCK_ON_STATE %x DEV_OFF_STATE
%x DEVBLOCK_OFF_STATE %s DEV_ON_STATE
%% %%
@ -47,22 +47,26 @@ RGX_DEFAULT (.|\n)
%} %}
[ \t\r] { ctx->loc.step(); } [ \t\r] { ctx->loc.step(); }
\n { ctx->loc.lines(yyleng); ctx->loc.step(); } \n { ctx->loc.lines(yyleng); ctx->loc.step(); }
"//".* "//".*
"/*" { BEGIN(COMMENT_BLOCK_STATE); } "/*" { BEGIN(COMMENT_STATE); }
<COMMENT_BLOCK_STATE>. <COMMENT_STATE>.
<COMMENT_BLOCK_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); } <COMMENT_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<COMMENT_BLOCK_STATE>"*/" { BEGIN(INITIAL); } <COMMENT_STATE>"*/" { BEGIN(INITIAL); }
<COMMENT_STATE><<EOF>> { throw h2::parser::syntax_error(ctx->loc, "unmatched multiline comment start ('/*')"); }
"/#" { BEGIN(ctx->mode == xsk::gsc::build::dev ? DEVBLOCK_ON_STATE : DEVBLOCK_OFF_STATE); }
<DEVBLOCK_OFF_STATE>.
<DEVBLOCK_OFF_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<DEVBLOCK_OFF_STATE,DEVBLOCK_ON_STATE>"#/" { BEGIN(INITIAL); }
<INITIAL>"*/" { throw h2::parser::syntax_error(ctx->loc, "unmatched multiline comment end ('*/')"); } <INITIAL>"*/" { throw h2::parser::syntax_error(ctx->loc, "unmatched multiline comment end ('*/')"); }
<DEV_ON_STATE>"/#" { throw h2::parser::syntax_error(ctx->loc, "cannot recurse devblock ('/#')"); }
<DEV_ON_STATE>"#/" { BEGIN(INITIAL); return h2::parser::make_DEVEND(ctx->loc); }
<DEV_ON_STATE><<EOF>> { throw h2::parser::syntax_error(ctx->loc, "unmatched devblock start ('/#')"); }
"/#" { BEGIN(ctx->mode == xsk::gsc::build::dev ? DEV_ON_STATE : DEV_OFF_STATE); if(ctx->mode == xsk::gsc::build::dev) return h2::parser::make_DEVBEGIN(ctx->loc); }
<DEV_OFF_STATE>.
<DEV_OFF_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<DEV_OFF_STATE>"#/" { BEGIN(INITIAL); }
<DEV_OFF_STATE><<EOF>> { throw h2::parser::syntax_error(ctx->loc, "unmatched devblock start ('/#')"); }
<INITIAL>"#/" { throw h2::parser::syntax_error(ctx->loc, "unmatched devblock end ('#/')"); } <INITIAL>"#/" { throw h2::parser::syntax_error(ctx->loc, "unmatched devblock end ('#/')"); }
"#inline" { return h2::parser::make_INLINE(ctx->loc); } "#inline" { return h2::parser::make_INLINE(ctx->loc); }

View File

@ -45,6 +45,8 @@ using namespace xsk::gsc;
xsk::gsc::h2::parser::symbol_type H2lex(yyscan_t yyscanner, xsk::gsc::context* ctx); xsk::gsc::h2::parser::symbol_type H2lex(yyscan_t yyscanner, xsk::gsc::context* ctx);
} }
%token DEVBEGIN "/#"
%token DEVEND "#/"
%token INLINE "#inline" %token INLINE "#inline"
%token INCLUDE "#include" %token INCLUDE "#include"
%token USINGTREE "#using_animtree" %token USINGTREE "#using_animtree"
@ -147,6 +149,7 @@ xsk::gsc::h2::parser::symbol_type H2lex(yyscan_t yyscanner, xsk::gsc::context* c
%type <ast::decl_constant::ptr> decl_constant %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_list::ptr> stmt_dev
%type <ast::stmt_list::ptr> stmt_block %type <ast::stmt_list::ptr> stmt_block
%type <ast::stmt_list::ptr> stmt_list %type <ast::stmt_list::ptr> stmt_list
%type <ast::stmt_expr::ptr> stmt_expr %type <ast::stmt_expr::ptr> stmt_expr
@ -277,7 +280,9 @@ include
; ;
declaration declaration
: decl_usingtree { $$.as_usingtree = std::move($1); } : DEVBEGIN { $$.as_dev_begin = std::make_unique<ast::decl_dev_begin>(@$); }
| DEVEND { $$.as_dev_end = std::make_unique<ast::decl_dev_end>(@$); }
| decl_usingtree { $$.as_usingtree = std::move($1); }
| decl_constant { $$.as_constant = std::move($1); } | decl_constant { $$.as_constant = std::move($1); }
| decl_thread { $$.as_thread = std::move($1); } | decl_thread { $$.as_thread = std::move($1); }
; ;
@ -298,7 +303,8 @@ decl_thread
; ;
stmt stmt
: stmt_block { $$.as_list = std::move($1); } : stmt_dev { $$.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_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); }
@ -325,6 +331,11 @@ stmt
| stmt_prof_end { $$.as_prof_end = std::move($1); } | stmt_prof_end { $$.as_prof_end = std::move($1); }
; ;
stmt_dev
: DEVBEGIN stmt_list DEVEND { $$ = std::move($2); }
| DEVBEGIN DEVEND { $$ = std::make_unique<ast::stmt_list>(@$); }
;
stmt_block stmt_block
: LBRACE stmt_list RBRACE { $$ = std::move($2); } : LBRACE stmt_list RBRACE { $$ = std::move($2); }
| LBRACE RBRACE { $$ = std::make_unique<ast::stmt_list>(@$); } | LBRACE RBRACE { $$ = std::make_unique<ast::stmt_list>(@$); }

View File

@ -36,9 +36,9 @@ RGX_INT_HEX 0[xX][0-9a-fA-F]+
RGX_INT_DEC [0-9]+ RGX_INT_DEC [0-9]+
RGX_DEFAULT (.|\n) RGX_DEFAULT (.|\n)
%x COMMENT_BLOCK_STATE %x COMMENT_STATE
%s DEVBLOCK_ON_STATE %x DEV_OFF_STATE
%x DEVBLOCK_OFF_STATE %s DEV_ON_STATE
%% %%
@ -47,22 +47,26 @@ RGX_DEFAULT (.|\n)
%} %}
[ \t\r] { ctx->loc.step(); } [ \t\r] { ctx->loc.step(); }
\n { ctx->loc.lines(yyleng); ctx->loc.step(); } \n { ctx->loc.lines(yyleng); ctx->loc.step(); }
"//".* "//".*
"/*" { BEGIN(COMMENT_BLOCK_STATE); } "/*" { BEGIN(COMMENT_STATE); }
<COMMENT_BLOCK_STATE>. <COMMENT_STATE>.
<COMMENT_BLOCK_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); } <COMMENT_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<COMMENT_BLOCK_STATE>"*/" { BEGIN(INITIAL); } <COMMENT_STATE>"*/" { BEGIN(INITIAL); }
<COMMENT_STATE><<EOF>> { throw iw5::parser::syntax_error(ctx->loc, "unmatched multiline comment start ('/*')"); }
"/#" { BEGIN(ctx->mode == xsk::gsc::build::dev ? DEVBLOCK_ON_STATE : DEVBLOCK_OFF_STATE); }
<DEVBLOCK_OFF_STATE>.
<DEVBLOCK_OFF_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<DEVBLOCK_OFF_STATE,DEVBLOCK_ON_STATE>"#/" { BEGIN(INITIAL); }
<INITIAL>"*/" { throw iw5::parser::syntax_error(ctx->loc, "unmatched multiline comment end ('*/')"); } <INITIAL>"*/" { throw iw5::parser::syntax_error(ctx->loc, "unmatched multiline comment end ('*/')"); }
<DEV_ON_STATE>"/#" { throw iw5::parser::syntax_error(ctx->loc, "cannot recurse devblock ('/#')"); }
<DEV_ON_STATE>"#/" { BEGIN(INITIAL); return iw5::parser::make_DEVEND(ctx->loc); }
<DEV_ON_STATE><<EOF>> { throw iw5::parser::syntax_error(ctx->loc, "unmatched devblock start ('/#')"); }
"/#" { BEGIN(ctx->mode == xsk::gsc::build::dev ? DEV_ON_STATE : DEV_OFF_STATE); if(ctx->mode == xsk::gsc::build::dev) return iw5::parser::make_DEVBEGIN(ctx->loc); }
<DEV_OFF_STATE>.
<DEV_OFF_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<DEV_OFF_STATE>"#/" { BEGIN(INITIAL); }
<DEV_OFF_STATE><<EOF>> { throw iw5::parser::syntax_error(ctx->loc, "unmatched devblock start ('/#')"); }
<INITIAL>"#/" { throw iw5::parser::syntax_error(ctx->loc, "unmatched devblock end ('#/')"); } <INITIAL>"#/" { throw iw5::parser::syntax_error(ctx->loc, "unmatched devblock end ('#/')"); }
"#inline" { return iw5::parser::make_INLINE(ctx->loc); } "#inline" { return iw5::parser::make_INLINE(ctx->loc); }

View File

@ -45,6 +45,8 @@ using namespace xsk::gsc;
xsk::gsc::iw5::parser::symbol_type IW5lex(yyscan_t yyscanner, xsk::gsc::context* ctx); xsk::gsc::iw5::parser::symbol_type IW5lex(yyscan_t yyscanner, xsk::gsc::context* ctx);
} }
%token DEVBEGIN "/#"
%token DEVEND "#/"
%token INLINE "#inline" %token INLINE "#inline"
%token INCLUDE "#include" %token INCLUDE "#include"
%token USINGTREE "#using_animtree" %token USINGTREE "#using_animtree"
@ -146,6 +148,7 @@ xsk::gsc::iw5::parser::symbol_type IW5lex(yyscan_t yyscanner, xsk::gsc::context*
%type <ast::decl_constant::ptr> decl_constant %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_list::ptr> stmt_dev
%type <ast::stmt_list::ptr> stmt_block %type <ast::stmt_list::ptr> stmt_block
%type <ast::stmt_list::ptr> stmt_list %type <ast::stmt_list::ptr> stmt_list
%type <ast::stmt_expr::ptr> stmt_expr %type <ast::stmt_expr::ptr> stmt_expr
@ -275,7 +278,9 @@ include
; ;
declaration declaration
: decl_usingtree { $$.as_usingtree = std::move($1); } : DEVBEGIN { $$.as_dev_begin = std::make_unique<ast::decl_dev_begin>(@$); }
| DEVEND { $$.as_dev_end = std::make_unique<ast::decl_dev_end>(@$); }
| decl_usingtree { $$.as_usingtree = std::move($1); }
| decl_constant { $$.as_constant = std::move($1); } | decl_constant { $$.as_constant = std::move($1); }
| decl_thread { $$.as_thread = std::move($1); } | decl_thread { $$.as_thread = std::move($1); }
; ;
@ -296,7 +301,8 @@ decl_thread
; ;
stmt stmt
: stmt_block { $$.as_list = std::move($1); } : stmt_dev { $$.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_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); }
@ -322,6 +328,11 @@ stmt
| stmt_prof_end { $$.as_prof_end = std::move($1); } | stmt_prof_end { $$.as_prof_end = std::move($1); }
; ;
stmt_dev
: DEVBEGIN stmt_list DEVEND { $$ = std::move($2); }
| DEVBEGIN DEVEND { $$ = std::make_unique<ast::stmt_list>(@$); }
;
stmt_block stmt_block
: LBRACE stmt_list RBRACE { $$ = std::move($2); } : LBRACE stmt_list RBRACE { $$ = std::move($2); }
| LBRACE RBRACE { $$ = std::make_unique<ast::stmt_list>(@$); } | LBRACE RBRACE { $$ = std::make_unique<ast::stmt_list>(@$); }

View File

@ -36,9 +36,9 @@ RGX_INT_HEX 0[xX][0-9a-fA-F]+
RGX_INT_DEC [0-9]+ RGX_INT_DEC [0-9]+
RGX_DEFAULT (.|\n) RGX_DEFAULT (.|\n)
%x COMMENT_BLOCK_STATE %x COMMENT_STATE
%s DEVBLOCK_ON_STATE %x DEV_OFF_STATE
%x DEVBLOCK_OFF_STATE %s DEV_ON_STATE
%% %%
@ -47,22 +47,26 @@ RGX_DEFAULT (.|\n)
%} %}
[ \t\r] { ctx->loc.step(); } [ \t\r] { ctx->loc.step(); }
\n { ctx->loc.lines(yyleng); ctx->loc.step(); } \n { ctx->loc.lines(yyleng); ctx->loc.step(); }
"//".* "//".*
"/*" { BEGIN(COMMENT_BLOCK_STATE); } "/*" { BEGIN(COMMENT_STATE); }
<COMMENT_BLOCK_STATE>. <COMMENT_STATE>.
<COMMENT_BLOCK_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); } <COMMENT_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<COMMENT_BLOCK_STATE>"*/" { BEGIN(INITIAL); } <COMMENT_STATE>"*/" { BEGIN(INITIAL); }
<COMMENT_STATE><<EOF>> { throw iw6::parser::syntax_error(ctx->loc, "unmatched multiline comment start ('/*')"); }
"/#" { BEGIN(ctx->mode == xsk::gsc::build::dev ? DEVBLOCK_ON_STATE : DEVBLOCK_OFF_STATE); }
<DEVBLOCK_OFF_STATE>.
<DEVBLOCK_OFF_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<DEVBLOCK_OFF_STATE,DEVBLOCK_ON_STATE>"#/" { BEGIN(INITIAL); }
<INITIAL>"*/" { throw iw6::parser::syntax_error(ctx->loc, "unmatched multiline comment end ('*/')"); } <INITIAL>"*/" { throw iw6::parser::syntax_error(ctx->loc, "unmatched multiline comment end ('*/')"); }
<DEV_ON_STATE>"/#" { throw iw6::parser::syntax_error(ctx->loc, "cannot recurse devblock ('/#')"); }
<DEV_ON_STATE>"#/" { BEGIN(INITIAL); return iw6::parser::make_DEVEND(ctx->loc); }
<DEV_ON_STATE><<EOF>> { throw iw6::parser::syntax_error(ctx->loc, "unmatched devblock start ('/#')"); }
"/#" { BEGIN(ctx->mode == xsk::gsc::build::dev ? DEV_ON_STATE : DEV_OFF_STATE); if(ctx->mode == xsk::gsc::build::dev) return iw6::parser::make_DEVBEGIN(ctx->loc); }
<DEV_OFF_STATE>.
<DEV_OFF_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<DEV_OFF_STATE>"#/" { BEGIN(INITIAL); }
<DEV_OFF_STATE><<EOF>> { throw iw6::parser::syntax_error(ctx->loc, "unmatched devblock start ('/#')"); }
<INITIAL>"#/" { throw iw6::parser::syntax_error(ctx->loc, "unmatched devblock end ('#/')"); } <INITIAL>"#/" { throw iw6::parser::syntax_error(ctx->loc, "unmatched devblock end ('#/')"); }
"#inline" { return iw6::parser::make_INLINE(ctx->loc); } "#inline" { return iw6::parser::make_INLINE(ctx->loc); }

View File

@ -45,6 +45,8 @@ using namespace xsk::gsc;
xsk::gsc::iw6::parser::symbol_type IW6lex(yyscan_t yyscanner, xsk::gsc::context* ctx); xsk::gsc::iw6::parser::symbol_type IW6lex(yyscan_t yyscanner, xsk::gsc::context* ctx);
} }
%token DEVBEGIN "/#"
%token DEVEND "#/"
%token INLINE "#inline" %token INLINE "#inline"
%token INCLUDE "#include" %token INCLUDE "#include"
%token USINGTREE "#using_animtree" %token USINGTREE "#using_animtree"
@ -146,6 +148,7 @@ xsk::gsc::iw6::parser::symbol_type IW6lex(yyscan_t yyscanner, xsk::gsc::context*
%type <ast::decl_constant::ptr> decl_constant %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_list::ptr> stmt_dev
%type <ast::stmt_list::ptr> stmt_block %type <ast::stmt_list::ptr> stmt_block
%type <ast::stmt_list::ptr> stmt_list %type <ast::stmt_list::ptr> stmt_list
%type <ast::stmt_expr::ptr> stmt_expr %type <ast::stmt_expr::ptr> stmt_expr
@ -275,7 +278,9 @@ include
; ;
declaration declaration
: decl_usingtree { $$.as_usingtree = std::move($1); } : DEVBEGIN { $$.as_dev_begin = std::make_unique<ast::decl_dev_begin>(@$); }
| DEVEND { $$.as_dev_end = std::make_unique<ast::decl_dev_end>(@$); }
| decl_usingtree { $$.as_usingtree = std::move($1); }
| decl_constant { $$.as_constant = std::move($1); } | decl_constant { $$.as_constant = std::move($1); }
| decl_thread { $$.as_thread = std::move($1); } | decl_thread { $$.as_thread = std::move($1); }
; ;
@ -296,7 +301,8 @@ decl_thread
; ;
stmt stmt
: stmt_block { $$.as_list = std::move($1); } : stmt_dev { $$.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_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); }
@ -322,6 +328,11 @@ stmt
| stmt_prof_end { $$.as_prof_end = std::move($1); } | stmt_prof_end { $$.as_prof_end = std::move($1); }
; ;
stmt_dev
: DEVBEGIN stmt_list DEVEND { $$ = std::move($2); }
| DEVBEGIN DEVEND { $$ = std::make_unique<ast::stmt_list>(@$); }
;
stmt_block stmt_block
: LBRACE stmt_list RBRACE { $$ = std::move($2); } : LBRACE stmt_list RBRACE { $$ = std::move($2); }
| LBRACE RBRACE { $$ = std::make_unique<ast::stmt_list>(@$); } | LBRACE RBRACE { $$ = std::make_unique<ast::stmt_list>(@$); }

View File

@ -36,9 +36,9 @@ RGX_INT_HEX 0[xX][0-9a-fA-F]+
RGX_INT_DEC [0-9]+ RGX_INT_DEC [0-9]+
RGX_DEFAULT (.|\n) RGX_DEFAULT (.|\n)
%x COMMENT_BLOCK_STATE %x COMMENT_STATE
%s DEVBLOCK_ON_STATE %x DEV_OFF_STATE
%x DEVBLOCK_OFF_STATE %s DEV_ON_STATE
%% %%
@ -47,22 +47,26 @@ RGX_DEFAULT (.|\n)
%} %}
[ \t\r] { ctx->loc.step(); } [ \t\r] { ctx->loc.step(); }
\n { ctx->loc.lines(yyleng); ctx->loc.step(); } \n { ctx->loc.lines(yyleng); ctx->loc.step(); }
"//".* "//".*
"/*" { BEGIN(COMMENT_BLOCK_STATE); } "/*" { BEGIN(COMMENT_STATE); }
<COMMENT_BLOCK_STATE>. <COMMENT_STATE>.
<COMMENT_BLOCK_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); } <COMMENT_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<COMMENT_BLOCK_STATE>"*/" { BEGIN(INITIAL); } <COMMENT_STATE>"*/" { BEGIN(INITIAL); }
<COMMENT_STATE><<EOF>> { throw iw7::parser::syntax_error(ctx->loc, "unmatched multiline comment start ('/*')"); }
"/#" { BEGIN(ctx->mode == xsk::gsc::build::dev ? DEVBLOCK_ON_STATE : DEVBLOCK_OFF_STATE); }
<DEVBLOCK_OFF_STATE>.
<DEVBLOCK_OFF_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<DEVBLOCK_OFF_STATE,DEVBLOCK_ON_STATE>"#/" { BEGIN(INITIAL); }
<INITIAL>"*/" { throw iw7::parser::syntax_error(ctx->loc, "unmatched multiline comment end ('*/')"); } <INITIAL>"*/" { throw iw7::parser::syntax_error(ctx->loc, "unmatched multiline comment end ('*/')"); }
<DEV_ON_STATE>"/#" { throw iw7::parser::syntax_error(ctx->loc, "cannot recurse devblock ('/#')"); }
<DEV_ON_STATE>"#/" { BEGIN(INITIAL); return iw7::parser::make_DEVEND(ctx->loc); }
<DEV_ON_STATE><<EOF>> { throw iw7::parser::syntax_error(ctx->loc, "unmatched devblock start ('/#')"); }
"/#" { BEGIN(ctx->mode == xsk::gsc::build::dev ? DEV_ON_STATE : DEV_OFF_STATE); if(ctx->mode == xsk::gsc::build::dev) return iw7::parser::make_DEVBEGIN(ctx->loc); }
<DEV_OFF_STATE>.
<DEV_OFF_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<DEV_OFF_STATE>"#/" { BEGIN(INITIAL); }
<DEV_OFF_STATE><<EOF>> { throw iw7::parser::syntax_error(ctx->loc, "unmatched devblock start ('/#')"); }
<INITIAL>"#/" { throw iw7::parser::syntax_error(ctx->loc, "unmatched devblock end ('#/')"); } <INITIAL>"#/" { throw iw7::parser::syntax_error(ctx->loc, "unmatched devblock end ('#/')"); }
"#inline" { return iw7::parser::make_INLINE(ctx->loc); } "#inline" { return iw7::parser::make_INLINE(ctx->loc); }

View File

@ -45,6 +45,8 @@ using namespace xsk::gsc;
xsk::gsc::iw7::parser::symbol_type IW7lex(yyscan_t yyscanner, xsk::gsc::context* ctx); xsk::gsc::iw7::parser::symbol_type IW7lex(yyscan_t yyscanner, xsk::gsc::context* ctx);
} }
%token DEVBEGIN "/#"
%token DEVEND "#/"
%token INLINE "#inline" %token INLINE "#inline"
%token INCLUDE "#include" %token INCLUDE "#include"
%token USINGTREE "#using_animtree" %token USINGTREE "#using_animtree"
@ -146,6 +148,7 @@ xsk::gsc::iw7::parser::symbol_type IW7lex(yyscan_t yyscanner, xsk::gsc::context*
%type <ast::decl_constant::ptr> decl_constant %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_list::ptr> stmt_dev
%type <ast::stmt_list::ptr> stmt_block %type <ast::stmt_list::ptr> stmt_block
%type <ast::stmt_list::ptr> stmt_list %type <ast::stmt_list::ptr> stmt_list
%type <ast::stmt_expr::ptr> stmt_expr %type <ast::stmt_expr::ptr> stmt_expr
@ -275,7 +278,9 @@ include
; ;
declaration declaration
: decl_usingtree { $$.as_usingtree = std::move($1); } : DEVBEGIN { $$.as_dev_begin = std::make_unique<ast::decl_dev_begin>(@$); }
| DEVEND { $$.as_dev_end = std::make_unique<ast::decl_dev_end>(@$); }
| decl_usingtree { $$.as_usingtree = std::move($1); }
| decl_constant { $$.as_constant = std::move($1); } | decl_constant { $$.as_constant = std::move($1); }
| decl_thread { $$.as_thread = std::move($1); } | decl_thread { $$.as_thread = std::move($1); }
; ;
@ -296,7 +301,8 @@ decl_thread
; ;
stmt stmt
: stmt_block { $$.as_list = std::move($1); } : stmt_dev { $$.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_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); }
@ -322,6 +328,11 @@ stmt
| stmt_prof_end { $$.as_prof_end = std::move($1); } | stmt_prof_end { $$.as_prof_end = std::move($1); }
; ;
stmt_dev
: DEVBEGIN stmt_list DEVEND { $$ = std::move($2); }
| DEVBEGIN DEVEND { $$ = std::make_unique<ast::stmt_list>(@$); }
;
stmt_block stmt_block
: LBRACE stmt_list RBRACE { $$ = std::move($2); } : LBRACE stmt_list RBRACE { $$ = std::move($2); }
| LBRACE RBRACE { $$ = std::make_unique<ast::stmt_list>(@$); } | LBRACE RBRACE { $$ = std::make_unique<ast::stmt_list>(@$); }

View File

@ -36,9 +36,9 @@ RGX_INT_HEX 0[xX][0-9a-fA-F]+
RGX_INT_DEC [0-9]+ RGX_INT_DEC [0-9]+
RGX_DEFAULT (.|\n) RGX_DEFAULT (.|\n)
%x COMMENT_BLOCK_STATE %x COMMENT_STATE
%s DEVBLOCK_ON_STATE %x DEV_OFF_STATE
%x DEVBLOCK_OFF_STATE %s DEV_ON_STATE
%% %%
@ -47,22 +47,26 @@ RGX_DEFAULT (.|\n)
%} %}
[ \t\r] { ctx->loc.step(); } [ \t\r] { ctx->loc.step(); }
\n { ctx->loc.lines(yyleng); ctx->loc.step(); } \n { ctx->loc.lines(yyleng); ctx->loc.step(); }
"//".* "//".*
"/*" { BEGIN(COMMENT_BLOCK_STATE); } "/*" { BEGIN(COMMENT_STATE); }
<COMMENT_BLOCK_STATE>. <COMMENT_STATE>.
<COMMENT_BLOCK_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); } <COMMENT_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<COMMENT_BLOCK_STATE>"*/" { BEGIN(INITIAL); } <COMMENT_STATE>"*/" { BEGIN(INITIAL); }
<COMMENT_STATE><<EOF>> { throw iw8::parser::syntax_error(ctx->loc, "unmatched multiline comment start ('/*')"); }
"/#" { BEGIN(ctx->mode == xsk::gsc::build::dev ? DEVBLOCK_ON_STATE : DEVBLOCK_OFF_STATE); }
<DEVBLOCK_OFF_STATE>.
<DEVBLOCK_OFF_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<DEVBLOCK_OFF_STATE,DEVBLOCK_ON_STATE>"#/" { BEGIN(INITIAL); }
<INITIAL>"*/" { throw iw8::parser::syntax_error(ctx->loc, "unmatched multiline comment end ('*/')"); } <INITIAL>"*/" { throw iw8::parser::syntax_error(ctx->loc, "unmatched multiline comment end ('*/')"); }
<DEV_ON_STATE>"/#" { throw iw8::parser::syntax_error(ctx->loc, "cannot recurse devblock ('/#')"); }
<DEV_ON_STATE>"#/" { BEGIN(INITIAL); return iw8::parser::make_DEVEND(ctx->loc); }
<DEV_ON_STATE><<EOF>> { throw iw8::parser::syntax_error(ctx->loc, "unmatched devblock start ('/#')"); }
"/#" { BEGIN(ctx->mode == xsk::gsc::build::dev ? DEV_ON_STATE : DEV_OFF_STATE); if(ctx->mode == xsk::gsc::build::dev) return iw8::parser::make_DEVBEGIN(ctx->loc); }
<DEV_OFF_STATE>.
<DEV_OFF_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<DEV_OFF_STATE>"#/" { BEGIN(INITIAL); }
<DEV_OFF_STATE><<EOF>> { throw iw8::parser::syntax_error(ctx->loc, "unmatched devblock start ('/#')"); }
<INITIAL>"#/" { throw iw8::parser::syntax_error(ctx->loc, "unmatched devblock end ('#/')"); } <INITIAL>"#/" { throw iw8::parser::syntax_error(ctx->loc, "unmatched devblock end ('#/')"); }
"#inline" { return iw8::parser::make_INLINE(ctx->loc); } "#inline" { return iw8::parser::make_INLINE(ctx->loc); }

View File

@ -45,6 +45,8 @@ using namespace xsk::gsc;
xsk::gsc::iw8::parser::symbol_type IW8lex(yyscan_t yyscanner, xsk::gsc::context* ctx); xsk::gsc::iw8::parser::symbol_type IW8lex(yyscan_t yyscanner, xsk::gsc::context* ctx);
} }
%token DEVBEGIN "/#"
%token DEVEND "#/"
%token INLINE "#inline" %token INLINE "#inline"
%token INCLUDE "#include" %token INCLUDE "#include"
%token USINGTREE "#using_animtree" %token USINGTREE "#using_animtree"
@ -149,6 +151,7 @@ xsk::gsc::iw8::parser::symbol_type IW8lex(yyscan_t yyscanner, xsk::gsc::context*
%type <ast::decl_constant::ptr> decl_constant %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_list::ptr> stmt_dev
%type <ast::stmt_list::ptr> stmt_block %type <ast::stmt_list::ptr> stmt_block
%type <ast::stmt_list::ptr> stmt_list %type <ast::stmt_list::ptr> stmt_list
%type <ast::stmt_expr::ptr> stmt_expr %type <ast::stmt_expr::ptr> stmt_expr
@ -281,7 +284,9 @@ include
; ;
declaration declaration
: decl_usingtree { $$.as_usingtree = std::move($1); } : DEVBEGIN { $$.as_dev_begin = std::make_unique<ast::decl_dev_begin>(@$); }
| DEVEND { $$.as_dev_end = std::make_unique<ast::decl_dev_end>(@$); }
| decl_usingtree { $$.as_usingtree = std::move($1); }
| decl_constant { $$.as_constant = std::move($1); } | decl_constant { $$.as_constant = std::move($1); }
| decl_thread { $$.as_thread = std::move($1); } | decl_thread { $$.as_thread = std::move($1); }
; ;
@ -302,7 +307,8 @@ decl_thread
; ;
stmt stmt
: stmt_block { $$.as_list = std::move($1); } : stmt_dev { $$.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_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); }
@ -329,6 +335,11 @@ stmt
| stmt_prof_end { $$.as_prof_end = std::move($1); } | stmt_prof_end { $$.as_prof_end = std::move($1); }
; ;
stmt_dev
: DEVBEGIN stmt_list DEVEND { $$ = std::move($2); }
| DEVBEGIN DEVEND { $$ = std::make_unique<ast::stmt_list>(@$); }
;
stmt_block stmt_block
: LBRACE stmt_list RBRACE { $$ = std::move($2); } : LBRACE stmt_list RBRACE { $$ = std::move($2); }
| LBRACE RBRACE { $$ = std::make_unique<ast::stmt_list>(@$); } | LBRACE RBRACE { $$ = std::make_unique<ast::stmt_list>(@$); }

View File

@ -36,9 +36,9 @@ RGX_INT_HEX 0[xX][0-9a-fA-F]+
RGX_INT_DEC [0-9]+ RGX_INT_DEC [0-9]+
RGX_DEFAULT (.|\n) RGX_DEFAULT (.|\n)
%x COMMENT_BLOCK_STATE %x COMMENT_STATE
%s DEVBLOCK_ON_STATE %x DEV_OFF_STATE
%x DEVBLOCK_OFF_STATE %s DEV_ON_STATE
%% %%
@ -47,22 +47,26 @@ RGX_DEFAULT (.|\n)
%} %}
[ \t\r] { ctx->loc.step(); } [ \t\r] { ctx->loc.step(); }
\n { ctx->loc.lines(yyleng); ctx->loc.step(); } \n { ctx->loc.lines(yyleng); ctx->loc.step(); }
"//".* "//".*
"/*" { BEGIN(COMMENT_BLOCK_STATE); } "/*" { BEGIN(COMMENT_STATE); }
<COMMENT_BLOCK_STATE>. <COMMENT_STATE>.
<COMMENT_BLOCK_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); } <COMMENT_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<COMMENT_BLOCK_STATE>"*/" { BEGIN(INITIAL); } <COMMENT_STATE>"*/" { BEGIN(INITIAL); }
<COMMENT_STATE><<EOF>> { throw s1::parser::syntax_error(ctx->loc, "unmatched multiline comment start ('/*')"); }
"/#" { BEGIN(ctx->mode == xsk::gsc::build::dev ? DEVBLOCK_ON_STATE : DEVBLOCK_OFF_STATE); }
<DEVBLOCK_OFF_STATE>.
<DEVBLOCK_OFF_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<DEVBLOCK_OFF_STATE,DEVBLOCK_ON_STATE>"#/" { BEGIN(INITIAL); }
<INITIAL>"*/" { throw s1::parser::syntax_error(ctx->loc, "unmatched multiline comment end ('*/')"); } <INITIAL>"*/" { throw s1::parser::syntax_error(ctx->loc, "unmatched multiline comment end ('*/')"); }
<DEV_ON_STATE>"/#" { throw s1::parser::syntax_error(ctx->loc, "cannot recurse devblock ('/#')"); }
<DEV_ON_STATE>"#/" { BEGIN(INITIAL); return s1::parser::make_DEVEND(ctx->loc); }
<DEV_ON_STATE><<EOF>> { throw s1::parser::syntax_error(ctx->loc, "unmatched devblock start ('/#')"); }
"/#" { BEGIN(ctx->mode == xsk::gsc::build::dev ? DEV_ON_STATE : DEV_OFF_STATE); if(ctx->mode == xsk::gsc::build::dev) return s1::parser::make_DEVBEGIN(ctx->loc); }
<DEV_OFF_STATE>.
<DEV_OFF_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<DEV_OFF_STATE>"#/" { BEGIN(INITIAL); }
<DEV_OFF_STATE><<EOF>> { throw s1::parser::syntax_error(ctx->loc, "unmatched devblock start ('/#')"); }
<INITIAL>"#/" { throw s1::parser::syntax_error(ctx->loc, "unmatched devblock end ('#/')"); } <INITIAL>"#/" { throw s1::parser::syntax_error(ctx->loc, "unmatched devblock end ('#/')"); }
"#inline" { return s1::parser::make_INLINE(ctx->loc); } "#inline" { return s1::parser::make_INLINE(ctx->loc); }

View File

@ -45,6 +45,8 @@ using namespace xsk::gsc;
xsk::gsc::s1::parser::symbol_type S1lex(yyscan_t yyscanner, xsk::gsc::context* ctx); xsk::gsc::s1::parser::symbol_type S1lex(yyscan_t yyscanner, xsk::gsc::context* ctx);
} }
%token DEVBEGIN "/#"
%token DEVEND "#/"
%token INLINE "#inline" %token INLINE "#inline"
%token INCLUDE "#include" %token INCLUDE "#include"
%token USINGTREE "#using_animtree" %token USINGTREE "#using_animtree"
@ -147,6 +149,7 @@ xsk::gsc::s1::parser::symbol_type S1lex(yyscan_t yyscanner, xsk::gsc::context* c
%type <ast::decl_constant::ptr> decl_constant %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_list::ptr> stmt_dev
%type <ast::stmt_list::ptr> stmt_block %type <ast::stmt_list::ptr> stmt_block
%type <ast::stmt_list::ptr> stmt_list %type <ast::stmt_list::ptr> stmt_list
%type <ast::stmt_expr::ptr> stmt_expr %type <ast::stmt_expr::ptr> stmt_expr
@ -277,7 +280,9 @@ include
; ;
declaration declaration
: decl_usingtree { $$.as_usingtree = std::move($1); } : DEVBEGIN { $$.as_dev_begin = std::make_unique<ast::decl_dev_begin>(@$); }
| DEVEND { $$.as_dev_end = std::make_unique<ast::decl_dev_end>(@$); }
| decl_usingtree { $$.as_usingtree = std::move($1); }
| decl_constant { $$.as_constant = std::move($1); } | decl_constant { $$.as_constant = std::move($1); }
| decl_thread { $$.as_thread = std::move($1); } | decl_thread { $$.as_thread = std::move($1); }
; ;
@ -298,7 +303,8 @@ decl_thread
; ;
stmt stmt
: stmt_block { $$.as_list = std::move($1); } : stmt_dev { $$.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_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); }
@ -325,6 +331,11 @@ stmt
| stmt_prof_end { $$.as_prof_end = std::move($1); } | stmt_prof_end { $$.as_prof_end = std::move($1); }
; ;
stmt_dev
: DEVBEGIN stmt_list DEVEND { $$ = std::move($2); }
| DEVBEGIN DEVEND { $$ = std::make_unique<ast::stmt_list>(@$); }
;
stmt_block stmt_block
: LBRACE stmt_list RBRACE { $$ = std::move($2); } : LBRACE stmt_list RBRACE { $$ = std::move($2); }
| LBRACE RBRACE { $$ = std::make_unique<ast::stmt_list>(@$); } | LBRACE RBRACE { $$ = std::make_unique<ast::stmt_list>(@$); }

View File

@ -36,9 +36,9 @@ RGX_INT_HEX 0[xX][0-9a-fA-F]+
RGX_INT_DEC [0-9]+ RGX_INT_DEC [0-9]+
RGX_DEFAULT (.|\n) RGX_DEFAULT (.|\n)
%x COMMENT_BLOCK_STATE %x COMMENT_STATE
%s DEVBLOCK_ON_STATE %x DEV_OFF_STATE
%x DEVBLOCK_OFF_STATE %s DEV_ON_STATE
%% %%
@ -47,22 +47,26 @@ RGX_DEFAULT (.|\n)
%} %}
[ \t\r] { ctx->loc.step(); } [ \t\r] { ctx->loc.step(); }
\n { ctx->loc.lines(yyleng); ctx->loc.step(); } \n { ctx->loc.lines(yyleng); ctx->loc.step(); }
"//".* "//".*
"/*" { BEGIN(COMMENT_BLOCK_STATE); } "/*" { BEGIN(COMMENT_STATE); }
<COMMENT_BLOCK_STATE>. <COMMENT_STATE>.
<COMMENT_BLOCK_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); } <COMMENT_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<COMMENT_BLOCK_STATE>"*/" { BEGIN(INITIAL); } <COMMENT_STATE>"*/" { BEGIN(INITIAL); }
<COMMENT_STATE><<EOF>> { throw s2::parser::syntax_error(ctx->loc, "unmatched multiline comment start ('/*')"); }
"/#" { BEGIN(ctx->mode == xsk::gsc::build::dev ? DEVBLOCK_ON_STATE : DEVBLOCK_OFF_STATE); }
<DEVBLOCK_OFF_STATE>.
<DEVBLOCK_OFF_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<DEVBLOCK_OFF_STATE,DEVBLOCK_ON_STATE>"#/" { BEGIN(INITIAL); }
<INITIAL>"*/" { throw s2::parser::syntax_error(ctx->loc, "unmatched multiline comment end ('*/')"); } <INITIAL>"*/" { throw s2::parser::syntax_error(ctx->loc, "unmatched multiline comment end ('*/')"); }
<DEV_ON_STATE>"/#" { throw s2::parser::syntax_error(ctx->loc, "cannot recurse devblock ('/#')"); }
<DEV_ON_STATE>"#/" { BEGIN(INITIAL); return s2::parser::make_DEVEND(ctx->loc); }
<DEV_ON_STATE><<EOF>> { throw s2::parser::syntax_error(ctx->loc, "unmatched devblock start ('/#')"); }
"/#" { BEGIN(ctx->mode == xsk::gsc::build::dev ? DEV_ON_STATE : DEV_OFF_STATE); if(ctx->mode == xsk::gsc::build::dev) return s2::parser::make_DEVBEGIN(ctx->loc); }
<DEV_OFF_STATE>.
<DEV_OFF_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<DEV_OFF_STATE>"#/" { BEGIN(INITIAL); }
<DEV_OFF_STATE><<EOF>> { throw s2::parser::syntax_error(ctx->loc, "unmatched devblock start ('/#')"); }
<INITIAL>"#/" { throw s2::parser::syntax_error(ctx->loc, "unmatched devblock end ('#/')"); } <INITIAL>"#/" { throw s2::parser::syntax_error(ctx->loc, "unmatched devblock end ('#/')"); }
"#inline" { return s2::parser::make_INLINE(ctx->loc); } "#inline" { return s2::parser::make_INLINE(ctx->loc); }

View File

@ -45,6 +45,8 @@ using namespace xsk::gsc;
xsk::gsc::s2::parser::symbol_type S2lex(yyscan_t yyscanner, xsk::gsc::context* ctx); xsk::gsc::s2::parser::symbol_type S2lex(yyscan_t yyscanner, xsk::gsc::context* ctx);
} }
%token DEVBEGIN "/#"
%token DEVEND "#/"
%token INLINE "#inline" %token INLINE "#inline"
%token INCLUDE "#include" %token INCLUDE "#include"
%token USINGTREE "#using_animtree" %token USINGTREE "#using_animtree"
@ -147,6 +149,7 @@ xsk::gsc::s2::parser::symbol_type S2lex(yyscan_t yyscanner, xsk::gsc::context* c
%type <ast::decl_constant::ptr> decl_constant %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_list::ptr> stmt_dev
%type <ast::stmt_list::ptr> stmt_block %type <ast::stmt_list::ptr> stmt_block
%type <ast::stmt_list::ptr> stmt_list %type <ast::stmt_list::ptr> stmt_list
%type <ast::stmt_expr::ptr> stmt_expr %type <ast::stmt_expr::ptr> stmt_expr
@ -277,7 +280,9 @@ include
; ;
declaration declaration
: decl_usingtree { $$.as_usingtree = std::move($1); } : DEVBEGIN { $$.as_dev_begin = std::make_unique<ast::decl_dev_begin>(@$); }
| DEVEND { $$.as_dev_end = std::make_unique<ast::decl_dev_end>(@$); }
| decl_usingtree { $$.as_usingtree = std::move($1); }
| decl_constant { $$.as_constant = std::move($1); } | decl_constant { $$.as_constant = std::move($1); }
| decl_thread { $$.as_thread = std::move($1); } | decl_thread { $$.as_thread = std::move($1); }
; ;
@ -298,7 +303,8 @@ decl_thread
; ;
stmt stmt
: stmt_block { $$.as_list = std::move($1); } : stmt_dev { $$.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_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); }
@ -325,6 +331,11 @@ stmt
| stmt_prof_end { $$.as_prof_end = std::move($1); } | stmt_prof_end { $$.as_prof_end = std::move($1); }
; ;
stmt_dev
: DEVBEGIN stmt_list DEVEND { $$ = std::move($2); }
| DEVBEGIN DEVEND { $$ = std::make_unique<ast::stmt_list>(@$); }
;
stmt_block stmt_block
: LBRACE stmt_list RBRACE { $$ = std::move($2); } : LBRACE stmt_list RBRACE { $$ = std::move($2); }
| LBRACE RBRACE { $$ = std::make_unique<ast::stmt_list>(@$); } | LBRACE RBRACE { $$ = std::make_unique<ast::stmt_list>(@$); }

View File

@ -36,9 +36,9 @@ RGX_INT_HEX 0[xX][0-9a-fA-F]+
RGX_INT_DEC [0-9]+ RGX_INT_DEC [0-9]+
RGX_DEFAULT (.|\n) RGX_DEFAULT (.|\n)
%x COMMENT_BLOCK_STATE %x COMMENT_STATE
%s DEVBLOCK_ON_STATE %x DEV_OFF_STATE
%x DEVBLOCK_OFF_STATE %s DEV_ON_STATE
%% %%
@ -47,22 +47,26 @@ RGX_DEFAULT (.|\n)
%} %}
[ \t\r] { ctx->loc.step(); } [ \t\r] { ctx->loc.step(); }
\n { ctx->loc.lines(yyleng); ctx->loc.step(); } \n { ctx->loc.lines(yyleng); ctx->loc.step(); }
"//".* "//".*
"/*" { BEGIN(COMMENT_BLOCK_STATE); } "/*" { BEGIN(COMMENT_STATE); }
<COMMENT_BLOCK_STATE>. <COMMENT_STATE>.
<COMMENT_BLOCK_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); } <COMMENT_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<COMMENT_BLOCK_STATE>"*/" { BEGIN(INITIAL); } <COMMENT_STATE>"*/" { BEGIN(INITIAL); }
<COMMENT_STATE><<EOF>> { throw s4::parser::syntax_error(ctx->loc, "unmatched multiline comment start ('/*')"); }
"/#" { BEGIN(ctx->mode == xsk::gsc::build::dev ? DEVBLOCK_ON_STATE : DEVBLOCK_OFF_STATE); }
<DEVBLOCK_OFF_STATE>.
<DEVBLOCK_OFF_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<DEVBLOCK_OFF_STATE,DEVBLOCK_ON_STATE>"#/" { BEGIN(INITIAL); }
<INITIAL>"*/" { throw s4::parser::syntax_error(ctx->loc, "unmatched multiline comment end ('*/')"); } <INITIAL>"*/" { throw s4::parser::syntax_error(ctx->loc, "unmatched multiline comment end ('*/')"); }
<DEV_ON_STATE>"/#" { throw s4::parser::syntax_error(ctx->loc, "cannot recurse devblock ('/#')"); }
<DEV_ON_STATE>"#/" { BEGIN(INITIAL); return s4::parser::make_DEVEND(ctx->loc); }
<DEV_ON_STATE><<EOF>> { throw s4::parser::syntax_error(ctx->loc, "unmatched devblock start ('/#')"); }
"/#" { BEGIN(ctx->mode == xsk::gsc::build::dev ? DEV_ON_STATE : DEV_OFF_STATE); if(ctx->mode == xsk::gsc::build::dev) return s4::parser::make_DEVBEGIN(ctx->loc); }
<DEV_OFF_STATE>.
<DEV_OFF_STATE>\n { ctx->loc.lines(yyleng); ctx->loc.step(); }
<DEV_OFF_STATE>"#/" { BEGIN(INITIAL); }
<DEV_OFF_STATE><<EOF>> { throw s4::parser::syntax_error(ctx->loc, "unmatched devblock start ('/#')"); }
<INITIAL>"#/" { throw s4::parser::syntax_error(ctx->loc, "unmatched devblock end ('#/')"); } <INITIAL>"#/" { throw s4::parser::syntax_error(ctx->loc, "unmatched devblock end ('#/')"); }
"#inline" { return s4::parser::make_INLINE(ctx->loc); } "#inline" { return s4::parser::make_INLINE(ctx->loc); }

View File

@ -45,6 +45,8 @@ using namespace xsk::gsc;
xsk::gsc::s4::parser::symbol_type S4lex(yyscan_t yyscanner, xsk::gsc::context* ctx); xsk::gsc::s4::parser::symbol_type S4lex(yyscan_t yyscanner, xsk::gsc::context* ctx);
} }
%token DEVBEGIN "/#"
%token DEVEND "#/"
%token INLINE "#inline" %token INLINE "#inline"
%token INCLUDE "#include" %token INCLUDE "#include"
%token USINGTREE "#using_animtree" %token USINGTREE "#using_animtree"
@ -149,6 +151,7 @@ xsk::gsc::s4::parser::symbol_type S4lex(yyscan_t yyscanner, xsk::gsc::context* c
%type <ast::decl_constant::ptr> decl_constant %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_list::ptr> stmt_dev
%type <ast::stmt_list::ptr> stmt_block %type <ast::stmt_list::ptr> stmt_block
%type <ast::stmt_list::ptr> stmt_list %type <ast::stmt_list::ptr> stmt_list
%type <ast::stmt_expr::ptr> stmt_expr %type <ast::stmt_expr::ptr> stmt_expr
@ -281,7 +284,9 @@ include
; ;
declaration declaration
: decl_usingtree { $$.as_usingtree = std::move($1); } : DEVBEGIN { $$.as_dev_begin = std::make_unique<ast::decl_dev_begin>(@$); }
| DEVEND { $$.as_dev_end = std::make_unique<ast::decl_dev_end>(@$); }
| decl_usingtree { $$.as_usingtree = std::move($1); }
| decl_constant { $$.as_constant = std::move($1); } | decl_constant { $$.as_constant = std::move($1); }
| decl_thread { $$.as_thread = std::move($1); } | decl_thread { $$.as_thread = std::move($1); }
; ;
@ -302,7 +307,8 @@ decl_thread
; ;
stmt stmt
: stmt_block { $$.as_list = std::move($1); } : stmt_dev { $$.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_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); }
@ -329,6 +335,11 @@ stmt
| stmt_prof_end { $$.as_prof_end = std::move($1); } | stmt_prof_end { $$.as_prof_end = std::move($1); }
; ;
stmt_dev
: DEVBEGIN stmt_list DEVEND { $$ = std::move($2); }
| DEVBEGIN DEVEND { $$ = std::make_unique<ast::stmt_list>(@$); }
;
stmt_block stmt_block
: LBRACE stmt_list RBRACE { $$ = std::move($2); } : LBRACE stmt_list RBRACE { $$ = std::move($2); }
| LBRACE RBRACE { $$ = std::make_unique<ast::stmt_list>(@$); } | LBRACE RBRACE { $$ = std::make_unique<ast::stmt_list>(@$); }

View File

@ -85,6 +85,7 @@ void compiler::compile_program(const ast::program::ptr& program)
constants_.clear(); constants_.clear();
local_functions_.clear(); local_functions_.clear();
index_ = 1; index_ = 1;
developer_thread_ = false;
for (const auto& entry : program->declarations) for (const auto& entry : program->declarations)
{ {
@ -150,6 +151,12 @@ void compiler::emit_declaration(const ast::decl& decl)
{ {
switch (decl.kind()) switch (decl.kind())
{ {
case ast::kind::decl_dev_begin:
developer_thread_ = true;
break;
case ast::kind::decl_dev_end:
developer_thread_ = false;
break;
case ast::kind::decl_usingtree: case ast::kind::decl_usingtree:
emit_decl_usingtree(decl.as_usingtree); emit_decl_usingtree(decl.as_usingtree);
break; break;
@ -166,6 +173,9 @@ void compiler::emit_declaration(const ast::decl& decl)
void compiler::emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree) void compiler::emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree)
{ {
if(developer_thread_)
throw comp_error(animtree->loc(), "cannot put #using_animtree inside /# ... #/ comment");
animtrees_.push_back({ animtree->name->value, false }); animtrees_.push_back({ animtree->name->value, false });
} }

File diff suppressed because it is too large Load Diff

View File

@ -439,9 +439,9 @@ void yyfree ( void * , yyscan_t yyscanner );
#ifdef YY_HEADER_EXPORT_START_CONDITIONS #ifdef YY_HEADER_EXPORT_START_CONDITIONS
#define INITIAL 0 #define INITIAL 0
#define COMMENT_BLOCK_STATE 1 #define COMMENT_STATE 1
#define DEVBLOCK_ON_STATE 2 #define DEV_OFF_STATE 2
#define DEVBLOCK_OFF_STATE 3 #define DEV_ON_STATE 3
#endif #endif
@ -703,7 +703,7 @@ extern int yylex (yyscan_t yyscanner);
#undef yyTABLES_NAME #undef yyTABLES_NAME
#endif #endif
#line 166 "lexer.lpp" #line 170 "lexer.lpp"
#line 709 "lexer.hpp" #line 709 "lexer.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -580,6 +580,7 @@ namespace xsk { namespace gsc { namespace h1 {
// stmt_ifelse // stmt_ifelse
char dummy54[sizeof (ast::stmt_ifelse::ptr)]; char dummy54[sizeof (ast::stmt_ifelse::ptr)];
// stmt_dev
// stmt_block // stmt_block
// stmt_list // stmt_list
char dummy55[sizeof (ast::stmt_list::ptr)]; char dummy55[sizeof (ast::stmt_list::ptr)];
@ -679,109 +680,111 @@ namespace xsk { namespace gsc { namespace h1 {
H1EOF = 0, // "end of file" H1EOF = 0, // "end of file"
H1error = 1, // error H1error = 1, // error
H1UNDEF = 2, // "invalid token" H1UNDEF = 2, // "invalid token"
INLINE = 3, // "#inline" DEVBEGIN = 3, // "/#"
INCLUDE = 4, // "#include" DEVEND = 4, // "#/"
USINGTREE = 5, // "#using_animtree" INLINE = 5, // "#inline"
ANIMTREE = 6, // "#animtree" INCLUDE = 6, // "#include"
ENDON = 7, // "endon" USINGTREE = 7, // "#using_animtree"
NOTIFY = 8, // "notify" ANIMTREE = 8, // "#animtree"
WAIT = 9, // "wait" ENDON = 9, // "endon"
WAITTILL = 10, // "waittill" NOTIFY = 10, // "notify"
WAITTILLMATCH = 11, // "waittillmatch" WAIT = 11, // "wait"
WAITTILLFRAMEEND = 12, // "waittillframeend" WAITTILL = 12, // "waittill"
WAITFRAME = 13, // "waitframe" WAITTILLMATCH = 13, // "waittillmatch"
IF = 14, // "if" WAITTILLFRAMEEND = 14, // "waittillframeend"
ELSE = 15, // "else" WAITFRAME = 15, // "waitframe"
DO = 16, // "do" IF = 16, // "if"
WHILE = 17, // "while" ELSE = 17, // "else"
FOR = 18, // "for" DO = 18, // "do"
FOREACH = 19, // "foreach" WHILE = 19, // "while"
IN = 20, // "in" FOR = 20, // "for"
SWITCH = 21, // "switch" FOREACH = 21, // "foreach"
CASE = 22, // "case" IN = 22, // "in"
DEFAULT = 23, // "default" SWITCH = 23, // "switch"
BREAK = 24, // "break" CASE = 24, // "case"
CONTINUE = 25, // "continue" DEFAULT = 25, // "default"
RETURN = 26, // "return" BREAK = 26, // "break"
BREAKPOINT = 27, // "breakpoint" CONTINUE = 27, // "continue"
PROFBEGIN = 28, // "prof_begin" RETURN = 28, // "return"
PROFEND = 29, // "prof_end" BREAKPOINT = 29, // "breakpoint"
THREAD = 30, // "thread" PROFBEGIN = 30, // "prof_begin"
CHILDTHREAD = 31, // "childthread" PROFEND = 31, // "prof_end"
THISTHREAD = 32, // "thisthread" THREAD = 32, // "thread"
CALL = 33, // "call" CHILDTHREAD = 33, // "childthread"
TRUE = 34, // "true" THISTHREAD = 34, // "thisthread"
FALSE = 35, // "false" CALL = 35, // "call"
UNDEFINED = 36, // "undefined" TRUE = 36, // "true"
SIZE = 37, // ".size" FALSE = 37, // "false"
GAME = 38, // "game" UNDEFINED = 38, // "undefined"
SELF = 39, // "self" SIZE = 39, // ".size"
ANIM = 40, // "anim" GAME = 40, // "game"
LEVEL = 41, // "level" SELF = 41, // "self"
LPAREN = 42, // "(" ANIM = 42, // "anim"
RPAREN = 43, // ")" LEVEL = 43, // "level"
LBRACE = 44, // "{" LPAREN = 44, // "("
RBRACE = 45, // "}" RPAREN = 45, // ")"
LBRACKET = 46, // "[" LBRACE = 46, // "{"
RBRACKET = 47, // "]" RBRACE = 47, // "}"
COMMA = 48, // "," LBRACKET = 48, // "["
DOT = 49, // "." RBRACKET = 49, // "]"
DOUBLECOLON = 50, // "::" COMMA = 50, // ","
COLON = 51, // ":" DOT = 51, // "."
SEMICOLON = 52, // ";" DOUBLECOLON = 52, // "::"
QMARK = 53, // "?" COLON = 53, // ":"
INCREMENT = 54, // "++" SEMICOLON = 54, // ";"
DECREMENT = 55, // "--" QMARK = 55, // "?"
LSHIFT = 56, // "<<" INCREMENT = 56, // "++"
RSHIFT = 57, // ">>" DECREMENT = 57, // "--"
OR = 58, // "||" LSHIFT = 58, // "<<"
AND = 59, // "&&" RSHIFT = 59, // ">>"
EQUALITY = 60, // "==" OR = 60, // "||"
INEQUALITY = 61, // "!=" AND = 61, // "&&"
LESS_EQUAL = 62, // "<=" EQUALITY = 62, // "=="
GREATER_EQUAL = 63, // ">=" INEQUALITY = 63, // "!="
LESS = 64, // "<" LESS_EQUAL = 64, // "<="
GREATER = 65, // ">" GREATER_EQUAL = 65, // ">="
NOT = 66, // "!" LESS = 66, // "<"
COMPLEMENT = 67, // "~" GREATER = 67, // ">"
ASSIGN = 68, // "=" NOT = 68, // "!"
ASSIGN_ADD = 69, // "+=" COMPLEMENT = 69, // "~"
ASSIGN_SUB = 70, // "-=" ASSIGN = 70, // "="
ASSIGN_MUL = 71, // "*=" ASSIGN_ADD = 71, // "+="
ASSIGN_DIV = 72, // "/=" ASSIGN_SUB = 72, // "-="
ASSIGN_MOD = 73, // "%=" ASSIGN_MUL = 73, // "*="
ASSIGN_BW_OR = 74, // "|=" ASSIGN_DIV = 74, // "/="
ASSIGN_BW_AND = 75, // "&=" ASSIGN_MOD = 75, // "%="
ASSIGN_BW_EXOR = 76, // "^=" ASSIGN_BW_OR = 76, // "|="
ASSIGN_RSHIFT = 77, // ">>=" ASSIGN_BW_AND = 77, // "&="
ASSIGN_LSHIFT = 78, // "<<=" ASSIGN_BW_EXOR = 78, // "^="
BITWISE_OR = 79, // "|" ASSIGN_RSHIFT = 79, // ">>="
BITWISE_AND = 80, // "&" ASSIGN_LSHIFT = 80, // "<<="
BITWISE_EXOR = 81, // "^" BITWISE_OR = 81, // "|"
ADD = 82, // "+" BITWISE_AND = 82, // "&"
SUB = 83, // "-" BITWISE_EXOR = 83, // "^"
MUL = 84, // "*" ADD = 84, // "+"
DIV = 85, // "/" SUB = 85, // "-"
MOD = 86, // "%" MUL = 86, // "*"
PATH = 87, // "path" DIV = 87, // "/"
IDENTIFIER = 88, // "identifier" MOD = 88, // "%"
STRING = 89, // "string literal" PATH = 89, // "path"
ISTRING = 90, // "localized string" IDENTIFIER = 90, // "identifier"
COLOR = 91, // "color" STRING = 91, // "string literal"
FLOAT = 92, // "float" ISTRING = 92, // "localized string"
INT_DEC = 93, // "int" COLOR = 93, // "color"
INT_OCT = 94, // "octal int" FLOAT = 94, // "float"
INT_BIN = 95, // "binary int" INT_DEC = 95, // "int"
INT_HEX = 96, // "hexadecimal int" INT_OCT = 96, // "octal int"
ADD_ARRAY = 97, // ADD_ARRAY INT_BIN = 97, // "binary int"
THEN = 98, // THEN INT_HEX = 98, // "hexadecimal int"
TERN = 99, // TERN ADD_ARRAY = 99, // ADD_ARRAY
NEG = 100, // NEG THEN = 100, // THEN
ANIMREF = 101, // ANIMREF TERN = 101, // TERN
PREINC = 102, // PREINC NEG = 102, // NEG
PREDEC = 103, // PREDEC ANIMREF = 103, // ANIMREF
POSTINC = 104, // POSTINC PREINC = 104, // PREINC
POSTDEC = 105 // POSTDEC PREDEC = 105, // PREDEC
POSTINC = 106, // POSTINC
POSTDEC = 107 // POSTDEC
}; };
/// Backward compatibility alias (Bison 3.6). /// Backward compatibility alias (Bison 3.6).
typedef token_kind_type yytokentype; typedef token_kind_type yytokentype;
@ -798,194 +801,197 @@ namespace xsk { namespace gsc { namespace h1 {
{ {
enum symbol_kind_type enum symbol_kind_type
{ {
YYNTOKENS = 106, ///< Number of tokens. YYNTOKENS = 108, ///< 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
S_YYUNDEF = 2, // "invalid token" S_YYUNDEF = 2, // "invalid token"
S_INLINE = 3, // "#inline" S_DEVBEGIN = 3, // "/#"
S_INCLUDE = 4, // "#include" S_DEVEND = 4, // "#/"
S_USINGTREE = 5, // "#using_animtree" S_INLINE = 5, // "#inline"
S_ANIMTREE = 6, // "#animtree" S_INCLUDE = 6, // "#include"
S_ENDON = 7, // "endon" S_USINGTREE = 7, // "#using_animtree"
S_NOTIFY = 8, // "notify" S_ANIMTREE = 8, // "#animtree"
S_WAIT = 9, // "wait" S_ENDON = 9, // "endon"
S_WAITTILL = 10, // "waittill" S_NOTIFY = 10, // "notify"
S_WAITTILLMATCH = 11, // "waittillmatch" S_WAIT = 11, // "wait"
S_WAITTILLFRAMEEND = 12, // "waittillframeend" S_WAITTILL = 12, // "waittill"
S_WAITFRAME = 13, // "waitframe" S_WAITTILLMATCH = 13, // "waittillmatch"
S_IF = 14, // "if" S_WAITTILLFRAMEEND = 14, // "waittillframeend"
S_ELSE = 15, // "else" S_WAITFRAME = 15, // "waitframe"
S_DO = 16, // "do" S_IF = 16, // "if"
S_WHILE = 17, // "while" S_ELSE = 17, // "else"
S_FOR = 18, // "for" S_DO = 18, // "do"
S_FOREACH = 19, // "foreach" S_WHILE = 19, // "while"
S_IN = 20, // "in" S_FOR = 20, // "for"
S_SWITCH = 21, // "switch" S_FOREACH = 21, // "foreach"
S_CASE = 22, // "case" S_IN = 22, // "in"
S_DEFAULT = 23, // "default" S_SWITCH = 23, // "switch"
S_BREAK = 24, // "break" S_CASE = 24, // "case"
S_CONTINUE = 25, // "continue" S_DEFAULT = 25, // "default"
S_RETURN = 26, // "return" S_BREAK = 26, // "break"
S_BREAKPOINT = 27, // "breakpoint" S_CONTINUE = 27, // "continue"
S_PROFBEGIN = 28, // "prof_begin" S_RETURN = 28, // "return"
S_PROFEND = 29, // "prof_end" S_BREAKPOINT = 29, // "breakpoint"
S_THREAD = 30, // "thread" S_PROFBEGIN = 30, // "prof_begin"
S_CHILDTHREAD = 31, // "childthread" S_PROFEND = 31, // "prof_end"
S_THISTHREAD = 32, // "thisthread" S_THREAD = 32, // "thread"
S_CALL = 33, // "call" S_CHILDTHREAD = 33, // "childthread"
S_TRUE = 34, // "true" S_THISTHREAD = 34, // "thisthread"
S_FALSE = 35, // "false" S_CALL = 35, // "call"
S_UNDEFINED = 36, // "undefined" S_TRUE = 36, // "true"
S_SIZE = 37, // ".size" S_FALSE = 37, // "false"
S_GAME = 38, // "game" S_UNDEFINED = 38, // "undefined"
S_SELF = 39, // "self" S_SIZE = 39, // ".size"
S_ANIM = 40, // "anim" S_GAME = 40, // "game"
S_LEVEL = 41, // "level" S_SELF = 41, // "self"
S_LPAREN = 42, // "(" S_ANIM = 42, // "anim"
S_RPAREN = 43, // ")" S_LEVEL = 43, // "level"
S_LBRACE = 44, // "{" S_LPAREN = 44, // "("
S_RBRACE = 45, // "}" S_RPAREN = 45, // ")"
S_LBRACKET = 46, // "[" S_LBRACE = 46, // "{"
S_RBRACKET = 47, // "]" S_RBRACE = 47, // "}"
S_COMMA = 48, // "," S_LBRACKET = 48, // "["
S_DOT = 49, // "." S_RBRACKET = 49, // "]"
S_DOUBLECOLON = 50, // "::" S_COMMA = 50, // ","
S_COLON = 51, // ":" S_DOT = 51, // "."
S_SEMICOLON = 52, // ";" S_DOUBLECOLON = 52, // "::"
S_QMARK = 53, // "?" S_COLON = 53, // ":"
S_INCREMENT = 54, // "++" S_SEMICOLON = 54, // ";"
S_DECREMENT = 55, // "--" S_QMARK = 55, // "?"
S_LSHIFT = 56, // "<<" S_INCREMENT = 56, // "++"
S_RSHIFT = 57, // ">>" S_DECREMENT = 57, // "--"
S_OR = 58, // "||" S_LSHIFT = 58, // "<<"
S_AND = 59, // "&&" S_RSHIFT = 59, // ">>"
S_EQUALITY = 60, // "==" S_OR = 60, // "||"
S_INEQUALITY = 61, // "!=" S_AND = 61, // "&&"
S_LESS_EQUAL = 62, // "<=" S_EQUALITY = 62, // "=="
S_GREATER_EQUAL = 63, // ">=" S_INEQUALITY = 63, // "!="
S_LESS = 64, // "<" S_LESS_EQUAL = 64, // "<="
S_GREATER = 65, // ">" S_GREATER_EQUAL = 65, // ">="
S_NOT = 66, // "!" S_LESS = 66, // "<"
S_COMPLEMENT = 67, // "~" S_GREATER = 67, // ">"
S_ASSIGN = 68, // "=" S_NOT = 68, // "!"
S_ASSIGN_ADD = 69, // "+=" S_COMPLEMENT = 69, // "~"
S_ASSIGN_SUB = 70, // "-=" S_ASSIGN = 70, // "="
S_ASSIGN_MUL = 71, // "*=" S_ASSIGN_ADD = 71, // "+="
S_ASSIGN_DIV = 72, // "/=" S_ASSIGN_SUB = 72, // "-="
S_ASSIGN_MOD = 73, // "%=" S_ASSIGN_MUL = 73, // "*="
S_ASSIGN_BW_OR = 74, // "|=" S_ASSIGN_DIV = 74, // "/="
S_ASSIGN_BW_AND = 75, // "&=" S_ASSIGN_MOD = 75, // "%="
S_ASSIGN_BW_EXOR = 76, // "^=" S_ASSIGN_BW_OR = 76, // "|="
S_ASSIGN_RSHIFT = 77, // ">>=" S_ASSIGN_BW_AND = 77, // "&="
S_ASSIGN_LSHIFT = 78, // "<<=" S_ASSIGN_BW_EXOR = 78, // "^="
S_BITWISE_OR = 79, // "|" S_ASSIGN_RSHIFT = 79, // ">>="
S_BITWISE_AND = 80, // "&" S_ASSIGN_LSHIFT = 80, // "<<="
S_BITWISE_EXOR = 81, // "^" S_BITWISE_OR = 81, // "|"
S_ADD = 82, // "+" S_BITWISE_AND = 82, // "&"
S_SUB = 83, // "-" S_BITWISE_EXOR = 83, // "^"
S_MUL = 84, // "*" S_ADD = 84, // "+"
S_DIV = 85, // "/" S_SUB = 85, // "-"
S_MOD = 86, // "%" S_MUL = 86, // "*"
S_PATH = 87, // "path" S_DIV = 87, // "/"
S_IDENTIFIER = 88, // "identifier" S_MOD = 88, // "%"
S_STRING = 89, // "string literal" S_PATH = 89, // "path"
S_ISTRING = 90, // "localized string" S_IDENTIFIER = 90, // "identifier"
S_COLOR = 91, // "color" S_STRING = 91, // "string literal"
S_FLOAT = 92, // "float" S_ISTRING = 92, // "localized string"
S_INT_DEC = 93, // "int" S_COLOR = 93, // "color"
S_INT_OCT = 94, // "octal int" S_FLOAT = 94, // "float"
S_INT_BIN = 95, // "binary int" S_INT_DEC = 95, // "int"
S_INT_HEX = 96, // "hexadecimal int" S_INT_OCT = 96, // "octal int"
S_ADD_ARRAY = 97, // ADD_ARRAY S_INT_BIN = 97, // "binary int"
S_THEN = 98, // THEN S_INT_HEX = 98, // "hexadecimal int"
S_TERN = 99, // TERN S_ADD_ARRAY = 99, // ADD_ARRAY
S_NEG = 100, // NEG S_THEN = 100, // THEN
S_ANIMREF = 101, // ANIMREF S_TERN = 101, // TERN
S_PREINC = 102, // PREINC S_NEG = 102, // NEG
S_PREDEC = 103, // PREDEC S_ANIMREF = 103, // ANIMREF
S_POSTINC = 104, // POSTINC S_PREINC = 104, // PREINC
S_POSTDEC = 105, // POSTDEC S_PREDEC = 105, // PREDEC
S_YYACCEPT = 106, // $accept S_POSTINC = 106, // POSTINC
S_root = 107, // root S_POSTDEC = 107, // POSTDEC
S_program = 108, // program S_YYACCEPT = 108, // $accept
S_inline = 109, // inline S_root = 109, // root
S_include = 110, // include S_program = 110, // program
S_declaration = 111, // declaration S_inline = 111, // inline
S_decl_usingtree = 112, // decl_usingtree S_include = 112, // include
S_decl_constant = 113, // decl_constant S_declaration = 113, // declaration
S_decl_thread = 114, // decl_thread S_decl_usingtree = 114, // decl_usingtree
S_stmt = 115, // stmt S_decl_constant = 115, // decl_constant
S_stmt_block = 116, // stmt_block S_decl_thread = 116, // decl_thread
S_stmt_list = 117, // stmt_list S_stmt = 117, // stmt
S_stmt_expr = 118, // stmt_expr S_stmt_dev = 118, // stmt_dev
S_stmt_call = 119, // stmt_call S_stmt_block = 119, // stmt_block
S_stmt_assign = 120, // stmt_assign S_stmt_list = 120, // stmt_list
S_stmt_endon = 121, // stmt_endon S_stmt_expr = 121, // stmt_expr
S_stmt_notify = 122, // stmt_notify S_stmt_call = 122, // stmt_call
S_stmt_wait = 123, // stmt_wait S_stmt_assign = 123, // stmt_assign
S_stmt_waittill = 124, // stmt_waittill S_stmt_endon = 124, // stmt_endon
S_stmt_waittillmatch = 125, // stmt_waittillmatch S_stmt_notify = 125, // stmt_notify
S_stmt_waittillframeend = 126, // stmt_waittillframeend S_stmt_wait = 126, // stmt_wait
S_stmt_waitframe = 127, // stmt_waitframe S_stmt_waittill = 127, // stmt_waittill
S_stmt_if = 128, // stmt_if S_stmt_waittillmatch = 128, // stmt_waittillmatch
S_stmt_ifelse = 129, // stmt_ifelse S_stmt_waittillframeend = 129, // stmt_waittillframeend
S_stmt_while = 130, // stmt_while S_stmt_waitframe = 130, // stmt_waitframe
S_stmt_dowhile = 131, // stmt_dowhile S_stmt_if = 131, // stmt_if
S_stmt_for = 132, // stmt_for S_stmt_ifelse = 132, // stmt_ifelse
S_stmt_foreach = 133, // stmt_foreach S_stmt_while = 133, // stmt_while
S_stmt_switch = 134, // stmt_switch S_stmt_dowhile = 134, // stmt_dowhile
S_stmt_case = 135, // stmt_case S_stmt_for = 135, // stmt_for
S_stmt_default = 136, // stmt_default S_stmt_foreach = 136, // stmt_foreach
S_stmt_break = 137, // stmt_break S_stmt_switch = 137, // stmt_switch
S_stmt_continue = 138, // stmt_continue S_stmt_case = 138, // stmt_case
S_stmt_return = 139, // stmt_return S_stmt_default = 139, // stmt_default
S_stmt_breakpoint = 140, // stmt_breakpoint S_stmt_break = 140, // stmt_break
S_stmt_prof_begin = 141, // stmt_prof_begin S_stmt_continue = 141, // stmt_continue
S_stmt_prof_end = 142, // stmt_prof_end S_stmt_return = 142, // stmt_return
S_expr = 143, // expr S_stmt_breakpoint = 143, // stmt_breakpoint
S_expr_or_empty = 144, // expr_or_empty S_stmt_prof_begin = 144, // stmt_prof_begin
S_expr_assign = 145, // expr_assign S_stmt_prof_end = 145, // stmt_prof_end
S_expr_increment = 146, // expr_increment S_expr = 146, // expr
S_expr_decrement = 147, // expr_decrement S_expr_or_empty = 147, // expr_or_empty
S_expr_ternary = 148, // expr_ternary S_expr_assign = 148, // expr_assign
S_expr_binary = 149, // expr_binary S_expr_increment = 149, // expr_increment
S_expr_primitive = 150, // expr_primitive S_expr_decrement = 150, // expr_decrement
S_expr_complement = 151, // expr_complement S_expr_ternary = 151, // expr_ternary
S_expr_not = 152, // expr_not S_expr_binary = 152, // expr_binary
S_expr_call = 153, // expr_call S_expr_primitive = 153, // expr_primitive
S_expr_method = 154, // expr_method S_expr_complement = 154, // expr_complement
S_expr_function = 155, // expr_function S_expr_not = 155, // expr_not
S_expr_pointer = 156, // expr_pointer S_expr_call = 156, // expr_call
S_expr_add_array = 157, // expr_add_array S_expr_method = 157, // expr_method
S_expr_parameters = 158, // expr_parameters S_expr_function = 158, // expr_function
S_expr_arguments = 159, // expr_arguments S_expr_pointer = 159, // expr_pointer
S_expr_arguments_no_empty = 160, // expr_arguments_no_empty S_expr_add_array = 160, // expr_add_array
S_expr_reference = 161, // expr_reference S_expr_parameters = 161, // expr_parameters
S_expr_array = 162, // expr_array S_expr_arguments = 162, // expr_arguments
S_expr_field = 163, // expr_field S_expr_arguments_no_empty = 163, // expr_arguments_no_empty
S_expr_size = 164, // expr_size S_expr_reference = 164, // expr_reference
S_expr_paren = 165, // expr_paren S_expr_array = 165, // expr_array
S_expr_object = 166, // expr_object S_expr_field = 166, // expr_field
S_expr_thisthread = 167, // expr_thisthread S_expr_size = 167, // expr_size
S_expr_empty_array = 168, // expr_empty_array S_expr_paren = 168, // expr_paren
S_expr_undefined = 169, // expr_undefined S_expr_object = 169, // expr_object
S_expr_game = 170, // expr_game S_expr_thisthread = 170, // expr_thisthread
S_expr_self = 171, // expr_self S_expr_empty_array = 171, // expr_empty_array
S_expr_anim = 172, // expr_anim S_expr_undefined = 172, // expr_undefined
S_expr_level = 173, // expr_level S_expr_game = 173, // expr_game
S_expr_animation = 174, // expr_animation S_expr_self = 174, // expr_self
S_expr_animtree = 175, // expr_animtree S_expr_anim = 175, // expr_anim
S_expr_identifier = 176, // expr_identifier S_expr_level = 176, // expr_level
S_expr_path = 177, // expr_path S_expr_animation = 177, // expr_animation
S_expr_istring = 178, // expr_istring S_expr_animtree = 178, // expr_animtree
S_expr_string = 179, // expr_string S_expr_identifier = 179, // expr_identifier
S_expr_color = 180, // expr_color S_expr_path = 180, // expr_path
S_expr_vector = 181, // expr_vector S_expr_istring = 181, // expr_istring
S_expr_float = 182, // expr_float S_expr_string = 182, // expr_string
S_expr_integer = 183, // expr_integer S_expr_color = 183, // expr_color
S_expr_false = 184, // expr_false S_expr_vector = 184, // expr_vector
S_expr_true = 185 // expr_true S_expr_float = 185, // expr_float
S_expr_integer = 186, // expr_integer
S_expr_false = 187, // expr_false
S_expr_true = 188 // expr_true
}; };
}; };
@ -1248,6 +1254,7 @@ namespace xsk { namespace gsc { namespace h1 {
value.move< ast::stmt_ifelse::ptr > (std::move (that.value)); value.move< ast::stmt_ifelse::ptr > (std::move (that.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.move< ast::stmt_list::ptr > (std::move (that.value)); value.move< ast::stmt_list::ptr > (std::move (that.value));
@ -2519,6 +2526,7 @@ switch (yykind)
value.template destroy< ast::stmt_ifelse::ptr > (); value.template destroy< ast::stmt_ifelse::ptr > ();
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.template destroy< ast::stmt_list::ptr > (); value.template destroy< ast::stmt_list::ptr > ();
@ -2782,6 +2790,36 @@ switch (yykind)
return symbol_type (token::H1UNDEF, l); return symbol_type (token::H1UNDEF, l);
} }
#endif #endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_DEVBEGIN (location_type l)
{
return symbol_type (token::DEVBEGIN, std::move (l));
}
#else
static
symbol_type
make_DEVBEGIN (const location_type& l)
{
return symbol_type (token::DEVBEGIN, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_DEVEND (location_type l)
{
return symbol_type (token::DEVEND, std::move (l));
}
#else
static
symbol_type
make_DEVEND (const location_type& l)
{
return symbol_type (token::DEVEND, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS #if 201103L <= YY_CPLUSPLUS
static static
symbol_type symbol_type
@ -4671,9 +4709,9 @@ switch (yykind)
/// Constants. /// Constants.
enum enum
{ {
yylast_ = 2075, ///< Last index in yytable_. yylast_ = 2254, ///< Last index in yytable_.
yynnts_ = 80, ///< Number of nonterminal symbols. yynnts_ = 81, ///< Number of nonterminal symbols.
yyfinal_ = 19 ///< Termination state number. yyfinal_ = 21 ///< Termination state number.
}; };
@ -4926,6 +4964,7 @@ switch (yykind)
value.copy< ast::stmt_ifelse::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_ifelse::ptr > (YY_MOVE (that.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.copy< ast::stmt_list::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_list::ptr > (YY_MOVE (that.value));
@ -5243,6 +5282,7 @@ switch (yykind)
value.move< ast::stmt_ifelse::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_ifelse::ptr > (YY_MOVE (s.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.move< ast::stmt_list::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_list::ptr > (YY_MOVE (s.value));
@ -5368,7 +5408,7 @@ switch (yykind)
#line 13 "parser.ypp" #line 13 "parser.ypp"
} } } // xsk::gsc::h1 } } } // xsk::gsc::h1
#line 5372 "parser.hpp" #line 5412 "parser.hpp"

View File

@ -85,6 +85,7 @@ void compiler::compile_program(const ast::program::ptr& program)
constants_.clear(); constants_.clear();
local_functions_.clear(); local_functions_.clear();
index_ = 1; index_ = 1;
developer_thread_ = false;
for (const auto& entry : program->declarations) for (const auto& entry : program->declarations)
{ {
@ -150,6 +151,12 @@ void compiler::emit_declaration(const ast::decl& decl)
{ {
switch (decl.kind()) switch (decl.kind())
{ {
case ast::kind::decl_dev_begin:
developer_thread_ = true;
break;
case ast::kind::decl_dev_end:
developer_thread_ = false;
break;
case ast::kind::decl_usingtree: case ast::kind::decl_usingtree:
emit_decl_usingtree(decl.as_usingtree); emit_decl_usingtree(decl.as_usingtree);
break; break;
@ -166,6 +173,9 @@ void compiler::emit_declaration(const ast::decl& decl)
void compiler::emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree) void compiler::emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree)
{ {
if(developer_thread_)
throw comp_error(animtree->loc(), "cannot put #using_animtree inside /# ... #/ comment");
animtrees_.push_back({ animtree->name->value, false }); animtrees_.push_back({ animtree->name->value, false });
} }

File diff suppressed because it is too large Load Diff

View File

@ -439,9 +439,9 @@ void yyfree ( void * , yyscan_t yyscanner );
#ifdef YY_HEADER_EXPORT_START_CONDITIONS #ifdef YY_HEADER_EXPORT_START_CONDITIONS
#define INITIAL 0 #define INITIAL 0
#define COMMENT_BLOCK_STATE 1 #define COMMENT_STATE 1
#define DEVBLOCK_ON_STATE 2 #define DEV_OFF_STATE 2
#define DEVBLOCK_OFF_STATE 3 #define DEV_ON_STATE 3
#endif #endif
@ -703,7 +703,7 @@ extern int yylex (yyscan_t yyscanner);
#undef yyTABLES_NAME #undef yyTABLES_NAME
#endif #endif
#line 166 "lexer.lpp" #line 170 "lexer.lpp"
#line 709 "lexer.hpp" #line 709 "lexer.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -580,6 +580,7 @@ namespace xsk { namespace gsc { namespace h2 {
// stmt_ifelse // stmt_ifelse
char dummy54[sizeof (ast::stmt_ifelse::ptr)]; char dummy54[sizeof (ast::stmt_ifelse::ptr)];
// stmt_dev
// stmt_block // stmt_block
// stmt_list // stmt_list
char dummy55[sizeof (ast::stmt_list::ptr)]; char dummy55[sizeof (ast::stmt_list::ptr)];
@ -679,109 +680,111 @@ namespace xsk { namespace gsc { namespace h2 {
H2EOF = 0, // "end of file" H2EOF = 0, // "end of file"
H2error = 1, // error H2error = 1, // error
H2UNDEF = 2, // "invalid token" H2UNDEF = 2, // "invalid token"
INLINE = 3, // "#inline" DEVBEGIN = 3, // "/#"
INCLUDE = 4, // "#include" DEVEND = 4, // "#/"
USINGTREE = 5, // "#using_animtree" INLINE = 5, // "#inline"
ANIMTREE = 6, // "#animtree" INCLUDE = 6, // "#include"
ENDON = 7, // "endon" USINGTREE = 7, // "#using_animtree"
NOTIFY = 8, // "notify" ANIMTREE = 8, // "#animtree"
WAIT = 9, // "wait" ENDON = 9, // "endon"
WAITTILL = 10, // "waittill" NOTIFY = 10, // "notify"
WAITTILLMATCH = 11, // "waittillmatch" WAIT = 11, // "wait"
WAITTILLFRAMEEND = 12, // "waittillframeend" WAITTILL = 12, // "waittill"
WAITFRAME = 13, // "waitframe" WAITTILLMATCH = 13, // "waittillmatch"
IF = 14, // "if" WAITTILLFRAMEEND = 14, // "waittillframeend"
ELSE = 15, // "else" WAITFRAME = 15, // "waitframe"
DO = 16, // "do" IF = 16, // "if"
WHILE = 17, // "while" ELSE = 17, // "else"
FOR = 18, // "for" DO = 18, // "do"
FOREACH = 19, // "foreach" WHILE = 19, // "while"
IN = 20, // "in" FOR = 20, // "for"
SWITCH = 21, // "switch" FOREACH = 21, // "foreach"
CASE = 22, // "case" IN = 22, // "in"
DEFAULT = 23, // "default" SWITCH = 23, // "switch"
BREAK = 24, // "break" CASE = 24, // "case"
CONTINUE = 25, // "continue" DEFAULT = 25, // "default"
RETURN = 26, // "return" BREAK = 26, // "break"
BREAKPOINT = 27, // "breakpoint" CONTINUE = 27, // "continue"
PROFBEGIN = 28, // "prof_begin" RETURN = 28, // "return"
PROFEND = 29, // "prof_end" BREAKPOINT = 29, // "breakpoint"
THREAD = 30, // "thread" PROFBEGIN = 30, // "prof_begin"
CHILDTHREAD = 31, // "childthread" PROFEND = 31, // "prof_end"
THISTHREAD = 32, // "thisthread" THREAD = 32, // "thread"
CALL = 33, // "call" CHILDTHREAD = 33, // "childthread"
TRUE = 34, // "true" THISTHREAD = 34, // "thisthread"
FALSE = 35, // "false" CALL = 35, // "call"
UNDEFINED = 36, // "undefined" TRUE = 36, // "true"
SIZE = 37, // ".size" FALSE = 37, // "false"
GAME = 38, // "game" UNDEFINED = 38, // "undefined"
SELF = 39, // "self" SIZE = 39, // ".size"
ANIM = 40, // "anim" GAME = 40, // "game"
LEVEL = 41, // "level" SELF = 41, // "self"
LPAREN = 42, // "(" ANIM = 42, // "anim"
RPAREN = 43, // ")" LEVEL = 43, // "level"
LBRACE = 44, // "{" LPAREN = 44, // "("
RBRACE = 45, // "}" RPAREN = 45, // ")"
LBRACKET = 46, // "[" LBRACE = 46, // "{"
RBRACKET = 47, // "]" RBRACE = 47, // "}"
COMMA = 48, // "," LBRACKET = 48, // "["
DOT = 49, // "." RBRACKET = 49, // "]"
DOUBLECOLON = 50, // "::" COMMA = 50, // ","
COLON = 51, // ":" DOT = 51, // "."
SEMICOLON = 52, // ";" DOUBLECOLON = 52, // "::"
QMARK = 53, // "?" COLON = 53, // ":"
INCREMENT = 54, // "++" SEMICOLON = 54, // ";"
DECREMENT = 55, // "--" QMARK = 55, // "?"
LSHIFT = 56, // "<<" INCREMENT = 56, // "++"
RSHIFT = 57, // ">>" DECREMENT = 57, // "--"
OR = 58, // "||" LSHIFT = 58, // "<<"
AND = 59, // "&&" RSHIFT = 59, // ">>"
EQUALITY = 60, // "==" OR = 60, // "||"
INEQUALITY = 61, // "!=" AND = 61, // "&&"
LESS_EQUAL = 62, // "<=" EQUALITY = 62, // "=="
GREATER_EQUAL = 63, // ">=" INEQUALITY = 63, // "!="
LESS = 64, // "<" LESS_EQUAL = 64, // "<="
GREATER = 65, // ">" GREATER_EQUAL = 65, // ">="
NOT = 66, // "!" LESS = 66, // "<"
COMPLEMENT = 67, // "~" GREATER = 67, // ">"
ASSIGN = 68, // "=" NOT = 68, // "!"
ASSIGN_ADD = 69, // "+=" COMPLEMENT = 69, // "~"
ASSIGN_SUB = 70, // "-=" ASSIGN = 70, // "="
ASSIGN_MUL = 71, // "*=" ASSIGN_ADD = 71, // "+="
ASSIGN_DIV = 72, // "/=" ASSIGN_SUB = 72, // "-="
ASSIGN_MOD = 73, // "%=" ASSIGN_MUL = 73, // "*="
ASSIGN_BW_OR = 74, // "|=" ASSIGN_DIV = 74, // "/="
ASSIGN_BW_AND = 75, // "&=" ASSIGN_MOD = 75, // "%="
ASSIGN_BW_EXOR = 76, // "^=" ASSIGN_BW_OR = 76, // "|="
ASSIGN_RSHIFT = 77, // ">>=" ASSIGN_BW_AND = 77, // "&="
ASSIGN_LSHIFT = 78, // "<<=" ASSIGN_BW_EXOR = 78, // "^="
BITWISE_OR = 79, // "|" ASSIGN_RSHIFT = 79, // ">>="
BITWISE_AND = 80, // "&" ASSIGN_LSHIFT = 80, // "<<="
BITWISE_EXOR = 81, // "^" BITWISE_OR = 81, // "|"
ADD = 82, // "+" BITWISE_AND = 82, // "&"
SUB = 83, // "-" BITWISE_EXOR = 83, // "^"
MUL = 84, // "*" ADD = 84, // "+"
DIV = 85, // "/" SUB = 85, // "-"
MOD = 86, // "%" MUL = 86, // "*"
PATH = 87, // "path" DIV = 87, // "/"
IDENTIFIER = 88, // "identifier" MOD = 88, // "%"
STRING = 89, // "string literal" PATH = 89, // "path"
ISTRING = 90, // "localized string" IDENTIFIER = 90, // "identifier"
COLOR = 91, // "color" STRING = 91, // "string literal"
FLOAT = 92, // "float" ISTRING = 92, // "localized string"
INT_DEC = 93, // "int" COLOR = 93, // "color"
INT_OCT = 94, // "octal int" FLOAT = 94, // "float"
INT_BIN = 95, // "binary int" INT_DEC = 95, // "int"
INT_HEX = 96, // "hexadecimal int" INT_OCT = 96, // "octal int"
ADD_ARRAY = 97, // ADD_ARRAY INT_BIN = 97, // "binary int"
THEN = 98, // THEN INT_HEX = 98, // "hexadecimal int"
TERN = 99, // TERN ADD_ARRAY = 99, // ADD_ARRAY
NEG = 100, // NEG THEN = 100, // THEN
ANIMREF = 101, // ANIMREF TERN = 101, // TERN
PREINC = 102, // PREINC NEG = 102, // NEG
PREDEC = 103, // PREDEC ANIMREF = 103, // ANIMREF
POSTINC = 104, // POSTINC PREINC = 104, // PREINC
POSTDEC = 105 // POSTDEC PREDEC = 105, // PREDEC
POSTINC = 106, // POSTINC
POSTDEC = 107 // POSTDEC
}; };
/// Backward compatibility alias (Bison 3.6). /// Backward compatibility alias (Bison 3.6).
typedef token_kind_type yytokentype; typedef token_kind_type yytokentype;
@ -798,194 +801,197 @@ namespace xsk { namespace gsc { namespace h2 {
{ {
enum symbol_kind_type enum symbol_kind_type
{ {
YYNTOKENS = 106, ///< Number of tokens. YYNTOKENS = 108, ///< 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
S_YYUNDEF = 2, // "invalid token" S_YYUNDEF = 2, // "invalid token"
S_INLINE = 3, // "#inline" S_DEVBEGIN = 3, // "/#"
S_INCLUDE = 4, // "#include" S_DEVEND = 4, // "#/"
S_USINGTREE = 5, // "#using_animtree" S_INLINE = 5, // "#inline"
S_ANIMTREE = 6, // "#animtree" S_INCLUDE = 6, // "#include"
S_ENDON = 7, // "endon" S_USINGTREE = 7, // "#using_animtree"
S_NOTIFY = 8, // "notify" S_ANIMTREE = 8, // "#animtree"
S_WAIT = 9, // "wait" S_ENDON = 9, // "endon"
S_WAITTILL = 10, // "waittill" S_NOTIFY = 10, // "notify"
S_WAITTILLMATCH = 11, // "waittillmatch" S_WAIT = 11, // "wait"
S_WAITTILLFRAMEEND = 12, // "waittillframeend" S_WAITTILL = 12, // "waittill"
S_WAITFRAME = 13, // "waitframe" S_WAITTILLMATCH = 13, // "waittillmatch"
S_IF = 14, // "if" S_WAITTILLFRAMEEND = 14, // "waittillframeend"
S_ELSE = 15, // "else" S_WAITFRAME = 15, // "waitframe"
S_DO = 16, // "do" S_IF = 16, // "if"
S_WHILE = 17, // "while" S_ELSE = 17, // "else"
S_FOR = 18, // "for" S_DO = 18, // "do"
S_FOREACH = 19, // "foreach" S_WHILE = 19, // "while"
S_IN = 20, // "in" S_FOR = 20, // "for"
S_SWITCH = 21, // "switch" S_FOREACH = 21, // "foreach"
S_CASE = 22, // "case" S_IN = 22, // "in"
S_DEFAULT = 23, // "default" S_SWITCH = 23, // "switch"
S_BREAK = 24, // "break" S_CASE = 24, // "case"
S_CONTINUE = 25, // "continue" S_DEFAULT = 25, // "default"
S_RETURN = 26, // "return" S_BREAK = 26, // "break"
S_BREAKPOINT = 27, // "breakpoint" S_CONTINUE = 27, // "continue"
S_PROFBEGIN = 28, // "prof_begin" S_RETURN = 28, // "return"
S_PROFEND = 29, // "prof_end" S_BREAKPOINT = 29, // "breakpoint"
S_THREAD = 30, // "thread" S_PROFBEGIN = 30, // "prof_begin"
S_CHILDTHREAD = 31, // "childthread" S_PROFEND = 31, // "prof_end"
S_THISTHREAD = 32, // "thisthread" S_THREAD = 32, // "thread"
S_CALL = 33, // "call" S_CHILDTHREAD = 33, // "childthread"
S_TRUE = 34, // "true" S_THISTHREAD = 34, // "thisthread"
S_FALSE = 35, // "false" S_CALL = 35, // "call"
S_UNDEFINED = 36, // "undefined" S_TRUE = 36, // "true"
S_SIZE = 37, // ".size" S_FALSE = 37, // "false"
S_GAME = 38, // "game" S_UNDEFINED = 38, // "undefined"
S_SELF = 39, // "self" S_SIZE = 39, // ".size"
S_ANIM = 40, // "anim" S_GAME = 40, // "game"
S_LEVEL = 41, // "level" S_SELF = 41, // "self"
S_LPAREN = 42, // "(" S_ANIM = 42, // "anim"
S_RPAREN = 43, // ")" S_LEVEL = 43, // "level"
S_LBRACE = 44, // "{" S_LPAREN = 44, // "("
S_RBRACE = 45, // "}" S_RPAREN = 45, // ")"
S_LBRACKET = 46, // "[" S_LBRACE = 46, // "{"
S_RBRACKET = 47, // "]" S_RBRACE = 47, // "}"
S_COMMA = 48, // "," S_LBRACKET = 48, // "["
S_DOT = 49, // "." S_RBRACKET = 49, // "]"
S_DOUBLECOLON = 50, // "::" S_COMMA = 50, // ","
S_COLON = 51, // ":" S_DOT = 51, // "."
S_SEMICOLON = 52, // ";" S_DOUBLECOLON = 52, // "::"
S_QMARK = 53, // "?" S_COLON = 53, // ":"
S_INCREMENT = 54, // "++" S_SEMICOLON = 54, // ";"
S_DECREMENT = 55, // "--" S_QMARK = 55, // "?"
S_LSHIFT = 56, // "<<" S_INCREMENT = 56, // "++"
S_RSHIFT = 57, // ">>" S_DECREMENT = 57, // "--"
S_OR = 58, // "||" S_LSHIFT = 58, // "<<"
S_AND = 59, // "&&" S_RSHIFT = 59, // ">>"
S_EQUALITY = 60, // "==" S_OR = 60, // "||"
S_INEQUALITY = 61, // "!=" S_AND = 61, // "&&"
S_LESS_EQUAL = 62, // "<=" S_EQUALITY = 62, // "=="
S_GREATER_EQUAL = 63, // ">=" S_INEQUALITY = 63, // "!="
S_LESS = 64, // "<" S_LESS_EQUAL = 64, // "<="
S_GREATER = 65, // ">" S_GREATER_EQUAL = 65, // ">="
S_NOT = 66, // "!" S_LESS = 66, // "<"
S_COMPLEMENT = 67, // "~" S_GREATER = 67, // ">"
S_ASSIGN = 68, // "=" S_NOT = 68, // "!"
S_ASSIGN_ADD = 69, // "+=" S_COMPLEMENT = 69, // "~"
S_ASSIGN_SUB = 70, // "-=" S_ASSIGN = 70, // "="
S_ASSIGN_MUL = 71, // "*=" S_ASSIGN_ADD = 71, // "+="
S_ASSIGN_DIV = 72, // "/=" S_ASSIGN_SUB = 72, // "-="
S_ASSIGN_MOD = 73, // "%=" S_ASSIGN_MUL = 73, // "*="
S_ASSIGN_BW_OR = 74, // "|=" S_ASSIGN_DIV = 74, // "/="
S_ASSIGN_BW_AND = 75, // "&=" S_ASSIGN_MOD = 75, // "%="
S_ASSIGN_BW_EXOR = 76, // "^=" S_ASSIGN_BW_OR = 76, // "|="
S_ASSIGN_RSHIFT = 77, // ">>=" S_ASSIGN_BW_AND = 77, // "&="
S_ASSIGN_LSHIFT = 78, // "<<=" S_ASSIGN_BW_EXOR = 78, // "^="
S_BITWISE_OR = 79, // "|" S_ASSIGN_RSHIFT = 79, // ">>="
S_BITWISE_AND = 80, // "&" S_ASSIGN_LSHIFT = 80, // "<<="
S_BITWISE_EXOR = 81, // "^" S_BITWISE_OR = 81, // "|"
S_ADD = 82, // "+" S_BITWISE_AND = 82, // "&"
S_SUB = 83, // "-" S_BITWISE_EXOR = 83, // "^"
S_MUL = 84, // "*" S_ADD = 84, // "+"
S_DIV = 85, // "/" S_SUB = 85, // "-"
S_MOD = 86, // "%" S_MUL = 86, // "*"
S_PATH = 87, // "path" S_DIV = 87, // "/"
S_IDENTIFIER = 88, // "identifier" S_MOD = 88, // "%"
S_STRING = 89, // "string literal" S_PATH = 89, // "path"
S_ISTRING = 90, // "localized string" S_IDENTIFIER = 90, // "identifier"
S_COLOR = 91, // "color" S_STRING = 91, // "string literal"
S_FLOAT = 92, // "float" S_ISTRING = 92, // "localized string"
S_INT_DEC = 93, // "int" S_COLOR = 93, // "color"
S_INT_OCT = 94, // "octal int" S_FLOAT = 94, // "float"
S_INT_BIN = 95, // "binary int" S_INT_DEC = 95, // "int"
S_INT_HEX = 96, // "hexadecimal int" S_INT_OCT = 96, // "octal int"
S_ADD_ARRAY = 97, // ADD_ARRAY S_INT_BIN = 97, // "binary int"
S_THEN = 98, // THEN S_INT_HEX = 98, // "hexadecimal int"
S_TERN = 99, // TERN S_ADD_ARRAY = 99, // ADD_ARRAY
S_NEG = 100, // NEG S_THEN = 100, // THEN
S_ANIMREF = 101, // ANIMREF S_TERN = 101, // TERN
S_PREINC = 102, // PREINC S_NEG = 102, // NEG
S_PREDEC = 103, // PREDEC S_ANIMREF = 103, // ANIMREF
S_POSTINC = 104, // POSTINC S_PREINC = 104, // PREINC
S_POSTDEC = 105, // POSTDEC S_PREDEC = 105, // PREDEC
S_YYACCEPT = 106, // $accept S_POSTINC = 106, // POSTINC
S_root = 107, // root S_POSTDEC = 107, // POSTDEC
S_program = 108, // program S_YYACCEPT = 108, // $accept
S_inline = 109, // inline S_root = 109, // root
S_include = 110, // include S_program = 110, // program
S_declaration = 111, // declaration S_inline = 111, // inline
S_decl_usingtree = 112, // decl_usingtree S_include = 112, // include
S_decl_constant = 113, // decl_constant S_declaration = 113, // declaration
S_decl_thread = 114, // decl_thread S_decl_usingtree = 114, // decl_usingtree
S_stmt = 115, // stmt S_decl_constant = 115, // decl_constant
S_stmt_block = 116, // stmt_block S_decl_thread = 116, // decl_thread
S_stmt_list = 117, // stmt_list S_stmt = 117, // stmt
S_stmt_expr = 118, // stmt_expr S_stmt_dev = 118, // stmt_dev
S_stmt_call = 119, // stmt_call S_stmt_block = 119, // stmt_block
S_stmt_assign = 120, // stmt_assign S_stmt_list = 120, // stmt_list
S_stmt_endon = 121, // stmt_endon S_stmt_expr = 121, // stmt_expr
S_stmt_notify = 122, // stmt_notify S_stmt_call = 122, // stmt_call
S_stmt_wait = 123, // stmt_wait S_stmt_assign = 123, // stmt_assign
S_stmt_waittill = 124, // stmt_waittill S_stmt_endon = 124, // stmt_endon
S_stmt_waittillmatch = 125, // stmt_waittillmatch S_stmt_notify = 125, // stmt_notify
S_stmt_waittillframeend = 126, // stmt_waittillframeend S_stmt_wait = 126, // stmt_wait
S_stmt_waitframe = 127, // stmt_waitframe S_stmt_waittill = 127, // stmt_waittill
S_stmt_if = 128, // stmt_if S_stmt_waittillmatch = 128, // stmt_waittillmatch
S_stmt_ifelse = 129, // stmt_ifelse S_stmt_waittillframeend = 129, // stmt_waittillframeend
S_stmt_while = 130, // stmt_while S_stmt_waitframe = 130, // stmt_waitframe
S_stmt_dowhile = 131, // stmt_dowhile S_stmt_if = 131, // stmt_if
S_stmt_for = 132, // stmt_for S_stmt_ifelse = 132, // stmt_ifelse
S_stmt_foreach = 133, // stmt_foreach S_stmt_while = 133, // stmt_while
S_stmt_switch = 134, // stmt_switch S_stmt_dowhile = 134, // stmt_dowhile
S_stmt_case = 135, // stmt_case S_stmt_for = 135, // stmt_for
S_stmt_default = 136, // stmt_default S_stmt_foreach = 136, // stmt_foreach
S_stmt_break = 137, // stmt_break S_stmt_switch = 137, // stmt_switch
S_stmt_continue = 138, // stmt_continue S_stmt_case = 138, // stmt_case
S_stmt_return = 139, // stmt_return S_stmt_default = 139, // stmt_default
S_stmt_breakpoint = 140, // stmt_breakpoint S_stmt_break = 140, // stmt_break
S_stmt_prof_begin = 141, // stmt_prof_begin S_stmt_continue = 141, // stmt_continue
S_stmt_prof_end = 142, // stmt_prof_end S_stmt_return = 142, // stmt_return
S_expr = 143, // expr S_stmt_breakpoint = 143, // stmt_breakpoint
S_expr_or_empty = 144, // expr_or_empty S_stmt_prof_begin = 144, // stmt_prof_begin
S_expr_assign = 145, // expr_assign S_stmt_prof_end = 145, // stmt_prof_end
S_expr_increment = 146, // expr_increment S_expr = 146, // expr
S_expr_decrement = 147, // expr_decrement S_expr_or_empty = 147, // expr_or_empty
S_expr_ternary = 148, // expr_ternary S_expr_assign = 148, // expr_assign
S_expr_binary = 149, // expr_binary S_expr_increment = 149, // expr_increment
S_expr_primitive = 150, // expr_primitive S_expr_decrement = 150, // expr_decrement
S_expr_complement = 151, // expr_complement S_expr_ternary = 151, // expr_ternary
S_expr_not = 152, // expr_not S_expr_binary = 152, // expr_binary
S_expr_call = 153, // expr_call S_expr_primitive = 153, // expr_primitive
S_expr_method = 154, // expr_method S_expr_complement = 154, // expr_complement
S_expr_function = 155, // expr_function S_expr_not = 155, // expr_not
S_expr_pointer = 156, // expr_pointer S_expr_call = 156, // expr_call
S_expr_add_array = 157, // expr_add_array S_expr_method = 157, // expr_method
S_expr_parameters = 158, // expr_parameters S_expr_function = 158, // expr_function
S_expr_arguments = 159, // expr_arguments S_expr_pointer = 159, // expr_pointer
S_expr_arguments_no_empty = 160, // expr_arguments_no_empty S_expr_add_array = 160, // expr_add_array
S_expr_reference = 161, // expr_reference S_expr_parameters = 161, // expr_parameters
S_expr_array = 162, // expr_array S_expr_arguments = 162, // expr_arguments
S_expr_field = 163, // expr_field S_expr_arguments_no_empty = 163, // expr_arguments_no_empty
S_expr_size = 164, // expr_size S_expr_reference = 164, // expr_reference
S_expr_paren = 165, // expr_paren S_expr_array = 165, // expr_array
S_expr_object = 166, // expr_object S_expr_field = 166, // expr_field
S_expr_thisthread = 167, // expr_thisthread S_expr_size = 167, // expr_size
S_expr_empty_array = 168, // expr_empty_array S_expr_paren = 168, // expr_paren
S_expr_undefined = 169, // expr_undefined S_expr_object = 169, // expr_object
S_expr_game = 170, // expr_game S_expr_thisthread = 170, // expr_thisthread
S_expr_self = 171, // expr_self S_expr_empty_array = 171, // expr_empty_array
S_expr_anim = 172, // expr_anim S_expr_undefined = 172, // expr_undefined
S_expr_level = 173, // expr_level S_expr_game = 173, // expr_game
S_expr_animation = 174, // expr_animation S_expr_self = 174, // expr_self
S_expr_animtree = 175, // expr_animtree S_expr_anim = 175, // expr_anim
S_expr_identifier = 176, // expr_identifier S_expr_level = 176, // expr_level
S_expr_path = 177, // expr_path S_expr_animation = 177, // expr_animation
S_expr_istring = 178, // expr_istring S_expr_animtree = 178, // expr_animtree
S_expr_string = 179, // expr_string S_expr_identifier = 179, // expr_identifier
S_expr_color = 180, // expr_color S_expr_path = 180, // expr_path
S_expr_vector = 181, // expr_vector S_expr_istring = 181, // expr_istring
S_expr_float = 182, // expr_float S_expr_string = 182, // expr_string
S_expr_integer = 183, // expr_integer S_expr_color = 183, // expr_color
S_expr_false = 184, // expr_false S_expr_vector = 184, // expr_vector
S_expr_true = 185 // expr_true S_expr_float = 185, // expr_float
S_expr_integer = 186, // expr_integer
S_expr_false = 187, // expr_false
S_expr_true = 188 // expr_true
}; };
}; };
@ -1248,6 +1254,7 @@ namespace xsk { namespace gsc { namespace h2 {
value.move< ast::stmt_ifelse::ptr > (std::move (that.value)); value.move< ast::stmt_ifelse::ptr > (std::move (that.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.move< ast::stmt_list::ptr > (std::move (that.value)); value.move< ast::stmt_list::ptr > (std::move (that.value));
@ -2519,6 +2526,7 @@ switch (yykind)
value.template destroy< ast::stmt_ifelse::ptr > (); value.template destroy< ast::stmt_ifelse::ptr > ();
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.template destroy< ast::stmt_list::ptr > (); value.template destroy< ast::stmt_list::ptr > ();
@ -2782,6 +2790,36 @@ switch (yykind)
return symbol_type (token::H2UNDEF, l); return symbol_type (token::H2UNDEF, l);
} }
#endif #endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_DEVBEGIN (location_type l)
{
return symbol_type (token::DEVBEGIN, std::move (l));
}
#else
static
symbol_type
make_DEVBEGIN (const location_type& l)
{
return symbol_type (token::DEVBEGIN, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_DEVEND (location_type l)
{
return symbol_type (token::DEVEND, std::move (l));
}
#else
static
symbol_type
make_DEVEND (const location_type& l)
{
return symbol_type (token::DEVEND, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS #if 201103L <= YY_CPLUSPLUS
static static
symbol_type symbol_type
@ -4671,9 +4709,9 @@ switch (yykind)
/// Constants. /// Constants.
enum enum
{ {
yylast_ = 2075, ///< Last index in yytable_. yylast_ = 2254, ///< Last index in yytable_.
yynnts_ = 80, ///< Number of nonterminal symbols. yynnts_ = 81, ///< Number of nonterminal symbols.
yyfinal_ = 19 ///< Termination state number. yyfinal_ = 21 ///< Termination state number.
}; };
@ -4926,6 +4964,7 @@ switch (yykind)
value.copy< ast::stmt_ifelse::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_ifelse::ptr > (YY_MOVE (that.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.copy< ast::stmt_list::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_list::ptr > (YY_MOVE (that.value));
@ -5243,6 +5282,7 @@ switch (yykind)
value.move< ast::stmt_ifelse::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_ifelse::ptr > (YY_MOVE (s.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.move< ast::stmt_list::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_list::ptr > (YY_MOVE (s.value));
@ -5368,7 +5408,7 @@ switch (yykind)
#line 13 "parser.ypp" #line 13 "parser.ypp"
} } } // xsk::gsc::h2 } } } // xsk::gsc::h2
#line 5372 "parser.hpp" #line 5412 "parser.hpp"

View File

@ -85,6 +85,7 @@ void compiler::compile_program(const ast::program::ptr& program)
constants_.clear(); constants_.clear();
local_functions_.clear(); local_functions_.clear();
index_ = 1; index_ = 1;
developer_thread_ = false;
for (const auto& entry : program->declarations) for (const auto& entry : program->declarations)
{ {
@ -150,6 +151,12 @@ void compiler::emit_declaration(const ast::decl& decl)
{ {
switch (decl.kind()) switch (decl.kind())
{ {
case ast::kind::decl_dev_begin:
developer_thread_ = true;
break;
case ast::kind::decl_dev_end:
developer_thread_ = false;
break;
case ast::kind::decl_usingtree: case ast::kind::decl_usingtree:
emit_decl_usingtree(decl.as_usingtree); emit_decl_usingtree(decl.as_usingtree);
break; break;
@ -166,6 +173,9 @@ void compiler::emit_declaration(const ast::decl& decl)
void compiler::emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree) void compiler::emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree)
{ {
if(developer_thread_)
throw comp_error(animtree->loc(), "cannot put #using_animtree inside /# ... #/ comment");
animtrees_.push_back({ animtree->name->value, false }); animtrees_.push_back({ animtree->name->value, false });
} }

File diff suppressed because it is too large Load Diff

View File

@ -439,9 +439,9 @@ void yyfree ( void * , yyscan_t yyscanner );
#ifdef YY_HEADER_EXPORT_START_CONDITIONS #ifdef YY_HEADER_EXPORT_START_CONDITIONS
#define INITIAL 0 #define INITIAL 0
#define COMMENT_BLOCK_STATE 1 #define COMMENT_STATE 1
#define DEVBLOCK_ON_STATE 2 #define DEV_OFF_STATE 2
#define DEVBLOCK_OFF_STATE 3 #define DEV_ON_STATE 3
#endif #endif
@ -703,7 +703,7 @@ extern int yylex (yyscan_t yyscanner);
#undef yyTABLES_NAME #undef yyTABLES_NAME
#endif #endif
#line 165 "lexer.lpp" #line 169 "lexer.lpp"
#line 709 "lexer.hpp" #line 709 "lexer.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -580,6 +580,7 @@ namespace xsk { namespace gsc { namespace iw5 {
// stmt_ifelse // stmt_ifelse
char dummy54[sizeof (ast::stmt_ifelse::ptr)]; char dummy54[sizeof (ast::stmt_ifelse::ptr)];
// stmt_dev
// stmt_block // stmt_block
// stmt_list // stmt_list
char dummy55[sizeof (ast::stmt_list::ptr)]; char dummy55[sizeof (ast::stmt_list::ptr)];
@ -676,108 +677,110 @@ namespace xsk { namespace gsc { namespace iw5 {
IW5EOF = 0, // "end of file" IW5EOF = 0, // "end of file"
IW5error = 1, // error IW5error = 1, // error
IW5UNDEF = 2, // "invalid token" IW5UNDEF = 2, // "invalid token"
INLINE = 3, // "#inline" DEVBEGIN = 3, // "/#"
INCLUDE = 4, // "#include" DEVEND = 4, // "#/"
USINGTREE = 5, // "#using_animtree" INLINE = 5, // "#inline"
ANIMTREE = 6, // "#animtree" INCLUDE = 6, // "#include"
ENDON = 7, // "endon" USINGTREE = 7, // "#using_animtree"
NOTIFY = 8, // "notify" ANIMTREE = 8, // "#animtree"
WAIT = 9, // "wait" ENDON = 9, // "endon"
WAITTILL = 10, // "waittill" NOTIFY = 10, // "notify"
WAITTILLMATCH = 11, // "waittillmatch" WAIT = 11, // "wait"
WAITTILLFRAMEEND = 12, // "waittillframeend" WAITTILL = 12, // "waittill"
IF = 13, // "if" WAITTILLMATCH = 13, // "waittillmatch"
ELSE = 14, // "else" WAITTILLFRAMEEND = 14, // "waittillframeend"
DO = 15, // "do" IF = 15, // "if"
WHILE = 16, // "while" ELSE = 16, // "else"
FOR = 17, // "for" DO = 17, // "do"
FOREACH = 18, // "foreach" WHILE = 18, // "while"
IN = 19, // "in" FOR = 19, // "for"
SWITCH = 20, // "switch" FOREACH = 20, // "foreach"
CASE = 21, // "case" IN = 21, // "in"
DEFAULT = 22, // "default" SWITCH = 22, // "switch"
BREAK = 23, // "break" CASE = 23, // "case"
CONTINUE = 24, // "continue" DEFAULT = 24, // "default"
RETURN = 25, // "return" BREAK = 25, // "break"
BREAKPOINT = 26, // "breakpoint" CONTINUE = 26, // "continue"
PROFBEGIN = 27, // "prof_begin" RETURN = 27, // "return"
PROFEND = 28, // "prof_end" BREAKPOINT = 28, // "breakpoint"
THREAD = 29, // "thread" PROFBEGIN = 29, // "prof_begin"
CHILDTHREAD = 30, // "childthread" PROFEND = 30, // "prof_end"
THISTHREAD = 31, // "thisthread" THREAD = 31, // "thread"
CALL = 32, // "call" CHILDTHREAD = 32, // "childthread"
TRUE = 33, // "true" THISTHREAD = 33, // "thisthread"
FALSE = 34, // "false" CALL = 34, // "call"
UNDEFINED = 35, // "undefined" TRUE = 35, // "true"
SIZE = 36, // ".size" FALSE = 36, // "false"
GAME = 37, // "game" UNDEFINED = 37, // "undefined"
SELF = 38, // "self" SIZE = 38, // ".size"
ANIM = 39, // "anim" GAME = 39, // "game"
LEVEL = 40, // "level" SELF = 40, // "self"
LPAREN = 41, // "(" ANIM = 41, // "anim"
RPAREN = 42, // ")" LEVEL = 42, // "level"
LBRACE = 43, // "{" LPAREN = 43, // "("
RBRACE = 44, // "}" RPAREN = 44, // ")"
LBRACKET = 45, // "[" LBRACE = 45, // "{"
RBRACKET = 46, // "]" RBRACE = 46, // "}"
COMMA = 47, // "," LBRACKET = 47, // "["
DOT = 48, // "." RBRACKET = 48, // "]"
DOUBLECOLON = 49, // "::" COMMA = 49, // ","
COLON = 50, // ":" DOT = 50, // "."
SEMICOLON = 51, // ";" DOUBLECOLON = 51, // "::"
QMARK = 52, // "?" COLON = 52, // ":"
INCREMENT = 53, // "++" SEMICOLON = 53, // ";"
DECREMENT = 54, // "--" QMARK = 54, // "?"
LSHIFT = 55, // "<<" INCREMENT = 55, // "++"
RSHIFT = 56, // ">>" DECREMENT = 56, // "--"
OR = 57, // "||" LSHIFT = 57, // "<<"
AND = 58, // "&&" RSHIFT = 58, // ">>"
EQUALITY = 59, // "==" OR = 59, // "||"
INEQUALITY = 60, // "!=" AND = 60, // "&&"
LESS_EQUAL = 61, // "<=" EQUALITY = 61, // "=="
GREATER_EQUAL = 62, // ">=" INEQUALITY = 62, // "!="
LESS = 63, // "<" LESS_EQUAL = 63, // "<="
GREATER = 64, // ">" GREATER_EQUAL = 64, // ">="
NOT = 65, // "!" LESS = 65, // "<"
COMPLEMENT = 66, // "~" GREATER = 66, // ">"
ASSIGN = 67, // "=" NOT = 67, // "!"
ASSIGN_ADD = 68, // "+=" COMPLEMENT = 68, // "~"
ASSIGN_SUB = 69, // "-=" ASSIGN = 69, // "="
ASSIGN_MUL = 70, // "*=" ASSIGN_ADD = 70, // "+="
ASSIGN_DIV = 71, // "/=" ASSIGN_SUB = 71, // "-="
ASSIGN_MOD = 72, // "%=" ASSIGN_MUL = 72, // "*="
ASSIGN_BW_OR = 73, // "|=" ASSIGN_DIV = 73, // "/="
ASSIGN_BW_AND = 74, // "&=" ASSIGN_MOD = 74, // "%="
ASSIGN_BW_EXOR = 75, // "^=" ASSIGN_BW_OR = 75, // "|="
ASSIGN_RSHIFT = 76, // ">>=" ASSIGN_BW_AND = 76, // "&="
ASSIGN_LSHIFT = 77, // "<<=" ASSIGN_BW_EXOR = 77, // "^="
BITWISE_OR = 78, // "|" ASSIGN_RSHIFT = 78, // ">>="
BITWISE_AND = 79, // "&" ASSIGN_LSHIFT = 79, // "<<="
BITWISE_EXOR = 80, // "^" BITWISE_OR = 80, // "|"
ADD = 81, // "+" BITWISE_AND = 81, // "&"
SUB = 82, // "-" BITWISE_EXOR = 82, // "^"
MUL = 83, // "*" ADD = 83, // "+"
DIV = 84, // "/" SUB = 84, // "-"
MOD = 85, // "%" MUL = 85, // "*"
PATH = 86, // "path" DIV = 86, // "/"
IDENTIFIER = 87, // "identifier" MOD = 87, // "%"
STRING = 88, // "string literal" PATH = 88, // "path"
ISTRING = 89, // "localized string" IDENTIFIER = 89, // "identifier"
COLOR = 90, // "color" STRING = 90, // "string literal"
FLOAT = 91, // "float" ISTRING = 91, // "localized string"
INT_DEC = 92, // "int" COLOR = 92, // "color"
INT_OCT = 93, // "octal int" FLOAT = 93, // "float"
INT_BIN = 94, // "binary int" INT_DEC = 94, // "int"
INT_HEX = 95, // "hexadecimal int" INT_OCT = 95, // "octal int"
ADD_ARRAY = 96, // ADD_ARRAY INT_BIN = 96, // "binary int"
THEN = 97, // THEN INT_HEX = 97, // "hexadecimal int"
TERN = 98, // TERN ADD_ARRAY = 98, // ADD_ARRAY
NEG = 99, // NEG THEN = 99, // THEN
ANIMREF = 100, // ANIMREF TERN = 100, // TERN
PREINC = 101, // PREINC NEG = 101, // NEG
PREDEC = 102, // PREDEC ANIMREF = 102, // ANIMREF
POSTINC = 103, // POSTINC PREINC = 103, // PREINC
POSTDEC = 104 // POSTDEC PREDEC = 104, // PREDEC
POSTINC = 105, // POSTINC
POSTDEC = 106 // POSTDEC
}; };
/// Backward compatibility alias (Bison 3.6). /// Backward compatibility alias (Bison 3.6).
typedef token_kind_type yytokentype; typedef token_kind_type yytokentype;
@ -794,192 +797,195 @@ namespace xsk { namespace gsc { namespace iw5 {
{ {
enum symbol_kind_type enum symbol_kind_type
{ {
YYNTOKENS = 105, ///< Number of tokens. YYNTOKENS = 107, ///< 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
S_YYUNDEF = 2, // "invalid token" S_YYUNDEF = 2, // "invalid token"
S_INLINE = 3, // "#inline" S_DEVBEGIN = 3, // "/#"
S_INCLUDE = 4, // "#include" S_DEVEND = 4, // "#/"
S_USINGTREE = 5, // "#using_animtree" S_INLINE = 5, // "#inline"
S_ANIMTREE = 6, // "#animtree" S_INCLUDE = 6, // "#include"
S_ENDON = 7, // "endon" S_USINGTREE = 7, // "#using_animtree"
S_NOTIFY = 8, // "notify" S_ANIMTREE = 8, // "#animtree"
S_WAIT = 9, // "wait" S_ENDON = 9, // "endon"
S_WAITTILL = 10, // "waittill" S_NOTIFY = 10, // "notify"
S_WAITTILLMATCH = 11, // "waittillmatch" S_WAIT = 11, // "wait"
S_WAITTILLFRAMEEND = 12, // "waittillframeend" S_WAITTILL = 12, // "waittill"
S_IF = 13, // "if" S_WAITTILLMATCH = 13, // "waittillmatch"
S_ELSE = 14, // "else" S_WAITTILLFRAMEEND = 14, // "waittillframeend"
S_DO = 15, // "do" S_IF = 15, // "if"
S_WHILE = 16, // "while" S_ELSE = 16, // "else"
S_FOR = 17, // "for" S_DO = 17, // "do"
S_FOREACH = 18, // "foreach" S_WHILE = 18, // "while"
S_IN = 19, // "in" S_FOR = 19, // "for"
S_SWITCH = 20, // "switch" S_FOREACH = 20, // "foreach"
S_CASE = 21, // "case" S_IN = 21, // "in"
S_DEFAULT = 22, // "default" S_SWITCH = 22, // "switch"
S_BREAK = 23, // "break" S_CASE = 23, // "case"
S_CONTINUE = 24, // "continue" S_DEFAULT = 24, // "default"
S_RETURN = 25, // "return" S_BREAK = 25, // "break"
S_BREAKPOINT = 26, // "breakpoint" S_CONTINUE = 26, // "continue"
S_PROFBEGIN = 27, // "prof_begin" S_RETURN = 27, // "return"
S_PROFEND = 28, // "prof_end" S_BREAKPOINT = 28, // "breakpoint"
S_THREAD = 29, // "thread" S_PROFBEGIN = 29, // "prof_begin"
S_CHILDTHREAD = 30, // "childthread" S_PROFEND = 30, // "prof_end"
S_THISTHREAD = 31, // "thisthread" S_THREAD = 31, // "thread"
S_CALL = 32, // "call" S_CHILDTHREAD = 32, // "childthread"
S_TRUE = 33, // "true" S_THISTHREAD = 33, // "thisthread"
S_FALSE = 34, // "false" S_CALL = 34, // "call"
S_UNDEFINED = 35, // "undefined" S_TRUE = 35, // "true"
S_SIZE = 36, // ".size" S_FALSE = 36, // "false"
S_GAME = 37, // "game" S_UNDEFINED = 37, // "undefined"
S_SELF = 38, // "self" S_SIZE = 38, // ".size"
S_ANIM = 39, // "anim" S_GAME = 39, // "game"
S_LEVEL = 40, // "level" S_SELF = 40, // "self"
S_LPAREN = 41, // "(" S_ANIM = 41, // "anim"
S_RPAREN = 42, // ")" S_LEVEL = 42, // "level"
S_LBRACE = 43, // "{" S_LPAREN = 43, // "("
S_RBRACE = 44, // "}" S_RPAREN = 44, // ")"
S_LBRACKET = 45, // "[" S_LBRACE = 45, // "{"
S_RBRACKET = 46, // "]" S_RBRACE = 46, // "}"
S_COMMA = 47, // "," S_LBRACKET = 47, // "["
S_DOT = 48, // "." S_RBRACKET = 48, // "]"
S_DOUBLECOLON = 49, // "::" S_COMMA = 49, // ","
S_COLON = 50, // ":" S_DOT = 50, // "."
S_SEMICOLON = 51, // ";" S_DOUBLECOLON = 51, // "::"
S_QMARK = 52, // "?" S_COLON = 52, // ":"
S_INCREMENT = 53, // "++" S_SEMICOLON = 53, // ";"
S_DECREMENT = 54, // "--" S_QMARK = 54, // "?"
S_LSHIFT = 55, // "<<" S_INCREMENT = 55, // "++"
S_RSHIFT = 56, // ">>" S_DECREMENT = 56, // "--"
S_OR = 57, // "||" S_LSHIFT = 57, // "<<"
S_AND = 58, // "&&" S_RSHIFT = 58, // ">>"
S_EQUALITY = 59, // "==" S_OR = 59, // "||"
S_INEQUALITY = 60, // "!=" S_AND = 60, // "&&"
S_LESS_EQUAL = 61, // "<=" S_EQUALITY = 61, // "=="
S_GREATER_EQUAL = 62, // ">=" S_INEQUALITY = 62, // "!="
S_LESS = 63, // "<" S_LESS_EQUAL = 63, // "<="
S_GREATER = 64, // ">" S_GREATER_EQUAL = 64, // ">="
S_NOT = 65, // "!" S_LESS = 65, // "<"
S_COMPLEMENT = 66, // "~" S_GREATER = 66, // ">"
S_ASSIGN = 67, // "=" S_NOT = 67, // "!"
S_ASSIGN_ADD = 68, // "+=" S_COMPLEMENT = 68, // "~"
S_ASSIGN_SUB = 69, // "-=" S_ASSIGN = 69, // "="
S_ASSIGN_MUL = 70, // "*=" S_ASSIGN_ADD = 70, // "+="
S_ASSIGN_DIV = 71, // "/=" S_ASSIGN_SUB = 71, // "-="
S_ASSIGN_MOD = 72, // "%=" S_ASSIGN_MUL = 72, // "*="
S_ASSIGN_BW_OR = 73, // "|=" S_ASSIGN_DIV = 73, // "/="
S_ASSIGN_BW_AND = 74, // "&=" S_ASSIGN_MOD = 74, // "%="
S_ASSIGN_BW_EXOR = 75, // "^=" S_ASSIGN_BW_OR = 75, // "|="
S_ASSIGN_RSHIFT = 76, // ">>=" S_ASSIGN_BW_AND = 76, // "&="
S_ASSIGN_LSHIFT = 77, // "<<=" S_ASSIGN_BW_EXOR = 77, // "^="
S_BITWISE_OR = 78, // "|" S_ASSIGN_RSHIFT = 78, // ">>="
S_BITWISE_AND = 79, // "&" S_ASSIGN_LSHIFT = 79, // "<<="
S_BITWISE_EXOR = 80, // "^" S_BITWISE_OR = 80, // "|"
S_ADD = 81, // "+" S_BITWISE_AND = 81, // "&"
S_SUB = 82, // "-" S_BITWISE_EXOR = 82, // "^"
S_MUL = 83, // "*" S_ADD = 83, // "+"
S_DIV = 84, // "/" S_SUB = 84, // "-"
S_MOD = 85, // "%" S_MUL = 85, // "*"
S_PATH = 86, // "path" S_DIV = 86, // "/"
S_IDENTIFIER = 87, // "identifier" S_MOD = 87, // "%"
S_STRING = 88, // "string literal" S_PATH = 88, // "path"
S_ISTRING = 89, // "localized string" S_IDENTIFIER = 89, // "identifier"
S_COLOR = 90, // "color" S_STRING = 90, // "string literal"
S_FLOAT = 91, // "float" S_ISTRING = 91, // "localized string"
S_INT_DEC = 92, // "int" S_COLOR = 92, // "color"
S_INT_OCT = 93, // "octal int" S_FLOAT = 93, // "float"
S_INT_BIN = 94, // "binary int" S_INT_DEC = 94, // "int"
S_INT_HEX = 95, // "hexadecimal int" S_INT_OCT = 95, // "octal int"
S_ADD_ARRAY = 96, // ADD_ARRAY S_INT_BIN = 96, // "binary int"
S_THEN = 97, // THEN S_INT_HEX = 97, // "hexadecimal int"
S_TERN = 98, // TERN S_ADD_ARRAY = 98, // ADD_ARRAY
S_NEG = 99, // NEG S_THEN = 99, // THEN
S_ANIMREF = 100, // ANIMREF S_TERN = 100, // TERN
S_PREINC = 101, // PREINC S_NEG = 101, // NEG
S_PREDEC = 102, // PREDEC S_ANIMREF = 102, // ANIMREF
S_POSTINC = 103, // POSTINC S_PREINC = 103, // PREINC
S_POSTDEC = 104, // POSTDEC S_PREDEC = 104, // PREDEC
S_YYACCEPT = 105, // $accept S_POSTINC = 105, // POSTINC
S_root = 106, // root S_POSTDEC = 106, // POSTDEC
S_program = 107, // program S_YYACCEPT = 107, // $accept
S_inline = 108, // inline S_root = 108, // root
S_include = 109, // include S_program = 109, // program
S_declaration = 110, // declaration S_inline = 110, // inline
S_decl_usingtree = 111, // decl_usingtree S_include = 111, // include
S_decl_constant = 112, // decl_constant S_declaration = 112, // declaration
S_decl_thread = 113, // decl_thread S_decl_usingtree = 113, // decl_usingtree
S_stmt = 114, // stmt S_decl_constant = 114, // decl_constant
S_stmt_block = 115, // stmt_block S_decl_thread = 115, // decl_thread
S_stmt_list = 116, // stmt_list S_stmt = 116, // stmt
S_stmt_expr = 117, // stmt_expr S_stmt_dev = 117, // stmt_dev
S_stmt_call = 118, // stmt_call S_stmt_block = 118, // stmt_block
S_stmt_assign = 119, // stmt_assign S_stmt_list = 119, // stmt_list
S_stmt_endon = 120, // stmt_endon S_stmt_expr = 120, // stmt_expr
S_stmt_notify = 121, // stmt_notify S_stmt_call = 121, // stmt_call
S_stmt_wait = 122, // stmt_wait S_stmt_assign = 122, // stmt_assign
S_stmt_waittill = 123, // stmt_waittill S_stmt_endon = 123, // stmt_endon
S_stmt_waittillmatch = 124, // stmt_waittillmatch S_stmt_notify = 124, // stmt_notify
S_stmt_waittillframeend = 125, // stmt_waittillframeend S_stmt_wait = 125, // stmt_wait
S_stmt_if = 126, // stmt_if S_stmt_waittill = 126, // stmt_waittill
S_stmt_ifelse = 127, // stmt_ifelse S_stmt_waittillmatch = 127, // stmt_waittillmatch
S_stmt_while = 128, // stmt_while S_stmt_waittillframeend = 128, // stmt_waittillframeend
S_stmt_dowhile = 129, // stmt_dowhile S_stmt_if = 129, // stmt_if
S_stmt_for = 130, // stmt_for S_stmt_ifelse = 130, // stmt_ifelse
S_stmt_foreach = 131, // stmt_foreach S_stmt_while = 131, // stmt_while
S_stmt_switch = 132, // stmt_switch S_stmt_dowhile = 132, // stmt_dowhile
S_stmt_case = 133, // stmt_case S_stmt_for = 133, // stmt_for
S_stmt_default = 134, // stmt_default S_stmt_foreach = 134, // stmt_foreach
S_stmt_break = 135, // stmt_break S_stmt_switch = 135, // stmt_switch
S_stmt_continue = 136, // stmt_continue S_stmt_case = 136, // stmt_case
S_stmt_return = 137, // stmt_return S_stmt_default = 137, // stmt_default
S_stmt_breakpoint = 138, // stmt_breakpoint S_stmt_break = 138, // stmt_break
S_stmt_prof_begin = 139, // stmt_prof_begin S_stmt_continue = 139, // stmt_continue
S_stmt_prof_end = 140, // stmt_prof_end S_stmt_return = 140, // stmt_return
S_expr = 141, // expr S_stmt_breakpoint = 141, // stmt_breakpoint
S_expr_or_empty = 142, // expr_or_empty S_stmt_prof_begin = 142, // stmt_prof_begin
S_expr_assign = 143, // expr_assign S_stmt_prof_end = 143, // stmt_prof_end
S_expr_increment = 144, // expr_increment S_expr = 144, // expr
S_expr_decrement = 145, // expr_decrement S_expr_or_empty = 145, // expr_or_empty
S_expr_ternary = 146, // expr_ternary S_expr_assign = 146, // expr_assign
S_expr_binary = 147, // expr_binary S_expr_increment = 147, // expr_increment
S_expr_primitive = 148, // expr_primitive S_expr_decrement = 148, // expr_decrement
S_expr_complement = 149, // expr_complement S_expr_ternary = 149, // expr_ternary
S_expr_not = 150, // expr_not S_expr_binary = 150, // expr_binary
S_expr_call = 151, // expr_call S_expr_primitive = 151, // expr_primitive
S_expr_method = 152, // expr_method S_expr_complement = 152, // expr_complement
S_expr_function = 153, // expr_function S_expr_not = 153, // expr_not
S_expr_pointer = 154, // expr_pointer S_expr_call = 154, // expr_call
S_expr_add_array = 155, // expr_add_array S_expr_method = 155, // expr_method
S_expr_parameters = 156, // expr_parameters S_expr_function = 156, // expr_function
S_expr_arguments = 157, // expr_arguments S_expr_pointer = 157, // expr_pointer
S_expr_arguments_no_empty = 158, // expr_arguments_no_empty S_expr_add_array = 158, // expr_add_array
S_expr_reference = 159, // expr_reference S_expr_parameters = 159, // expr_parameters
S_expr_array = 160, // expr_array S_expr_arguments = 160, // expr_arguments
S_expr_field = 161, // expr_field S_expr_arguments_no_empty = 161, // expr_arguments_no_empty
S_expr_size = 162, // expr_size S_expr_reference = 162, // expr_reference
S_expr_paren = 163, // expr_paren S_expr_array = 163, // expr_array
S_expr_object = 164, // expr_object S_expr_field = 164, // expr_field
S_expr_thisthread = 165, // expr_thisthread S_expr_size = 165, // expr_size
S_expr_empty_array = 166, // expr_empty_array S_expr_paren = 166, // expr_paren
S_expr_undefined = 167, // expr_undefined S_expr_object = 167, // expr_object
S_expr_game = 168, // expr_game S_expr_thisthread = 168, // expr_thisthread
S_expr_self = 169, // expr_self S_expr_empty_array = 169, // expr_empty_array
S_expr_anim = 170, // expr_anim S_expr_undefined = 170, // expr_undefined
S_expr_level = 171, // expr_level S_expr_game = 171, // expr_game
S_expr_animation = 172, // expr_animation S_expr_self = 172, // expr_self
S_expr_animtree = 173, // expr_animtree S_expr_anim = 173, // expr_anim
S_expr_identifier = 174, // expr_identifier S_expr_level = 174, // expr_level
S_expr_path = 175, // expr_path S_expr_animation = 175, // expr_animation
S_expr_istring = 176, // expr_istring S_expr_animtree = 176, // expr_animtree
S_expr_string = 177, // expr_string S_expr_identifier = 177, // expr_identifier
S_expr_color = 178, // expr_color S_expr_path = 178, // expr_path
S_expr_vector = 179, // expr_vector S_expr_istring = 179, // expr_istring
S_expr_float = 180, // expr_float S_expr_string = 180, // expr_string
S_expr_integer = 181, // expr_integer S_expr_color = 181, // expr_color
S_expr_false = 182, // expr_false S_expr_vector = 182, // expr_vector
S_expr_true = 183 // expr_true S_expr_float = 183, // expr_float
S_expr_integer = 184, // expr_integer
S_expr_false = 185, // expr_false
S_expr_true = 186 // expr_true
}; };
}; };
@ -1242,6 +1248,7 @@ namespace xsk { namespace gsc { namespace iw5 {
value.move< ast::stmt_ifelse::ptr > (std::move (that.value)); value.move< ast::stmt_ifelse::ptr > (std::move (that.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.move< ast::stmt_list::ptr > (std::move (that.value)); value.move< ast::stmt_list::ptr > (std::move (that.value));
@ -2495,6 +2502,7 @@ switch (yykind)
value.template destroy< ast::stmt_ifelse::ptr > (); value.template destroy< ast::stmt_ifelse::ptr > ();
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.template destroy< ast::stmt_list::ptr > (); value.template destroy< ast::stmt_list::ptr > ();
@ -2754,6 +2762,36 @@ switch (yykind)
return symbol_type (token::IW5UNDEF, l); return symbol_type (token::IW5UNDEF, l);
} }
#endif #endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_DEVBEGIN (location_type l)
{
return symbol_type (token::DEVBEGIN, std::move (l));
}
#else
static
symbol_type
make_DEVBEGIN (const location_type& l)
{
return symbol_type (token::DEVBEGIN, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_DEVEND (location_type l)
{
return symbol_type (token::DEVEND, std::move (l));
}
#else
static
symbol_type
make_DEVEND (const location_type& l)
{
return symbol_type (token::DEVEND, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS #if 201103L <= YY_CPLUSPLUS
static static
symbol_type symbol_type
@ -4628,9 +4666,9 @@ switch (yykind)
/// Constants. /// Constants.
enum enum
{ {
yylast_ = 2111, ///< Last index in yytable_. yylast_ = 2346, ///< Last index in yytable_.
yynnts_ = 79, ///< Number of nonterminal symbols. yynnts_ = 80, ///< Number of nonterminal symbols.
yyfinal_ = 19 ///< Termination state number. yyfinal_ = 21 ///< Termination state number.
}; };
@ -4883,6 +4921,7 @@ switch (yykind)
value.copy< ast::stmt_ifelse::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_ifelse::ptr > (YY_MOVE (that.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.copy< ast::stmt_list::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_list::ptr > (YY_MOVE (that.value));
@ -5196,6 +5235,7 @@ switch (yykind)
value.move< ast::stmt_ifelse::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_ifelse::ptr > (YY_MOVE (s.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.move< ast::stmt_list::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_list::ptr > (YY_MOVE (s.value));
@ -5317,7 +5357,7 @@ switch (yykind)
#line 13 "parser.ypp" #line 13 "parser.ypp"
} } } // xsk::gsc::iw5 } } } // xsk::gsc::iw5
#line 5321 "parser.hpp" #line 5361 "parser.hpp"

View File

@ -85,6 +85,7 @@ void compiler::compile_program(const ast::program::ptr& program)
constants_.clear(); constants_.clear();
local_functions_.clear(); local_functions_.clear();
index_ = 1; index_ = 1;
developer_thread_ = false;
for (const auto& entry : program->declarations) for (const auto& entry : program->declarations)
{ {
@ -150,6 +151,12 @@ void compiler::emit_declaration(const ast::decl& decl)
{ {
switch (decl.kind()) switch (decl.kind())
{ {
case ast::kind::decl_dev_begin:
developer_thread_ = true;
break;
case ast::kind::decl_dev_end:
developer_thread_ = false;
break;
case ast::kind::decl_usingtree: case ast::kind::decl_usingtree:
emit_decl_usingtree(decl.as_usingtree); emit_decl_usingtree(decl.as_usingtree);
break; break;
@ -166,6 +173,9 @@ void compiler::emit_declaration(const ast::decl& decl)
void compiler::emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree) void compiler::emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree)
{ {
if(developer_thread_)
throw comp_error(animtree->loc(), "cannot put #using_animtree inside /# ... #/ comment");
animtrees_.push_back({ animtree->name->value, false }); animtrees_.push_back({ animtree->name->value, false });
} }

File diff suppressed because it is too large Load Diff

View File

@ -439,9 +439,9 @@ void yyfree ( void * , yyscan_t yyscanner );
#ifdef YY_HEADER_EXPORT_START_CONDITIONS #ifdef YY_HEADER_EXPORT_START_CONDITIONS
#define INITIAL 0 #define INITIAL 0
#define COMMENT_BLOCK_STATE 1 #define COMMENT_STATE 1
#define DEVBLOCK_ON_STATE 2 #define DEV_OFF_STATE 2
#define DEVBLOCK_OFF_STATE 3 #define DEV_ON_STATE 3
#endif #endif
@ -703,7 +703,7 @@ extern int yylex (yyscan_t yyscanner);
#undef yyTABLES_NAME #undef yyTABLES_NAME
#endif #endif
#line 165 "lexer.lpp" #line 169 "lexer.lpp"
#line 709 "lexer.hpp" #line 709 "lexer.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -580,6 +580,7 @@ namespace xsk { namespace gsc { namespace iw6 {
// stmt_ifelse // stmt_ifelse
char dummy54[sizeof (ast::stmt_ifelse::ptr)]; char dummy54[sizeof (ast::stmt_ifelse::ptr)];
// stmt_dev
// stmt_block // stmt_block
// stmt_list // stmt_list
char dummy55[sizeof (ast::stmt_list::ptr)]; char dummy55[sizeof (ast::stmt_list::ptr)];
@ -676,108 +677,110 @@ namespace xsk { namespace gsc { namespace iw6 {
IW6EOF = 0, // "end of file" IW6EOF = 0, // "end of file"
IW6error = 1, // error IW6error = 1, // error
IW6UNDEF = 2, // "invalid token" IW6UNDEF = 2, // "invalid token"
INLINE = 3, // "#inline" DEVBEGIN = 3, // "/#"
INCLUDE = 4, // "#include" DEVEND = 4, // "#/"
USINGTREE = 5, // "#using_animtree" INLINE = 5, // "#inline"
ANIMTREE = 6, // "#animtree" INCLUDE = 6, // "#include"
ENDON = 7, // "endon" USINGTREE = 7, // "#using_animtree"
NOTIFY = 8, // "notify" ANIMTREE = 8, // "#animtree"
WAIT = 9, // "wait" ENDON = 9, // "endon"
WAITTILL = 10, // "waittill" NOTIFY = 10, // "notify"
WAITTILLMATCH = 11, // "waittillmatch" WAIT = 11, // "wait"
WAITTILLFRAMEEND = 12, // "waittillframeend" WAITTILL = 12, // "waittill"
IF = 13, // "if" WAITTILLMATCH = 13, // "waittillmatch"
ELSE = 14, // "else" WAITTILLFRAMEEND = 14, // "waittillframeend"
DO = 15, // "do" IF = 15, // "if"
WHILE = 16, // "while" ELSE = 16, // "else"
FOR = 17, // "for" DO = 17, // "do"
FOREACH = 18, // "foreach" WHILE = 18, // "while"
IN = 19, // "in" FOR = 19, // "for"
SWITCH = 20, // "switch" FOREACH = 20, // "foreach"
CASE = 21, // "case" IN = 21, // "in"
DEFAULT = 22, // "default" SWITCH = 22, // "switch"
BREAK = 23, // "break" CASE = 23, // "case"
CONTINUE = 24, // "continue" DEFAULT = 24, // "default"
RETURN = 25, // "return" BREAK = 25, // "break"
BREAKPOINT = 26, // "breakpoint" CONTINUE = 26, // "continue"
PROFBEGIN = 27, // "prof_begin" RETURN = 27, // "return"
PROFEND = 28, // "prof_end" BREAKPOINT = 28, // "breakpoint"
THREAD = 29, // "thread" PROFBEGIN = 29, // "prof_begin"
CHILDTHREAD = 30, // "childthread" PROFEND = 30, // "prof_end"
THISTHREAD = 31, // "thisthread" THREAD = 31, // "thread"
CALL = 32, // "call" CHILDTHREAD = 32, // "childthread"
TRUE = 33, // "true" THISTHREAD = 33, // "thisthread"
FALSE = 34, // "false" CALL = 34, // "call"
UNDEFINED = 35, // "undefined" TRUE = 35, // "true"
SIZE = 36, // ".size" FALSE = 36, // "false"
GAME = 37, // "game" UNDEFINED = 37, // "undefined"
SELF = 38, // "self" SIZE = 38, // ".size"
ANIM = 39, // "anim" GAME = 39, // "game"
LEVEL = 40, // "level" SELF = 40, // "self"
LPAREN = 41, // "(" ANIM = 41, // "anim"
RPAREN = 42, // ")" LEVEL = 42, // "level"
LBRACE = 43, // "{" LPAREN = 43, // "("
RBRACE = 44, // "}" RPAREN = 44, // ")"
LBRACKET = 45, // "[" LBRACE = 45, // "{"
RBRACKET = 46, // "]" RBRACE = 46, // "}"
COMMA = 47, // "," LBRACKET = 47, // "["
DOT = 48, // "." RBRACKET = 48, // "]"
DOUBLECOLON = 49, // "::" COMMA = 49, // ","
COLON = 50, // ":" DOT = 50, // "."
SEMICOLON = 51, // ";" DOUBLECOLON = 51, // "::"
QMARK = 52, // "?" COLON = 52, // ":"
INCREMENT = 53, // "++" SEMICOLON = 53, // ";"
DECREMENT = 54, // "--" QMARK = 54, // "?"
LSHIFT = 55, // "<<" INCREMENT = 55, // "++"
RSHIFT = 56, // ">>" DECREMENT = 56, // "--"
OR = 57, // "||" LSHIFT = 57, // "<<"
AND = 58, // "&&" RSHIFT = 58, // ">>"
EQUALITY = 59, // "==" OR = 59, // "||"
INEQUALITY = 60, // "!=" AND = 60, // "&&"
LESS_EQUAL = 61, // "<=" EQUALITY = 61, // "=="
GREATER_EQUAL = 62, // ">=" INEQUALITY = 62, // "!="
LESS = 63, // "<" LESS_EQUAL = 63, // "<="
GREATER = 64, // ">" GREATER_EQUAL = 64, // ">="
NOT = 65, // "!" LESS = 65, // "<"
COMPLEMENT = 66, // "~" GREATER = 66, // ">"
ASSIGN = 67, // "=" NOT = 67, // "!"
ASSIGN_ADD = 68, // "+=" COMPLEMENT = 68, // "~"
ASSIGN_SUB = 69, // "-=" ASSIGN = 69, // "="
ASSIGN_MUL = 70, // "*=" ASSIGN_ADD = 70, // "+="
ASSIGN_DIV = 71, // "/=" ASSIGN_SUB = 71, // "-="
ASSIGN_MOD = 72, // "%=" ASSIGN_MUL = 72, // "*="
ASSIGN_BW_OR = 73, // "|=" ASSIGN_DIV = 73, // "/="
ASSIGN_BW_AND = 74, // "&=" ASSIGN_MOD = 74, // "%="
ASSIGN_BW_EXOR = 75, // "^=" ASSIGN_BW_OR = 75, // "|="
ASSIGN_RSHIFT = 76, // ">>=" ASSIGN_BW_AND = 76, // "&="
ASSIGN_LSHIFT = 77, // "<<=" ASSIGN_BW_EXOR = 77, // "^="
BITWISE_OR = 78, // "|" ASSIGN_RSHIFT = 78, // ">>="
BITWISE_AND = 79, // "&" ASSIGN_LSHIFT = 79, // "<<="
BITWISE_EXOR = 80, // "^" BITWISE_OR = 80, // "|"
ADD = 81, // "+" BITWISE_AND = 81, // "&"
SUB = 82, // "-" BITWISE_EXOR = 82, // "^"
MUL = 83, // "*" ADD = 83, // "+"
DIV = 84, // "/" SUB = 84, // "-"
MOD = 85, // "%" MUL = 85, // "*"
PATH = 86, // "path" DIV = 86, // "/"
IDENTIFIER = 87, // "identifier" MOD = 87, // "%"
STRING = 88, // "string literal" PATH = 88, // "path"
ISTRING = 89, // "localized string" IDENTIFIER = 89, // "identifier"
COLOR = 90, // "color" STRING = 90, // "string literal"
FLOAT = 91, // "float" ISTRING = 91, // "localized string"
INT_DEC = 92, // "int" COLOR = 92, // "color"
INT_OCT = 93, // "octal int" FLOAT = 93, // "float"
INT_BIN = 94, // "binary int" INT_DEC = 94, // "int"
INT_HEX = 95, // "hexadecimal int" INT_OCT = 95, // "octal int"
ADD_ARRAY = 96, // ADD_ARRAY INT_BIN = 96, // "binary int"
THEN = 97, // THEN INT_HEX = 97, // "hexadecimal int"
TERN = 98, // TERN ADD_ARRAY = 98, // ADD_ARRAY
NEG = 99, // NEG THEN = 99, // THEN
ANIMREF = 100, // ANIMREF TERN = 100, // TERN
PREINC = 101, // PREINC NEG = 101, // NEG
PREDEC = 102, // PREDEC ANIMREF = 102, // ANIMREF
POSTINC = 103, // POSTINC PREINC = 103, // PREINC
POSTDEC = 104 // POSTDEC PREDEC = 104, // PREDEC
POSTINC = 105, // POSTINC
POSTDEC = 106 // POSTDEC
}; };
/// Backward compatibility alias (Bison 3.6). /// Backward compatibility alias (Bison 3.6).
typedef token_kind_type yytokentype; typedef token_kind_type yytokentype;
@ -794,192 +797,195 @@ namespace xsk { namespace gsc { namespace iw6 {
{ {
enum symbol_kind_type enum symbol_kind_type
{ {
YYNTOKENS = 105, ///< Number of tokens. YYNTOKENS = 107, ///< 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
S_YYUNDEF = 2, // "invalid token" S_YYUNDEF = 2, // "invalid token"
S_INLINE = 3, // "#inline" S_DEVBEGIN = 3, // "/#"
S_INCLUDE = 4, // "#include" S_DEVEND = 4, // "#/"
S_USINGTREE = 5, // "#using_animtree" S_INLINE = 5, // "#inline"
S_ANIMTREE = 6, // "#animtree" S_INCLUDE = 6, // "#include"
S_ENDON = 7, // "endon" S_USINGTREE = 7, // "#using_animtree"
S_NOTIFY = 8, // "notify" S_ANIMTREE = 8, // "#animtree"
S_WAIT = 9, // "wait" S_ENDON = 9, // "endon"
S_WAITTILL = 10, // "waittill" S_NOTIFY = 10, // "notify"
S_WAITTILLMATCH = 11, // "waittillmatch" S_WAIT = 11, // "wait"
S_WAITTILLFRAMEEND = 12, // "waittillframeend" S_WAITTILL = 12, // "waittill"
S_IF = 13, // "if" S_WAITTILLMATCH = 13, // "waittillmatch"
S_ELSE = 14, // "else" S_WAITTILLFRAMEEND = 14, // "waittillframeend"
S_DO = 15, // "do" S_IF = 15, // "if"
S_WHILE = 16, // "while" S_ELSE = 16, // "else"
S_FOR = 17, // "for" S_DO = 17, // "do"
S_FOREACH = 18, // "foreach" S_WHILE = 18, // "while"
S_IN = 19, // "in" S_FOR = 19, // "for"
S_SWITCH = 20, // "switch" S_FOREACH = 20, // "foreach"
S_CASE = 21, // "case" S_IN = 21, // "in"
S_DEFAULT = 22, // "default" S_SWITCH = 22, // "switch"
S_BREAK = 23, // "break" S_CASE = 23, // "case"
S_CONTINUE = 24, // "continue" S_DEFAULT = 24, // "default"
S_RETURN = 25, // "return" S_BREAK = 25, // "break"
S_BREAKPOINT = 26, // "breakpoint" S_CONTINUE = 26, // "continue"
S_PROFBEGIN = 27, // "prof_begin" S_RETURN = 27, // "return"
S_PROFEND = 28, // "prof_end" S_BREAKPOINT = 28, // "breakpoint"
S_THREAD = 29, // "thread" S_PROFBEGIN = 29, // "prof_begin"
S_CHILDTHREAD = 30, // "childthread" S_PROFEND = 30, // "prof_end"
S_THISTHREAD = 31, // "thisthread" S_THREAD = 31, // "thread"
S_CALL = 32, // "call" S_CHILDTHREAD = 32, // "childthread"
S_TRUE = 33, // "true" S_THISTHREAD = 33, // "thisthread"
S_FALSE = 34, // "false" S_CALL = 34, // "call"
S_UNDEFINED = 35, // "undefined" S_TRUE = 35, // "true"
S_SIZE = 36, // ".size" S_FALSE = 36, // "false"
S_GAME = 37, // "game" S_UNDEFINED = 37, // "undefined"
S_SELF = 38, // "self" S_SIZE = 38, // ".size"
S_ANIM = 39, // "anim" S_GAME = 39, // "game"
S_LEVEL = 40, // "level" S_SELF = 40, // "self"
S_LPAREN = 41, // "(" S_ANIM = 41, // "anim"
S_RPAREN = 42, // ")" S_LEVEL = 42, // "level"
S_LBRACE = 43, // "{" S_LPAREN = 43, // "("
S_RBRACE = 44, // "}" S_RPAREN = 44, // ")"
S_LBRACKET = 45, // "[" S_LBRACE = 45, // "{"
S_RBRACKET = 46, // "]" S_RBRACE = 46, // "}"
S_COMMA = 47, // "," S_LBRACKET = 47, // "["
S_DOT = 48, // "." S_RBRACKET = 48, // "]"
S_DOUBLECOLON = 49, // "::" S_COMMA = 49, // ","
S_COLON = 50, // ":" S_DOT = 50, // "."
S_SEMICOLON = 51, // ";" S_DOUBLECOLON = 51, // "::"
S_QMARK = 52, // "?" S_COLON = 52, // ":"
S_INCREMENT = 53, // "++" S_SEMICOLON = 53, // ";"
S_DECREMENT = 54, // "--" S_QMARK = 54, // "?"
S_LSHIFT = 55, // "<<" S_INCREMENT = 55, // "++"
S_RSHIFT = 56, // ">>" S_DECREMENT = 56, // "--"
S_OR = 57, // "||" S_LSHIFT = 57, // "<<"
S_AND = 58, // "&&" S_RSHIFT = 58, // ">>"
S_EQUALITY = 59, // "==" S_OR = 59, // "||"
S_INEQUALITY = 60, // "!=" S_AND = 60, // "&&"
S_LESS_EQUAL = 61, // "<=" S_EQUALITY = 61, // "=="
S_GREATER_EQUAL = 62, // ">=" S_INEQUALITY = 62, // "!="
S_LESS = 63, // "<" S_LESS_EQUAL = 63, // "<="
S_GREATER = 64, // ">" S_GREATER_EQUAL = 64, // ">="
S_NOT = 65, // "!" S_LESS = 65, // "<"
S_COMPLEMENT = 66, // "~" S_GREATER = 66, // ">"
S_ASSIGN = 67, // "=" S_NOT = 67, // "!"
S_ASSIGN_ADD = 68, // "+=" S_COMPLEMENT = 68, // "~"
S_ASSIGN_SUB = 69, // "-=" S_ASSIGN = 69, // "="
S_ASSIGN_MUL = 70, // "*=" S_ASSIGN_ADD = 70, // "+="
S_ASSIGN_DIV = 71, // "/=" S_ASSIGN_SUB = 71, // "-="
S_ASSIGN_MOD = 72, // "%=" S_ASSIGN_MUL = 72, // "*="
S_ASSIGN_BW_OR = 73, // "|=" S_ASSIGN_DIV = 73, // "/="
S_ASSIGN_BW_AND = 74, // "&=" S_ASSIGN_MOD = 74, // "%="
S_ASSIGN_BW_EXOR = 75, // "^=" S_ASSIGN_BW_OR = 75, // "|="
S_ASSIGN_RSHIFT = 76, // ">>=" S_ASSIGN_BW_AND = 76, // "&="
S_ASSIGN_LSHIFT = 77, // "<<=" S_ASSIGN_BW_EXOR = 77, // "^="
S_BITWISE_OR = 78, // "|" S_ASSIGN_RSHIFT = 78, // ">>="
S_BITWISE_AND = 79, // "&" S_ASSIGN_LSHIFT = 79, // "<<="
S_BITWISE_EXOR = 80, // "^" S_BITWISE_OR = 80, // "|"
S_ADD = 81, // "+" S_BITWISE_AND = 81, // "&"
S_SUB = 82, // "-" S_BITWISE_EXOR = 82, // "^"
S_MUL = 83, // "*" S_ADD = 83, // "+"
S_DIV = 84, // "/" S_SUB = 84, // "-"
S_MOD = 85, // "%" S_MUL = 85, // "*"
S_PATH = 86, // "path" S_DIV = 86, // "/"
S_IDENTIFIER = 87, // "identifier" S_MOD = 87, // "%"
S_STRING = 88, // "string literal" S_PATH = 88, // "path"
S_ISTRING = 89, // "localized string" S_IDENTIFIER = 89, // "identifier"
S_COLOR = 90, // "color" S_STRING = 90, // "string literal"
S_FLOAT = 91, // "float" S_ISTRING = 91, // "localized string"
S_INT_DEC = 92, // "int" S_COLOR = 92, // "color"
S_INT_OCT = 93, // "octal int" S_FLOAT = 93, // "float"
S_INT_BIN = 94, // "binary int" S_INT_DEC = 94, // "int"
S_INT_HEX = 95, // "hexadecimal int" S_INT_OCT = 95, // "octal int"
S_ADD_ARRAY = 96, // ADD_ARRAY S_INT_BIN = 96, // "binary int"
S_THEN = 97, // THEN S_INT_HEX = 97, // "hexadecimal int"
S_TERN = 98, // TERN S_ADD_ARRAY = 98, // ADD_ARRAY
S_NEG = 99, // NEG S_THEN = 99, // THEN
S_ANIMREF = 100, // ANIMREF S_TERN = 100, // TERN
S_PREINC = 101, // PREINC S_NEG = 101, // NEG
S_PREDEC = 102, // PREDEC S_ANIMREF = 102, // ANIMREF
S_POSTINC = 103, // POSTINC S_PREINC = 103, // PREINC
S_POSTDEC = 104, // POSTDEC S_PREDEC = 104, // PREDEC
S_YYACCEPT = 105, // $accept S_POSTINC = 105, // POSTINC
S_root = 106, // root S_POSTDEC = 106, // POSTDEC
S_program = 107, // program S_YYACCEPT = 107, // $accept
S_inline = 108, // inline S_root = 108, // root
S_include = 109, // include S_program = 109, // program
S_declaration = 110, // declaration S_inline = 110, // inline
S_decl_usingtree = 111, // decl_usingtree S_include = 111, // include
S_decl_constant = 112, // decl_constant S_declaration = 112, // declaration
S_decl_thread = 113, // decl_thread S_decl_usingtree = 113, // decl_usingtree
S_stmt = 114, // stmt S_decl_constant = 114, // decl_constant
S_stmt_block = 115, // stmt_block S_decl_thread = 115, // decl_thread
S_stmt_list = 116, // stmt_list S_stmt = 116, // stmt
S_stmt_expr = 117, // stmt_expr S_stmt_dev = 117, // stmt_dev
S_stmt_call = 118, // stmt_call S_stmt_block = 118, // stmt_block
S_stmt_assign = 119, // stmt_assign S_stmt_list = 119, // stmt_list
S_stmt_endon = 120, // stmt_endon S_stmt_expr = 120, // stmt_expr
S_stmt_notify = 121, // stmt_notify S_stmt_call = 121, // stmt_call
S_stmt_wait = 122, // stmt_wait S_stmt_assign = 122, // stmt_assign
S_stmt_waittill = 123, // stmt_waittill S_stmt_endon = 123, // stmt_endon
S_stmt_waittillmatch = 124, // stmt_waittillmatch S_stmt_notify = 124, // stmt_notify
S_stmt_waittillframeend = 125, // stmt_waittillframeend S_stmt_wait = 125, // stmt_wait
S_stmt_if = 126, // stmt_if S_stmt_waittill = 126, // stmt_waittill
S_stmt_ifelse = 127, // stmt_ifelse S_stmt_waittillmatch = 127, // stmt_waittillmatch
S_stmt_while = 128, // stmt_while S_stmt_waittillframeend = 128, // stmt_waittillframeend
S_stmt_dowhile = 129, // stmt_dowhile S_stmt_if = 129, // stmt_if
S_stmt_for = 130, // stmt_for S_stmt_ifelse = 130, // stmt_ifelse
S_stmt_foreach = 131, // stmt_foreach S_stmt_while = 131, // stmt_while
S_stmt_switch = 132, // stmt_switch S_stmt_dowhile = 132, // stmt_dowhile
S_stmt_case = 133, // stmt_case S_stmt_for = 133, // stmt_for
S_stmt_default = 134, // stmt_default S_stmt_foreach = 134, // stmt_foreach
S_stmt_break = 135, // stmt_break S_stmt_switch = 135, // stmt_switch
S_stmt_continue = 136, // stmt_continue S_stmt_case = 136, // stmt_case
S_stmt_return = 137, // stmt_return S_stmt_default = 137, // stmt_default
S_stmt_breakpoint = 138, // stmt_breakpoint S_stmt_break = 138, // stmt_break
S_stmt_prof_begin = 139, // stmt_prof_begin S_stmt_continue = 139, // stmt_continue
S_stmt_prof_end = 140, // stmt_prof_end S_stmt_return = 140, // stmt_return
S_expr = 141, // expr S_stmt_breakpoint = 141, // stmt_breakpoint
S_expr_or_empty = 142, // expr_or_empty S_stmt_prof_begin = 142, // stmt_prof_begin
S_expr_assign = 143, // expr_assign S_stmt_prof_end = 143, // stmt_prof_end
S_expr_increment = 144, // expr_increment S_expr = 144, // expr
S_expr_decrement = 145, // expr_decrement S_expr_or_empty = 145, // expr_or_empty
S_expr_ternary = 146, // expr_ternary S_expr_assign = 146, // expr_assign
S_expr_binary = 147, // expr_binary S_expr_increment = 147, // expr_increment
S_expr_primitive = 148, // expr_primitive S_expr_decrement = 148, // expr_decrement
S_expr_complement = 149, // expr_complement S_expr_ternary = 149, // expr_ternary
S_expr_not = 150, // expr_not S_expr_binary = 150, // expr_binary
S_expr_call = 151, // expr_call S_expr_primitive = 151, // expr_primitive
S_expr_method = 152, // expr_method S_expr_complement = 152, // expr_complement
S_expr_function = 153, // expr_function S_expr_not = 153, // expr_not
S_expr_pointer = 154, // expr_pointer S_expr_call = 154, // expr_call
S_expr_add_array = 155, // expr_add_array S_expr_method = 155, // expr_method
S_expr_parameters = 156, // expr_parameters S_expr_function = 156, // expr_function
S_expr_arguments = 157, // expr_arguments S_expr_pointer = 157, // expr_pointer
S_expr_arguments_no_empty = 158, // expr_arguments_no_empty S_expr_add_array = 158, // expr_add_array
S_expr_reference = 159, // expr_reference S_expr_parameters = 159, // expr_parameters
S_expr_array = 160, // expr_array S_expr_arguments = 160, // expr_arguments
S_expr_field = 161, // expr_field S_expr_arguments_no_empty = 161, // expr_arguments_no_empty
S_expr_size = 162, // expr_size S_expr_reference = 162, // expr_reference
S_expr_paren = 163, // expr_paren S_expr_array = 163, // expr_array
S_expr_object = 164, // expr_object S_expr_field = 164, // expr_field
S_expr_thisthread = 165, // expr_thisthread S_expr_size = 165, // expr_size
S_expr_empty_array = 166, // expr_empty_array S_expr_paren = 166, // expr_paren
S_expr_undefined = 167, // expr_undefined S_expr_object = 167, // expr_object
S_expr_game = 168, // expr_game S_expr_thisthread = 168, // expr_thisthread
S_expr_self = 169, // expr_self S_expr_empty_array = 169, // expr_empty_array
S_expr_anim = 170, // expr_anim S_expr_undefined = 170, // expr_undefined
S_expr_level = 171, // expr_level S_expr_game = 171, // expr_game
S_expr_animation = 172, // expr_animation S_expr_self = 172, // expr_self
S_expr_animtree = 173, // expr_animtree S_expr_anim = 173, // expr_anim
S_expr_identifier = 174, // expr_identifier S_expr_level = 174, // expr_level
S_expr_path = 175, // expr_path S_expr_animation = 175, // expr_animation
S_expr_istring = 176, // expr_istring S_expr_animtree = 176, // expr_animtree
S_expr_string = 177, // expr_string S_expr_identifier = 177, // expr_identifier
S_expr_color = 178, // expr_color S_expr_path = 178, // expr_path
S_expr_vector = 179, // expr_vector S_expr_istring = 179, // expr_istring
S_expr_float = 180, // expr_float S_expr_string = 180, // expr_string
S_expr_integer = 181, // expr_integer S_expr_color = 181, // expr_color
S_expr_false = 182, // expr_false S_expr_vector = 182, // expr_vector
S_expr_true = 183 // expr_true S_expr_float = 183, // expr_float
S_expr_integer = 184, // expr_integer
S_expr_false = 185, // expr_false
S_expr_true = 186 // expr_true
}; };
}; };
@ -1242,6 +1248,7 @@ namespace xsk { namespace gsc { namespace iw6 {
value.move< ast::stmt_ifelse::ptr > (std::move (that.value)); value.move< ast::stmt_ifelse::ptr > (std::move (that.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.move< ast::stmt_list::ptr > (std::move (that.value)); value.move< ast::stmt_list::ptr > (std::move (that.value));
@ -2495,6 +2502,7 @@ switch (yykind)
value.template destroy< ast::stmt_ifelse::ptr > (); value.template destroy< ast::stmt_ifelse::ptr > ();
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.template destroy< ast::stmt_list::ptr > (); value.template destroy< ast::stmt_list::ptr > ();
@ -2754,6 +2762,36 @@ switch (yykind)
return symbol_type (token::IW6UNDEF, l); return symbol_type (token::IW6UNDEF, l);
} }
#endif #endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_DEVBEGIN (location_type l)
{
return symbol_type (token::DEVBEGIN, std::move (l));
}
#else
static
symbol_type
make_DEVBEGIN (const location_type& l)
{
return symbol_type (token::DEVBEGIN, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_DEVEND (location_type l)
{
return symbol_type (token::DEVEND, std::move (l));
}
#else
static
symbol_type
make_DEVEND (const location_type& l)
{
return symbol_type (token::DEVEND, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS #if 201103L <= YY_CPLUSPLUS
static static
symbol_type symbol_type
@ -4628,9 +4666,9 @@ switch (yykind)
/// Constants. /// Constants.
enum enum
{ {
yylast_ = 2111, ///< Last index in yytable_. yylast_ = 2346, ///< Last index in yytable_.
yynnts_ = 79, ///< Number of nonterminal symbols. yynnts_ = 80, ///< Number of nonterminal symbols.
yyfinal_ = 19 ///< Termination state number. yyfinal_ = 21 ///< Termination state number.
}; };
@ -4883,6 +4921,7 @@ switch (yykind)
value.copy< ast::stmt_ifelse::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_ifelse::ptr > (YY_MOVE (that.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.copy< ast::stmt_list::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_list::ptr > (YY_MOVE (that.value));
@ -5196,6 +5235,7 @@ switch (yykind)
value.move< ast::stmt_ifelse::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_ifelse::ptr > (YY_MOVE (s.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.move< ast::stmt_list::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_list::ptr > (YY_MOVE (s.value));
@ -5317,7 +5357,7 @@ switch (yykind)
#line 13 "parser.ypp" #line 13 "parser.ypp"
} } } // xsk::gsc::iw6 } } } // xsk::gsc::iw6
#line 5321 "parser.hpp" #line 5361 "parser.hpp"

View File

@ -85,6 +85,7 @@ void compiler::compile_program(const ast::program::ptr& program)
constants_.clear(); constants_.clear();
local_functions_.clear(); local_functions_.clear();
index_ = 1; index_ = 1;
developer_thread_ = false;
for (const auto& entry : program->declarations) for (const auto& entry : program->declarations)
{ {
@ -150,6 +151,12 @@ void compiler::emit_declaration(const ast::decl& decl)
{ {
switch (decl.kind()) switch (decl.kind())
{ {
case ast::kind::decl_dev_begin:
developer_thread_ = true;
break;
case ast::kind::decl_dev_end:
developer_thread_ = false;
break;
case ast::kind::decl_usingtree: case ast::kind::decl_usingtree:
emit_decl_usingtree(decl.as_usingtree); emit_decl_usingtree(decl.as_usingtree);
break; break;
@ -166,6 +173,9 @@ void compiler::emit_declaration(const ast::decl& decl)
void compiler::emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree) void compiler::emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree)
{ {
if(developer_thread_)
throw comp_error(animtree->loc(), "cannot put #using_animtree inside /# ... #/ comment");
animtrees_.push_back({ animtree->name->value, false }); animtrees_.push_back({ animtree->name->value, false });
} }

File diff suppressed because it is too large Load Diff

View File

@ -439,9 +439,9 @@ void yyfree ( void * , yyscan_t yyscanner );
#ifdef YY_HEADER_EXPORT_START_CONDITIONS #ifdef YY_HEADER_EXPORT_START_CONDITIONS
#define INITIAL 0 #define INITIAL 0
#define COMMENT_BLOCK_STATE 1 #define COMMENT_STATE 1
#define DEVBLOCK_ON_STATE 2 #define DEV_OFF_STATE 2
#define DEVBLOCK_OFF_STATE 3 #define DEV_ON_STATE 3
#endif #endif
@ -703,7 +703,7 @@ extern int yylex (yyscan_t yyscanner);
#undef yyTABLES_NAME #undef yyTABLES_NAME
#endif #endif
#line 165 "lexer.lpp" #line 169 "lexer.lpp"
#line 709 "lexer.hpp" #line 709 "lexer.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -580,6 +580,7 @@ namespace xsk { namespace gsc { namespace iw7 {
// stmt_ifelse // stmt_ifelse
char dummy54[sizeof (ast::stmt_ifelse::ptr)]; char dummy54[sizeof (ast::stmt_ifelse::ptr)];
// stmt_dev
// stmt_block // stmt_block
// stmt_list // stmt_list
char dummy55[sizeof (ast::stmt_list::ptr)]; char dummy55[sizeof (ast::stmt_list::ptr)];
@ -676,108 +677,110 @@ namespace xsk { namespace gsc { namespace iw7 {
IW7EOF = 0, // "end of file" IW7EOF = 0, // "end of file"
IW7error = 1, // error IW7error = 1, // error
IW7UNDEF = 2, // "invalid token" IW7UNDEF = 2, // "invalid token"
INLINE = 3, // "#inline" DEVBEGIN = 3, // "/#"
INCLUDE = 4, // "#include" DEVEND = 4, // "#/"
USINGTREE = 5, // "#using_animtree" INLINE = 5, // "#inline"
ANIMTREE = 6, // "#animtree" INCLUDE = 6, // "#include"
ENDON = 7, // "endon" USINGTREE = 7, // "#using_animtree"
NOTIFY = 8, // "notify" ANIMTREE = 8, // "#animtree"
WAIT = 9, // "wait" ENDON = 9, // "endon"
WAITTILL = 10, // "waittill" NOTIFY = 10, // "notify"
WAITTILLMATCH = 11, // "waittillmatch" WAIT = 11, // "wait"
WAITTILLFRAMEEND = 12, // "waittillframeend" WAITTILL = 12, // "waittill"
IF = 13, // "if" WAITTILLMATCH = 13, // "waittillmatch"
ELSE = 14, // "else" WAITTILLFRAMEEND = 14, // "waittillframeend"
DO = 15, // "do" IF = 15, // "if"
WHILE = 16, // "while" ELSE = 16, // "else"
FOR = 17, // "for" DO = 17, // "do"
FOREACH = 18, // "foreach" WHILE = 18, // "while"
IN = 19, // "in" FOR = 19, // "for"
SWITCH = 20, // "switch" FOREACH = 20, // "foreach"
CASE = 21, // "case" IN = 21, // "in"
DEFAULT = 22, // "default" SWITCH = 22, // "switch"
BREAK = 23, // "break" CASE = 23, // "case"
CONTINUE = 24, // "continue" DEFAULT = 24, // "default"
RETURN = 25, // "return" BREAK = 25, // "break"
BREAKPOINT = 26, // "breakpoint" CONTINUE = 26, // "continue"
PROFBEGIN = 27, // "prof_begin" RETURN = 27, // "return"
PROFEND = 28, // "prof_end" BREAKPOINT = 28, // "breakpoint"
THREAD = 29, // "thread" PROFBEGIN = 29, // "prof_begin"
CHILDTHREAD = 30, // "childthread" PROFEND = 30, // "prof_end"
THISTHREAD = 31, // "thisthread" THREAD = 31, // "thread"
CALL = 32, // "call" CHILDTHREAD = 32, // "childthread"
TRUE = 33, // "true" THISTHREAD = 33, // "thisthread"
FALSE = 34, // "false" CALL = 34, // "call"
UNDEFINED = 35, // "undefined" TRUE = 35, // "true"
SIZE = 36, // ".size" FALSE = 36, // "false"
GAME = 37, // "game" UNDEFINED = 37, // "undefined"
SELF = 38, // "self" SIZE = 38, // ".size"
ANIM = 39, // "anim" GAME = 39, // "game"
LEVEL = 40, // "level" SELF = 40, // "self"
LPAREN = 41, // "(" ANIM = 41, // "anim"
RPAREN = 42, // ")" LEVEL = 42, // "level"
LBRACE = 43, // "{" LPAREN = 43, // "("
RBRACE = 44, // "}" RPAREN = 44, // ")"
LBRACKET = 45, // "[" LBRACE = 45, // "{"
RBRACKET = 46, // "]" RBRACE = 46, // "}"
COMMA = 47, // "," LBRACKET = 47, // "["
DOT = 48, // "." RBRACKET = 48, // "]"
DOUBLECOLON = 49, // "::" COMMA = 49, // ","
COLON = 50, // ":" DOT = 50, // "."
SEMICOLON = 51, // ";" DOUBLECOLON = 51, // "::"
QMARK = 52, // "?" COLON = 52, // ":"
INCREMENT = 53, // "++" SEMICOLON = 53, // ";"
DECREMENT = 54, // "--" QMARK = 54, // "?"
LSHIFT = 55, // "<<" INCREMENT = 55, // "++"
RSHIFT = 56, // ">>" DECREMENT = 56, // "--"
OR = 57, // "||" LSHIFT = 57, // "<<"
AND = 58, // "&&" RSHIFT = 58, // ">>"
EQUALITY = 59, // "==" OR = 59, // "||"
INEQUALITY = 60, // "!=" AND = 60, // "&&"
LESS_EQUAL = 61, // "<=" EQUALITY = 61, // "=="
GREATER_EQUAL = 62, // ">=" INEQUALITY = 62, // "!="
LESS = 63, // "<" LESS_EQUAL = 63, // "<="
GREATER = 64, // ">" GREATER_EQUAL = 64, // ">="
NOT = 65, // "!" LESS = 65, // "<"
COMPLEMENT = 66, // "~" GREATER = 66, // ">"
ASSIGN = 67, // "=" NOT = 67, // "!"
ASSIGN_ADD = 68, // "+=" COMPLEMENT = 68, // "~"
ASSIGN_SUB = 69, // "-=" ASSIGN = 69, // "="
ASSIGN_MUL = 70, // "*=" ASSIGN_ADD = 70, // "+="
ASSIGN_DIV = 71, // "/=" ASSIGN_SUB = 71, // "-="
ASSIGN_MOD = 72, // "%=" ASSIGN_MUL = 72, // "*="
ASSIGN_BW_OR = 73, // "|=" ASSIGN_DIV = 73, // "/="
ASSIGN_BW_AND = 74, // "&=" ASSIGN_MOD = 74, // "%="
ASSIGN_BW_EXOR = 75, // "^=" ASSIGN_BW_OR = 75, // "|="
ASSIGN_RSHIFT = 76, // ">>=" ASSIGN_BW_AND = 76, // "&="
ASSIGN_LSHIFT = 77, // "<<=" ASSIGN_BW_EXOR = 77, // "^="
BITWISE_OR = 78, // "|" ASSIGN_RSHIFT = 78, // ">>="
BITWISE_AND = 79, // "&" ASSIGN_LSHIFT = 79, // "<<="
BITWISE_EXOR = 80, // "^" BITWISE_OR = 80, // "|"
ADD = 81, // "+" BITWISE_AND = 81, // "&"
SUB = 82, // "-" BITWISE_EXOR = 82, // "^"
MUL = 83, // "*" ADD = 83, // "+"
DIV = 84, // "/" SUB = 84, // "-"
MOD = 85, // "%" MUL = 85, // "*"
PATH = 86, // "path" DIV = 86, // "/"
IDENTIFIER = 87, // "identifier" MOD = 87, // "%"
STRING = 88, // "string literal" PATH = 88, // "path"
ISTRING = 89, // "localized string" IDENTIFIER = 89, // "identifier"
COLOR = 90, // "color" STRING = 90, // "string literal"
FLOAT = 91, // "float" ISTRING = 91, // "localized string"
INT_DEC = 92, // "int" COLOR = 92, // "color"
INT_OCT = 93, // "octal int" FLOAT = 93, // "float"
INT_BIN = 94, // "binary int" INT_DEC = 94, // "int"
INT_HEX = 95, // "hexadecimal int" INT_OCT = 95, // "octal int"
ADD_ARRAY = 96, // ADD_ARRAY INT_BIN = 96, // "binary int"
THEN = 97, // THEN INT_HEX = 97, // "hexadecimal int"
TERN = 98, // TERN ADD_ARRAY = 98, // ADD_ARRAY
NEG = 99, // NEG THEN = 99, // THEN
ANIMREF = 100, // ANIMREF TERN = 100, // TERN
PREINC = 101, // PREINC NEG = 101, // NEG
PREDEC = 102, // PREDEC ANIMREF = 102, // ANIMREF
POSTINC = 103, // POSTINC PREINC = 103, // PREINC
POSTDEC = 104 // POSTDEC PREDEC = 104, // PREDEC
POSTINC = 105, // POSTINC
POSTDEC = 106 // POSTDEC
}; };
/// Backward compatibility alias (Bison 3.6). /// Backward compatibility alias (Bison 3.6).
typedef token_kind_type yytokentype; typedef token_kind_type yytokentype;
@ -794,192 +797,195 @@ namespace xsk { namespace gsc { namespace iw7 {
{ {
enum symbol_kind_type enum symbol_kind_type
{ {
YYNTOKENS = 105, ///< Number of tokens. YYNTOKENS = 107, ///< 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
S_YYUNDEF = 2, // "invalid token" S_YYUNDEF = 2, // "invalid token"
S_INLINE = 3, // "#inline" S_DEVBEGIN = 3, // "/#"
S_INCLUDE = 4, // "#include" S_DEVEND = 4, // "#/"
S_USINGTREE = 5, // "#using_animtree" S_INLINE = 5, // "#inline"
S_ANIMTREE = 6, // "#animtree" S_INCLUDE = 6, // "#include"
S_ENDON = 7, // "endon" S_USINGTREE = 7, // "#using_animtree"
S_NOTIFY = 8, // "notify" S_ANIMTREE = 8, // "#animtree"
S_WAIT = 9, // "wait" S_ENDON = 9, // "endon"
S_WAITTILL = 10, // "waittill" S_NOTIFY = 10, // "notify"
S_WAITTILLMATCH = 11, // "waittillmatch" S_WAIT = 11, // "wait"
S_WAITTILLFRAMEEND = 12, // "waittillframeend" S_WAITTILL = 12, // "waittill"
S_IF = 13, // "if" S_WAITTILLMATCH = 13, // "waittillmatch"
S_ELSE = 14, // "else" S_WAITTILLFRAMEEND = 14, // "waittillframeend"
S_DO = 15, // "do" S_IF = 15, // "if"
S_WHILE = 16, // "while" S_ELSE = 16, // "else"
S_FOR = 17, // "for" S_DO = 17, // "do"
S_FOREACH = 18, // "foreach" S_WHILE = 18, // "while"
S_IN = 19, // "in" S_FOR = 19, // "for"
S_SWITCH = 20, // "switch" S_FOREACH = 20, // "foreach"
S_CASE = 21, // "case" S_IN = 21, // "in"
S_DEFAULT = 22, // "default" S_SWITCH = 22, // "switch"
S_BREAK = 23, // "break" S_CASE = 23, // "case"
S_CONTINUE = 24, // "continue" S_DEFAULT = 24, // "default"
S_RETURN = 25, // "return" S_BREAK = 25, // "break"
S_BREAKPOINT = 26, // "breakpoint" S_CONTINUE = 26, // "continue"
S_PROFBEGIN = 27, // "prof_begin" S_RETURN = 27, // "return"
S_PROFEND = 28, // "prof_end" S_BREAKPOINT = 28, // "breakpoint"
S_THREAD = 29, // "thread" S_PROFBEGIN = 29, // "prof_begin"
S_CHILDTHREAD = 30, // "childthread" S_PROFEND = 30, // "prof_end"
S_THISTHREAD = 31, // "thisthread" S_THREAD = 31, // "thread"
S_CALL = 32, // "call" S_CHILDTHREAD = 32, // "childthread"
S_TRUE = 33, // "true" S_THISTHREAD = 33, // "thisthread"
S_FALSE = 34, // "false" S_CALL = 34, // "call"
S_UNDEFINED = 35, // "undefined" S_TRUE = 35, // "true"
S_SIZE = 36, // ".size" S_FALSE = 36, // "false"
S_GAME = 37, // "game" S_UNDEFINED = 37, // "undefined"
S_SELF = 38, // "self" S_SIZE = 38, // ".size"
S_ANIM = 39, // "anim" S_GAME = 39, // "game"
S_LEVEL = 40, // "level" S_SELF = 40, // "self"
S_LPAREN = 41, // "(" S_ANIM = 41, // "anim"
S_RPAREN = 42, // ")" S_LEVEL = 42, // "level"
S_LBRACE = 43, // "{" S_LPAREN = 43, // "("
S_RBRACE = 44, // "}" S_RPAREN = 44, // ")"
S_LBRACKET = 45, // "[" S_LBRACE = 45, // "{"
S_RBRACKET = 46, // "]" S_RBRACE = 46, // "}"
S_COMMA = 47, // "," S_LBRACKET = 47, // "["
S_DOT = 48, // "." S_RBRACKET = 48, // "]"
S_DOUBLECOLON = 49, // "::" S_COMMA = 49, // ","
S_COLON = 50, // ":" S_DOT = 50, // "."
S_SEMICOLON = 51, // ";" S_DOUBLECOLON = 51, // "::"
S_QMARK = 52, // "?" S_COLON = 52, // ":"
S_INCREMENT = 53, // "++" S_SEMICOLON = 53, // ";"
S_DECREMENT = 54, // "--" S_QMARK = 54, // "?"
S_LSHIFT = 55, // "<<" S_INCREMENT = 55, // "++"
S_RSHIFT = 56, // ">>" S_DECREMENT = 56, // "--"
S_OR = 57, // "||" S_LSHIFT = 57, // "<<"
S_AND = 58, // "&&" S_RSHIFT = 58, // ">>"
S_EQUALITY = 59, // "==" S_OR = 59, // "||"
S_INEQUALITY = 60, // "!=" S_AND = 60, // "&&"
S_LESS_EQUAL = 61, // "<=" S_EQUALITY = 61, // "=="
S_GREATER_EQUAL = 62, // ">=" S_INEQUALITY = 62, // "!="
S_LESS = 63, // "<" S_LESS_EQUAL = 63, // "<="
S_GREATER = 64, // ">" S_GREATER_EQUAL = 64, // ">="
S_NOT = 65, // "!" S_LESS = 65, // "<"
S_COMPLEMENT = 66, // "~" S_GREATER = 66, // ">"
S_ASSIGN = 67, // "=" S_NOT = 67, // "!"
S_ASSIGN_ADD = 68, // "+=" S_COMPLEMENT = 68, // "~"
S_ASSIGN_SUB = 69, // "-=" S_ASSIGN = 69, // "="
S_ASSIGN_MUL = 70, // "*=" S_ASSIGN_ADD = 70, // "+="
S_ASSIGN_DIV = 71, // "/=" S_ASSIGN_SUB = 71, // "-="
S_ASSIGN_MOD = 72, // "%=" S_ASSIGN_MUL = 72, // "*="
S_ASSIGN_BW_OR = 73, // "|=" S_ASSIGN_DIV = 73, // "/="
S_ASSIGN_BW_AND = 74, // "&=" S_ASSIGN_MOD = 74, // "%="
S_ASSIGN_BW_EXOR = 75, // "^=" S_ASSIGN_BW_OR = 75, // "|="
S_ASSIGN_RSHIFT = 76, // ">>=" S_ASSIGN_BW_AND = 76, // "&="
S_ASSIGN_LSHIFT = 77, // "<<=" S_ASSIGN_BW_EXOR = 77, // "^="
S_BITWISE_OR = 78, // "|" S_ASSIGN_RSHIFT = 78, // ">>="
S_BITWISE_AND = 79, // "&" S_ASSIGN_LSHIFT = 79, // "<<="
S_BITWISE_EXOR = 80, // "^" S_BITWISE_OR = 80, // "|"
S_ADD = 81, // "+" S_BITWISE_AND = 81, // "&"
S_SUB = 82, // "-" S_BITWISE_EXOR = 82, // "^"
S_MUL = 83, // "*" S_ADD = 83, // "+"
S_DIV = 84, // "/" S_SUB = 84, // "-"
S_MOD = 85, // "%" S_MUL = 85, // "*"
S_PATH = 86, // "path" S_DIV = 86, // "/"
S_IDENTIFIER = 87, // "identifier" S_MOD = 87, // "%"
S_STRING = 88, // "string literal" S_PATH = 88, // "path"
S_ISTRING = 89, // "localized string" S_IDENTIFIER = 89, // "identifier"
S_COLOR = 90, // "color" S_STRING = 90, // "string literal"
S_FLOAT = 91, // "float" S_ISTRING = 91, // "localized string"
S_INT_DEC = 92, // "int" S_COLOR = 92, // "color"
S_INT_OCT = 93, // "octal int" S_FLOAT = 93, // "float"
S_INT_BIN = 94, // "binary int" S_INT_DEC = 94, // "int"
S_INT_HEX = 95, // "hexadecimal int" S_INT_OCT = 95, // "octal int"
S_ADD_ARRAY = 96, // ADD_ARRAY S_INT_BIN = 96, // "binary int"
S_THEN = 97, // THEN S_INT_HEX = 97, // "hexadecimal int"
S_TERN = 98, // TERN S_ADD_ARRAY = 98, // ADD_ARRAY
S_NEG = 99, // NEG S_THEN = 99, // THEN
S_ANIMREF = 100, // ANIMREF S_TERN = 100, // TERN
S_PREINC = 101, // PREINC S_NEG = 101, // NEG
S_PREDEC = 102, // PREDEC S_ANIMREF = 102, // ANIMREF
S_POSTINC = 103, // POSTINC S_PREINC = 103, // PREINC
S_POSTDEC = 104, // POSTDEC S_PREDEC = 104, // PREDEC
S_YYACCEPT = 105, // $accept S_POSTINC = 105, // POSTINC
S_root = 106, // root S_POSTDEC = 106, // POSTDEC
S_program = 107, // program S_YYACCEPT = 107, // $accept
S_inline = 108, // inline S_root = 108, // root
S_include = 109, // include S_program = 109, // program
S_declaration = 110, // declaration S_inline = 110, // inline
S_decl_usingtree = 111, // decl_usingtree S_include = 111, // include
S_decl_constant = 112, // decl_constant S_declaration = 112, // declaration
S_decl_thread = 113, // decl_thread S_decl_usingtree = 113, // decl_usingtree
S_stmt = 114, // stmt S_decl_constant = 114, // decl_constant
S_stmt_block = 115, // stmt_block S_decl_thread = 115, // decl_thread
S_stmt_list = 116, // stmt_list S_stmt = 116, // stmt
S_stmt_expr = 117, // stmt_expr S_stmt_dev = 117, // stmt_dev
S_stmt_call = 118, // stmt_call S_stmt_block = 118, // stmt_block
S_stmt_assign = 119, // stmt_assign S_stmt_list = 119, // stmt_list
S_stmt_endon = 120, // stmt_endon S_stmt_expr = 120, // stmt_expr
S_stmt_notify = 121, // stmt_notify S_stmt_call = 121, // stmt_call
S_stmt_wait = 122, // stmt_wait S_stmt_assign = 122, // stmt_assign
S_stmt_waittill = 123, // stmt_waittill S_stmt_endon = 123, // stmt_endon
S_stmt_waittillmatch = 124, // stmt_waittillmatch S_stmt_notify = 124, // stmt_notify
S_stmt_waittillframeend = 125, // stmt_waittillframeend S_stmt_wait = 125, // stmt_wait
S_stmt_if = 126, // stmt_if S_stmt_waittill = 126, // stmt_waittill
S_stmt_ifelse = 127, // stmt_ifelse S_stmt_waittillmatch = 127, // stmt_waittillmatch
S_stmt_while = 128, // stmt_while S_stmt_waittillframeend = 128, // stmt_waittillframeend
S_stmt_dowhile = 129, // stmt_dowhile S_stmt_if = 129, // stmt_if
S_stmt_for = 130, // stmt_for S_stmt_ifelse = 130, // stmt_ifelse
S_stmt_foreach = 131, // stmt_foreach S_stmt_while = 131, // stmt_while
S_stmt_switch = 132, // stmt_switch S_stmt_dowhile = 132, // stmt_dowhile
S_stmt_case = 133, // stmt_case S_stmt_for = 133, // stmt_for
S_stmt_default = 134, // stmt_default S_stmt_foreach = 134, // stmt_foreach
S_stmt_break = 135, // stmt_break S_stmt_switch = 135, // stmt_switch
S_stmt_continue = 136, // stmt_continue S_stmt_case = 136, // stmt_case
S_stmt_return = 137, // stmt_return S_stmt_default = 137, // stmt_default
S_stmt_breakpoint = 138, // stmt_breakpoint S_stmt_break = 138, // stmt_break
S_stmt_prof_begin = 139, // stmt_prof_begin S_stmt_continue = 139, // stmt_continue
S_stmt_prof_end = 140, // stmt_prof_end S_stmt_return = 140, // stmt_return
S_expr = 141, // expr S_stmt_breakpoint = 141, // stmt_breakpoint
S_expr_or_empty = 142, // expr_or_empty S_stmt_prof_begin = 142, // stmt_prof_begin
S_expr_assign = 143, // expr_assign S_stmt_prof_end = 143, // stmt_prof_end
S_expr_increment = 144, // expr_increment S_expr = 144, // expr
S_expr_decrement = 145, // expr_decrement S_expr_or_empty = 145, // expr_or_empty
S_expr_ternary = 146, // expr_ternary S_expr_assign = 146, // expr_assign
S_expr_binary = 147, // expr_binary S_expr_increment = 147, // expr_increment
S_expr_primitive = 148, // expr_primitive S_expr_decrement = 148, // expr_decrement
S_expr_complement = 149, // expr_complement S_expr_ternary = 149, // expr_ternary
S_expr_not = 150, // expr_not S_expr_binary = 150, // expr_binary
S_expr_call = 151, // expr_call S_expr_primitive = 151, // expr_primitive
S_expr_method = 152, // expr_method S_expr_complement = 152, // expr_complement
S_expr_function = 153, // expr_function S_expr_not = 153, // expr_not
S_expr_pointer = 154, // expr_pointer S_expr_call = 154, // expr_call
S_expr_add_array = 155, // expr_add_array S_expr_method = 155, // expr_method
S_expr_parameters = 156, // expr_parameters S_expr_function = 156, // expr_function
S_expr_arguments = 157, // expr_arguments S_expr_pointer = 157, // expr_pointer
S_expr_arguments_no_empty = 158, // expr_arguments_no_empty S_expr_add_array = 158, // expr_add_array
S_expr_reference = 159, // expr_reference S_expr_parameters = 159, // expr_parameters
S_expr_array = 160, // expr_array S_expr_arguments = 160, // expr_arguments
S_expr_field = 161, // expr_field S_expr_arguments_no_empty = 161, // expr_arguments_no_empty
S_expr_size = 162, // expr_size S_expr_reference = 162, // expr_reference
S_expr_paren = 163, // expr_paren S_expr_array = 163, // expr_array
S_expr_object = 164, // expr_object S_expr_field = 164, // expr_field
S_expr_thisthread = 165, // expr_thisthread S_expr_size = 165, // expr_size
S_expr_empty_array = 166, // expr_empty_array S_expr_paren = 166, // expr_paren
S_expr_undefined = 167, // expr_undefined S_expr_object = 167, // expr_object
S_expr_game = 168, // expr_game S_expr_thisthread = 168, // expr_thisthread
S_expr_self = 169, // expr_self S_expr_empty_array = 169, // expr_empty_array
S_expr_anim = 170, // expr_anim S_expr_undefined = 170, // expr_undefined
S_expr_level = 171, // expr_level S_expr_game = 171, // expr_game
S_expr_animation = 172, // expr_animation S_expr_self = 172, // expr_self
S_expr_animtree = 173, // expr_animtree S_expr_anim = 173, // expr_anim
S_expr_identifier = 174, // expr_identifier S_expr_level = 174, // expr_level
S_expr_path = 175, // expr_path S_expr_animation = 175, // expr_animation
S_expr_istring = 176, // expr_istring S_expr_animtree = 176, // expr_animtree
S_expr_string = 177, // expr_string S_expr_identifier = 177, // expr_identifier
S_expr_color = 178, // expr_color S_expr_path = 178, // expr_path
S_expr_vector = 179, // expr_vector S_expr_istring = 179, // expr_istring
S_expr_float = 180, // expr_float S_expr_string = 180, // expr_string
S_expr_integer = 181, // expr_integer S_expr_color = 181, // expr_color
S_expr_false = 182, // expr_false S_expr_vector = 182, // expr_vector
S_expr_true = 183 // expr_true S_expr_float = 183, // expr_float
S_expr_integer = 184, // expr_integer
S_expr_false = 185, // expr_false
S_expr_true = 186 // expr_true
}; };
}; };
@ -1242,6 +1248,7 @@ namespace xsk { namespace gsc { namespace iw7 {
value.move< ast::stmt_ifelse::ptr > (std::move (that.value)); value.move< ast::stmt_ifelse::ptr > (std::move (that.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.move< ast::stmt_list::ptr > (std::move (that.value)); value.move< ast::stmt_list::ptr > (std::move (that.value));
@ -2495,6 +2502,7 @@ switch (yykind)
value.template destroy< ast::stmt_ifelse::ptr > (); value.template destroy< ast::stmt_ifelse::ptr > ();
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.template destroy< ast::stmt_list::ptr > (); value.template destroy< ast::stmt_list::ptr > ();
@ -2754,6 +2762,36 @@ switch (yykind)
return symbol_type (token::IW7UNDEF, l); return symbol_type (token::IW7UNDEF, l);
} }
#endif #endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_DEVBEGIN (location_type l)
{
return symbol_type (token::DEVBEGIN, std::move (l));
}
#else
static
symbol_type
make_DEVBEGIN (const location_type& l)
{
return symbol_type (token::DEVBEGIN, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_DEVEND (location_type l)
{
return symbol_type (token::DEVEND, std::move (l));
}
#else
static
symbol_type
make_DEVEND (const location_type& l)
{
return symbol_type (token::DEVEND, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS #if 201103L <= YY_CPLUSPLUS
static static
symbol_type symbol_type
@ -4628,9 +4666,9 @@ switch (yykind)
/// Constants. /// Constants.
enum enum
{ {
yylast_ = 2111, ///< Last index in yytable_. yylast_ = 2346, ///< Last index in yytable_.
yynnts_ = 79, ///< Number of nonterminal symbols. yynnts_ = 80, ///< Number of nonterminal symbols.
yyfinal_ = 19 ///< Termination state number. yyfinal_ = 21 ///< Termination state number.
}; };
@ -4883,6 +4921,7 @@ switch (yykind)
value.copy< ast::stmt_ifelse::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_ifelse::ptr > (YY_MOVE (that.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.copy< ast::stmt_list::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_list::ptr > (YY_MOVE (that.value));
@ -5196,6 +5235,7 @@ switch (yykind)
value.move< ast::stmt_ifelse::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_ifelse::ptr > (YY_MOVE (s.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.move< ast::stmt_list::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_list::ptr > (YY_MOVE (s.value));
@ -5317,7 +5357,7 @@ switch (yykind)
#line 13 "parser.ypp" #line 13 "parser.ypp"
} } } // xsk::gsc::iw7 } } } // xsk::gsc::iw7
#line 5321 "parser.hpp" #line 5361 "parser.hpp"

View File

@ -85,6 +85,7 @@ void compiler::compile_program(const ast::program::ptr& program)
constants_.clear(); constants_.clear();
local_functions_.clear(); local_functions_.clear();
index_ = 1; index_ = 1;
developer_thread_ = false;
for (const auto& entry : program->declarations) for (const auto& entry : program->declarations)
{ {
@ -150,6 +151,12 @@ void compiler::emit_declaration(const ast::decl& decl)
{ {
switch (decl.kind()) switch (decl.kind())
{ {
case ast::kind::decl_dev_begin:
developer_thread_ = true;
break;
case ast::kind::decl_dev_end:
developer_thread_ = false;
break;
case ast::kind::decl_usingtree: case ast::kind::decl_usingtree:
emit_decl_usingtree(decl.as_usingtree); emit_decl_usingtree(decl.as_usingtree);
break; break;
@ -166,6 +173,9 @@ void compiler::emit_declaration(const ast::decl& decl)
void compiler::emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree) void compiler::emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree)
{ {
if(developer_thread_)
throw comp_error(animtree->loc(), "cannot put #using_animtree inside /# ... #/ comment");
animtrees_.push_back({ animtree->name->value, false }); animtrees_.push_back({ animtree->name->value, false });
} }

File diff suppressed because it is too large Load Diff

View File

@ -439,9 +439,9 @@ void yyfree ( void * , yyscan_t yyscanner );
#ifdef YY_HEADER_EXPORT_START_CONDITIONS #ifdef YY_HEADER_EXPORT_START_CONDITIONS
#define INITIAL 0 #define INITIAL 0
#define COMMENT_BLOCK_STATE 1 #define COMMENT_STATE 1
#define DEVBLOCK_ON_STATE 2 #define DEV_OFF_STATE 2
#define DEVBLOCK_OFF_STATE 3 #define DEV_ON_STATE 3
#endif #endif
@ -703,7 +703,7 @@ extern int yylex (yyscan_t yyscanner);
#undef yyTABLES_NAME #undef yyTABLES_NAME
#endif #endif
#line 168 "lexer.lpp" #line 172 "lexer.lpp"
#line 709 "lexer.hpp" #line 709 "lexer.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -586,6 +586,7 @@ namespace xsk { namespace gsc { namespace iw8 {
// stmt_ifelse // stmt_ifelse
char dummy56[sizeof (ast::stmt_ifelse::ptr)]; char dummy56[sizeof (ast::stmt_ifelse::ptr)];
// stmt_dev
// stmt_block // stmt_block
// stmt_list // stmt_list
char dummy57[sizeof (ast::stmt_list::ptr)]; char dummy57[sizeof (ast::stmt_list::ptr)];
@ -685,111 +686,113 @@ namespace xsk { namespace gsc { namespace iw8 {
IW8EOF = 0, // "end of file" IW8EOF = 0, // "end of file"
IW8error = 1, // error IW8error = 1, // error
IW8UNDEF = 2, // "invalid token" IW8UNDEF = 2, // "invalid token"
INLINE = 3, // "#inline" DEVBEGIN = 3, // "/#"
INCLUDE = 4, // "#include" DEVEND = 4, // "#/"
USINGTREE = 5, // "#using_animtree" INLINE = 5, // "#inline"
ANIMTREE = 6, // "#animtree" INCLUDE = 6, // "#include"
ENDON = 7, // "endon" USINGTREE = 7, // "#using_animtree"
NOTIFY = 8, // "notify" ANIMTREE = 8, // "#animtree"
WAIT = 9, // "wait" ENDON = 9, // "endon"
WAITTILL = 10, // "waittill" NOTIFY = 10, // "notify"
WAITTILLMATCH = 11, // "waittillmatch" WAIT = 11, // "wait"
WAITTILLFRAMEEND = 12, // "waittillframeend" WAITTILL = 12, // "waittill"
WAITFRAME = 13, // "waitframe" WAITTILLMATCH = 13, // "waittillmatch"
IF = 14, // "if" WAITTILLFRAMEEND = 14, // "waittillframeend"
ELSE = 15, // "else" WAITFRAME = 15, // "waitframe"
DO = 16, // "do" IF = 16, // "if"
WHILE = 17, // "while" ELSE = 17, // "else"
FOR = 18, // "for" DO = 18, // "do"
FOREACH = 19, // "foreach" WHILE = 19, // "while"
IN = 20, // "in" FOR = 20, // "for"
SWITCH = 21, // "switch" FOREACH = 21, // "foreach"
CASE = 22, // "case" IN = 22, // "in"
DEFAULT = 23, // "default" SWITCH = 23, // "switch"
BREAK = 24, // "break" CASE = 24, // "case"
CONTINUE = 25, // "continue" DEFAULT = 25, // "default"
RETURN = 26, // "return" BREAK = 26, // "break"
BREAKPOINT = 27, // "breakpoint" CONTINUE = 27, // "continue"
PROFBEGIN = 28, // "prof_begin" RETURN = 28, // "return"
PROFEND = 29, // "prof_end" BREAKPOINT = 29, // "breakpoint"
THREAD = 30, // "thread" PROFBEGIN = 30, // "prof_begin"
CHILDTHREAD = 31, // "childthread" PROFEND = 31, // "prof_end"
THISTHREAD = 32, // "thisthread" THREAD = 32, // "thread"
CALL = 33, // "call" CHILDTHREAD = 33, // "childthread"
TRUE = 34, // "true" THISTHREAD = 34, // "thisthread"
FALSE = 35, // "false" CALL = 35, // "call"
UNDEFINED = 36, // "undefined" TRUE = 36, // "true"
SIZE = 37, // ".size" FALSE = 37, // "false"
GAME = 38, // "game" UNDEFINED = 38, // "undefined"
SELF = 39, // "self" SIZE = 39, // ".size"
ANIM = 40, // "anim" GAME = 40, // "game"
LEVEL = 41, // "level" SELF = 41, // "self"
ISDEFINED = 42, // "isdefined" ANIM = 42, // "anim"
ISTRUE = 43, // "istrue" LEVEL = 43, // "level"
LPAREN = 44, // "(" ISDEFINED = 44, // "isdefined"
RPAREN = 45, // ")" ISTRUE = 45, // "istrue"
LBRACE = 46, // "{" LPAREN = 46, // "("
RBRACE = 47, // "}" RPAREN = 47, // ")"
LBRACKET = 48, // "[" LBRACE = 48, // "{"
RBRACKET = 49, // "]" RBRACE = 49, // "}"
COMMA = 50, // "," LBRACKET = 50, // "["
DOT = 51, // "." RBRACKET = 51, // "]"
DOUBLECOLON = 52, // "::" COMMA = 52, // ","
COLON = 53, // ":" DOT = 53, // "."
SEMICOLON = 54, // ";" DOUBLECOLON = 54, // "::"
QMARK = 55, // "?" COLON = 55, // ":"
INCREMENT = 56, // "++" SEMICOLON = 56, // ";"
DECREMENT = 57, // "--" QMARK = 57, // "?"
LSHIFT = 58, // "<<" INCREMENT = 58, // "++"
RSHIFT = 59, // ">>" DECREMENT = 59, // "--"
OR = 60, // "||" LSHIFT = 60, // "<<"
AND = 61, // "&&" RSHIFT = 61, // ">>"
EQUALITY = 62, // "==" OR = 62, // "||"
INEQUALITY = 63, // "!=" AND = 63, // "&&"
LESS_EQUAL = 64, // "<=" EQUALITY = 64, // "=="
GREATER_EQUAL = 65, // ">=" INEQUALITY = 65, // "!="
LESS = 66, // "<" LESS_EQUAL = 66, // "<="
GREATER = 67, // ">" GREATER_EQUAL = 67, // ">="
NOT = 68, // "!" LESS = 68, // "<"
COMPLEMENT = 69, // "~" GREATER = 69, // ">"
ASSIGN = 70, // "=" NOT = 70, // "!"
ASSIGN_ADD = 71, // "+=" COMPLEMENT = 71, // "~"
ASSIGN_SUB = 72, // "-=" ASSIGN = 72, // "="
ASSIGN_MUL = 73, // "*=" ASSIGN_ADD = 73, // "+="
ASSIGN_DIV = 74, // "/=" ASSIGN_SUB = 74, // "-="
ASSIGN_MOD = 75, // "%=" ASSIGN_MUL = 75, // "*="
ASSIGN_BW_OR = 76, // "|=" ASSIGN_DIV = 76, // "/="
ASSIGN_BW_AND = 77, // "&=" ASSIGN_MOD = 77, // "%="
ASSIGN_BW_EXOR = 78, // "^=" ASSIGN_BW_OR = 78, // "|="
ASSIGN_RSHIFT = 79, // ">>=" ASSIGN_BW_AND = 79, // "&="
ASSIGN_LSHIFT = 80, // "<<=" ASSIGN_BW_EXOR = 80, // "^="
BITWISE_OR = 81, // "|" ASSIGN_RSHIFT = 81, // ">>="
BITWISE_AND = 82, // "&" ASSIGN_LSHIFT = 82, // "<<="
BITWISE_EXOR = 83, // "^" BITWISE_OR = 83, // "|"
ADD = 84, // "+" BITWISE_AND = 84, // "&"
SUB = 85, // "-" BITWISE_EXOR = 85, // "^"
MUL = 86, // "*" ADD = 86, // "+"
DIV = 87, // "/" SUB = 87, // "-"
MOD = 88, // "%" MUL = 88, // "*"
PATH = 89, // "path" DIV = 89, // "/"
IDENTIFIER = 90, // "identifier" MOD = 90, // "%"
STRING = 91, // "string literal" PATH = 91, // "path"
ISTRING = 92, // "localized string" IDENTIFIER = 92, // "identifier"
COLOR = 93, // "color" STRING = 93, // "string literal"
FLOAT = 94, // "float" ISTRING = 94, // "localized string"
INT_DEC = 95, // "int" COLOR = 95, // "color"
INT_OCT = 96, // "octal int" FLOAT = 96, // "float"
INT_BIN = 97, // "binary int" INT_DEC = 97, // "int"
INT_HEX = 98, // "hexadecimal int" INT_OCT = 98, // "octal int"
ADD_ARRAY = 99, // ADD_ARRAY INT_BIN = 99, // "binary int"
THEN = 100, // THEN INT_HEX = 100, // "hexadecimal int"
TERN = 101, // TERN ADD_ARRAY = 101, // ADD_ARRAY
NEG = 102, // NEG THEN = 102, // THEN
ANIMREF = 103, // ANIMREF TERN = 103, // TERN
PREINC = 104, // PREINC NEG = 104, // NEG
PREDEC = 105, // PREDEC ANIMREF = 105, // ANIMREF
POSTINC = 106, // POSTINC PREINC = 106, // PREINC
POSTDEC = 107 // POSTDEC PREDEC = 107, // PREDEC
POSTINC = 108, // POSTINC
POSTDEC = 109 // POSTDEC
}; };
/// Backward compatibility alias (Bison 3.6). /// Backward compatibility alias (Bison 3.6).
typedef token_kind_type yytokentype; typedef token_kind_type yytokentype;
@ -806,198 +809,201 @@ namespace xsk { namespace gsc { namespace iw8 {
{ {
enum symbol_kind_type enum symbol_kind_type
{ {
YYNTOKENS = 108, ///< Number of tokens. YYNTOKENS = 110, ///< 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
S_YYUNDEF = 2, // "invalid token" S_YYUNDEF = 2, // "invalid token"
S_INLINE = 3, // "#inline" S_DEVBEGIN = 3, // "/#"
S_INCLUDE = 4, // "#include" S_DEVEND = 4, // "#/"
S_USINGTREE = 5, // "#using_animtree" S_INLINE = 5, // "#inline"
S_ANIMTREE = 6, // "#animtree" S_INCLUDE = 6, // "#include"
S_ENDON = 7, // "endon" S_USINGTREE = 7, // "#using_animtree"
S_NOTIFY = 8, // "notify" S_ANIMTREE = 8, // "#animtree"
S_WAIT = 9, // "wait" S_ENDON = 9, // "endon"
S_WAITTILL = 10, // "waittill" S_NOTIFY = 10, // "notify"
S_WAITTILLMATCH = 11, // "waittillmatch" S_WAIT = 11, // "wait"
S_WAITTILLFRAMEEND = 12, // "waittillframeend" S_WAITTILL = 12, // "waittill"
S_WAITFRAME = 13, // "waitframe" S_WAITTILLMATCH = 13, // "waittillmatch"
S_IF = 14, // "if" S_WAITTILLFRAMEEND = 14, // "waittillframeend"
S_ELSE = 15, // "else" S_WAITFRAME = 15, // "waitframe"
S_DO = 16, // "do" S_IF = 16, // "if"
S_WHILE = 17, // "while" S_ELSE = 17, // "else"
S_FOR = 18, // "for" S_DO = 18, // "do"
S_FOREACH = 19, // "foreach" S_WHILE = 19, // "while"
S_IN = 20, // "in" S_FOR = 20, // "for"
S_SWITCH = 21, // "switch" S_FOREACH = 21, // "foreach"
S_CASE = 22, // "case" S_IN = 22, // "in"
S_DEFAULT = 23, // "default" S_SWITCH = 23, // "switch"
S_BREAK = 24, // "break" S_CASE = 24, // "case"
S_CONTINUE = 25, // "continue" S_DEFAULT = 25, // "default"
S_RETURN = 26, // "return" S_BREAK = 26, // "break"
S_BREAKPOINT = 27, // "breakpoint" S_CONTINUE = 27, // "continue"
S_PROFBEGIN = 28, // "prof_begin" S_RETURN = 28, // "return"
S_PROFEND = 29, // "prof_end" S_BREAKPOINT = 29, // "breakpoint"
S_THREAD = 30, // "thread" S_PROFBEGIN = 30, // "prof_begin"
S_CHILDTHREAD = 31, // "childthread" S_PROFEND = 31, // "prof_end"
S_THISTHREAD = 32, // "thisthread" S_THREAD = 32, // "thread"
S_CALL = 33, // "call" S_CHILDTHREAD = 33, // "childthread"
S_TRUE = 34, // "true" S_THISTHREAD = 34, // "thisthread"
S_FALSE = 35, // "false" S_CALL = 35, // "call"
S_UNDEFINED = 36, // "undefined" S_TRUE = 36, // "true"
S_SIZE = 37, // ".size" S_FALSE = 37, // "false"
S_GAME = 38, // "game" S_UNDEFINED = 38, // "undefined"
S_SELF = 39, // "self" S_SIZE = 39, // ".size"
S_ANIM = 40, // "anim" S_GAME = 40, // "game"
S_LEVEL = 41, // "level" S_SELF = 41, // "self"
S_ISDEFINED = 42, // "isdefined" S_ANIM = 42, // "anim"
S_ISTRUE = 43, // "istrue" S_LEVEL = 43, // "level"
S_LPAREN = 44, // "(" S_ISDEFINED = 44, // "isdefined"
S_RPAREN = 45, // ")" S_ISTRUE = 45, // "istrue"
S_LBRACE = 46, // "{" S_LPAREN = 46, // "("
S_RBRACE = 47, // "}" S_RPAREN = 47, // ")"
S_LBRACKET = 48, // "[" S_LBRACE = 48, // "{"
S_RBRACKET = 49, // "]" S_RBRACE = 49, // "}"
S_COMMA = 50, // "," S_LBRACKET = 50, // "["
S_DOT = 51, // "." S_RBRACKET = 51, // "]"
S_DOUBLECOLON = 52, // "::" S_COMMA = 52, // ","
S_COLON = 53, // ":" S_DOT = 53, // "."
S_SEMICOLON = 54, // ";" S_DOUBLECOLON = 54, // "::"
S_QMARK = 55, // "?" S_COLON = 55, // ":"
S_INCREMENT = 56, // "++" S_SEMICOLON = 56, // ";"
S_DECREMENT = 57, // "--" S_QMARK = 57, // "?"
S_LSHIFT = 58, // "<<" S_INCREMENT = 58, // "++"
S_RSHIFT = 59, // ">>" S_DECREMENT = 59, // "--"
S_OR = 60, // "||" S_LSHIFT = 60, // "<<"
S_AND = 61, // "&&" S_RSHIFT = 61, // ">>"
S_EQUALITY = 62, // "==" S_OR = 62, // "||"
S_INEQUALITY = 63, // "!=" S_AND = 63, // "&&"
S_LESS_EQUAL = 64, // "<=" S_EQUALITY = 64, // "=="
S_GREATER_EQUAL = 65, // ">=" S_INEQUALITY = 65, // "!="
S_LESS = 66, // "<" S_LESS_EQUAL = 66, // "<="
S_GREATER = 67, // ">" S_GREATER_EQUAL = 67, // ">="
S_NOT = 68, // "!" S_LESS = 68, // "<"
S_COMPLEMENT = 69, // "~" S_GREATER = 69, // ">"
S_ASSIGN = 70, // "=" S_NOT = 70, // "!"
S_ASSIGN_ADD = 71, // "+=" S_COMPLEMENT = 71, // "~"
S_ASSIGN_SUB = 72, // "-=" S_ASSIGN = 72, // "="
S_ASSIGN_MUL = 73, // "*=" S_ASSIGN_ADD = 73, // "+="
S_ASSIGN_DIV = 74, // "/=" S_ASSIGN_SUB = 74, // "-="
S_ASSIGN_MOD = 75, // "%=" S_ASSIGN_MUL = 75, // "*="
S_ASSIGN_BW_OR = 76, // "|=" S_ASSIGN_DIV = 76, // "/="
S_ASSIGN_BW_AND = 77, // "&=" S_ASSIGN_MOD = 77, // "%="
S_ASSIGN_BW_EXOR = 78, // "^=" S_ASSIGN_BW_OR = 78, // "|="
S_ASSIGN_RSHIFT = 79, // ">>=" S_ASSIGN_BW_AND = 79, // "&="
S_ASSIGN_LSHIFT = 80, // "<<=" S_ASSIGN_BW_EXOR = 80, // "^="
S_BITWISE_OR = 81, // "|" S_ASSIGN_RSHIFT = 81, // ">>="
S_BITWISE_AND = 82, // "&" S_ASSIGN_LSHIFT = 82, // "<<="
S_BITWISE_EXOR = 83, // "^" S_BITWISE_OR = 83, // "|"
S_ADD = 84, // "+" S_BITWISE_AND = 84, // "&"
S_SUB = 85, // "-" S_BITWISE_EXOR = 85, // "^"
S_MUL = 86, // "*" S_ADD = 86, // "+"
S_DIV = 87, // "/" S_SUB = 87, // "-"
S_MOD = 88, // "%" S_MUL = 88, // "*"
S_PATH = 89, // "path" S_DIV = 89, // "/"
S_IDENTIFIER = 90, // "identifier" S_MOD = 90, // "%"
S_STRING = 91, // "string literal" S_PATH = 91, // "path"
S_ISTRING = 92, // "localized string" S_IDENTIFIER = 92, // "identifier"
S_COLOR = 93, // "color" S_STRING = 93, // "string literal"
S_FLOAT = 94, // "float" S_ISTRING = 94, // "localized string"
S_INT_DEC = 95, // "int" S_COLOR = 95, // "color"
S_INT_OCT = 96, // "octal int" S_FLOAT = 96, // "float"
S_INT_BIN = 97, // "binary int" S_INT_DEC = 97, // "int"
S_INT_HEX = 98, // "hexadecimal int" S_INT_OCT = 98, // "octal int"
S_ADD_ARRAY = 99, // ADD_ARRAY S_INT_BIN = 99, // "binary int"
S_THEN = 100, // THEN S_INT_HEX = 100, // "hexadecimal int"
S_TERN = 101, // TERN S_ADD_ARRAY = 101, // ADD_ARRAY
S_NEG = 102, // NEG S_THEN = 102, // THEN
S_ANIMREF = 103, // ANIMREF S_TERN = 103, // TERN
S_PREINC = 104, // PREINC S_NEG = 104, // NEG
S_PREDEC = 105, // PREDEC S_ANIMREF = 105, // ANIMREF
S_POSTINC = 106, // POSTINC S_PREINC = 106, // PREINC
S_POSTDEC = 107, // POSTDEC S_PREDEC = 107, // PREDEC
S_YYACCEPT = 108, // $accept S_POSTINC = 108, // POSTINC
S_root = 109, // root S_POSTDEC = 109, // POSTDEC
S_program = 110, // program S_YYACCEPT = 110, // $accept
S_inline = 111, // inline S_root = 111, // root
S_include = 112, // include S_program = 112, // program
S_declaration = 113, // declaration S_inline = 113, // inline
S_decl_usingtree = 114, // decl_usingtree S_include = 114, // include
S_decl_constant = 115, // decl_constant S_declaration = 115, // declaration
S_decl_thread = 116, // decl_thread S_decl_usingtree = 116, // decl_usingtree
S_stmt = 117, // stmt S_decl_constant = 117, // decl_constant
S_stmt_block = 118, // stmt_block S_decl_thread = 118, // decl_thread
S_stmt_list = 119, // stmt_list S_stmt = 119, // stmt
S_stmt_expr = 120, // stmt_expr S_stmt_dev = 120, // stmt_dev
S_stmt_call = 121, // stmt_call S_stmt_block = 121, // stmt_block
S_stmt_assign = 122, // stmt_assign S_stmt_list = 122, // stmt_list
S_stmt_endon = 123, // stmt_endon S_stmt_expr = 123, // stmt_expr
S_stmt_notify = 124, // stmt_notify S_stmt_call = 124, // stmt_call
S_stmt_wait = 125, // stmt_wait S_stmt_assign = 125, // stmt_assign
S_stmt_waittill = 126, // stmt_waittill S_stmt_endon = 126, // stmt_endon
S_stmt_waittillmatch = 127, // stmt_waittillmatch S_stmt_notify = 127, // stmt_notify
S_stmt_waittillframeend = 128, // stmt_waittillframeend S_stmt_wait = 128, // stmt_wait
S_stmt_waitframe = 129, // stmt_waitframe S_stmt_waittill = 129, // stmt_waittill
S_stmt_if = 130, // stmt_if S_stmt_waittillmatch = 130, // stmt_waittillmatch
S_stmt_ifelse = 131, // stmt_ifelse S_stmt_waittillframeend = 131, // stmt_waittillframeend
S_stmt_while = 132, // stmt_while S_stmt_waitframe = 132, // stmt_waitframe
S_stmt_dowhile = 133, // stmt_dowhile S_stmt_if = 133, // stmt_if
S_stmt_for = 134, // stmt_for S_stmt_ifelse = 134, // stmt_ifelse
S_stmt_foreach = 135, // stmt_foreach S_stmt_while = 135, // stmt_while
S_stmt_switch = 136, // stmt_switch S_stmt_dowhile = 136, // stmt_dowhile
S_stmt_case = 137, // stmt_case S_stmt_for = 137, // stmt_for
S_stmt_default = 138, // stmt_default S_stmt_foreach = 138, // stmt_foreach
S_stmt_break = 139, // stmt_break S_stmt_switch = 139, // stmt_switch
S_stmt_continue = 140, // stmt_continue S_stmt_case = 140, // stmt_case
S_stmt_return = 141, // stmt_return S_stmt_default = 141, // stmt_default
S_stmt_breakpoint = 142, // stmt_breakpoint S_stmt_break = 142, // stmt_break
S_stmt_prof_begin = 143, // stmt_prof_begin S_stmt_continue = 143, // stmt_continue
S_stmt_prof_end = 144, // stmt_prof_end S_stmt_return = 144, // stmt_return
S_expr = 145, // expr S_stmt_breakpoint = 145, // stmt_breakpoint
S_expr_or_empty = 146, // expr_or_empty S_stmt_prof_begin = 146, // stmt_prof_begin
S_expr_assign = 147, // expr_assign S_stmt_prof_end = 147, // stmt_prof_end
S_expr_increment = 148, // expr_increment S_expr = 148, // expr
S_expr_decrement = 149, // expr_decrement S_expr_or_empty = 149, // expr_or_empty
S_expr_ternary = 150, // expr_ternary S_expr_assign = 150, // expr_assign
S_expr_binary = 151, // expr_binary S_expr_increment = 151, // expr_increment
S_expr_primitive = 152, // expr_primitive S_expr_decrement = 152, // expr_decrement
S_expr_complement = 153, // expr_complement S_expr_ternary = 153, // expr_ternary
S_expr_not = 154, // expr_not S_expr_binary = 154, // expr_binary
S_expr_call = 155, // expr_call S_expr_primitive = 155, // expr_primitive
S_expr_method = 156, // expr_method S_expr_complement = 156, // expr_complement
S_expr_function = 157, // expr_function S_expr_not = 157, // expr_not
S_expr_pointer = 158, // expr_pointer S_expr_call = 158, // expr_call
S_expr_add_array = 159, // expr_add_array S_expr_method = 159, // expr_method
S_expr_parameters = 160, // expr_parameters S_expr_function = 160, // expr_function
S_expr_arguments = 161, // expr_arguments S_expr_pointer = 161, // expr_pointer
S_expr_arguments_no_empty = 162, // expr_arguments_no_empty S_expr_add_array = 162, // expr_add_array
S_expr_isdefined = 163, // expr_isdefined S_expr_parameters = 163, // expr_parameters
S_expr_istrue = 164, // expr_istrue S_expr_arguments = 164, // expr_arguments
S_expr_reference = 165, // expr_reference S_expr_arguments_no_empty = 165, // expr_arguments_no_empty
S_expr_array = 166, // expr_array S_expr_isdefined = 166, // expr_isdefined
S_expr_field = 167, // expr_field S_expr_istrue = 167, // expr_istrue
S_expr_size = 168, // expr_size S_expr_reference = 168, // expr_reference
S_expr_paren = 169, // expr_paren S_expr_array = 169, // expr_array
S_expr_object = 170, // expr_object S_expr_field = 170, // expr_field
S_expr_thisthread = 171, // expr_thisthread S_expr_size = 171, // expr_size
S_expr_empty_array = 172, // expr_empty_array S_expr_paren = 172, // expr_paren
S_expr_undefined = 173, // expr_undefined S_expr_object = 173, // expr_object
S_expr_game = 174, // expr_game S_expr_thisthread = 174, // expr_thisthread
S_expr_self = 175, // expr_self S_expr_empty_array = 175, // expr_empty_array
S_expr_anim = 176, // expr_anim S_expr_undefined = 176, // expr_undefined
S_expr_level = 177, // expr_level S_expr_game = 177, // expr_game
S_expr_animation = 178, // expr_animation S_expr_self = 178, // expr_self
S_expr_animtree = 179, // expr_animtree S_expr_anim = 179, // expr_anim
S_expr_identifier = 180, // expr_identifier S_expr_level = 180, // expr_level
S_expr_path = 181, // expr_path S_expr_animation = 181, // expr_animation
S_expr_istring = 182, // expr_istring S_expr_animtree = 182, // expr_animtree
S_expr_string = 183, // expr_string S_expr_identifier = 183, // expr_identifier
S_expr_color = 184, // expr_color S_expr_path = 184, // expr_path
S_expr_vector = 185, // expr_vector S_expr_istring = 185, // expr_istring
S_expr_float = 186, // expr_float S_expr_string = 186, // expr_string
S_expr_integer = 187, // expr_integer S_expr_color = 187, // expr_color
S_expr_false = 188, // expr_false S_expr_vector = 188, // expr_vector
S_expr_true = 189 // expr_true S_expr_float = 189, // expr_float
S_expr_integer = 190, // expr_integer
S_expr_false = 191, // expr_false
S_expr_true = 192 // expr_true
}; };
}; };
@ -1268,6 +1274,7 @@ namespace xsk { namespace gsc { namespace iw8 {
value.move< ast::stmt_ifelse::ptr > (std::move (that.value)); value.move< ast::stmt_ifelse::ptr > (std::move (that.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.move< ast::stmt_list::ptr > (std::move (that.value)); value.move< ast::stmt_list::ptr > (std::move (that.value));
@ -2575,6 +2582,7 @@ switch (yykind)
value.template destroy< ast::stmt_ifelse::ptr > (); value.template destroy< ast::stmt_ifelse::ptr > ();
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.template destroy< ast::stmt_list::ptr > (); value.template destroy< ast::stmt_list::ptr > ();
@ -2838,6 +2846,36 @@ switch (yykind)
return symbol_type (token::IW8UNDEF, l); return symbol_type (token::IW8UNDEF, l);
} }
#endif #endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_DEVBEGIN (location_type l)
{
return symbol_type (token::DEVBEGIN, std::move (l));
}
#else
static
symbol_type
make_DEVBEGIN (const location_type& l)
{
return symbol_type (token::DEVBEGIN, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_DEVEND (location_type l)
{
return symbol_type (token::DEVEND, std::move (l));
}
#else
static
symbol_type
make_DEVEND (const location_type& l)
{
return symbol_type (token::DEVEND, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS #if 201103L <= YY_CPLUSPLUS
static static
symbol_type symbol_type
@ -4757,9 +4795,9 @@ switch (yykind)
/// Constants. /// Constants.
enum enum
{ {
yylast_ = 2068, ///< Last index in yytable_. yylast_ = 2336, ///< Last index in yytable_.
yynnts_ = 82, ///< Number of nonterminal symbols. yynnts_ = 83, ///< Number of nonterminal symbols.
yyfinal_ = 19 ///< Termination state number. yyfinal_ = 21 ///< Termination state number.
}; };
@ -5020,6 +5058,7 @@ switch (yykind)
value.copy< ast::stmt_ifelse::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_ifelse::ptr > (YY_MOVE (that.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.copy< ast::stmt_list::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_list::ptr > (YY_MOVE (that.value));
@ -5345,6 +5384,7 @@ switch (yykind)
value.move< ast::stmt_ifelse::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_ifelse::ptr > (YY_MOVE (s.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.move< ast::stmt_list::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_list::ptr > (YY_MOVE (s.value));
@ -5470,7 +5510,7 @@ switch (yykind)
#line 13 "parser.ypp" #line 13 "parser.ypp"
} } } // xsk::gsc::iw8 } } } // xsk::gsc::iw8
#line 5474 "parser.hpp" #line 5514 "parser.hpp"

View File

@ -85,6 +85,7 @@ void compiler::compile_program(const ast::program::ptr& program)
constants_.clear(); constants_.clear();
local_functions_.clear(); local_functions_.clear();
index_ = 1; index_ = 1;
developer_thread_ = false;
for (const auto& entry : program->declarations) for (const auto& entry : program->declarations)
{ {
@ -150,6 +151,12 @@ void compiler::emit_declaration(const ast::decl& decl)
{ {
switch (decl.kind()) switch (decl.kind())
{ {
case ast::kind::decl_dev_begin:
developer_thread_ = true;
break;
case ast::kind::decl_dev_end:
developer_thread_ = false;
break;
case ast::kind::decl_usingtree: case ast::kind::decl_usingtree:
emit_decl_usingtree(decl.as_usingtree); emit_decl_usingtree(decl.as_usingtree);
break; break;
@ -166,6 +173,9 @@ void compiler::emit_declaration(const ast::decl& decl)
void compiler::emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree) void compiler::emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree)
{ {
if(developer_thread_)
throw comp_error(animtree->loc(), "cannot put #using_animtree inside /# ... #/ comment");
animtrees_.push_back({ animtree->name->value, false }); animtrees_.push_back({ animtree->name->value, false });
} }

File diff suppressed because it is too large Load Diff

View File

@ -439,9 +439,9 @@ void yyfree ( void * , yyscan_t yyscanner );
#ifdef YY_HEADER_EXPORT_START_CONDITIONS #ifdef YY_HEADER_EXPORT_START_CONDITIONS
#define INITIAL 0 #define INITIAL 0
#define COMMENT_BLOCK_STATE 1 #define COMMENT_STATE 1
#define DEVBLOCK_ON_STATE 2 #define DEV_OFF_STATE 2
#define DEVBLOCK_OFF_STATE 3 #define DEV_ON_STATE 3
#endif #endif
@ -703,7 +703,7 @@ extern int yylex (yyscan_t yyscanner);
#undef yyTABLES_NAME #undef yyTABLES_NAME
#endif #endif
#line 166 "lexer.lpp" #line 170 "lexer.lpp"
#line 709 "lexer.hpp" #line 709 "lexer.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -580,6 +580,7 @@ namespace xsk { namespace gsc { namespace s1 {
// stmt_ifelse // stmt_ifelse
char dummy54[sizeof (ast::stmt_ifelse::ptr)]; char dummy54[sizeof (ast::stmt_ifelse::ptr)];
// stmt_dev
// stmt_block // stmt_block
// stmt_list // stmt_list
char dummy55[sizeof (ast::stmt_list::ptr)]; char dummy55[sizeof (ast::stmt_list::ptr)];
@ -679,109 +680,111 @@ namespace xsk { namespace gsc { namespace s1 {
S1EOF = 0, // "end of file" S1EOF = 0, // "end of file"
S1error = 1, // error S1error = 1, // error
S1UNDEF = 2, // "invalid token" S1UNDEF = 2, // "invalid token"
INLINE = 3, // "#inline" DEVBEGIN = 3, // "/#"
INCLUDE = 4, // "#include" DEVEND = 4, // "#/"
USINGTREE = 5, // "#using_animtree" INLINE = 5, // "#inline"
ANIMTREE = 6, // "#animtree" INCLUDE = 6, // "#include"
ENDON = 7, // "endon" USINGTREE = 7, // "#using_animtree"
NOTIFY = 8, // "notify" ANIMTREE = 8, // "#animtree"
WAIT = 9, // "wait" ENDON = 9, // "endon"
WAITTILL = 10, // "waittill" NOTIFY = 10, // "notify"
WAITTILLMATCH = 11, // "waittillmatch" WAIT = 11, // "wait"
WAITTILLFRAMEEND = 12, // "waittillframeend" WAITTILL = 12, // "waittill"
WAITFRAME = 13, // "waitframe" WAITTILLMATCH = 13, // "waittillmatch"
IF = 14, // "if" WAITTILLFRAMEEND = 14, // "waittillframeend"
ELSE = 15, // "else" WAITFRAME = 15, // "waitframe"
DO = 16, // "do" IF = 16, // "if"
WHILE = 17, // "while" ELSE = 17, // "else"
FOR = 18, // "for" DO = 18, // "do"
FOREACH = 19, // "foreach" WHILE = 19, // "while"
IN = 20, // "in" FOR = 20, // "for"
SWITCH = 21, // "switch" FOREACH = 21, // "foreach"
CASE = 22, // "case" IN = 22, // "in"
DEFAULT = 23, // "default" SWITCH = 23, // "switch"
BREAK = 24, // "break" CASE = 24, // "case"
CONTINUE = 25, // "continue" DEFAULT = 25, // "default"
RETURN = 26, // "return" BREAK = 26, // "break"
BREAKPOINT = 27, // "breakpoint" CONTINUE = 27, // "continue"
PROFBEGIN = 28, // "prof_begin" RETURN = 28, // "return"
PROFEND = 29, // "prof_end" BREAKPOINT = 29, // "breakpoint"
THREAD = 30, // "thread" PROFBEGIN = 30, // "prof_begin"
CHILDTHREAD = 31, // "childthread" PROFEND = 31, // "prof_end"
THISTHREAD = 32, // "thisthread" THREAD = 32, // "thread"
CALL = 33, // "call" CHILDTHREAD = 33, // "childthread"
TRUE = 34, // "true" THISTHREAD = 34, // "thisthread"
FALSE = 35, // "false" CALL = 35, // "call"
UNDEFINED = 36, // "undefined" TRUE = 36, // "true"
SIZE = 37, // ".size" FALSE = 37, // "false"
GAME = 38, // "game" UNDEFINED = 38, // "undefined"
SELF = 39, // "self" SIZE = 39, // ".size"
ANIM = 40, // "anim" GAME = 40, // "game"
LEVEL = 41, // "level" SELF = 41, // "self"
LPAREN = 42, // "(" ANIM = 42, // "anim"
RPAREN = 43, // ")" LEVEL = 43, // "level"
LBRACE = 44, // "{" LPAREN = 44, // "("
RBRACE = 45, // "}" RPAREN = 45, // ")"
LBRACKET = 46, // "[" LBRACE = 46, // "{"
RBRACKET = 47, // "]" RBRACE = 47, // "}"
COMMA = 48, // "," LBRACKET = 48, // "["
DOT = 49, // "." RBRACKET = 49, // "]"
DOUBLECOLON = 50, // "::" COMMA = 50, // ","
COLON = 51, // ":" DOT = 51, // "."
SEMICOLON = 52, // ";" DOUBLECOLON = 52, // "::"
QMARK = 53, // "?" COLON = 53, // ":"
INCREMENT = 54, // "++" SEMICOLON = 54, // ";"
DECREMENT = 55, // "--" QMARK = 55, // "?"
LSHIFT = 56, // "<<" INCREMENT = 56, // "++"
RSHIFT = 57, // ">>" DECREMENT = 57, // "--"
OR = 58, // "||" LSHIFT = 58, // "<<"
AND = 59, // "&&" RSHIFT = 59, // ">>"
EQUALITY = 60, // "==" OR = 60, // "||"
INEQUALITY = 61, // "!=" AND = 61, // "&&"
LESS_EQUAL = 62, // "<=" EQUALITY = 62, // "=="
GREATER_EQUAL = 63, // ">=" INEQUALITY = 63, // "!="
LESS = 64, // "<" LESS_EQUAL = 64, // "<="
GREATER = 65, // ">" GREATER_EQUAL = 65, // ">="
NOT = 66, // "!" LESS = 66, // "<"
COMPLEMENT = 67, // "~" GREATER = 67, // ">"
ASSIGN = 68, // "=" NOT = 68, // "!"
ASSIGN_ADD = 69, // "+=" COMPLEMENT = 69, // "~"
ASSIGN_SUB = 70, // "-=" ASSIGN = 70, // "="
ASSIGN_MUL = 71, // "*=" ASSIGN_ADD = 71, // "+="
ASSIGN_DIV = 72, // "/=" ASSIGN_SUB = 72, // "-="
ASSIGN_MOD = 73, // "%=" ASSIGN_MUL = 73, // "*="
ASSIGN_BW_OR = 74, // "|=" ASSIGN_DIV = 74, // "/="
ASSIGN_BW_AND = 75, // "&=" ASSIGN_MOD = 75, // "%="
ASSIGN_BW_EXOR = 76, // "^=" ASSIGN_BW_OR = 76, // "|="
ASSIGN_RSHIFT = 77, // ">>=" ASSIGN_BW_AND = 77, // "&="
ASSIGN_LSHIFT = 78, // "<<=" ASSIGN_BW_EXOR = 78, // "^="
BITWISE_OR = 79, // "|" ASSIGN_RSHIFT = 79, // ">>="
BITWISE_AND = 80, // "&" ASSIGN_LSHIFT = 80, // "<<="
BITWISE_EXOR = 81, // "^" BITWISE_OR = 81, // "|"
ADD = 82, // "+" BITWISE_AND = 82, // "&"
SUB = 83, // "-" BITWISE_EXOR = 83, // "^"
MUL = 84, // "*" ADD = 84, // "+"
DIV = 85, // "/" SUB = 85, // "-"
MOD = 86, // "%" MUL = 86, // "*"
PATH = 87, // "path" DIV = 87, // "/"
IDENTIFIER = 88, // "identifier" MOD = 88, // "%"
STRING = 89, // "string literal" PATH = 89, // "path"
ISTRING = 90, // "localized string" IDENTIFIER = 90, // "identifier"
COLOR = 91, // "color" STRING = 91, // "string literal"
FLOAT = 92, // "float" ISTRING = 92, // "localized string"
INT_DEC = 93, // "int" COLOR = 93, // "color"
INT_OCT = 94, // "octal int" FLOAT = 94, // "float"
INT_BIN = 95, // "binary int" INT_DEC = 95, // "int"
INT_HEX = 96, // "hexadecimal int" INT_OCT = 96, // "octal int"
ADD_ARRAY = 97, // ADD_ARRAY INT_BIN = 97, // "binary int"
THEN = 98, // THEN INT_HEX = 98, // "hexadecimal int"
TERN = 99, // TERN ADD_ARRAY = 99, // ADD_ARRAY
NEG = 100, // NEG THEN = 100, // THEN
ANIMREF = 101, // ANIMREF TERN = 101, // TERN
PREINC = 102, // PREINC NEG = 102, // NEG
PREDEC = 103, // PREDEC ANIMREF = 103, // ANIMREF
POSTINC = 104, // POSTINC PREINC = 104, // PREINC
POSTDEC = 105 // POSTDEC PREDEC = 105, // PREDEC
POSTINC = 106, // POSTINC
POSTDEC = 107 // POSTDEC
}; };
/// Backward compatibility alias (Bison 3.6). /// Backward compatibility alias (Bison 3.6).
typedef token_kind_type yytokentype; typedef token_kind_type yytokentype;
@ -798,194 +801,197 @@ namespace xsk { namespace gsc { namespace s1 {
{ {
enum symbol_kind_type enum symbol_kind_type
{ {
YYNTOKENS = 106, ///< Number of tokens. YYNTOKENS = 108, ///< 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
S_YYUNDEF = 2, // "invalid token" S_YYUNDEF = 2, // "invalid token"
S_INLINE = 3, // "#inline" S_DEVBEGIN = 3, // "/#"
S_INCLUDE = 4, // "#include" S_DEVEND = 4, // "#/"
S_USINGTREE = 5, // "#using_animtree" S_INLINE = 5, // "#inline"
S_ANIMTREE = 6, // "#animtree" S_INCLUDE = 6, // "#include"
S_ENDON = 7, // "endon" S_USINGTREE = 7, // "#using_animtree"
S_NOTIFY = 8, // "notify" S_ANIMTREE = 8, // "#animtree"
S_WAIT = 9, // "wait" S_ENDON = 9, // "endon"
S_WAITTILL = 10, // "waittill" S_NOTIFY = 10, // "notify"
S_WAITTILLMATCH = 11, // "waittillmatch" S_WAIT = 11, // "wait"
S_WAITTILLFRAMEEND = 12, // "waittillframeend" S_WAITTILL = 12, // "waittill"
S_WAITFRAME = 13, // "waitframe" S_WAITTILLMATCH = 13, // "waittillmatch"
S_IF = 14, // "if" S_WAITTILLFRAMEEND = 14, // "waittillframeend"
S_ELSE = 15, // "else" S_WAITFRAME = 15, // "waitframe"
S_DO = 16, // "do" S_IF = 16, // "if"
S_WHILE = 17, // "while" S_ELSE = 17, // "else"
S_FOR = 18, // "for" S_DO = 18, // "do"
S_FOREACH = 19, // "foreach" S_WHILE = 19, // "while"
S_IN = 20, // "in" S_FOR = 20, // "for"
S_SWITCH = 21, // "switch" S_FOREACH = 21, // "foreach"
S_CASE = 22, // "case" S_IN = 22, // "in"
S_DEFAULT = 23, // "default" S_SWITCH = 23, // "switch"
S_BREAK = 24, // "break" S_CASE = 24, // "case"
S_CONTINUE = 25, // "continue" S_DEFAULT = 25, // "default"
S_RETURN = 26, // "return" S_BREAK = 26, // "break"
S_BREAKPOINT = 27, // "breakpoint" S_CONTINUE = 27, // "continue"
S_PROFBEGIN = 28, // "prof_begin" S_RETURN = 28, // "return"
S_PROFEND = 29, // "prof_end" S_BREAKPOINT = 29, // "breakpoint"
S_THREAD = 30, // "thread" S_PROFBEGIN = 30, // "prof_begin"
S_CHILDTHREAD = 31, // "childthread" S_PROFEND = 31, // "prof_end"
S_THISTHREAD = 32, // "thisthread" S_THREAD = 32, // "thread"
S_CALL = 33, // "call" S_CHILDTHREAD = 33, // "childthread"
S_TRUE = 34, // "true" S_THISTHREAD = 34, // "thisthread"
S_FALSE = 35, // "false" S_CALL = 35, // "call"
S_UNDEFINED = 36, // "undefined" S_TRUE = 36, // "true"
S_SIZE = 37, // ".size" S_FALSE = 37, // "false"
S_GAME = 38, // "game" S_UNDEFINED = 38, // "undefined"
S_SELF = 39, // "self" S_SIZE = 39, // ".size"
S_ANIM = 40, // "anim" S_GAME = 40, // "game"
S_LEVEL = 41, // "level" S_SELF = 41, // "self"
S_LPAREN = 42, // "(" S_ANIM = 42, // "anim"
S_RPAREN = 43, // ")" S_LEVEL = 43, // "level"
S_LBRACE = 44, // "{" S_LPAREN = 44, // "("
S_RBRACE = 45, // "}" S_RPAREN = 45, // ")"
S_LBRACKET = 46, // "[" S_LBRACE = 46, // "{"
S_RBRACKET = 47, // "]" S_RBRACE = 47, // "}"
S_COMMA = 48, // "," S_LBRACKET = 48, // "["
S_DOT = 49, // "." S_RBRACKET = 49, // "]"
S_DOUBLECOLON = 50, // "::" S_COMMA = 50, // ","
S_COLON = 51, // ":" S_DOT = 51, // "."
S_SEMICOLON = 52, // ";" S_DOUBLECOLON = 52, // "::"
S_QMARK = 53, // "?" S_COLON = 53, // ":"
S_INCREMENT = 54, // "++" S_SEMICOLON = 54, // ";"
S_DECREMENT = 55, // "--" S_QMARK = 55, // "?"
S_LSHIFT = 56, // "<<" S_INCREMENT = 56, // "++"
S_RSHIFT = 57, // ">>" S_DECREMENT = 57, // "--"
S_OR = 58, // "||" S_LSHIFT = 58, // "<<"
S_AND = 59, // "&&" S_RSHIFT = 59, // ">>"
S_EQUALITY = 60, // "==" S_OR = 60, // "||"
S_INEQUALITY = 61, // "!=" S_AND = 61, // "&&"
S_LESS_EQUAL = 62, // "<=" S_EQUALITY = 62, // "=="
S_GREATER_EQUAL = 63, // ">=" S_INEQUALITY = 63, // "!="
S_LESS = 64, // "<" S_LESS_EQUAL = 64, // "<="
S_GREATER = 65, // ">" S_GREATER_EQUAL = 65, // ">="
S_NOT = 66, // "!" S_LESS = 66, // "<"
S_COMPLEMENT = 67, // "~" S_GREATER = 67, // ">"
S_ASSIGN = 68, // "=" S_NOT = 68, // "!"
S_ASSIGN_ADD = 69, // "+=" S_COMPLEMENT = 69, // "~"
S_ASSIGN_SUB = 70, // "-=" S_ASSIGN = 70, // "="
S_ASSIGN_MUL = 71, // "*=" S_ASSIGN_ADD = 71, // "+="
S_ASSIGN_DIV = 72, // "/=" S_ASSIGN_SUB = 72, // "-="
S_ASSIGN_MOD = 73, // "%=" S_ASSIGN_MUL = 73, // "*="
S_ASSIGN_BW_OR = 74, // "|=" S_ASSIGN_DIV = 74, // "/="
S_ASSIGN_BW_AND = 75, // "&=" S_ASSIGN_MOD = 75, // "%="
S_ASSIGN_BW_EXOR = 76, // "^=" S_ASSIGN_BW_OR = 76, // "|="
S_ASSIGN_RSHIFT = 77, // ">>=" S_ASSIGN_BW_AND = 77, // "&="
S_ASSIGN_LSHIFT = 78, // "<<=" S_ASSIGN_BW_EXOR = 78, // "^="
S_BITWISE_OR = 79, // "|" S_ASSIGN_RSHIFT = 79, // ">>="
S_BITWISE_AND = 80, // "&" S_ASSIGN_LSHIFT = 80, // "<<="
S_BITWISE_EXOR = 81, // "^" S_BITWISE_OR = 81, // "|"
S_ADD = 82, // "+" S_BITWISE_AND = 82, // "&"
S_SUB = 83, // "-" S_BITWISE_EXOR = 83, // "^"
S_MUL = 84, // "*" S_ADD = 84, // "+"
S_DIV = 85, // "/" S_SUB = 85, // "-"
S_MOD = 86, // "%" S_MUL = 86, // "*"
S_PATH = 87, // "path" S_DIV = 87, // "/"
S_IDENTIFIER = 88, // "identifier" S_MOD = 88, // "%"
S_STRING = 89, // "string literal" S_PATH = 89, // "path"
S_ISTRING = 90, // "localized string" S_IDENTIFIER = 90, // "identifier"
S_COLOR = 91, // "color" S_STRING = 91, // "string literal"
S_FLOAT = 92, // "float" S_ISTRING = 92, // "localized string"
S_INT_DEC = 93, // "int" S_COLOR = 93, // "color"
S_INT_OCT = 94, // "octal int" S_FLOAT = 94, // "float"
S_INT_BIN = 95, // "binary int" S_INT_DEC = 95, // "int"
S_INT_HEX = 96, // "hexadecimal int" S_INT_OCT = 96, // "octal int"
S_ADD_ARRAY = 97, // ADD_ARRAY S_INT_BIN = 97, // "binary int"
S_THEN = 98, // THEN S_INT_HEX = 98, // "hexadecimal int"
S_TERN = 99, // TERN S_ADD_ARRAY = 99, // ADD_ARRAY
S_NEG = 100, // NEG S_THEN = 100, // THEN
S_ANIMREF = 101, // ANIMREF S_TERN = 101, // TERN
S_PREINC = 102, // PREINC S_NEG = 102, // NEG
S_PREDEC = 103, // PREDEC S_ANIMREF = 103, // ANIMREF
S_POSTINC = 104, // POSTINC S_PREINC = 104, // PREINC
S_POSTDEC = 105, // POSTDEC S_PREDEC = 105, // PREDEC
S_YYACCEPT = 106, // $accept S_POSTINC = 106, // POSTINC
S_root = 107, // root S_POSTDEC = 107, // POSTDEC
S_program = 108, // program S_YYACCEPT = 108, // $accept
S_inline = 109, // inline S_root = 109, // root
S_include = 110, // include S_program = 110, // program
S_declaration = 111, // declaration S_inline = 111, // inline
S_decl_usingtree = 112, // decl_usingtree S_include = 112, // include
S_decl_constant = 113, // decl_constant S_declaration = 113, // declaration
S_decl_thread = 114, // decl_thread S_decl_usingtree = 114, // decl_usingtree
S_stmt = 115, // stmt S_decl_constant = 115, // decl_constant
S_stmt_block = 116, // stmt_block S_decl_thread = 116, // decl_thread
S_stmt_list = 117, // stmt_list S_stmt = 117, // stmt
S_stmt_expr = 118, // stmt_expr S_stmt_dev = 118, // stmt_dev
S_stmt_call = 119, // stmt_call S_stmt_block = 119, // stmt_block
S_stmt_assign = 120, // stmt_assign S_stmt_list = 120, // stmt_list
S_stmt_endon = 121, // stmt_endon S_stmt_expr = 121, // stmt_expr
S_stmt_notify = 122, // stmt_notify S_stmt_call = 122, // stmt_call
S_stmt_wait = 123, // stmt_wait S_stmt_assign = 123, // stmt_assign
S_stmt_waittill = 124, // stmt_waittill S_stmt_endon = 124, // stmt_endon
S_stmt_waittillmatch = 125, // stmt_waittillmatch S_stmt_notify = 125, // stmt_notify
S_stmt_waittillframeend = 126, // stmt_waittillframeend S_stmt_wait = 126, // stmt_wait
S_stmt_waitframe = 127, // stmt_waitframe S_stmt_waittill = 127, // stmt_waittill
S_stmt_if = 128, // stmt_if S_stmt_waittillmatch = 128, // stmt_waittillmatch
S_stmt_ifelse = 129, // stmt_ifelse S_stmt_waittillframeend = 129, // stmt_waittillframeend
S_stmt_while = 130, // stmt_while S_stmt_waitframe = 130, // stmt_waitframe
S_stmt_dowhile = 131, // stmt_dowhile S_stmt_if = 131, // stmt_if
S_stmt_for = 132, // stmt_for S_stmt_ifelse = 132, // stmt_ifelse
S_stmt_foreach = 133, // stmt_foreach S_stmt_while = 133, // stmt_while
S_stmt_switch = 134, // stmt_switch S_stmt_dowhile = 134, // stmt_dowhile
S_stmt_case = 135, // stmt_case S_stmt_for = 135, // stmt_for
S_stmt_default = 136, // stmt_default S_stmt_foreach = 136, // stmt_foreach
S_stmt_break = 137, // stmt_break S_stmt_switch = 137, // stmt_switch
S_stmt_continue = 138, // stmt_continue S_stmt_case = 138, // stmt_case
S_stmt_return = 139, // stmt_return S_stmt_default = 139, // stmt_default
S_stmt_breakpoint = 140, // stmt_breakpoint S_stmt_break = 140, // stmt_break
S_stmt_prof_begin = 141, // stmt_prof_begin S_stmt_continue = 141, // stmt_continue
S_stmt_prof_end = 142, // stmt_prof_end S_stmt_return = 142, // stmt_return
S_expr = 143, // expr S_stmt_breakpoint = 143, // stmt_breakpoint
S_expr_or_empty = 144, // expr_or_empty S_stmt_prof_begin = 144, // stmt_prof_begin
S_expr_assign = 145, // expr_assign S_stmt_prof_end = 145, // stmt_prof_end
S_expr_increment = 146, // expr_increment S_expr = 146, // expr
S_expr_decrement = 147, // expr_decrement S_expr_or_empty = 147, // expr_or_empty
S_expr_ternary = 148, // expr_ternary S_expr_assign = 148, // expr_assign
S_expr_binary = 149, // expr_binary S_expr_increment = 149, // expr_increment
S_expr_primitive = 150, // expr_primitive S_expr_decrement = 150, // expr_decrement
S_expr_complement = 151, // expr_complement S_expr_ternary = 151, // expr_ternary
S_expr_not = 152, // expr_not S_expr_binary = 152, // expr_binary
S_expr_call = 153, // expr_call S_expr_primitive = 153, // expr_primitive
S_expr_method = 154, // expr_method S_expr_complement = 154, // expr_complement
S_expr_function = 155, // expr_function S_expr_not = 155, // expr_not
S_expr_pointer = 156, // expr_pointer S_expr_call = 156, // expr_call
S_expr_add_array = 157, // expr_add_array S_expr_method = 157, // expr_method
S_expr_parameters = 158, // expr_parameters S_expr_function = 158, // expr_function
S_expr_arguments = 159, // expr_arguments S_expr_pointer = 159, // expr_pointer
S_expr_arguments_no_empty = 160, // expr_arguments_no_empty S_expr_add_array = 160, // expr_add_array
S_expr_reference = 161, // expr_reference S_expr_parameters = 161, // expr_parameters
S_expr_array = 162, // expr_array S_expr_arguments = 162, // expr_arguments
S_expr_field = 163, // expr_field S_expr_arguments_no_empty = 163, // expr_arguments_no_empty
S_expr_size = 164, // expr_size S_expr_reference = 164, // expr_reference
S_expr_paren = 165, // expr_paren S_expr_array = 165, // expr_array
S_expr_object = 166, // expr_object S_expr_field = 166, // expr_field
S_expr_thisthread = 167, // expr_thisthread S_expr_size = 167, // expr_size
S_expr_empty_array = 168, // expr_empty_array S_expr_paren = 168, // expr_paren
S_expr_undefined = 169, // expr_undefined S_expr_object = 169, // expr_object
S_expr_game = 170, // expr_game S_expr_thisthread = 170, // expr_thisthread
S_expr_self = 171, // expr_self S_expr_empty_array = 171, // expr_empty_array
S_expr_anim = 172, // expr_anim S_expr_undefined = 172, // expr_undefined
S_expr_level = 173, // expr_level S_expr_game = 173, // expr_game
S_expr_animation = 174, // expr_animation S_expr_self = 174, // expr_self
S_expr_animtree = 175, // expr_animtree S_expr_anim = 175, // expr_anim
S_expr_identifier = 176, // expr_identifier S_expr_level = 176, // expr_level
S_expr_path = 177, // expr_path S_expr_animation = 177, // expr_animation
S_expr_istring = 178, // expr_istring S_expr_animtree = 178, // expr_animtree
S_expr_string = 179, // expr_string S_expr_identifier = 179, // expr_identifier
S_expr_color = 180, // expr_color S_expr_path = 180, // expr_path
S_expr_vector = 181, // expr_vector S_expr_istring = 181, // expr_istring
S_expr_float = 182, // expr_float S_expr_string = 182, // expr_string
S_expr_integer = 183, // expr_integer S_expr_color = 183, // expr_color
S_expr_false = 184, // expr_false S_expr_vector = 184, // expr_vector
S_expr_true = 185 // expr_true S_expr_float = 185, // expr_float
S_expr_integer = 186, // expr_integer
S_expr_false = 187, // expr_false
S_expr_true = 188 // expr_true
}; };
}; };
@ -1248,6 +1254,7 @@ namespace xsk { namespace gsc { namespace s1 {
value.move< ast::stmt_ifelse::ptr > (std::move (that.value)); value.move< ast::stmt_ifelse::ptr > (std::move (that.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.move< ast::stmt_list::ptr > (std::move (that.value)); value.move< ast::stmt_list::ptr > (std::move (that.value));
@ -2519,6 +2526,7 @@ switch (yykind)
value.template destroy< ast::stmt_ifelse::ptr > (); value.template destroy< ast::stmt_ifelse::ptr > ();
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.template destroy< ast::stmt_list::ptr > (); value.template destroy< ast::stmt_list::ptr > ();
@ -2782,6 +2790,36 @@ switch (yykind)
return symbol_type (token::S1UNDEF, l); return symbol_type (token::S1UNDEF, l);
} }
#endif #endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_DEVBEGIN (location_type l)
{
return symbol_type (token::DEVBEGIN, std::move (l));
}
#else
static
symbol_type
make_DEVBEGIN (const location_type& l)
{
return symbol_type (token::DEVBEGIN, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_DEVEND (location_type l)
{
return symbol_type (token::DEVEND, std::move (l));
}
#else
static
symbol_type
make_DEVEND (const location_type& l)
{
return symbol_type (token::DEVEND, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS #if 201103L <= YY_CPLUSPLUS
static static
symbol_type symbol_type
@ -4671,9 +4709,9 @@ switch (yykind)
/// Constants. /// Constants.
enum enum
{ {
yylast_ = 2075, ///< Last index in yytable_. yylast_ = 2254, ///< Last index in yytable_.
yynnts_ = 80, ///< Number of nonterminal symbols. yynnts_ = 81, ///< Number of nonterminal symbols.
yyfinal_ = 19 ///< Termination state number. yyfinal_ = 21 ///< Termination state number.
}; };
@ -4926,6 +4964,7 @@ switch (yykind)
value.copy< ast::stmt_ifelse::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_ifelse::ptr > (YY_MOVE (that.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.copy< ast::stmt_list::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_list::ptr > (YY_MOVE (that.value));
@ -5243,6 +5282,7 @@ switch (yykind)
value.move< ast::stmt_ifelse::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_ifelse::ptr > (YY_MOVE (s.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.move< ast::stmt_list::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_list::ptr > (YY_MOVE (s.value));
@ -5368,7 +5408,7 @@ switch (yykind)
#line 13 "parser.ypp" #line 13 "parser.ypp"
} } } // xsk::gsc::s1 } } } // xsk::gsc::s1
#line 5372 "parser.hpp" #line 5412 "parser.hpp"

View File

@ -85,6 +85,7 @@ void compiler::compile_program(const ast::program::ptr& program)
constants_.clear(); constants_.clear();
local_functions_.clear(); local_functions_.clear();
index_ = 1; index_ = 1;
developer_thread_ = false;
for (const auto& entry : program->declarations) for (const auto& entry : program->declarations)
{ {
@ -150,6 +151,12 @@ void compiler::emit_declaration(const ast::decl& decl)
{ {
switch (decl.kind()) switch (decl.kind())
{ {
case ast::kind::decl_dev_begin:
developer_thread_ = true;
break;
case ast::kind::decl_dev_end:
developer_thread_ = false;
break;
case ast::kind::decl_usingtree: case ast::kind::decl_usingtree:
emit_decl_usingtree(decl.as_usingtree); emit_decl_usingtree(decl.as_usingtree);
break; break;
@ -166,6 +173,9 @@ void compiler::emit_declaration(const ast::decl& decl)
void compiler::emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree) void compiler::emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree)
{ {
if(developer_thread_)
throw comp_error(animtree->loc(), "cannot put #using_animtree inside /# ... #/ comment");
animtrees_.push_back({ animtree->name->value, false }); animtrees_.push_back({ animtree->name->value, false });
} }

File diff suppressed because it is too large Load Diff

View File

@ -439,9 +439,9 @@ void yyfree ( void * , yyscan_t yyscanner );
#ifdef YY_HEADER_EXPORT_START_CONDITIONS #ifdef YY_HEADER_EXPORT_START_CONDITIONS
#define INITIAL 0 #define INITIAL 0
#define COMMENT_BLOCK_STATE 1 #define COMMENT_STATE 1
#define DEVBLOCK_ON_STATE 2 #define DEV_OFF_STATE 2
#define DEVBLOCK_OFF_STATE 3 #define DEV_ON_STATE 3
#endif #endif
@ -703,7 +703,7 @@ extern int yylex (yyscan_t yyscanner);
#undef yyTABLES_NAME #undef yyTABLES_NAME
#endif #endif
#line 166 "lexer.lpp" #line 170 "lexer.lpp"
#line 709 "lexer.hpp" #line 709 "lexer.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -580,6 +580,7 @@ namespace xsk { namespace gsc { namespace s2 {
// stmt_ifelse // stmt_ifelse
char dummy54[sizeof (ast::stmt_ifelse::ptr)]; char dummy54[sizeof (ast::stmt_ifelse::ptr)];
// stmt_dev
// stmt_block // stmt_block
// stmt_list // stmt_list
char dummy55[sizeof (ast::stmt_list::ptr)]; char dummy55[sizeof (ast::stmt_list::ptr)];
@ -679,109 +680,111 @@ namespace xsk { namespace gsc { namespace s2 {
S2EOF = 0, // "end of file" S2EOF = 0, // "end of file"
S2error = 1, // error S2error = 1, // error
S2UNDEF = 2, // "invalid token" S2UNDEF = 2, // "invalid token"
INLINE = 3, // "#inline" DEVBEGIN = 3, // "/#"
INCLUDE = 4, // "#include" DEVEND = 4, // "#/"
USINGTREE = 5, // "#using_animtree" INLINE = 5, // "#inline"
ANIMTREE = 6, // "#animtree" INCLUDE = 6, // "#include"
ENDON = 7, // "endon" USINGTREE = 7, // "#using_animtree"
NOTIFY = 8, // "notify" ANIMTREE = 8, // "#animtree"
WAIT = 9, // "wait" ENDON = 9, // "endon"
WAITTILL = 10, // "waittill" NOTIFY = 10, // "notify"
WAITTILLMATCH = 11, // "waittillmatch" WAIT = 11, // "wait"
WAITTILLFRAMEEND = 12, // "waittillframeend" WAITTILL = 12, // "waittill"
WAITFRAME = 13, // "waitframe" WAITTILLMATCH = 13, // "waittillmatch"
IF = 14, // "if" WAITTILLFRAMEEND = 14, // "waittillframeend"
ELSE = 15, // "else" WAITFRAME = 15, // "waitframe"
DO = 16, // "do" IF = 16, // "if"
WHILE = 17, // "while" ELSE = 17, // "else"
FOR = 18, // "for" DO = 18, // "do"
FOREACH = 19, // "foreach" WHILE = 19, // "while"
IN = 20, // "in" FOR = 20, // "for"
SWITCH = 21, // "switch" FOREACH = 21, // "foreach"
CASE = 22, // "case" IN = 22, // "in"
DEFAULT = 23, // "default" SWITCH = 23, // "switch"
BREAK = 24, // "break" CASE = 24, // "case"
CONTINUE = 25, // "continue" DEFAULT = 25, // "default"
RETURN = 26, // "return" BREAK = 26, // "break"
BREAKPOINT = 27, // "breakpoint" CONTINUE = 27, // "continue"
PROFBEGIN = 28, // "prof_begin" RETURN = 28, // "return"
PROFEND = 29, // "prof_end" BREAKPOINT = 29, // "breakpoint"
THREAD = 30, // "thread" PROFBEGIN = 30, // "prof_begin"
CHILDTHREAD = 31, // "childthread" PROFEND = 31, // "prof_end"
THISTHREAD = 32, // "thisthread" THREAD = 32, // "thread"
CALL = 33, // "call" CHILDTHREAD = 33, // "childthread"
TRUE = 34, // "true" THISTHREAD = 34, // "thisthread"
FALSE = 35, // "false" CALL = 35, // "call"
UNDEFINED = 36, // "undefined" TRUE = 36, // "true"
SIZE = 37, // ".size" FALSE = 37, // "false"
GAME = 38, // "game" UNDEFINED = 38, // "undefined"
SELF = 39, // "self" SIZE = 39, // ".size"
ANIM = 40, // "anim" GAME = 40, // "game"
LEVEL = 41, // "level" SELF = 41, // "self"
LPAREN = 42, // "(" ANIM = 42, // "anim"
RPAREN = 43, // ")" LEVEL = 43, // "level"
LBRACE = 44, // "{" LPAREN = 44, // "("
RBRACE = 45, // "}" RPAREN = 45, // ")"
LBRACKET = 46, // "[" LBRACE = 46, // "{"
RBRACKET = 47, // "]" RBRACE = 47, // "}"
COMMA = 48, // "," LBRACKET = 48, // "["
DOT = 49, // "." RBRACKET = 49, // "]"
DOUBLECOLON = 50, // "::" COMMA = 50, // ","
COLON = 51, // ":" DOT = 51, // "."
SEMICOLON = 52, // ";" DOUBLECOLON = 52, // "::"
QMARK = 53, // "?" COLON = 53, // ":"
INCREMENT = 54, // "++" SEMICOLON = 54, // ";"
DECREMENT = 55, // "--" QMARK = 55, // "?"
LSHIFT = 56, // "<<" INCREMENT = 56, // "++"
RSHIFT = 57, // ">>" DECREMENT = 57, // "--"
OR = 58, // "||" LSHIFT = 58, // "<<"
AND = 59, // "&&" RSHIFT = 59, // ">>"
EQUALITY = 60, // "==" OR = 60, // "||"
INEQUALITY = 61, // "!=" AND = 61, // "&&"
LESS_EQUAL = 62, // "<=" EQUALITY = 62, // "=="
GREATER_EQUAL = 63, // ">=" INEQUALITY = 63, // "!="
LESS = 64, // "<" LESS_EQUAL = 64, // "<="
GREATER = 65, // ">" GREATER_EQUAL = 65, // ">="
NOT = 66, // "!" LESS = 66, // "<"
COMPLEMENT = 67, // "~" GREATER = 67, // ">"
ASSIGN = 68, // "=" NOT = 68, // "!"
ASSIGN_ADD = 69, // "+=" COMPLEMENT = 69, // "~"
ASSIGN_SUB = 70, // "-=" ASSIGN = 70, // "="
ASSIGN_MUL = 71, // "*=" ASSIGN_ADD = 71, // "+="
ASSIGN_DIV = 72, // "/=" ASSIGN_SUB = 72, // "-="
ASSIGN_MOD = 73, // "%=" ASSIGN_MUL = 73, // "*="
ASSIGN_BW_OR = 74, // "|=" ASSIGN_DIV = 74, // "/="
ASSIGN_BW_AND = 75, // "&=" ASSIGN_MOD = 75, // "%="
ASSIGN_BW_EXOR = 76, // "^=" ASSIGN_BW_OR = 76, // "|="
ASSIGN_RSHIFT = 77, // ">>=" ASSIGN_BW_AND = 77, // "&="
ASSIGN_LSHIFT = 78, // "<<=" ASSIGN_BW_EXOR = 78, // "^="
BITWISE_OR = 79, // "|" ASSIGN_RSHIFT = 79, // ">>="
BITWISE_AND = 80, // "&" ASSIGN_LSHIFT = 80, // "<<="
BITWISE_EXOR = 81, // "^" BITWISE_OR = 81, // "|"
ADD = 82, // "+" BITWISE_AND = 82, // "&"
SUB = 83, // "-" BITWISE_EXOR = 83, // "^"
MUL = 84, // "*" ADD = 84, // "+"
DIV = 85, // "/" SUB = 85, // "-"
MOD = 86, // "%" MUL = 86, // "*"
PATH = 87, // "path" DIV = 87, // "/"
IDENTIFIER = 88, // "identifier" MOD = 88, // "%"
STRING = 89, // "string literal" PATH = 89, // "path"
ISTRING = 90, // "localized string" IDENTIFIER = 90, // "identifier"
COLOR = 91, // "color" STRING = 91, // "string literal"
FLOAT = 92, // "float" ISTRING = 92, // "localized string"
INT_DEC = 93, // "int" COLOR = 93, // "color"
INT_OCT = 94, // "octal int" FLOAT = 94, // "float"
INT_BIN = 95, // "binary int" INT_DEC = 95, // "int"
INT_HEX = 96, // "hexadecimal int" INT_OCT = 96, // "octal int"
ADD_ARRAY = 97, // ADD_ARRAY INT_BIN = 97, // "binary int"
THEN = 98, // THEN INT_HEX = 98, // "hexadecimal int"
TERN = 99, // TERN ADD_ARRAY = 99, // ADD_ARRAY
NEG = 100, // NEG THEN = 100, // THEN
ANIMREF = 101, // ANIMREF TERN = 101, // TERN
PREINC = 102, // PREINC NEG = 102, // NEG
PREDEC = 103, // PREDEC ANIMREF = 103, // ANIMREF
POSTINC = 104, // POSTINC PREINC = 104, // PREINC
POSTDEC = 105 // POSTDEC PREDEC = 105, // PREDEC
POSTINC = 106, // POSTINC
POSTDEC = 107 // POSTDEC
}; };
/// Backward compatibility alias (Bison 3.6). /// Backward compatibility alias (Bison 3.6).
typedef token_kind_type yytokentype; typedef token_kind_type yytokentype;
@ -798,194 +801,197 @@ namespace xsk { namespace gsc { namespace s2 {
{ {
enum symbol_kind_type enum symbol_kind_type
{ {
YYNTOKENS = 106, ///< Number of tokens. YYNTOKENS = 108, ///< 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
S_YYUNDEF = 2, // "invalid token" S_YYUNDEF = 2, // "invalid token"
S_INLINE = 3, // "#inline" S_DEVBEGIN = 3, // "/#"
S_INCLUDE = 4, // "#include" S_DEVEND = 4, // "#/"
S_USINGTREE = 5, // "#using_animtree" S_INLINE = 5, // "#inline"
S_ANIMTREE = 6, // "#animtree" S_INCLUDE = 6, // "#include"
S_ENDON = 7, // "endon" S_USINGTREE = 7, // "#using_animtree"
S_NOTIFY = 8, // "notify" S_ANIMTREE = 8, // "#animtree"
S_WAIT = 9, // "wait" S_ENDON = 9, // "endon"
S_WAITTILL = 10, // "waittill" S_NOTIFY = 10, // "notify"
S_WAITTILLMATCH = 11, // "waittillmatch" S_WAIT = 11, // "wait"
S_WAITTILLFRAMEEND = 12, // "waittillframeend" S_WAITTILL = 12, // "waittill"
S_WAITFRAME = 13, // "waitframe" S_WAITTILLMATCH = 13, // "waittillmatch"
S_IF = 14, // "if" S_WAITTILLFRAMEEND = 14, // "waittillframeend"
S_ELSE = 15, // "else" S_WAITFRAME = 15, // "waitframe"
S_DO = 16, // "do" S_IF = 16, // "if"
S_WHILE = 17, // "while" S_ELSE = 17, // "else"
S_FOR = 18, // "for" S_DO = 18, // "do"
S_FOREACH = 19, // "foreach" S_WHILE = 19, // "while"
S_IN = 20, // "in" S_FOR = 20, // "for"
S_SWITCH = 21, // "switch" S_FOREACH = 21, // "foreach"
S_CASE = 22, // "case" S_IN = 22, // "in"
S_DEFAULT = 23, // "default" S_SWITCH = 23, // "switch"
S_BREAK = 24, // "break" S_CASE = 24, // "case"
S_CONTINUE = 25, // "continue" S_DEFAULT = 25, // "default"
S_RETURN = 26, // "return" S_BREAK = 26, // "break"
S_BREAKPOINT = 27, // "breakpoint" S_CONTINUE = 27, // "continue"
S_PROFBEGIN = 28, // "prof_begin" S_RETURN = 28, // "return"
S_PROFEND = 29, // "prof_end" S_BREAKPOINT = 29, // "breakpoint"
S_THREAD = 30, // "thread" S_PROFBEGIN = 30, // "prof_begin"
S_CHILDTHREAD = 31, // "childthread" S_PROFEND = 31, // "prof_end"
S_THISTHREAD = 32, // "thisthread" S_THREAD = 32, // "thread"
S_CALL = 33, // "call" S_CHILDTHREAD = 33, // "childthread"
S_TRUE = 34, // "true" S_THISTHREAD = 34, // "thisthread"
S_FALSE = 35, // "false" S_CALL = 35, // "call"
S_UNDEFINED = 36, // "undefined" S_TRUE = 36, // "true"
S_SIZE = 37, // ".size" S_FALSE = 37, // "false"
S_GAME = 38, // "game" S_UNDEFINED = 38, // "undefined"
S_SELF = 39, // "self" S_SIZE = 39, // ".size"
S_ANIM = 40, // "anim" S_GAME = 40, // "game"
S_LEVEL = 41, // "level" S_SELF = 41, // "self"
S_LPAREN = 42, // "(" S_ANIM = 42, // "anim"
S_RPAREN = 43, // ")" S_LEVEL = 43, // "level"
S_LBRACE = 44, // "{" S_LPAREN = 44, // "("
S_RBRACE = 45, // "}" S_RPAREN = 45, // ")"
S_LBRACKET = 46, // "[" S_LBRACE = 46, // "{"
S_RBRACKET = 47, // "]" S_RBRACE = 47, // "}"
S_COMMA = 48, // "," S_LBRACKET = 48, // "["
S_DOT = 49, // "." S_RBRACKET = 49, // "]"
S_DOUBLECOLON = 50, // "::" S_COMMA = 50, // ","
S_COLON = 51, // ":" S_DOT = 51, // "."
S_SEMICOLON = 52, // ";" S_DOUBLECOLON = 52, // "::"
S_QMARK = 53, // "?" S_COLON = 53, // ":"
S_INCREMENT = 54, // "++" S_SEMICOLON = 54, // ";"
S_DECREMENT = 55, // "--" S_QMARK = 55, // "?"
S_LSHIFT = 56, // "<<" S_INCREMENT = 56, // "++"
S_RSHIFT = 57, // ">>" S_DECREMENT = 57, // "--"
S_OR = 58, // "||" S_LSHIFT = 58, // "<<"
S_AND = 59, // "&&" S_RSHIFT = 59, // ">>"
S_EQUALITY = 60, // "==" S_OR = 60, // "||"
S_INEQUALITY = 61, // "!=" S_AND = 61, // "&&"
S_LESS_EQUAL = 62, // "<=" S_EQUALITY = 62, // "=="
S_GREATER_EQUAL = 63, // ">=" S_INEQUALITY = 63, // "!="
S_LESS = 64, // "<" S_LESS_EQUAL = 64, // "<="
S_GREATER = 65, // ">" S_GREATER_EQUAL = 65, // ">="
S_NOT = 66, // "!" S_LESS = 66, // "<"
S_COMPLEMENT = 67, // "~" S_GREATER = 67, // ">"
S_ASSIGN = 68, // "=" S_NOT = 68, // "!"
S_ASSIGN_ADD = 69, // "+=" S_COMPLEMENT = 69, // "~"
S_ASSIGN_SUB = 70, // "-=" S_ASSIGN = 70, // "="
S_ASSIGN_MUL = 71, // "*=" S_ASSIGN_ADD = 71, // "+="
S_ASSIGN_DIV = 72, // "/=" S_ASSIGN_SUB = 72, // "-="
S_ASSIGN_MOD = 73, // "%=" S_ASSIGN_MUL = 73, // "*="
S_ASSIGN_BW_OR = 74, // "|=" S_ASSIGN_DIV = 74, // "/="
S_ASSIGN_BW_AND = 75, // "&=" S_ASSIGN_MOD = 75, // "%="
S_ASSIGN_BW_EXOR = 76, // "^=" S_ASSIGN_BW_OR = 76, // "|="
S_ASSIGN_RSHIFT = 77, // ">>=" S_ASSIGN_BW_AND = 77, // "&="
S_ASSIGN_LSHIFT = 78, // "<<=" S_ASSIGN_BW_EXOR = 78, // "^="
S_BITWISE_OR = 79, // "|" S_ASSIGN_RSHIFT = 79, // ">>="
S_BITWISE_AND = 80, // "&" S_ASSIGN_LSHIFT = 80, // "<<="
S_BITWISE_EXOR = 81, // "^" S_BITWISE_OR = 81, // "|"
S_ADD = 82, // "+" S_BITWISE_AND = 82, // "&"
S_SUB = 83, // "-" S_BITWISE_EXOR = 83, // "^"
S_MUL = 84, // "*" S_ADD = 84, // "+"
S_DIV = 85, // "/" S_SUB = 85, // "-"
S_MOD = 86, // "%" S_MUL = 86, // "*"
S_PATH = 87, // "path" S_DIV = 87, // "/"
S_IDENTIFIER = 88, // "identifier" S_MOD = 88, // "%"
S_STRING = 89, // "string literal" S_PATH = 89, // "path"
S_ISTRING = 90, // "localized string" S_IDENTIFIER = 90, // "identifier"
S_COLOR = 91, // "color" S_STRING = 91, // "string literal"
S_FLOAT = 92, // "float" S_ISTRING = 92, // "localized string"
S_INT_DEC = 93, // "int" S_COLOR = 93, // "color"
S_INT_OCT = 94, // "octal int" S_FLOAT = 94, // "float"
S_INT_BIN = 95, // "binary int" S_INT_DEC = 95, // "int"
S_INT_HEX = 96, // "hexadecimal int" S_INT_OCT = 96, // "octal int"
S_ADD_ARRAY = 97, // ADD_ARRAY S_INT_BIN = 97, // "binary int"
S_THEN = 98, // THEN S_INT_HEX = 98, // "hexadecimal int"
S_TERN = 99, // TERN S_ADD_ARRAY = 99, // ADD_ARRAY
S_NEG = 100, // NEG S_THEN = 100, // THEN
S_ANIMREF = 101, // ANIMREF S_TERN = 101, // TERN
S_PREINC = 102, // PREINC S_NEG = 102, // NEG
S_PREDEC = 103, // PREDEC S_ANIMREF = 103, // ANIMREF
S_POSTINC = 104, // POSTINC S_PREINC = 104, // PREINC
S_POSTDEC = 105, // POSTDEC S_PREDEC = 105, // PREDEC
S_YYACCEPT = 106, // $accept S_POSTINC = 106, // POSTINC
S_root = 107, // root S_POSTDEC = 107, // POSTDEC
S_program = 108, // program S_YYACCEPT = 108, // $accept
S_inline = 109, // inline S_root = 109, // root
S_include = 110, // include S_program = 110, // program
S_declaration = 111, // declaration S_inline = 111, // inline
S_decl_usingtree = 112, // decl_usingtree S_include = 112, // include
S_decl_constant = 113, // decl_constant S_declaration = 113, // declaration
S_decl_thread = 114, // decl_thread S_decl_usingtree = 114, // decl_usingtree
S_stmt = 115, // stmt S_decl_constant = 115, // decl_constant
S_stmt_block = 116, // stmt_block S_decl_thread = 116, // decl_thread
S_stmt_list = 117, // stmt_list S_stmt = 117, // stmt
S_stmt_expr = 118, // stmt_expr S_stmt_dev = 118, // stmt_dev
S_stmt_call = 119, // stmt_call S_stmt_block = 119, // stmt_block
S_stmt_assign = 120, // stmt_assign S_stmt_list = 120, // stmt_list
S_stmt_endon = 121, // stmt_endon S_stmt_expr = 121, // stmt_expr
S_stmt_notify = 122, // stmt_notify S_stmt_call = 122, // stmt_call
S_stmt_wait = 123, // stmt_wait S_stmt_assign = 123, // stmt_assign
S_stmt_waittill = 124, // stmt_waittill S_stmt_endon = 124, // stmt_endon
S_stmt_waittillmatch = 125, // stmt_waittillmatch S_stmt_notify = 125, // stmt_notify
S_stmt_waittillframeend = 126, // stmt_waittillframeend S_stmt_wait = 126, // stmt_wait
S_stmt_waitframe = 127, // stmt_waitframe S_stmt_waittill = 127, // stmt_waittill
S_stmt_if = 128, // stmt_if S_stmt_waittillmatch = 128, // stmt_waittillmatch
S_stmt_ifelse = 129, // stmt_ifelse S_stmt_waittillframeend = 129, // stmt_waittillframeend
S_stmt_while = 130, // stmt_while S_stmt_waitframe = 130, // stmt_waitframe
S_stmt_dowhile = 131, // stmt_dowhile S_stmt_if = 131, // stmt_if
S_stmt_for = 132, // stmt_for S_stmt_ifelse = 132, // stmt_ifelse
S_stmt_foreach = 133, // stmt_foreach S_stmt_while = 133, // stmt_while
S_stmt_switch = 134, // stmt_switch S_stmt_dowhile = 134, // stmt_dowhile
S_stmt_case = 135, // stmt_case S_stmt_for = 135, // stmt_for
S_stmt_default = 136, // stmt_default S_stmt_foreach = 136, // stmt_foreach
S_stmt_break = 137, // stmt_break S_stmt_switch = 137, // stmt_switch
S_stmt_continue = 138, // stmt_continue S_stmt_case = 138, // stmt_case
S_stmt_return = 139, // stmt_return S_stmt_default = 139, // stmt_default
S_stmt_breakpoint = 140, // stmt_breakpoint S_stmt_break = 140, // stmt_break
S_stmt_prof_begin = 141, // stmt_prof_begin S_stmt_continue = 141, // stmt_continue
S_stmt_prof_end = 142, // stmt_prof_end S_stmt_return = 142, // stmt_return
S_expr = 143, // expr S_stmt_breakpoint = 143, // stmt_breakpoint
S_expr_or_empty = 144, // expr_or_empty S_stmt_prof_begin = 144, // stmt_prof_begin
S_expr_assign = 145, // expr_assign S_stmt_prof_end = 145, // stmt_prof_end
S_expr_increment = 146, // expr_increment S_expr = 146, // expr
S_expr_decrement = 147, // expr_decrement S_expr_or_empty = 147, // expr_or_empty
S_expr_ternary = 148, // expr_ternary S_expr_assign = 148, // expr_assign
S_expr_binary = 149, // expr_binary S_expr_increment = 149, // expr_increment
S_expr_primitive = 150, // expr_primitive S_expr_decrement = 150, // expr_decrement
S_expr_complement = 151, // expr_complement S_expr_ternary = 151, // expr_ternary
S_expr_not = 152, // expr_not S_expr_binary = 152, // expr_binary
S_expr_call = 153, // expr_call S_expr_primitive = 153, // expr_primitive
S_expr_method = 154, // expr_method S_expr_complement = 154, // expr_complement
S_expr_function = 155, // expr_function S_expr_not = 155, // expr_not
S_expr_pointer = 156, // expr_pointer S_expr_call = 156, // expr_call
S_expr_add_array = 157, // expr_add_array S_expr_method = 157, // expr_method
S_expr_parameters = 158, // expr_parameters S_expr_function = 158, // expr_function
S_expr_arguments = 159, // expr_arguments S_expr_pointer = 159, // expr_pointer
S_expr_arguments_no_empty = 160, // expr_arguments_no_empty S_expr_add_array = 160, // expr_add_array
S_expr_reference = 161, // expr_reference S_expr_parameters = 161, // expr_parameters
S_expr_array = 162, // expr_array S_expr_arguments = 162, // expr_arguments
S_expr_field = 163, // expr_field S_expr_arguments_no_empty = 163, // expr_arguments_no_empty
S_expr_size = 164, // expr_size S_expr_reference = 164, // expr_reference
S_expr_paren = 165, // expr_paren S_expr_array = 165, // expr_array
S_expr_object = 166, // expr_object S_expr_field = 166, // expr_field
S_expr_thisthread = 167, // expr_thisthread S_expr_size = 167, // expr_size
S_expr_empty_array = 168, // expr_empty_array S_expr_paren = 168, // expr_paren
S_expr_undefined = 169, // expr_undefined S_expr_object = 169, // expr_object
S_expr_game = 170, // expr_game S_expr_thisthread = 170, // expr_thisthread
S_expr_self = 171, // expr_self S_expr_empty_array = 171, // expr_empty_array
S_expr_anim = 172, // expr_anim S_expr_undefined = 172, // expr_undefined
S_expr_level = 173, // expr_level S_expr_game = 173, // expr_game
S_expr_animation = 174, // expr_animation S_expr_self = 174, // expr_self
S_expr_animtree = 175, // expr_animtree S_expr_anim = 175, // expr_anim
S_expr_identifier = 176, // expr_identifier S_expr_level = 176, // expr_level
S_expr_path = 177, // expr_path S_expr_animation = 177, // expr_animation
S_expr_istring = 178, // expr_istring S_expr_animtree = 178, // expr_animtree
S_expr_string = 179, // expr_string S_expr_identifier = 179, // expr_identifier
S_expr_color = 180, // expr_color S_expr_path = 180, // expr_path
S_expr_vector = 181, // expr_vector S_expr_istring = 181, // expr_istring
S_expr_float = 182, // expr_float S_expr_string = 182, // expr_string
S_expr_integer = 183, // expr_integer S_expr_color = 183, // expr_color
S_expr_false = 184, // expr_false S_expr_vector = 184, // expr_vector
S_expr_true = 185 // expr_true S_expr_float = 185, // expr_float
S_expr_integer = 186, // expr_integer
S_expr_false = 187, // expr_false
S_expr_true = 188 // expr_true
}; };
}; };
@ -1248,6 +1254,7 @@ namespace xsk { namespace gsc { namespace s2 {
value.move< ast::stmt_ifelse::ptr > (std::move (that.value)); value.move< ast::stmt_ifelse::ptr > (std::move (that.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.move< ast::stmt_list::ptr > (std::move (that.value)); value.move< ast::stmt_list::ptr > (std::move (that.value));
@ -2519,6 +2526,7 @@ switch (yykind)
value.template destroy< ast::stmt_ifelse::ptr > (); value.template destroy< ast::stmt_ifelse::ptr > ();
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.template destroy< ast::stmt_list::ptr > (); value.template destroy< ast::stmt_list::ptr > ();
@ -2782,6 +2790,36 @@ switch (yykind)
return symbol_type (token::S2UNDEF, l); return symbol_type (token::S2UNDEF, l);
} }
#endif #endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_DEVBEGIN (location_type l)
{
return symbol_type (token::DEVBEGIN, std::move (l));
}
#else
static
symbol_type
make_DEVBEGIN (const location_type& l)
{
return symbol_type (token::DEVBEGIN, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_DEVEND (location_type l)
{
return symbol_type (token::DEVEND, std::move (l));
}
#else
static
symbol_type
make_DEVEND (const location_type& l)
{
return symbol_type (token::DEVEND, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS #if 201103L <= YY_CPLUSPLUS
static static
symbol_type symbol_type
@ -4671,9 +4709,9 @@ switch (yykind)
/// Constants. /// Constants.
enum enum
{ {
yylast_ = 2075, ///< Last index in yytable_. yylast_ = 2254, ///< Last index in yytable_.
yynnts_ = 80, ///< Number of nonterminal symbols. yynnts_ = 81, ///< Number of nonterminal symbols.
yyfinal_ = 19 ///< Termination state number. yyfinal_ = 21 ///< Termination state number.
}; };
@ -4926,6 +4964,7 @@ switch (yykind)
value.copy< ast::stmt_ifelse::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_ifelse::ptr > (YY_MOVE (that.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.copy< ast::stmt_list::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_list::ptr > (YY_MOVE (that.value));
@ -5243,6 +5282,7 @@ switch (yykind)
value.move< ast::stmt_ifelse::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_ifelse::ptr > (YY_MOVE (s.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.move< ast::stmt_list::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_list::ptr > (YY_MOVE (s.value));
@ -5368,7 +5408,7 @@ switch (yykind)
#line 13 "parser.ypp" #line 13 "parser.ypp"
} } } // xsk::gsc::s2 } } } // xsk::gsc::s2
#line 5372 "parser.hpp" #line 5412 "parser.hpp"

View File

@ -85,6 +85,7 @@ void compiler::compile_program(const ast::program::ptr& program)
constants_.clear(); constants_.clear();
local_functions_.clear(); local_functions_.clear();
index_ = 1; index_ = 1;
developer_thread_ = false;
for (const auto& entry : program->declarations) for (const auto& entry : program->declarations)
{ {
@ -150,6 +151,12 @@ void compiler::emit_declaration(const ast::decl& decl)
{ {
switch (decl.kind()) switch (decl.kind())
{ {
case ast::kind::decl_dev_begin:
developer_thread_ = true;
break;
case ast::kind::decl_dev_end:
developer_thread_ = false;
break;
case ast::kind::decl_usingtree: case ast::kind::decl_usingtree:
emit_decl_usingtree(decl.as_usingtree); emit_decl_usingtree(decl.as_usingtree);
break; break;
@ -166,6 +173,9 @@ void compiler::emit_declaration(const ast::decl& decl)
void compiler::emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree) void compiler::emit_decl_usingtree(const ast::decl_usingtree::ptr& animtree)
{ {
if(developer_thread_)
throw comp_error(animtree->loc(), "cannot put #using_animtree inside /# ... #/ comment");
animtrees_.push_back({ animtree->name->value, false }); animtrees_.push_back({ animtree->name->value, false });
} }

File diff suppressed because it is too large Load Diff

View File

@ -439,9 +439,9 @@ void yyfree ( void * , yyscan_t yyscanner );
#ifdef YY_HEADER_EXPORT_START_CONDITIONS #ifdef YY_HEADER_EXPORT_START_CONDITIONS
#define INITIAL 0 #define INITIAL 0
#define COMMENT_BLOCK_STATE 1 #define COMMENT_STATE 1
#define DEVBLOCK_ON_STATE 2 #define DEV_OFF_STATE 2
#define DEVBLOCK_OFF_STATE 3 #define DEV_ON_STATE 3
#endif #endif
@ -703,7 +703,7 @@ extern int yylex (yyscan_t yyscanner);
#undef yyTABLES_NAME #undef yyTABLES_NAME
#endif #endif
#line 168 "lexer.lpp" #line 172 "lexer.lpp"
#line 709 "lexer.hpp" #line 709 "lexer.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -586,6 +586,7 @@ namespace xsk { namespace gsc { namespace s4 {
// stmt_ifelse // stmt_ifelse
char dummy56[sizeof (ast::stmt_ifelse::ptr)]; char dummy56[sizeof (ast::stmt_ifelse::ptr)];
// stmt_dev
// stmt_block // stmt_block
// stmt_list // stmt_list
char dummy57[sizeof (ast::stmt_list::ptr)]; char dummy57[sizeof (ast::stmt_list::ptr)];
@ -685,111 +686,113 @@ namespace xsk { namespace gsc { namespace s4 {
S4EOF = 0, // "end of file" S4EOF = 0, // "end of file"
S4error = 1, // error S4error = 1, // error
S4UNDEF = 2, // "invalid token" S4UNDEF = 2, // "invalid token"
INLINE = 3, // "#inline" DEVBEGIN = 3, // "/#"
INCLUDE = 4, // "#include" DEVEND = 4, // "#/"
USINGTREE = 5, // "#using_animtree" INLINE = 5, // "#inline"
ANIMTREE = 6, // "#animtree" INCLUDE = 6, // "#include"
ENDON = 7, // "endon" USINGTREE = 7, // "#using_animtree"
NOTIFY = 8, // "notify" ANIMTREE = 8, // "#animtree"
WAIT = 9, // "wait" ENDON = 9, // "endon"
WAITTILL = 10, // "waittill" NOTIFY = 10, // "notify"
WAITTILLMATCH = 11, // "waittillmatch" WAIT = 11, // "wait"
WAITTILLFRAMEEND = 12, // "waittillframeend" WAITTILL = 12, // "waittill"
WAITFRAME = 13, // "waitframe" WAITTILLMATCH = 13, // "waittillmatch"
IF = 14, // "if" WAITTILLFRAMEEND = 14, // "waittillframeend"
ELSE = 15, // "else" WAITFRAME = 15, // "waitframe"
DO = 16, // "do" IF = 16, // "if"
WHILE = 17, // "while" ELSE = 17, // "else"
FOR = 18, // "for" DO = 18, // "do"
FOREACH = 19, // "foreach" WHILE = 19, // "while"
IN = 20, // "in" FOR = 20, // "for"
SWITCH = 21, // "switch" FOREACH = 21, // "foreach"
CASE = 22, // "case" IN = 22, // "in"
DEFAULT = 23, // "default" SWITCH = 23, // "switch"
BREAK = 24, // "break" CASE = 24, // "case"
CONTINUE = 25, // "continue" DEFAULT = 25, // "default"
RETURN = 26, // "return" BREAK = 26, // "break"
BREAKPOINT = 27, // "breakpoint" CONTINUE = 27, // "continue"
PROFBEGIN = 28, // "prof_begin" RETURN = 28, // "return"
PROFEND = 29, // "prof_end" BREAKPOINT = 29, // "breakpoint"
THREAD = 30, // "thread" PROFBEGIN = 30, // "prof_begin"
CHILDTHREAD = 31, // "childthread" PROFEND = 31, // "prof_end"
THISTHREAD = 32, // "thisthread" THREAD = 32, // "thread"
CALL = 33, // "call" CHILDTHREAD = 33, // "childthread"
TRUE = 34, // "true" THISTHREAD = 34, // "thisthread"
FALSE = 35, // "false" CALL = 35, // "call"
UNDEFINED = 36, // "undefined" TRUE = 36, // "true"
SIZE = 37, // ".size" FALSE = 37, // "false"
GAME = 38, // "game" UNDEFINED = 38, // "undefined"
SELF = 39, // "self" SIZE = 39, // ".size"
ANIM = 40, // "anim" GAME = 40, // "game"
LEVEL = 41, // "level" SELF = 41, // "self"
ISDEFINED = 42, // "isdefined" ANIM = 42, // "anim"
ISTRUE = 43, // "istrue" LEVEL = 43, // "level"
LPAREN = 44, // "(" ISDEFINED = 44, // "isdefined"
RPAREN = 45, // ")" ISTRUE = 45, // "istrue"
LBRACE = 46, // "{" LPAREN = 46, // "("
RBRACE = 47, // "}" RPAREN = 47, // ")"
LBRACKET = 48, // "[" LBRACE = 48, // "{"
RBRACKET = 49, // "]" RBRACE = 49, // "}"
COMMA = 50, // "," LBRACKET = 50, // "["
DOT = 51, // "." RBRACKET = 51, // "]"
DOUBLECOLON = 52, // "::" COMMA = 52, // ","
COLON = 53, // ":" DOT = 53, // "."
SEMICOLON = 54, // ";" DOUBLECOLON = 54, // "::"
QMARK = 55, // "?" COLON = 55, // ":"
INCREMENT = 56, // "++" SEMICOLON = 56, // ";"
DECREMENT = 57, // "--" QMARK = 57, // "?"
LSHIFT = 58, // "<<" INCREMENT = 58, // "++"
RSHIFT = 59, // ">>" DECREMENT = 59, // "--"
OR = 60, // "||" LSHIFT = 60, // "<<"
AND = 61, // "&&" RSHIFT = 61, // ">>"
EQUALITY = 62, // "==" OR = 62, // "||"
INEQUALITY = 63, // "!=" AND = 63, // "&&"
LESS_EQUAL = 64, // "<=" EQUALITY = 64, // "=="
GREATER_EQUAL = 65, // ">=" INEQUALITY = 65, // "!="
LESS = 66, // "<" LESS_EQUAL = 66, // "<="
GREATER = 67, // ">" GREATER_EQUAL = 67, // ">="
NOT = 68, // "!" LESS = 68, // "<"
COMPLEMENT = 69, // "~" GREATER = 69, // ">"
ASSIGN = 70, // "=" NOT = 70, // "!"
ASSIGN_ADD = 71, // "+=" COMPLEMENT = 71, // "~"
ASSIGN_SUB = 72, // "-=" ASSIGN = 72, // "="
ASSIGN_MUL = 73, // "*=" ASSIGN_ADD = 73, // "+="
ASSIGN_DIV = 74, // "/=" ASSIGN_SUB = 74, // "-="
ASSIGN_MOD = 75, // "%=" ASSIGN_MUL = 75, // "*="
ASSIGN_BW_OR = 76, // "|=" ASSIGN_DIV = 76, // "/="
ASSIGN_BW_AND = 77, // "&=" ASSIGN_MOD = 77, // "%="
ASSIGN_BW_EXOR = 78, // "^=" ASSIGN_BW_OR = 78, // "|="
ASSIGN_RSHIFT = 79, // ">>=" ASSIGN_BW_AND = 79, // "&="
ASSIGN_LSHIFT = 80, // "<<=" ASSIGN_BW_EXOR = 80, // "^="
BITWISE_OR = 81, // "|" ASSIGN_RSHIFT = 81, // ">>="
BITWISE_AND = 82, // "&" ASSIGN_LSHIFT = 82, // "<<="
BITWISE_EXOR = 83, // "^" BITWISE_OR = 83, // "|"
ADD = 84, // "+" BITWISE_AND = 84, // "&"
SUB = 85, // "-" BITWISE_EXOR = 85, // "^"
MUL = 86, // "*" ADD = 86, // "+"
DIV = 87, // "/" SUB = 87, // "-"
MOD = 88, // "%" MUL = 88, // "*"
PATH = 89, // "path" DIV = 89, // "/"
IDENTIFIER = 90, // "identifier" MOD = 90, // "%"
STRING = 91, // "string literal" PATH = 91, // "path"
ISTRING = 92, // "localized string" IDENTIFIER = 92, // "identifier"
COLOR = 93, // "color" STRING = 93, // "string literal"
FLOAT = 94, // "float" ISTRING = 94, // "localized string"
INT_DEC = 95, // "int" COLOR = 95, // "color"
INT_OCT = 96, // "octal int" FLOAT = 96, // "float"
INT_BIN = 97, // "binary int" INT_DEC = 97, // "int"
INT_HEX = 98, // "hexadecimal int" INT_OCT = 98, // "octal int"
ADD_ARRAY = 99, // ADD_ARRAY INT_BIN = 99, // "binary int"
THEN = 100, // THEN INT_HEX = 100, // "hexadecimal int"
TERN = 101, // TERN ADD_ARRAY = 101, // ADD_ARRAY
NEG = 102, // NEG THEN = 102, // THEN
ANIMREF = 103, // ANIMREF TERN = 103, // TERN
PREINC = 104, // PREINC NEG = 104, // NEG
PREDEC = 105, // PREDEC ANIMREF = 105, // ANIMREF
POSTINC = 106, // POSTINC PREINC = 106, // PREINC
POSTDEC = 107 // POSTDEC PREDEC = 107, // PREDEC
POSTINC = 108, // POSTINC
POSTDEC = 109 // POSTDEC
}; };
/// Backward compatibility alias (Bison 3.6). /// Backward compatibility alias (Bison 3.6).
typedef token_kind_type yytokentype; typedef token_kind_type yytokentype;
@ -806,198 +809,201 @@ namespace xsk { namespace gsc { namespace s4 {
{ {
enum symbol_kind_type enum symbol_kind_type
{ {
YYNTOKENS = 108, ///< Number of tokens. YYNTOKENS = 110, ///< 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
S_YYUNDEF = 2, // "invalid token" S_YYUNDEF = 2, // "invalid token"
S_INLINE = 3, // "#inline" S_DEVBEGIN = 3, // "/#"
S_INCLUDE = 4, // "#include" S_DEVEND = 4, // "#/"
S_USINGTREE = 5, // "#using_animtree" S_INLINE = 5, // "#inline"
S_ANIMTREE = 6, // "#animtree" S_INCLUDE = 6, // "#include"
S_ENDON = 7, // "endon" S_USINGTREE = 7, // "#using_animtree"
S_NOTIFY = 8, // "notify" S_ANIMTREE = 8, // "#animtree"
S_WAIT = 9, // "wait" S_ENDON = 9, // "endon"
S_WAITTILL = 10, // "waittill" S_NOTIFY = 10, // "notify"
S_WAITTILLMATCH = 11, // "waittillmatch" S_WAIT = 11, // "wait"
S_WAITTILLFRAMEEND = 12, // "waittillframeend" S_WAITTILL = 12, // "waittill"
S_WAITFRAME = 13, // "waitframe" S_WAITTILLMATCH = 13, // "waittillmatch"
S_IF = 14, // "if" S_WAITTILLFRAMEEND = 14, // "waittillframeend"
S_ELSE = 15, // "else" S_WAITFRAME = 15, // "waitframe"
S_DO = 16, // "do" S_IF = 16, // "if"
S_WHILE = 17, // "while" S_ELSE = 17, // "else"
S_FOR = 18, // "for" S_DO = 18, // "do"
S_FOREACH = 19, // "foreach" S_WHILE = 19, // "while"
S_IN = 20, // "in" S_FOR = 20, // "for"
S_SWITCH = 21, // "switch" S_FOREACH = 21, // "foreach"
S_CASE = 22, // "case" S_IN = 22, // "in"
S_DEFAULT = 23, // "default" S_SWITCH = 23, // "switch"
S_BREAK = 24, // "break" S_CASE = 24, // "case"
S_CONTINUE = 25, // "continue" S_DEFAULT = 25, // "default"
S_RETURN = 26, // "return" S_BREAK = 26, // "break"
S_BREAKPOINT = 27, // "breakpoint" S_CONTINUE = 27, // "continue"
S_PROFBEGIN = 28, // "prof_begin" S_RETURN = 28, // "return"
S_PROFEND = 29, // "prof_end" S_BREAKPOINT = 29, // "breakpoint"
S_THREAD = 30, // "thread" S_PROFBEGIN = 30, // "prof_begin"
S_CHILDTHREAD = 31, // "childthread" S_PROFEND = 31, // "prof_end"
S_THISTHREAD = 32, // "thisthread" S_THREAD = 32, // "thread"
S_CALL = 33, // "call" S_CHILDTHREAD = 33, // "childthread"
S_TRUE = 34, // "true" S_THISTHREAD = 34, // "thisthread"
S_FALSE = 35, // "false" S_CALL = 35, // "call"
S_UNDEFINED = 36, // "undefined" S_TRUE = 36, // "true"
S_SIZE = 37, // ".size" S_FALSE = 37, // "false"
S_GAME = 38, // "game" S_UNDEFINED = 38, // "undefined"
S_SELF = 39, // "self" S_SIZE = 39, // ".size"
S_ANIM = 40, // "anim" S_GAME = 40, // "game"
S_LEVEL = 41, // "level" S_SELF = 41, // "self"
S_ISDEFINED = 42, // "isdefined" S_ANIM = 42, // "anim"
S_ISTRUE = 43, // "istrue" S_LEVEL = 43, // "level"
S_LPAREN = 44, // "(" S_ISDEFINED = 44, // "isdefined"
S_RPAREN = 45, // ")" S_ISTRUE = 45, // "istrue"
S_LBRACE = 46, // "{" S_LPAREN = 46, // "("
S_RBRACE = 47, // "}" S_RPAREN = 47, // ")"
S_LBRACKET = 48, // "[" S_LBRACE = 48, // "{"
S_RBRACKET = 49, // "]" S_RBRACE = 49, // "}"
S_COMMA = 50, // "," S_LBRACKET = 50, // "["
S_DOT = 51, // "." S_RBRACKET = 51, // "]"
S_DOUBLECOLON = 52, // "::" S_COMMA = 52, // ","
S_COLON = 53, // ":" S_DOT = 53, // "."
S_SEMICOLON = 54, // ";" S_DOUBLECOLON = 54, // "::"
S_QMARK = 55, // "?" S_COLON = 55, // ":"
S_INCREMENT = 56, // "++" S_SEMICOLON = 56, // ";"
S_DECREMENT = 57, // "--" S_QMARK = 57, // "?"
S_LSHIFT = 58, // "<<" S_INCREMENT = 58, // "++"
S_RSHIFT = 59, // ">>" S_DECREMENT = 59, // "--"
S_OR = 60, // "||" S_LSHIFT = 60, // "<<"
S_AND = 61, // "&&" S_RSHIFT = 61, // ">>"
S_EQUALITY = 62, // "==" S_OR = 62, // "||"
S_INEQUALITY = 63, // "!=" S_AND = 63, // "&&"
S_LESS_EQUAL = 64, // "<=" S_EQUALITY = 64, // "=="
S_GREATER_EQUAL = 65, // ">=" S_INEQUALITY = 65, // "!="
S_LESS = 66, // "<" S_LESS_EQUAL = 66, // "<="
S_GREATER = 67, // ">" S_GREATER_EQUAL = 67, // ">="
S_NOT = 68, // "!" S_LESS = 68, // "<"
S_COMPLEMENT = 69, // "~" S_GREATER = 69, // ">"
S_ASSIGN = 70, // "=" S_NOT = 70, // "!"
S_ASSIGN_ADD = 71, // "+=" S_COMPLEMENT = 71, // "~"
S_ASSIGN_SUB = 72, // "-=" S_ASSIGN = 72, // "="
S_ASSIGN_MUL = 73, // "*=" S_ASSIGN_ADD = 73, // "+="
S_ASSIGN_DIV = 74, // "/=" S_ASSIGN_SUB = 74, // "-="
S_ASSIGN_MOD = 75, // "%=" S_ASSIGN_MUL = 75, // "*="
S_ASSIGN_BW_OR = 76, // "|=" S_ASSIGN_DIV = 76, // "/="
S_ASSIGN_BW_AND = 77, // "&=" S_ASSIGN_MOD = 77, // "%="
S_ASSIGN_BW_EXOR = 78, // "^=" S_ASSIGN_BW_OR = 78, // "|="
S_ASSIGN_RSHIFT = 79, // ">>=" S_ASSIGN_BW_AND = 79, // "&="
S_ASSIGN_LSHIFT = 80, // "<<=" S_ASSIGN_BW_EXOR = 80, // "^="
S_BITWISE_OR = 81, // "|" S_ASSIGN_RSHIFT = 81, // ">>="
S_BITWISE_AND = 82, // "&" S_ASSIGN_LSHIFT = 82, // "<<="
S_BITWISE_EXOR = 83, // "^" S_BITWISE_OR = 83, // "|"
S_ADD = 84, // "+" S_BITWISE_AND = 84, // "&"
S_SUB = 85, // "-" S_BITWISE_EXOR = 85, // "^"
S_MUL = 86, // "*" S_ADD = 86, // "+"
S_DIV = 87, // "/" S_SUB = 87, // "-"
S_MOD = 88, // "%" S_MUL = 88, // "*"
S_PATH = 89, // "path" S_DIV = 89, // "/"
S_IDENTIFIER = 90, // "identifier" S_MOD = 90, // "%"
S_STRING = 91, // "string literal" S_PATH = 91, // "path"
S_ISTRING = 92, // "localized string" S_IDENTIFIER = 92, // "identifier"
S_COLOR = 93, // "color" S_STRING = 93, // "string literal"
S_FLOAT = 94, // "float" S_ISTRING = 94, // "localized string"
S_INT_DEC = 95, // "int" S_COLOR = 95, // "color"
S_INT_OCT = 96, // "octal int" S_FLOAT = 96, // "float"
S_INT_BIN = 97, // "binary int" S_INT_DEC = 97, // "int"
S_INT_HEX = 98, // "hexadecimal int" S_INT_OCT = 98, // "octal int"
S_ADD_ARRAY = 99, // ADD_ARRAY S_INT_BIN = 99, // "binary int"
S_THEN = 100, // THEN S_INT_HEX = 100, // "hexadecimal int"
S_TERN = 101, // TERN S_ADD_ARRAY = 101, // ADD_ARRAY
S_NEG = 102, // NEG S_THEN = 102, // THEN
S_ANIMREF = 103, // ANIMREF S_TERN = 103, // TERN
S_PREINC = 104, // PREINC S_NEG = 104, // NEG
S_PREDEC = 105, // PREDEC S_ANIMREF = 105, // ANIMREF
S_POSTINC = 106, // POSTINC S_PREINC = 106, // PREINC
S_POSTDEC = 107, // POSTDEC S_PREDEC = 107, // PREDEC
S_YYACCEPT = 108, // $accept S_POSTINC = 108, // POSTINC
S_root = 109, // root S_POSTDEC = 109, // POSTDEC
S_program = 110, // program S_YYACCEPT = 110, // $accept
S_inline = 111, // inline S_root = 111, // root
S_include = 112, // include S_program = 112, // program
S_declaration = 113, // declaration S_inline = 113, // inline
S_decl_usingtree = 114, // decl_usingtree S_include = 114, // include
S_decl_constant = 115, // decl_constant S_declaration = 115, // declaration
S_decl_thread = 116, // decl_thread S_decl_usingtree = 116, // decl_usingtree
S_stmt = 117, // stmt S_decl_constant = 117, // decl_constant
S_stmt_block = 118, // stmt_block S_decl_thread = 118, // decl_thread
S_stmt_list = 119, // stmt_list S_stmt = 119, // stmt
S_stmt_expr = 120, // stmt_expr S_stmt_dev = 120, // stmt_dev
S_stmt_call = 121, // stmt_call S_stmt_block = 121, // stmt_block
S_stmt_assign = 122, // stmt_assign S_stmt_list = 122, // stmt_list
S_stmt_endon = 123, // stmt_endon S_stmt_expr = 123, // stmt_expr
S_stmt_notify = 124, // stmt_notify S_stmt_call = 124, // stmt_call
S_stmt_wait = 125, // stmt_wait S_stmt_assign = 125, // stmt_assign
S_stmt_waittill = 126, // stmt_waittill S_stmt_endon = 126, // stmt_endon
S_stmt_waittillmatch = 127, // stmt_waittillmatch S_stmt_notify = 127, // stmt_notify
S_stmt_waittillframeend = 128, // stmt_waittillframeend S_stmt_wait = 128, // stmt_wait
S_stmt_waitframe = 129, // stmt_waitframe S_stmt_waittill = 129, // stmt_waittill
S_stmt_if = 130, // stmt_if S_stmt_waittillmatch = 130, // stmt_waittillmatch
S_stmt_ifelse = 131, // stmt_ifelse S_stmt_waittillframeend = 131, // stmt_waittillframeend
S_stmt_while = 132, // stmt_while S_stmt_waitframe = 132, // stmt_waitframe
S_stmt_dowhile = 133, // stmt_dowhile S_stmt_if = 133, // stmt_if
S_stmt_for = 134, // stmt_for S_stmt_ifelse = 134, // stmt_ifelse
S_stmt_foreach = 135, // stmt_foreach S_stmt_while = 135, // stmt_while
S_stmt_switch = 136, // stmt_switch S_stmt_dowhile = 136, // stmt_dowhile
S_stmt_case = 137, // stmt_case S_stmt_for = 137, // stmt_for
S_stmt_default = 138, // stmt_default S_stmt_foreach = 138, // stmt_foreach
S_stmt_break = 139, // stmt_break S_stmt_switch = 139, // stmt_switch
S_stmt_continue = 140, // stmt_continue S_stmt_case = 140, // stmt_case
S_stmt_return = 141, // stmt_return S_stmt_default = 141, // stmt_default
S_stmt_breakpoint = 142, // stmt_breakpoint S_stmt_break = 142, // stmt_break
S_stmt_prof_begin = 143, // stmt_prof_begin S_stmt_continue = 143, // stmt_continue
S_stmt_prof_end = 144, // stmt_prof_end S_stmt_return = 144, // stmt_return
S_expr = 145, // expr S_stmt_breakpoint = 145, // stmt_breakpoint
S_expr_or_empty = 146, // expr_or_empty S_stmt_prof_begin = 146, // stmt_prof_begin
S_expr_assign = 147, // expr_assign S_stmt_prof_end = 147, // stmt_prof_end
S_expr_increment = 148, // expr_increment S_expr = 148, // expr
S_expr_decrement = 149, // expr_decrement S_expr_or_empty = 149, // expr_or_empty
S_expr_ternary = 150, // expr_ternary S_expr_assign = 150, // expr_assign
S_expr_binary = 151, // expr_binary S_expr_increment = 151, // expr_increment
S_expr_primitive = 152, // expr_primitive S_expr_decrement = 152, // expr_decrement
S_expr_complement = 153, // expr_complement S_expr_ternary = 153, // expr_ternary
S_expr_not = 154, // expr_not S_expr_binary = 154, // expr_binary
S_expr_call = 155, // expr_call S_expr_primitive = 155, // expr_primitive
S_expr_method = 156, // expr_method S_expr_complement = 156, // expr_complement
S_expr_function = 157, // expr_function S_expr_not = 157, // expr_not
S_expr_pointer = 158, // expr_pointer S_expr_call = 158, // expr_call
S_expr_add_array = 159, // expr_add_array S_expr_method = 159, // expr_method
S_expr_parameters = 160, // expr_parameters S_expr_function = 160, // expr_function
S_expr_arguments = 161, // expr_arguments S_expr_pointer = 161, // expr_pointer
S_expr_arguments_no_empty = 162, // expr_arguments_no_empty S_expr_add_array = 162, // expr_add_array
S_expr_isdefined = 163, // expr_isdefined S_expr_parameters = 163, // expr_parameters
S_expr_istrue = 164, // expr_istrue S_expr_arguments = 164, // expr_arguments
S_expr_reference = 165, // expr_reference S_expr_arguments_no_empty = 165, // expr_arguments_no_empty
S_expr_array = 166, // expr_array S_expr_isdefined = 166, // expr_isdefined
S_expr_field = 167, // expr_field S_expr_istrue = 167, // expr_istrue
S_expr_size = 168, // expr_size S_expr_reference = 168, // expr_reference
S_expr_paren = 169, // expr_paren S_expr_array = 169, // expr_array
S_expr_object = 170, // expr_object S_expr_field = 170, // expr_field
S_expr_thisthread = 171, // expr_thisthread S_expr_size = 171, // expr_size
S_expr_empty_array = 172, // expr_empty_array S_expr_paren = 172, // expr_paren
S_expr_undefined = 173, // expr_undefined S_expr_object = 173, // expr_object
S_expr_game = 174, // expr_game S_expr_thisthread = 174, // expr_thisthread
S_expr_self = 175, // expr_self S_expr_empty_array = 175, // expr_empty_array
S_expr_anim = 176, // expr_anim S_expr_undefined = 176, // expr_undefined
S_expr_level = 177, // expr_level S_expr_game = 177, // expr_game
S_expr_animation = 178, // expr_animation S_expr_self = 178, // expr_self
S_expr_animtree = 179, // expr_animtree S_expr_anim = 179, // expr_anim
S_expr_identifier = 180, // expr_identifier S_expr_level = 180, // expr_level
S_expr_path = 181, // expr_path S_expr_animation = 181, // expr_animation
S_expr_istring = 182, // expr_istring S_expr_animtree = 182, // expr_animtree
S_expr_string = 183, // expr_string S_expr_identifier = 183, // expr_identifier
S_expr_color = 184, // expr_color S_expr_path = 184, // expr_path
S_expr_vector = 185, // expr_vector S_expr_istring = 185, // expr_istring
S_expr_float = 186, // expr_float S_expr_string = 186, // expr_string
S_expr_integer = 187, // expr_integer S_expr_color = 187, // expr_color
S_expr_false = 188, // expr_false S_expr_vector = 188, // expr_vector
S_expr_true = 189 // expr_true S_expr_float = 189, // expr_float
S_expr_integer = 190, // expr_integer
S_expr_false = 191, // expr_false
S_expr_true = 192 // expr_true
}; };
}; };
@ -1268,6 +1274,7 @@ namespace xsk { namespace gsc { namespace s4 {
value.move< ast::stmt_ifelse::ptr > (std::move (that.value)); value.move< ast::stmt_ifelse::ptr > (std::move (that.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.move< ast::stmt_list::ptr > (std::move (that.value)); value.move< ast::stmt_list::ptr > (std::move (that.value));
@ -2575,6 +2582,7 @@ switch (yykind)
value.template destroy< ast::stmt_ifelse::ptr > (); value.template destroy< ast::stmt_ifelse::ptr > ();
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.template destroy< ast::stmt_list::ptr > (); value.template destroy< ast::stmt_list::ptr > ();
@ -2838,6 +2846,36 @@ switch (yykind)
return symbol_type (token::S4UNDEF, l); return symbol_type (token::S4UNDEF, l);
} }
#endif #endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_DEVBEGIN (location_type l)
{
return symbol_type (token::DEVBEGIN, std::move (l));
}
#else
static
symbol_type
make_DEVBEGIN (const location_type& l)
{
return symbol_type (token::DEVBEGIN, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_DEVEND (location_type l)
{
return symbol_type (token::DEVEND, std::move (l));
}
#else
static
symbol_type
make_DEVEND (const location_type& l)
{
return symbol_type (token::DEVEND, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS #if 201103L <= YY_CPLUSPLUS
static static
symbol_type symbol_type
@ -4757,9 +4795,9 @@ switch (yykind)
/// Constants. /// Constants.
enum enum
{ {
yylast_ = 2068, ///< Last index in yytable_. yylast_ = 2336, ///< Last index in yytable_.
yynnts_ = 82, ///< Number of nonterminal symbols. yynnts_ = 83, ///< Number of nonterminal symbols.
yyfinal_ = 19 ///< Termination state number. yyfinal_ = 21 ///< Termination state number.
}; };
@ -5020,6 +5058,7 @@ switch (yykind)
value.copy< ast::stmt_ifelse::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_ifelse::ptr > (YY_MOVE (that.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.copy< ast::stmt_list::ptr > (YY_MOVE (that.value)); value.copy< ast::stmt_list::ptr > (YY_MOVE (that.value));
@ -5345,6 +5384,7 @@ switch (yykind)
value.move< ast::stmt_ifelse::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_ifelse::ptr > (YY_MOVE (s.value));
break; break;
case symbol_kind::S_stmt_dev: // stmt_dev
case symbol_kind::S_stmt_block: // stmt_block case symbol_kind::S_stmt_block: // stmt_block
case symbol_kind::S_stmt_list: // stmt_list case symbol_kind::S_stmt_list: // stmt_list
value.move< ast::stmt_list::ptr > (YY_MOVE (s.value)); value.move< ast::stmt_list::ptr > (YY_MOVE (s.value));
@ -5470,7 +5510,7 @@ switch (yykind)
#line 13 "parser.ypp" #line 13 "parser.ypp"
} } } // xsk::gsc::s4 } } } // xsk::gsc::s4
#line 5474 "parser.hpp" #line 5514 "parser.hpp"

View File

@ -407,6 +407,12 @@ decl_constant::decl_constant(const location& loc, expr_identifier::ptr name, exp
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)) {}
decl_dev_begin::decl_dev_begin() : node(kind::decl_dev_begin) {}
decl_dev_begin::decl_dev_begin(const location& loc) : node(kind::decl_dev_begin, loc) {}
decl_dev_end::decl_dev_end() : node(kind::decl_dev_end) {}
decl_dev_end::decl_dev_end(const location& loc) : node(kind::decl_dev_end, loc) {}
include::include(expr_path::ptr path) : node(kind::include), path(std::move(path)) {} include::include(expr_path::ptr path) : node(kind::include), path(std::move(path)) {}
include::include(const location& loc, expr_path::ptr path) : node(kind::include, loc), path(std::move(path)) {} include::include(const location& loc, expr_path::ptr path) : node(kind::include, loc), path(std::move(path)) {}
@ -1178,6 +1184,16 @@ auto decl_usingtree::print() const -> std::string
return "#using_animtree"s + "(" + name->print() + ");\n"; return "#using_animtree"s + "(" + name->print() + ");\n";
} }
auto decl_dev_begin::print() const -> std::string
{
return "/#";
}
auto decl_dev_end::print() const -> std::string
{
return "#/";
}
auto include::print() const -> std::string auto include::print() const -> std::string
{ {
return "#include"s + " " + path->print() + ";\n"; return "#include"s + " " + path->print() + ";\n";
@ -1705,6 +1721,8 @@ decl::~decl()
switch (as_node->kind()) switch (as_node->kind())
{ {
case kind::null: as_node.~unique_ptr(); return; case kind::null: as_node.~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_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_constant: as_constant.~unique_ptr(); return;
case kind::decl_usingtree: as_usingtree.~unique_ptr(); return; case kind::decl_usingtree: as_usingtree.~unique_ptr(); return;

View File

@ -107,6 +107,8 @@ enum class kind
decl_thread, decl_thread,
decl_constant, decl_constant,
decl_usingtree, decl_usingtree,
decl_dev_begin,
decl_dev_end,
include, include,
program, program,
// DECOMPILER // DECOMPILER
@ -225,6 +227,8 @@ struct stmt_prof_end;
struct decl_thread; struct decl_thread;
struct decl_constant; struct decl_constant;
struct decl_usingtree; struct decl_usingtree;
struct decl_dev_begin;
struct decl_dev_end;
struct include; struct include;
struct program; struct program;
struct asm_loc; struct asm_loc;
@ -407,6 +411,8 @@ union stmt
union decl union decl
{ {
std::unique_ptr<node> as_node; std::unique_ptr<node> as_node;
std::unique_ptr<decl_dev_begin> as_dev_begin;
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_constant> as_constant;
std::unique_ptr<decl_thread> as_thread; std::unique_ptr<decl_thread> as_thread;
@ -1541,6 +1547,24 @@ struct decl_usingtree : public node
auto print() const -> std::string override; auto print() const -> std::string override;
}; };
struct decl_dev_begin : public node
{
using ptr = std::unique_ptr<decl_dev_begin>;
decl_dev_begin();
decl_dev_begin(const location& loc);
auto print() const -> std::string override;
};
struct decl_dev_end : public node
{
using ptr = std::unique_ptr<decl_dev_end>;
decl_dev_end();
decl_dev_end(const location& loc);
auto print() const -> std::string override;
};
struct include : public node struct include : public node
{ {
using ptr = std::unique_ptr<include>; using ptr = std::unique_ptr<include>;