support html colors, hex/octal/bin integers

This commit is contained in:
xensik 2021-09-13 19:20:36 +02:00
parent dc9a8194c2
commit 8ced7a8c85
60 changed files with 13868 additions and 12087 deletions

View File

@ -26,8 +26,12 @@ using namespace xsk::gsc;
RGX_FILE ([_A-Za-z0-9]+\\)+[_A-Za-z0-9]+
RGX_NAME [_A-Za-z][_A-Za-z0-9]*
RGX_STRING \"(?:\\.|[^\"])*?\"|\'(?:\\.|[^\'])*?\'
RGX_FLOAT [0-9]+\.(?:[0-9]*)?f?|\.[0-9]+f?
RGX_INTEGER [0-9]+
RGX_COLOR #([0-9a-fA-F]{6}|[0-9a-fA-F]{3})
RGX_FLT_DEC [0-9]+\.(?:[0-9]*)?f?|\.[0-9]+f?
RGX_INT_OCT 0[1-7][0-7]*
RGX_INT_BIN 0[bB][01]+
RGX_INT_HEX 0[xX][0-9a-fA-F]+
RGX_INT_DEC [0-9]+
RGX_DEFAULT (.|\n)
%x COMMENT_BLOCK_STATE
@ -141,8 +145,12 @@ RGX_DEFAULT (.|\n)
{RGX_NAME} { return h1::parser::make_NAME((std::string(yytext, 3) == "_ID") ? std::string(yytext) : utils::string::to_lower(yytext), loc); }
\&{RGX_STRING} { return h1::parser::make_ISTRING(std::string(yytext).substr(1), loc); }
{RGX_STRING} { return h1::parser::make_STRING(std::string(yytext), loc); }
{RGX_FLOAT} { return h1::parser::make_FLOAT(std::string(yytext), loc); }
{RGX_INTEGER} { return h1::parser::make_INTEGER(std::string(yytext), loc); }
{RGX_COLOR} { return h1::parser::make_COLOR(std::string(yytext).substr(1), loc); }
{RGX_FLT_DEC} { return h1::parser::make_FLOAT(std::string(yytext), loc); }
{RGX_INT_OCT} { return h1::parser::make_INT_OCT(utils::string::oct_to_dec(yytext), loc); }
{RGX_INT_BIN} { return h1::parser::make_INT_BIN(utils::string::bin_to_dec(yytext), loc); }
{RGX_INT_HEX} { return h1::parser::make_INT_HEX(utils::string::hex_to_dec(yytext), loc); }
{RGX_INT_DEC} { return h1::parser::make_INT_DEC(std::string(yytext), loc); }
<<EOF>> { return h1::parser::make_H1EOF(loc); }
<*>{RGX_DEFAULT} { throw h1::parser::syntax_error(loc, "bad token: \'" + std::string(yytext) + "\'"); }

View File

@ -131,8 +131,12 @@ xsk::gsc::h1::parser::symbol_type H1lex(yyscan_t yyscanner, xsk::gsc::location&
%token <std::string> NAME "identifier"
%token <std::string> STRING "string literal"
%token <std::string> ISTRING "localized string"
%token <std::string> COLOR "color"
%token <std::string> FLOAT "float"
%token <std::string> INTEGER "int"
%token <std::string> INT_DEC "int"
%token <std::string> INT_OCT "octal int"
%token <std::string> INT_BIN "binary int"
%token <std::string> INT_HEX "hexadecimal int"
%type <program_ptr> program
%type <include_ptr> include
@ -202,9 +206,8 @@ xsk::gsc::h1::parser::symbol_type H1lex(yyscan_t yyscanner, xsk::gsc::location&
%type <file_ptr> file
%type <istring_ptr> istring
%type <string_ptr> string
%type <color_ptr> color
%type <vector_ptr> vector
%type <float_ptr> neg_float
%type <integer_ptr> neg_integer
%type <float_ptr> float
%type <integer_ptr> integer
%type <false_ptr> false
@ -419,8 +422,6 @@ stmt_switch
stmt_case
: CASE integer COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
| CASE neg_integer COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
| CASE string COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
;
@ -549,9 +550,8 @@ expr_primitive
| name { $$.as_node = std::move($1); }
| istring { $$.as_node = std::move($1); }
| string { $$.as_node = std::move($1); }
| color { $$.as_node = std::move($1); }
| vector { $$.as_node = std::move($1); }
| neg_float { $$.as_node = std::move($1); }
| neg_integer { $$.as_node = std::move($1); }
| float { $$.as_node = std::move($1); }
| integer { $$.as_node = std::move($1); }
| false { $$.as_node = std::move($1); }
@ -648,6 +648,19 @@ object
| name { $$ = std::move($1); }
;
float
: SUB FLOAT %prec NEG { $$ = std::make_unique<node_float>(@$, "-" + $2); };
| FLOAT { $$ = std::make_unique<node_float>(@$, $1); };
;
integer
: SUB INT_DEC %prec NEG { $$ = std::make_unique<node_integer>(@$, "-" + $2); };
| INT_DEC { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_OCT { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_BIN { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_HEX { $$ = std::make_unique<node_integer>(@$, $1); };
;
thisthread : THISTHREAD { $$ = std::make_unique<node_thisthread>(@$); };
empty_array : LBRACKET RBRACKET { $$ = std::make_unique<node_empty_array>(@$); };
undefined : UNDEFINED { $$ = std::make_unique<node_undefined>(@$); };
@ -661,11 +674,8 @@ name : NAME { $$ = std::make_unique<n
file : FILE { $$ = std::make_unique<node_file>(@$, $1); };
istring : ISTRING { $$ = std::make_unique<node_istring>(@$, $1); };
string : STRING { $$ = std::make_unique<node_string>(@$, $1); };
color : COLOR { $$ = std::make_unique<node_color>(@$, $1); };
vector : LPAREN expr COMMA expr COMMA expr RPAREN { $$ = std::make_unique<node_vector>(@$, std::move($2), std::move($4), std::move($6)); };
neg_float : SUB FLOAT %prec NEG { $$ = std::make_unique<node_float>(@$, "-" + $2); };
neg_integer : SUB INTEGER %prec NEG { $$ = std::make_unique<node_integer>(@$, "-" + $2); };
float : FLOAT { $$ = std::make_unique<node_float>(@$, $1); };
integer : INTEGER { $$ = std::make_unique<node_integer>(@$, $1); };
false : FALSE { $$ = std::make_unique<node_false>(@$); };
true : TRUE { $$ = std::make_unique<node_true>(@$); };

View File

@ -26,8 +26,12 @@ using namespace xsk::gsc;
RGX_FILE ([_A-Za-z0-9]+\\)+[_A-Za-z0-9]+
RGX_NAME [_A-Za-z][_A-Za-z0-9]*
RGX_STRING \"(?:\\.|[^\"])*?\"|\'(?:\\.|[^\'])*?\'
RGX_FLOAT [0-9]+\.(?:[0-9]*)?f?|\.[0-9]+f?
RGX_INTEGER [0-9]+
RGX_COLOR #([0-9a-fA-F]{6}|[0-9a-fA-F]{3})
RGX_FLT_DEC [0-9]+\.(?:[0-9]*)?f?|\.[0-9]+f?
RGX_INT_OCT 0[1-7][0-7]*
RGX_INT_BIN 0[bB][01]+
RGX_INT_HEX 0[xX][0-9a-fA-F]+
RGX_INT_DEC [0-9]+
RGX_DEFAULT (.|\n)
%x COMMENT_BLOCK_STATE
@ -141,8 +145,12 @@ RGX_DEFAULT (.|\n)
{RGX_NAME} { return h2::parser::make_NAME((std::string(yytext, 3) == "_ID") ? std::string(yytext) : utils::string::to_lower(yytext), loc); }
\&{RGX_STRING} { return h2::parser::make_ISTRING(std::string(yytext).substr(1), loc); }
{RGX_STRING} { return h2::parser::make_STRING(std::string(yytext), loc); }
{RGX_FLOAT} { return h2::parser::make_FLOAT(std::string(yytext), loc); }
{RGX_INTEGER} { return h2::parser::make_INTEGER(std::string(yytext), loc); }
{RGX_COLOR} { return h2::parser::make_COLOR(std::string(yytext).substr(1), loc); }
{RGX_FLT_DEC} { return h2::parser::make_FLOAT(std::string(yytext), loc); }
{RGX_INT_OCT} { return h2::parser::make_INT_OCT(utils::string::oct_to_dec(yytext), loc); }
{RGX_INT_BIN} { return h2::parser::make_INT_BIN(utils::string::bin_to_dec(yytext), loc); }
{RGX_INT_HEX} { return h2::parser::make_INT_HEX(utils::string::hex_to_dec(yytext), loc); }
{RGX_INT_DEC} { return h2::parser::make_INT_DEC(std::string(yytext), loc); }
<<EOF>> { return h2::parser::make_H2EOF(loc); }
<*>{RGX_DEFAULT} { throw h2::parser::syntax_error(loc, "bad token: \'" + std::string(yytext) + "\'"); }

View File

@ -131,8 +131,12 @@ xsk::gsc::h2::parser::symbol_type H2lex(yyscan_t yyscanner, xsk::gsc::location&
%token <std::string> NAME "identifier"
%token <std::string> STRING "string literal"
%token <std::string> ISTRING "localized string"
%token <std::string> COLOR "color"
%token <std::string> FLOAT "float"
%token <std::string> INTEGER "int"
%token <std::string> INT_DEC "int"
%token <std::string> INT_OCT "octal int"
%token <std::string> INT_BIN "binary int"
%token <std::string> INT_HEX "hexadecimal int"
%type <program_ptr> program
%type <include_ptr> include
@ -202,9 +206,8 @@ xsk::gsc::h2::parser::symbol_type H2lex(yyscan_t yyscanner, xsk::gsc::location&
%type <file_ptr> file
%type <istring_ptr> istring
%type <string_ptr> string
%type <color_ptr> color
%type <vector_ptr> vector
%type <float_ptr> neg_float
%type <integer_ptr> neg_integer
%type <float_ptr> float
%type <integer_ptr> integer
%type <false_ptr> false
@ -419,8 +422,6 @@ stmt_switch
stmt_case
: CASE integer COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
| CASE neg_integer COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
| CASE string COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
;
@ -549,9 +550,8 @@ expr_primitive
| name { $$.as_node = std::move($1); }
| istring { $$.as_node = std::move($1); }
| string { $$.as_node = std::move($1); }
| color { $$.as_node = std::move($1); }
| vector { $$.as_node = std::move($1); }
| neg_float { $$.as_node = std::move($1); }
| neg_integer { $$.as_node = std::move($1); }
| float { $$.as_node = std::move($1); }
| integer { $$.as_node = std::move($1); }
| false { $$.as_node = std::move($1); }
@ -648,6 +648,19 @@ object
| name { $$ = std::move($1); }
;
float
: SUB FLOAT %prec NEG { $$ = std::make_unique<node_float>(@$, "-" + $2); };
| FLOAT { $$ = std::make_unique<node_float>(@$, $1); };
;
integer
: SUB INT_DEC %prec NEG { $$ = std::make_unique<node_integer>(@$, "-" + $2); };
| INT_DEC { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_OCT { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_BIN { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_HEX { $$ = std::make_unique<node_integer>(@$, $1); };
;
thisthread : THISTHREAD { $$ = std::make_unique<node_thisthread>(@$); };
empty_array : LBRACKET RBRACKET { $$ = std::make_unique<node_empty_array>(@$); };
undefined : UNDEFINED { $$ = std::make_unique<node_undefined>(@$); };
@ -661,11 +674,8 @@ name : NAME { $$ = std::make_unique<n
file : FILE { $$ = std::make_unique<node_file>(@$, $1); };
istring : ISTRING { $$ = std::make_unique<node_istring>(@$, $1); };
string : STRING { $$ = std::make_unique<node_string>(@$, $1); };
color : COLOR { $$ = std::make_unique<node_color>(@$, $1); };
vector : LPAREN expr COMMA expr COMMA expr RPAREN { $$ = std::make_unique<node_vector>(@$, std::move($2), std::move($4), std::move($6)); };
neg_float : SUB FLOAT %prec NEG { $$ = std::make_unique<node_float>(@$, "-" + $2); };
neg_integer : SUB INTEGER %prec NEG { $$ = std::make_unique<node_integer>(@$, "-" + $2); };
float : FLOAT { $$ = std::make_unique<node_float>(@$, $1); };
integer : INTEGER { $$ = std::make_unique<node_integer>(@$, $1); };
false : FALSE { $$ = std::make_unique<node_false>(@$); };
true : TRUE { $$ = std::make_unique<node_true>(@$); };

View File

@ -26,8 +26,12 @@ using namespace xsk::gsc;
RGX_FILE ([_A-Za-z0-9]+\\)+[_A-Za-z0-9]+
RGX_NAME [_A-Za-z][_A-Za-z0-9]*
RGX_STRING \"(?:\\.|[^\"])*?\"|\'(?:\\.|[^\'])*?\'
RGX_FLOAT [0-9]+\.(?:[0-9]*)?f?|\.[0-9]+f?
RGX_INTEGER [0-9]+
RGX_COLOR #([0-9a-fA-F]{6}|[0-9a-fA-F]{3})
RGX_FLT_DEC [0-9]+\.(?:[0-9]*)?f?|\.[0-9]+f?
RGX_INT_OCT 0[1-7][0-7]*
RGX_INT_BIN 0[bB][01]+
RGX_INT_HEX 0[xX][0-9a-fA-F]+
RGX_INT_DEC [0-9]+
RGX_DEFAULT (.|\n)
%x COMMENT_BLOCK_STATE
@ -140,8 +144,12 @@ RGX_DEFAULT (.|\n)
{RGX_NAME} { return iw5::parser::make_NAME((std::string(yytext, 3) == "_ID") ? std::string(yytext) : utils::string::to_lower(yytext), loc); }
\&{RGX_STRING} { return iw5::parser::make_ISTRING(std::string(yytext).substr(1), loc); }
{RGX_STRING} { return iw5::parser::make_STRING(std::string(yytext), loc); }
{RGX_FLOAT} { return iw5::parser::make_FLOAT(std::string(yytext), loc); }
{RGX_INTEGER} { return iw5::parser::make_INTEGER(std::string(yytext), loc); }
{RGX_COLOR} { return iw5::parser::make_COLOR(std::string(yytext).substr(1), loc); }
{RGX_FLT_DEC} { return iw5::parser::make_FLOAT(std::string(yytext), loc); }
{RGX_INT_OCT} { return iw5::parser::make_INT_OCT(utils::string::oct_to_dec(yytext), loc); }
{RGX_INT_BIN} { return iw5::parser::make_INT_BIN(utils::string::bin_to_dec(yytext), loc); }
{RGX_INT_HEX} { return iw5::parser::make_INT_HEX(utils::string::hex_to_dec(yytext), loc); }
{RGX_INT_DEC} { return iw5::parser::make_INT_DEC(std::string(yytext), loc); }
<<EOF>> { return iw5::parser::make_IW5EOF(loc); }
<*>{RGX_DEFAULT} { throw iw5::parser::syntax_error(loc, "bad token: '" + std::string(yytext) + "'"); }

View File

@ -130,8 +130,12 @@ xsk::gsc::iw5::parser::symbol_type IW5lex(yyscan_t yyscanner, xsk::gsc::location
%token <std::string> NAME "identifier"
%token <std::string> STRING "string literal"
%token <std::string> ISTRING "localized string"
%token <std::string> COLOR "color"
%token <std::string> FLOAT "float"
%token <std::string> INTEGER "int"
%token <std::string> INT_DEC "int"
%token <std::string> INT_OCT "octal int"
%token <std::string> INT_BIN "binary int"
%token <std::string> INT_HEX "hexadecimal int"
%type <program_ptr> program
%type <include_ptr> include
@ -200,9 +204,8 @@ xsk::gsc::iw5::parser::symbol_type IW5lex(yyscan_t yyscanner, xsk::gsc::location
%type <file_ptr> file
%type <istring_ptr> istring
%type <string_ptr> string
%type <color_ptr> color
%type <vector_ptr> vector
%type <float_ptr> neg_float
%type <integer_ptr> neg_integer
%type <float_ptr> float
%type <integer_ptr> integer
%type <false_ptr> false
@ -409,8 +412,6 @@ stmt_switch
stmt_case
: CASE integer COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
| CASE neg_integer COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
| CASE string COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
;
@ -539,9 +540,8 @@ expr_primitive
| name { $$.as_node = std::move($1); }
| istring { $$.as_node = std::move($1); }
| string { $$.as_node = std::move($1); }
| color { $$.as_node = std::move($1); }
| vector { $$.as_node = std::move($1); }
| neg_float { $$.as_node = std::move($1); }
| neg_integer { $$.as_node = std::move($1); }
| float { $$.as_node = std::move($1); }
| integer { $$.as_node = std::move($1); }
| false { $$.as_node = std::move($1); }
@ -638,6 +638,19 @@ object
| name { $$ = std::move($1); }
;
float
: SUB FLOAT %prec NEG { $$ = std::make_unique<node_float>(@$, "-" + $2); };
| FLOAT { $$ = std::make_unique<node_float>(@$, $1); };
;
integer
: SUB INT_DEC %prec NEG { $$ = std::make_unique<node_integer>(@$, "-" + $2); };
| INT_DEC { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_OCT { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_BIN { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_HEX { $$ = std::make_unique<node_integer>(@$, $1); };
;
thisthread : THISTHREAD { $$ = std::make_unique<node_thisthread>(@$); };
empty_array : LBRACKET RBRACKET { $$ = std::make_unique<node_empty_array>(@$); };
undefined : UNDEFINED { $$ = std::make_unique<node_undefined>(@$); };
@ -651,11 +664,8 @@ name : NAME { $$ = std::make_unique<n
file : FILE { $$ = std::make_unique<node_file>(@$, $1); };
istring : ISTRING { $$ = std::make_unique<node_istring>(@$, $1); };
string : STRING { $$ = std::make_unique<node_string>(@$, $1); };
color : COLOR { $$ = std::make_unique<node_color>(@$, $1); };
vector : LPAREN expr COMMA expr COMMA expr RPAREN { $$ = std::make_unique<node_vector>(@$, std::move($2), std::move($4), std::move($6)); };
neg_float : SUB FLOAT %prec NEG { $$ = std::make_unique<node_float>(@$, "-" + $2); };
neg_integer : SUB INTEGER %prec NEG { $$ = std::make_unique<node_integer>(@$, "-" + $2); };
float : FLOAT { $$ = std::make_unique<node_float>(@$, $1); };
integer : INTEGER { $$ = std::make_unique<node_integer>(@$, $1); };
false : FALSE { $$ = std::make_unique<node_false>(@$); };
true : TRUE { $$ = std::make_unique<node_true>(@$); };

View File

@ -26,8 +26,12 @@ using namespace xsk::gsc;
RGX_FILE ([_A-Za-z0-9]+\\)+[_A-Za-z0-9]+
RGX_NAME [_A-Za-z][_A-Za-z0-9]*
RGX_STRING \"(?:\\.|[^\"])*?\"|\'(?:\\.|[^\'])*?\'
RGX_FLOAT [0-9]+\.(?:[0-9]*)?f?|\.[0-9]+f?
RGX_INTEGER [0-9]+
RGX_COLOR #([0-9a-fA-F]{6}|[0-9a-fA-F]{3})
RGX_FLT_DEC [0-9]+\.(?:[0-9]*)?f?|\.[0-9]+f?
RGX_INT_OCT 0[1-7][0-7]*
RGX_INT_BIN 0[bB][01]+
RGX_INT_HEX 0[xX][0-9a-fA-F]+
RGX_INT_DEC [0-9]+
RGX_DEFAULT (.|\n)
%x COMMENT_BLOCK_STATE
@ -140,8 +144,12 @@ RGX_DEFAULT (.|\n)
{RGX_NAME} { return iw6::parser::make_NAME((std::string(yytext, 3) == "_ID") ? std::string(yytext) : utils::string::to_lower(yytext), loc); }
\&{RGX_STRING} { return iw6::parser::make_ISTRING(std::string(yytext).substr(1), loc); }
{RGX_STRING} { return iw6::parser::make_STRING(std::string(yytext), loc); }
{RGX_FLOAT} { return iw6::parser::make_FLOAT(std::string(yytext), loc); }
{RGX_INTEGER} { return iw6::parser::make_INTEGER(std::string(yytext), loc); }
{RGX_COLOR} { return iw6::parser::make_COLOR(std::string(yytext).substr(1), loc); }
{RGX_FLT_DEC} { return iw6::parser::make_FLOAT(std::string(yytext), loc); }
{RGX_INT_OCT} { return iw6::parser::make_INT_OCT(utils::string::oct_to_dec(yytext), loc); }
{RGX_INT_BIN} { return iw6::parser::make_INT_BIN(utils::string::bin_to_dec(yytext), loc); }
{RGX_INT_HEX} { return iw6::parser::make_INT_HEX(utils::string::hex_to_dec(yytext), loc); }
{RGX_INT_DEC} { return iw6::parser::make_INT_DEC(std::string(yytext), loc); }
<<EOF>> { return iw6::parser::make_IW6EOF(loc); }
<*>{RGX_DEFAULT} { throw iw6::parser::syntax_error(loc, "bad token: \'" + std::string(yytext) + "\'"); }

View File

@ -130,8 +130,12 @@ xsk::gsc::iw6::parser::symbol_type IW6lex(yyscan_t yyscanner, xsk::gsc::location
%token <std::string> NAME "identifier"
%token <std::string> STRING "string literal"
%token <std::string> ISTRING "localized string"
%token <std::string> COLOR "color"
%token <std::string> FLOAT "float"
%token <std::string> INTEGER "int"
%token <std::string> INT_DEC "int"
%token <std::string> INT_OCT "octal int"
%token <std::string> INT_BIN "binary int"
%token <std::string> INT_HEX "hexadecimal int"
%type <program_ptr> program
%type <include_ptr> include
@ -200,9 +204,8 @@ xsk::gsc::iw6::parser::symbol_type IW6lex(yyscan_t yyscanner, xsk::gsc::location
%type <file_ptr> file
%type <istring_ptr> istring
%type <string_ptr> string
%type <color_ptr> color
%type <vector_ptr> vector
%type <float_ptr> neg_float
%type <integer_ptr> neg_integer
%type <float_ptr> float
%type <integer_ptr> integer
%type <false_ptr> false
@ -409,8 +412,6 @@ stmt_switch
stmt_case
: CASE integer COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
| CASE neg_integer COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
| CASE string COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
;
@ -539,9 +540,8 @@ expr_primitive
| name { $$.as_node = std::move($1); }
| istring { $$.as_node = std::move($1); }
| string { $$.as_node = std::move($1); }
| color { $$.as_node = std::move($1); }
| vector { $$.as_node = std::move($1); }
| neg_float { $$.as_node = std::move($1); }
| neg_integer { $$.as_node = std::move($1); }
| float { $$.as_node = std::move($1); }
| integer { $$.as_node = std::move($1); }
| false { $$.as_node = std::move($1); }
@ -638,6 +638,19 @@ object
| name { $$ = std::move($1); }
;
float
: SUB FLOAT %prec NEG { $$ = std::make_unique<node_float>(@$, "-" + $2); };
| FLOAT { $$ = std::make_unique<node_float>(@$, $1); };
;
integer
: SUB INT_DEC %prec NEG { $$ = std::make_unique<node_integer>(@$, "-" + $2); };
| INT_DEC { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_OCT { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_BIN { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_HEX { $$ = std::make_unique<node_integer>(@$, $1); };
;
thisthread : THISTHREAD { $$ = std::make_unique<node_thisthread>(@$); };
empty_array : LBRACKET RBRACKET { $$ = std::make_unique<node_empty_array>(@$); };
undefined : UNDEFINED { $$ = std::make_unique<node_undefined>(@$); };
@ -651,11 +664,8 @@ name : NAME { $$ = std::make_unique<n
file : FILE { $$ = std::make_unique<node_file>(@$, $1); };
istring : ISTRING { $$ = std::make_unique<node_istring>(@$, $1); };
string : STRING { $$ = std::make_unique<node_string>(@$, $1); };
color : COLOR { $$ = std::make_unique<node_color>(@$, $1); };
vector : LPAREN expr COMMA expr COMMA expr RPAREN { $$ = std::make_unique<node_vector>(@$, std::move($2), std::move($4), std::move($6)); };
neg_float : SUB FLOAT %prec NEG { $$ = std::make_unique<node_float>(@$, "-" + $2); };
neg_integer : SUB INTEGER %prec NEG { $$ = std::make_unique<node_integer>(@$, "-" + $2); };
float : FLOAT { $$ = std::make_unique<node_float>(@$, $1); };
integer : INTEGER { $$ = std::make_unique<node_integer>(@$, $1); };
false : FALSE { $$ = std::make_unique<node_false>(@$); };
true : TRUE { $$ = std::make_unique<node_true>(@$); };

View File

@ -26,8 +26,12 @@ using namespace xsk::gsc;
RGX_FILE ([_A-Za-z0-9]+\\)+[_A-Za-z0-9]+
RGX_NAME [_A-Za-z][_A-Za-z0-9]*
RGX_STRING \"(?:\\.|[^\"])*?\"|\'(?:\\.|[^\'])*?\'
RGX_FLOAT [0-9]+\.(?:[0-9]*)?f?|\.[0-9]+f?
RGX_INTEGER [0-9]+
RGX_COLOR #([0-9a-fA-F]{6}|[0-9a-fA-F]{3})
RGX_FLT_DEC [0-9]+\.(?:[0-9]*)?f?|\.[0-9]+f?
RGX_INT_OCT 0[1-7][0-7]*
RGX_INT_BIN 0[bB][01]+
RGX_INT_HEX 0[xX][0-9a-fA-F]+
RGX_INT_DEC [0-9]+
RGX_DEFAULT (.|\n)
%x COMMENT_BLOCK_STATE
@ -140,8 +144,12 @@ RGX_DEFAULT (.|\n)
{RGX_NAME} { return iw7::parser::make_NAME((std::string(yytext, 3) == "_ID") ? std::string(yytext) : utils::string::to_lower(yytext), loc); }
\&{RGX_STRING} { return iw7::parser::make_ISTRING(std::string(yytext).substr(1), loc); }
{RGX_STRING} { return iw7::parser::make_STRING(std::string(yytext), loc); }
{RGX_FLOAT} { return iw7::parser::make_FLOAT(std::string(yytext), loc); }
{RGX_INTEGER} { return iw7::parser::make_INTEGER(std::string(yytext), loc); }
{RGX_COLOR} { return iw7::parser::make_COLOR(std::string(yytext).substr(1), loc); }
{RGX_FLT_DEC} { return iw7::parser::make_FLOAT(std::string(yytext), loc); }
{RGX_INT_OCT} { return iw7::parser::make_INT_OCT(utils::string::oct_to_dec(yytext), loc); }
{RGX_INT_BIN} { return iw7::parser::make_INT_BIN(utils::string::bin_to_dec(yytext), loc); }
{RGX_INT_HEX} { return iw7::parser::make_INT_HEX(utils::string::hex_to_dec(yytext), loc); }
{RGX_INT_DEC} { return iw7::parser::make_INT_DEC(std::string(yytext), loc); }
<<EOF>> { return iw7::parser::make_IW7EOF(loc); }
<*>{RGX_DEFAULT} { throw iw7::parser::syntax_error(loc, "bad token: \'" + std::string(yytext) + "\'"); }

View File

@ -130,8 +130,12 @@ xsk::gsc::iw7::parser::symbol_type IW7lex(yyscan_t yyscanner, xsk::gsc::location
%token <std::string> NAME "identifier"
%token <std::string> STRING "string literal"
%token <std::string> ISTRING "localized string"
%token <std::string> COLOR "color"
%token <std::string> FLOAT "float"
%token <std::string> INTEGER "int"
%token <std::string> INT_DEC "int"
%token <std::string> INT_OCT "octal int"
%token <std::string> INT_BIN "binary int"
%token <std::string> INT_HEX "hexadecimal int"
%type <program_ptr> program
%type <include_ptr> include
@ -200,9 +204,8 @@ xsk::gsc::iw7::parser::symbol_type IW7lex(yyscan_t yyscanner, xsk::gsc::location
%type <file_ptr> file
%type <istring_ptr> istring
%type <string_ptr> string
%type <color_ptr> color
%type <vector_ptr> vector
%type <float_ptr> neg_float
%type <integer_ptr> neg_integer
%type <float_ptr> float
%type <integer_ptr> integer
%type <false_ptr> false
@ -409,8 +412,6 @@ stmt_switch
stmt_case
: CASE integer COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
| CASE neg_integer COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
| CASE string COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
;
@ -539,9 +540,8 @@ expr_primitive
| name { $$.as_node = std::move($1); }
| istring { $$.as_node = std::move($1); }
| string { $$.as_node = std::move($1); }
| color { $$.as_node = std::move($1); }
| vector { $$.as_node = std::move($1); }
| neg_float { $$.as_node = std::move($1); }
| neg_integer { $$.as_node = std::move($1); }
| float { $$.as_node = std::move($1); }
| integer { $$.as_node = std::move($1); }
| false { $$.as_node = std::move($1); }
@ -638,6 +638,19 @@ object
| name { $$ = std::move($1); }
;
float
: SUB FLOAT %prec NEG { $$ = std::make_unique<node_float>(@$, "-" + $2); };
| FLOAT { $$ = std::make_unique<node_float>(@$, $1); };
;
integer
: SUB INT_DEC %prec NEG { $$ = std::make_unique<node_integer>(@$, "-" + $2); };
| INT_DEC { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_OCT { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_BIN { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_HEX { $$ = std::make_unique<node_integer>(@$, $1); };
;
thisthread : THISTHREAD { $$ = std::make_unique<node_thisthread>(@$); };
empty_array : LBRACKET RBRACKET { $$ = std::make_unique<node_empty_array>(@$); };
undefined : UNDEFINED { $$ = std::make_unique<node_undefined>(@$); };
@ -651,11 +664,8 @@ name : NAME { $$ = std::make_unique<n
file : FILE { $$ = std::make_unique<node_file>(@$, $1); };
istring : ISTRING { $$ = std::make_unique<node_istring>(@$, $1); };
string : STRING { $$ = std::make_unique<node_string>(@$, $1); };
color : COLOR { $$ = std::make_unique<node_color>(@$, $1); };
vector : LPAREN expr COMMA expr COMMA expr RPAREN { $$ = std::make_unique<node_vector>(@$, std::move($2), std::move($4), std::move($6)); };
neg_float : SUB FLOAT %prec NEG { $$ = std::make_unique<node_float>(@$, "-" + $2); };
neg_integer : SUB INTEGER %prec NEG { $$ = std::make_unique<node_integer>(@$, "-" + $2); };
float : FLOAT { $$ = std::make_unique<node_float>(@$, $1); };
integer : INTEGER { $$ = std::make_unique<node_integer>(@$, $1); };
false : FALSE { $$ = std::make_unique<node_false>(@$); };
true : TRUE { $$ = std::make_unique<node_true>(@$); };

View File

@ -26,8 +26,12 @@ using namespace xsk::gsc;
RGX_FILE ([_A-Za-z0-9]+\\)+[_A-Za-z0-9]+
RGX_NAME [_A-Za-z][_A-Za-z0-9]*
RGX_STRING \"(?:\\.|[^\"])*?\"|\'(?:\\.|[^\'])*?\'
RGX_FLOAT [0-9]+\.(?:[0-9]*)?f?|\.[0-9]+f?
RGX_INTEGER [0-9]+
RGX_COLOR #([0-9a-fA-F]{6}|[0-9a-fA-F]{3})
RGX_FLT_DEC [0-9]+\.(?:[0-9]*)?f?|\.[0-9]+f?
RGX_INT_OCT 0[1-7][0-7]*
RGX_INT_BIN 0[bB][01]+
RGX_INT_HEX 0[xX][0-9a-fA-F]+
RGX_INT_DEC [0-9]+
RGX_DEFAULT (.|\n)
%x COMMENT_BLOCK_STATE
@ -141,8 +145,12 @@ RGX_DEFAULT (.|\n)
{RGX_NAME} { return s1::parser::make_NAME((std::string(yytext, 3) == "_ID") ? std::string(yytext) : utils::string::to_lower(yytext), loc); }
\&{RGX_STRING} { return s1::parser::make_ISTRING(std::string(yytext).substr(1), loc); }
{RGX_STRING} { return s1::parser::make_STRING(std::string(yytext), loc); }
{RGX_FLOAT} { return s1::parser::make_FLOAT(std::string(yytext), loc); }
{RGX_INTEGER} { return s1::parser::make_INTEGER(std::string(yytext), loc); }
{RGX_COLOR} { return s1::parser::make_COLOR(std::string(yytext).substr(1), loc); }
{RGX_FLT_DEC} { return s1::parser::make_FLOAT(std::string(yytext), loc); }
{RGX_INT_OCT} { return s1::parser::make_INT_OCT(utils::string::oct_to_dec(yytext), loc); }
{RGX_INT_BIN} { return s1::parser::make_INT_BIN(utils::string::bin_to_dec(yytext), loc); }
{RGX_INT_HEX} { return s1::parser::make_INT_HEX(utils::string::hex_to_dec(yytext), loc); }
{RGX_INT_DEC} { return s1::parser::make_INT_DEC(std::string(yytext), loc); }
<<EOF>> { return s1::parser::make_S1EOF(loc); }
<*>{RGX_DEFAULT} { throw s1::parser::syntax_error(loc, "bad token: \'" + std::string(yytext) + "\'"); }

View File

@ -131,8 +131,12 @@ xsk::gsc::s1::parser::symbol_type S1lex(yyscan_t yyscanner, xsk::gsc::location&
%token <std::string> NAME "identifier"
%token <std::string> STRING "string literal"
%token <std::string> ISTRING "localized string"
%token <std::string> COLOR "color"
%token <std::string> FLOAT "float"
%token <std::string> INTEGER "int"
%token <std::string> INT_DEC "int"
%token <std::string> INT_OCT "octal int"
%token <std::string> INT_BIN "binary int"
%token <std::string> INT_HEX "hexadecimal int"
%type <program_ptr> program
%type <include_ptr> include
@ -202,9 +206,8 @@ xsk::gsc::s1::parser::symbol_type S1lex(yyscan_t yyscanner, xsk::gsc::location&
%type <file_ptr> file
%type <istring_ptr> istring
%type <string_ptr> string
%type <color_ptr> color
%type <vector_ptr> vector
%type <float_ptr> neg_float
%type <integer_ptr> neg_integer
%type <float_ptr> float
%type <integer_ptr> integer
%type <false_ptr> false
@ -419,8 +422,6 @@ stmt_switch
stmt_case
: CASE integer COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
| CASE neg_integer COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
| CASE string COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
;
@ -549,9 +550,8 @@ expr_primitive
| name { $$.as_node = std::move($1); }
| istring { $$.as_node = std::move($1); }
| string { $$.as_node = std::move($1); }
| color { $$.as_node = std::move($1); }
| vector { $$.as_node = std::move($1); }
| neg_float { $$.as_node = std::move($1); }
| neg_integer { $$.as_node = std::move($1); }
| float { $$.as_node = std::move($1); }
| integer { $$.as_node = std::move($1); }
| false { $$.as_node = std::move($1); }
@ -648,6 +648,19 @@ object
| name { $$ = std::move($1); }
;
float
: SUB FLOAT %prec NEG { $$ = std::make_unique<node_float>(@$, "-" + $2); };
| FLOAT { $$ = std::make_unique<node_float>(@$, $1); };
;
integer
: SUB INT_DEC %prec NEG { $$ = std::make_unique<node_integer>(@$, "-" + $2); };
| INT_DEC { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_OCT { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_BIN { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_HEX { $$ = std::make_unique<node_integer>(@$, $1); };
;
thisthread : THISTHREAD { $$ = std::make_unique<node_thisthread>(@$); };
empty_array : LBRACKET RBRACKET { $$ = std::make_unique<node_empty_array>(@$); };
undefined : UNDEFINED { $$ = std::make_unique<node_undefined>(@$); };
@ -661,11 +674,8 @@ name : NAME { $$ = std::make_unique<n
file : FILE { $$ = std::make_unique<node_file>(@$, $1); };
istring : ISTRING { $$ = std::make_unique<node_istring>(@$, $1); };
string : STRING { $$ = std::make_unique<node_string>(@$, $1); };
color : COLOR { $$ = std::make_unique<node_color>(@$, $1); };
vector : LPAREN expr COMMA expr COMMA expr RPAREN { $$ = std::make_unique<node_vector>(@$, std::move($2), std::move($4), std::move($6)); };
neg_float : SUB FLOAT %prec NEG { $$ = std::make_unique<node_float>(@$, "-" + $2); };
neg_integer : SUB INTEGER %prec NEG { $$ = std::make_unique<node_integer>(@$, "-" + $2); };
float : FLOAT { $$ = std::make_unique<node_float>(@$, $1); };
integer : INTEGER { $$ = std::make_unique<node_integer>(@$, $1); };
false : FALSE { $$ = std::make_unique<node_false>(@$); };
true : TRUE { $$ = std::make_unique<node_true>(@$); };

View File

@ -26,8 +26,12 @@ using namespace xsk::gsc;
RGX_FILE ([_A-Za-z0-9]+\\)+[_A-Za-z0-9]+
RGX_NAME [_A-Za-z][_A-Za-z0-9]*
RGX_STRING \"(?:\\.|[^\"])*?\"|\'(?:\\.|[^\'])*?\'
RGX_FLOAT [0-9]+\.(?:[0-9]*)?f?|\.[0-9]+f?
RGX_INTEGER [0-9]+
RGX_COLOR #([0-9a-fA-F]{6}|[0-9a-fA-F]{3})
RGX_FLT_DEC [0-9]+\.(?:[0-9]*)?f?|\.[0-9]+f?
RGX_INT_OCT 0[1-7][0-7]*
RGX_INT_BIN 0[bB][01]+
RGX_INT_HEX 0[xX][0-9a-fA-F]+
RGX_INT_DEC [0-9]+
RGX_DEFAULT (.|\n)
%x COMMENT_BLOCK_STATE
@ -141,8 +145,12 @@ RGX_DEFAULT (.|\n)
{RGX_NAME} { return s2::parser::make_NAME((std::string(yytext, 3) == "_ID") ? std::string(yytext) : utils::string::to_lower(yytext), loc); }
\&{RGX_STRING} { return s2::parser::make_ISTRING(std::string(yytext).substr(1), loc); }
{RGX_STRING} { return s2::parser::make_STRING(std::string(yytext), loc); }
{RGX_FLOAT} { return s2::parser::make_FLOAT(std::string(yytext), loc); }
{RGX_INTEGER} { return s2::parser::make_INTEGER(std::string(yytext), loc); }
{RGX_COLOR} { return s2::parser::make_COLOR(std::string(yytext).substr(1), loc); }
{RGX_FLT_DEC} { return s2::parser::make_FLOAT(std::string(yytext), loc); }
{RGX_INT_OCT} { return s2::parser::make_INT_OCT(utils::string::oct_to_dec(yytext), loc); }
{RGX_INT_BIN} { return s2::parser::make_INT_BIN(utils::string::bin_to_dec(yytext), loc); }
{RGX_INT_HEX} { return s2::parser::make_INT_HEX(utils::string::hex_to_dec(yytext), loc); }
{RGX_INT_DEC} { return s2::parser::make_INT_DEC(std::string(yytext), loc); }
<<EOF>> { return s2::parser::make_S2EOF(loc); }
<*>{RGX_DEFAULT} { throw s2::parser::syntax_error(loc, "bad token: \'" + std::string(yytext) + "\'"); }

View File

@ -131,8 +131,12 @@ xsk::gsc::s2::parser::symbol_type S2lex(yyscan_t yyscanner, xsk::gsc::location&
%token <std::string> NAME "identifier"
%token <std::string> STRING "string literal"
%token <std::string> ISTRING "localized string"
%token <std::string> COLOR "color"
%token <std::string> FLOAT "float"
%token <std::string> INTEGER "int"
%token <std::string> INT_DEC "int"
%token <std::string> INT_OCT "octal int"
%token <std::string> INT_BIN "binary int"
%token <std::string> INT_HEX "hexadecimal int"
%type <program_ptr> program
%type <include_ptr> include
@ -202,9 +206,8 @@ xsk::gsc::s2::parser::symbol_type S2lex(yyscan_t yyscanner, xsk::gsc::location&
%type <file_ptr> file
%type <istring_ptr> istring
%type <string_ptr> string
%type <color_ptr> color
%type <vector_ptr> vector
%type <float_ptr> neg_float
%type <integer_ptr> neg_integer
%type <float_ptr> float
%type <integer_ptr> integer
%type <false_ptr> false
@ -419,8 +422,6 @@ stmt_switch
stmt_case
: CASE integer COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
| CASE neg_integer COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
| CASE string COLON
{ $$ = std::make_unique<node_stmt_case>(@$, expr_ptr(std::move($2)), std::make_unique<gsc::node_stmt_list>(@$)); }
;
@ -549,9 +550,8 @@ expr_primitive
| name { $$.as_node = std::move($1); }
| istring { $$.as_node = std::move($1); }
| string { $$.as_node = std::move($1); }
| color { $$.as_node = std::move($1); }
| vector { $$.as_node = std::move($1); }
| neg_float { $$.as_node = std::move($1); }
| neg_integer { $$.as_node = std::move($1); }
| float { $$.as_node = std::move($1); }
| integer { $$.as_node = std::move($1); }
| false { $$.as_node = std::move($1); }
@ -648,6 +648,19 @@ object
| name { $$ = std::move($1); }
;
float
: SUB FLOAT %prec NEG { $$ = std::make_unique<node_float>(@$, "-" + $2); };
| FLOAT { $$ = std::make_unique<node_float>(@$, $1); };
;
integer
: SUB INT_DEC %prec NEG { $$ = std::make_unique<node_integer>(@$, "-" + $2); };
| INT_DEC { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_OCT { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_BIN { $$ = std::make_unique<node_integer>(@$, $1); };
| INT_HEX { $$ = std::make_unique<node_integer>(@$, $1); };
;
thisthread : THISTHREAD { $$ = std::make_unique<node_thisthread>(@$); };
empty_array : LBRACKET RBRACKET { $$ = std::make_unique<node_empty_array>(@$); };
undefined : UNDEFINED { $$ = std::make_unique<node_undefined>(@$); };
@ -661,11 +674,8 @@ name : NAME { $$ = std::make_unique<n
file : FILE { $$ = std::make_unique<node_file>(@$, $1); };
istring : ISTRING { $$ = std::make_unique<node_istring>(@$, $1); };
string : STRING { $$ = std::make_unique<node_string>(@$, $1); };
color : COLOR { $$ = std::make_unique<node_color>(@$, $1); };
vector : LPAREN expr COMMA expr COMMA expr RPAREN { $$ = std::make_unique<node_vector>(@$, std::move($2), std::move($4), std::move($6)); };
neg_float : SUB FLOAT %prec NEG { $$ = std::make_unique<node_float>(@$, "-" + $2); };
neg_integer : SUB INTEGER %prec NEG { $$ = std::make_unique<node_integer>(@$, "-" + $2); };
float : FLOAT { $$ = std::make_unique<node_float>(@$, $1); };
integer : INTEGER { $$ = std::make_unique<node_integer>(@$, $1); };
false : FALSE { $$ = std::make_unique<node_false>(@$); };
true : TRUE { $$ = std::make_unique<node_true>(@$); };

View File

@ -791,6 +791,7 @@ void compiler::emit_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr)
case gsc::node_t::data_name: emit_local_variable(ctx, expr.as_name); break;
case gsc::node_t::data_istring: emit_istring(ctx, expr.as_istring); break;
case gsc::node_t::data_string: emit_string(ctx, expr.as_string); break;
case gsc::node_t::data_color: emit_color(ctx, expr.as_color); break;
case gsc::node_t::data_vector: emit_vector(ctx, expr.as_vector); break;
case gsc::node_t::data_float: emit_float(ctx, expr.as_float); break;
case gsc::node_t::data_integer: emit_integer(ctx, expr.as_integer); break;
@ -1612,6 +1613,30 @@ void compiler::emit_string(const gsc::context_ptr& ctx, const gsc::string_ptr& s
emit_opcode(ctx, opcode::OP_GetString, str->value);
}
void compiler::emit_color(const gsc::context_ptr& ctx, const gsc::color_ptr& color)
{
std::vector<std::string> data;
std::string x, y, z;
if(color->value.size() == 3)
{
x = "0x" + color->value.substr(0, 1) + color->value.substr(0, 1);
y = "0x" + color->value.substr(1, 1) + color->value.substr(1, 1);
z = "0x" + color->value.substr(2, 1) + color->value.substr(2, 1);
}
else
{
x = "0x" + color->value.substr(0, 2);
y = "0x" + color->value.substr(2, 2);
z = "0x" + color->value.substr(4, 2);
}
data.push_back(gsc::utils::string::hex_to_dec(x.data()));
data.push_back(gsc::utils::string::hex_to_dec(y.data()));
data.push_back(gsc::utils::string::hex_to_dec(z.data()));
emit_opcode(ctx, opcode::OP_GetVector, data);
}
void compiler::emit_vector(const gsc::context_ptr& ctx, const gsc::vector_ptr& vec)
{
std::vector<std::string> data;

View File

@ -102,6 +102,7 @@ private:
void emit_animation(const gsc::context_ptr& ctx, const gsc::animation_ptr& animation);
void emit_istring(const gsc::context_ptr& ctx, const gsc::istring_ptr& str);
void emit_string(const gsc::context_ptr& ctx, const gsc::string_ptr& str);
void emit_color(const gsc::context_ptr& ctx, const gsc::color_ptr& color);
void emit_vector(const gsc::context_ptr& ctx, const gsc::vector_ptr& vec);
void emit_float(const gsc::context_ptr& ctx, const gsc::float_ptr& num);
void emit_integer(const gsc::context_ptr& ctx, const gsc::integer_ptr& num);

File diff suppressed because it is too large Load Diff

View File

@ -700,7 +700,7 @@ extern int yylex (yyscan_t yyscanner);
#undef yyTABLES_NAME
#endif
#line 150 "lexer.lpp"
#line 158 "lexer.lpp"
#line 706 "lexer.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -417,31 +417,34 @@ namespace xsk { namespace gsc { namespace h1 {
// animtree
char dummy3[sizeof (animtree_ptr)];
// color
char dummy4[sizeof (color_ptr)];
// constant
char dummy4[sizeof (constant_ptr)];
char dummy5[sizeof (constant_ptr)];
// define
char dummy5[sizeof (define_ptr)];
char dummy6[sizeof (define_ptr)];
// empty_array
char dummy6[sizeof (empty_array_ptr)];
char dummy7[sizeof (empty_array_ptr)];
// expr_arguments
// expr_arguments_filled
// expr_arguments_empty
char dummy7[sizeof (expr_arguments_ptr)];
char dummy8[sizeof (expr_arguments_ptr)];
// expr_assign
char dummy8[sizeof (expr_assign_ptr)];
char dummy9[sizeof (expr_assign_ptr)];
// expr_call
// expr_call_thread
// expr_call_childthread
char dummy9[sizeof (expr_call_ptr)];
char dummy10[sizeof (expr_call_ptr)];
// expr_call_function
// expr_call_pointer
char dummy10[sizeof (expr_call_type_ptr)];
char dummy11[sizeof (expr_call_type_ptr)];
// for_expr
// expr
@ -449,36 +452,34 @@ namespace xsk { namespace gsc { namespace h1 {
// expr_ternary
// expr_binary
// expr_primitive
char dummy11[sizeof (expr_ptr)];
char dummy12[sizeof (expr_ptr)];
// false
char dummy12[sizeof (false_ptr)];
char dummy13[sizeof (false_ptr)];
// file
char dummy13[sizeof (file_ptr)];
char dummy14[sizeof (file_ptr)];
// neg_float
// float
char dummy14[sizeof (float_ptr)];
char dummy15[sizeof (float_ptr)];
// game
char dummy15[sizeof (game_ptr)];
char dummy16[sizeof (game_ptr)];
// include
char dummy16[sizeof (include_ptr)];
char dummy17[sizeof (include_ptr)];
// neg_integer
// integer
char dummy17[sizeof (integer_ptr)];
char dummy18[sizeof (integer_ptr)];
// istring
char dummy18[sizeof (istring_ptr)];
char dummy19[sizeof (istring_ptr)];
// level
char dummy19[sizeof (level_ptr)];
char dummy20[sizeof (level_ptr)];
// name
char dummy20[sizeof (name_ptr)];
char dummy21[sizeof (name_ptr)];
// expr_function
// expr_add_array
@ -486,122 +487,126 @@ namespace xsk { namespace gsc { namespace h1 {
// expr_field
// expr_size
// object
char dummy21[sizeof (node_ptr)];
char dummy22[sizeof (node_ptr)];
// parameters
char dummy22[sizeof (parameters_ptr)];
char dummy23[sizeof (parameters_ptr)];
// program
char dummy23[sizeof (program_ptr)];
char dummy24[sizeof (program_ptr)];
// self
char dummy24[sizeof (self_ptr)];
char dummy25[sizeof (self_ptr)];
// "file path"
// "identifier"
// "string literal"
// "localized string"
// "color"
// "float"
// "int"
char dummy25[sizeof (std::string)];
// "octal int"
// "binary int"
// "hexadecimal int"
char dummy26[sizeof (std::string)];
// stmt_assign
char dummy26[sizeof (stmt_assign_ptr)];
char dummy27[sizeof (stmt_assign_ptr)];
// stmt_break
char dummy27[sizeof (stmt_break_ptr)];
char dummy28[sizeof (stmt_break_ptr)];
// stmt_breakpoint
char dummy28[sizeof (stmt_breakpoint_ptr)];
char dummy29[sizeof (stmt_breakpoint_ptr)];
// stmt_call
char dummy29[sizeof (stmt_call_ptr)];
char dummy30[sizeof (stmt_call_ptr)];
// stmt_case
char dummy30[sizeof (stmt_case_ptr)];
char dummy31[sizeof (stmt_case_ptr)];
// stmt_continue
char dummy31[sizeof (stmt_continue_ptr)];
char dummy32[sizeof (stmt_continue_ptr)];
// stmt_default
char dummy32[sizeof (stmt_default_ptr)];
char dummy33[sizeof (stmt_default_ptr)];
// stmt_endon
char dummy33[sizeof (stmt_endon_ptr)];
char dummy34[sizeof (stmt_endon_ptr)];
// stmt_for
char dummy34[sizeof (stmt_for_ptr)];
char dummy35[sizeof (stmt_for_ptr)];
// stmt_foreach
char dummy35[sizeof (stmt_foreach_ptr)];
char dummy36[sizeof (stmt_foreach_ptr)];
// stmt_if
char dummy36[sizeof (stmt_if_ptr)];
char dummy37[sizeof (stmt_if_ptr)];
// stmt_ifelse
char dummy37[sizeof (stmt_ifelse_ptr)];
char dummy38[sizeof (stmt_ifelse_ptr)];
// stmt_block
// stmt_list
char dummy38[sizeof (stmt_list_ptr)];
char dummy39[sizeof (stmt_list_ptr)];
// stmt_notify
char dummy39[sizeof (stmt_notify_ptr)];
char dummy40[sizeof (stmt_notify_ptr)];
// stmt_prof_begin
char dummy40[sizeof (stmt_prof_begin_ptr)];
char dummy41[sizeof (stmt_prof_begin_ptr)];
// stmt_prof_end
char dummy41[sizeof (stmt_prof_end_ptr)];
char dummy42[sizeof (stmt_prof_end_ptr)];
// stmt
// for_stmt
char dummy42[sizeof (stmt_ptr)];
char dummy43[sizeof (stmt_ptr)];
// stmt_return
char dummy43[sizeof (stmt_return_ptr)];
char dummy44[sizeof (stmt_return_ptr)];
// stmt_switch
char dummy44[sizeof (stmt_switch_ptr)];
char dummy45[sizeof (stmt_switch_ptr)];
// stmt_wait
char dummy45[sizeof (stmt_wait_ptr)];
char dummy46[sizeof (stmt_wait_ptr)];
// stmt_waitframe
char dummy46[sizeof (stmt_waitframe_ptr)];
char dummy47[sizeof (stmt_waitframe_ptr)];
// stmt_waittill
char dummy47[sizeof (stmt_waittill_ptr)];
char dummy48[sizeof (stmt_waittill_ptr)];
// stmt_waittillframeend
char dummy48[sizeof (stmt_waittillframeend_ptr)];
char dummy49[sizeof (stmt_waittillframeend_ptr)];
// stmt_waittillmatch
char dummy49[sizeof (stmt_waittillmatch_ptr)];
char dummy50[sizeof (stmt_waittillmatch_ptr)];
// stmt_while
char dummy50[sizeof (stmt_while_ptr)];
char dummy51[sizeof (stmt_while_ptr)];
// string
char dummy51[sizeof (string_ptr)];
char dummy52[sizeof (string_ptr)];
// thisthread
char dummy52[sizeof (thisthread_ptr)];
char dummy53[sizeof (thisthread_ptr)];
// thread
char dummy53[sizeof (thread_ptr)];
char dummy54[sizeof (thread_ptr)];
// true
char dummy54[sizeof (true_ptr)];
char dummy55[sizeof (true_ptr)];
// undefined
char dummy55[sizeof (undefined_ptr)];
char dummy56[sizeof (undefined_ptr)];
// usingtree
char dummy56[sizeof (usingtree_ptr)];
char dummy57[sizeof (usingtree_ptr)];
// vector
char dummy57[sizeof (vector_ptr)];
char dummy58[sizeof (vector_ptr)];
};
/// The size of the largest semantic type.
@ -739,17 +744,21 @@ namespace xsk { namespace gsc { namespace h1 {
NAME = 86, // "identifier"
STRING = 87, // "string literal"
ISTRING = 88, // "localized string"
FLOAT = 89, // "float"
INTEGER = 90, // "int"
ADD_ARRAY = 91, // ADD_ARRAY
THEN = 92, // THEN
TERN = 93, // TERN
NEG = 94, // NEG
ANIMREF = 95, // ANIMREF
PREINC = 96, // PREINC
PREDEC = 97, // PREDEC
POSTINC = 98, // POSTINC
POSTDEC = 99 // POSTDEC
COLOR = 89, // "color"
FLOAT = 90, // "float"
INT_DEC = 91, // "int"
INT_OCT = 92, // "octal int"
INT_BIN = 93, // "binary int"
INT_HEX = 94, // "hexadecimal int"
ADD_ARRAY = 95, // ADD_ARRAY
THEN = 96, // THEN
TERN = 97, // TERN
NEG = 98, // NEG
ANIMREF = 99, // ANIMREF
PREINC = 100, // PREINC
PREDEC = 101, // PREDEC
POSTINC = 102, // POSTINC
POSTDEC = 103 // POSTDEC
};
/// Backward compatibility alias (Bison 3.6).
typedef token_kind_type yytokentype;
@ -766,7 +775,7 @@ namespace xsk { namespace gsc { namespace h1 {
{
enum symbol_kind_type
{
YYNTOKENS = 100, ///< Number of tokens.
YYNTOKENS = 104, ///< Number of tokens.
S_YYEMPTY = -2,
S_YYEOF = 0, // "end of file"
S_YYerror = 1, // error
@ -857,94 +866,97 @@ namespace xsk { namespace gsc { namespace h1 {
S_NAME = 86, // "identifier"
S_STRING = 87, // "string literal"
S_ISTRING = 88, // "localized string"
S_FLOAT = 89, // "float"
S_INTEGER = 90, // "int"
S_ADD_ARRAY = 91, // ADD_ARRAY
S_THEN = 92, // THEN
S_TERN = 93, // TERN
S_NEG = 94, // NEG
S_ANIMREF = 95, // ANIMREF
S_PREINC = 96, // PREINC
S_PREDEC = 97, // PREDEC
S_POSTINC = 98, // POSTINC
S_POSTDEC = 99, // POSTDEC
S_YYACCEPT = 100, // $accept
S_root = 101, // root
S_program = 102, // program
S_include = 103, // include
S_define = 104, // define
S_usingtree = 105, // usingtree
S_constant = 106, // constant
S_thread = 107, // thread
S_parameters = 108, // parameters
S_stmt = 109, // stmt
S_stmt_block = 110, // stmt_block
S_stmt_list = 111, // stmt_list
S_stmt_call = 112, // stmt_call
S_stmt_assign = 113, // stmt_assign
S_stmt_endon = 114, // stmt_endon
S_stmt_notify = 115, // stmt_notify
S_stmt_wait = 116, // stmt_wait
S_stmt_waittill = 117, // stmt_waittill
S_stmt_waittillmatch = 118, // stmt_waittillmatch
S_stmt_waittillframeend = 119, // stmt_waittillframeend
S_stmt_waitframe = 120, // stmt_waitframe
S_stmt_if = 121, // stmt_if
S_stmt_ifelse = 122, // stmt_ifelse
S_stmt_while = 123, // stmt_while
S_stmt_for = 124, // stmt_for
S_stmt_foreach = 125, // stmt_foreach
S_stmt_switch = 126, // stmt_switch
S_stmt_case = 127, // stmt_case
S_stmt_default = 128, // stmt_default
S_stmt_break = 129, // stmt_break
S_stmt_continue = 130, // stmt_continue
S_stmt_return = 131, // stmt_return
S_stmt_breakpoint = 132, // stmt_breakpoint
S_stmt_prof_begin = 133, // stmt_prof_begin
S_stmt_prof_end = 134, // stmt_prof_end
S_for_stmt = 135, // for_stmt
S_for_expr = 136, // for_expr
S_expr = 137, // expr
S_expr_assign = 138, // expr_assign
S_expr_compare = 139, // expr_compare
S_expr_ternary = 140, // expr_ternary
S_expr_binary = 141, // expr_binary
S_expr_primitive = 142, // expr_primitive
S_expr_call = 143, // expr_call
S_expr_call_thread = 144, // expr_call_thread
S_expr_call_childthread = 145, // expr_call_childthread
S_expr_call_function = 146, // expr_call_function
S_expr_call_pointer = 147, // expr_call_pointer
S_expr_arguments = 148, // expr_arguments
S_expr_arguments_filled = 149, // expr_arguments_filled
S_expr_arguments_empty = 150, // expr_arguments_empty
S_expr_function = 151, // expr_function
S_expr_add_array = 152, // expr_add_array
S_expr_array = 153, // expr_array
S_expr_field = 154, // expr_field
S_expr_size = 155, // expr_size
S_object = 156, // object
S_thisthread = 157, // thisthread
S_empty_array = 158, // empty_array
S_undefined = 159, // undefined
S_game = 160, // game
S_self = 161, // self
S_anim = 162, // anim
S_level = 163, // level
S_animation = 164, // animation
S_animtree = 165, // animtree
S_name = 166, // name
S_file = 167, // file
S_istring = 168, // istring
S_string = 169, // string
S_vector = 170, // vector
S_neg_float = 171, // neg_float
S_neg_integer = 172, // neg_integer
S_float = 173, // float
S_integer = 174, // integer
S_false = 175, // false
S_true = 176 // true
S_COLOR = 89, // "color"
S_FLOAT = 90, // "float"
S_INT_DEC = 91, // "int"
S_INT_OCT = 92, // "octal int"
S_INT_BIN = 93, // "binary int"
S_INT_HEX = 94, // "hexadecimal int"
S_ADD_ARRAY = 95, // ADD_ARRAY
S_THEN = 96, // THEN
S_TERN = 97, // TERN
S_NEG = 98, // NEG
S_ANIMREF = 99, // ANIMREF
S_PREINC = 100, // PREINC
S_PREDEC = 101, // PREDEC
S_POSTINC = 102, // POSTINC
S_POSTDEC = 103, // POSTDEC
S_YYACCEPT = 104, // $accept
S_root = 105, // root
S_program = 106, // program
S_include = 107, // include
S_define = 108, // define
S_usingtree = 109, // usingtree
S_constant = 110, // constant
S_thread = 111, // thread
S_parameters = 112, // parameters
S_stmt = 113, // stmt
S_stmt_block = 114, // stmt_block
S_stmt_list = 115, // stmt_list
S_stmt_call = 116, // stmt_call
S_stmt_assign = 117, // stmt_assign
S_stmt_endon = 118, // stmt_endon
S_stmt_notify = 119, // stmt_notify
S_stmt_wait = 120, // stmt_wait
S_stmt_waittill = 121, // stmt_waittill
S_stmt_waittillmatch = 122, // stmt_waittillmatch
S_stmt_waittillframeend = 123, // stmt_waittillframeend
S_stmt_waitframe = 124, // stmt_waitframe
S_stmt_if = 125, // stmt_if
S_stmt_ifelse = 126, // stmt_ifelse
S_stmt_while = 127, // stmt_while
S_stmt_for = 128, // stmt_for
S_stmt_foreach = 129, // stmt_foreach
S_stmt_switch = 130, // stmt_switch
S_stmt_case = 131, // stmt_case
S_stmt_default = 132, // stmt_default
S_stmt_break = 133, // stmt_break
S_stmt_continue = 134, // stmt_continue
S_stmt_return = 135, // stmt_return
S_stmt_breakpoint = 136, // stmt_breakpoint
S_stmt_prof_begin = 137, // stmt_prof_begin
S_stmt_prof_end = 138, // stmt_prof_end
S_for_stmt = 139, // for_stmt
S_for_expr = 140, // for_expr
S_expr = 141, // expr
S_expr_assign = 142, // expr_assign
S_expr_compare = 143, // expr_compare
S_expr_ternary = 144, // expr_ternary
S_expr_binary = 145, // expr_binary
S_expr_primitive = 146, // expr_primitive
S_expr_call = 147, // expr_call
S_expr_call_thread = 148, // expr_call_thread
S_expr_call_childthread = 149, // expr_call_childthread
S_expr_call_function = 150, // expr_call_function
S_expr_call_pointer = 151, // expr_call_pointer
S_expr_arguments = 152, // expr_arguments
S_expr_arguments_filled = 153, // expr_arguments_filled
S_expr_arguments_empty = 154, // expr_arguments_empty
S_expr_function = 155, // expr_function
S_expr_add_array = 156, // expr_add_array
S_expr_array = 157, // expr_array
S_expr_field = 158, // expr_field
S_expr_size = 159, // expr_size
S_object = 160, // object
S_float = 161, // float
S_integer = 162, // integer
S_thisthread = 163, // thisthread
S_empty_array = 164, // empty_array
S_undefined = 165, // undefined
S_game = 166, // game
S_self = 167, // self
S_anim = 168, // anim
S_level = 169, // level
S_animation = 170, // animation
S_animtree = 171, // animtree
S_name = 172, // name
S_file = 173, // file
S_istring = 174, // istring
S_string = 175, // string
S_color = 176, // color
S_vector = 177, // vector
S_false = 178, // false
S_true = 179 // true
};
};
@ -993,6 +1005,10 @@ namespace xsk { namespace gsc { namespace h1 {
value.move< animtree_ptr > (std::move (that.value));
break;
case symbol_kind::S_color: // color
value.move< color_ptr > (std::move (that.value));
break;
case symbol_kind::S_constant: // constant
value.move< constant_ptr > (std::move (that.value));
break;
@ -1043,7 +1059,6 @@ namespace xsk { namespace gsc { namespace h1 {
value.move< file_ptr > (std::move (that.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.move< float_ptr > (std::move (that.value));
break;
@ -1056,7 +1071,6 @@ namespace xsk { namespace gsc { namespace h1 {
value.move< include_ptr > (std::move (that.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.move< integer_ptr > (std::move (that.value));
break;
@ -1098,8 +1112,12 @@ namespace xsk { namespace gsc { namespace h1 {
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.move< std::string > (std::move (that.value));
break;
@ -1298,6 +1316,20 @@ namespace xsk { namespace gsc { namespace h1 {
{}
#endif
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, color_ptr&& v, location_type&& l)
: Base (t)
, value (std::move (v))
, location (std::move (l))
{}
#else
basic_symbol (typename Base::kind_type t, const color_ptr& v, const location_type& l)
: Base (t)
, value (v)
, location (l)
{}
#endif
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, constant_ptr&& v, location_type&& l)
: Base (t)
@ -2088,6 +2120,10 @@ switch (yykind)
value.template destroy< animtree_ptr > ();
break;
case symbol_kind::S_color: // color
value.template destroy< color_ptr > ();
break;
case symbol_kind::S_constant: // constant
value.template destroy< constant_ptr > ();
break;
@ -2138,7 +2174,6 @@ switch (yykind)
value.template destroy< file_ptr > ();
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.template destroy< float_ptr > ();
break;
@ -2151,7 +2186,6 @@ switch (yykind)
value.template destroy< include_ptr > ();
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.template destroy< integer_ptr > ();
break;
@ -2193,8 +2227,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.template destroy< std::string > ();
break;
@ -2434,7 +2472,7 @@ switch (yykind)
: super_type(token_type (tok), v, l)
#endif
{
H1_ASSERT ((token::FILE <= tok && tok <= token::INTEGER));
H1_ASSERT ((token::FILE <= tok && tok <= token::INT_HEX));
}
};
@ -3819,6 +3857,21 @@ switch (yykind)
return symbol_type (token::ISTRING, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_COLOR (std::string v, location_type l)
{
return symbol_type (token::COLOR, std::move (v), std::move (l));
}
#else
static
symbol_type
make_COLOR (const std::string& v, const location_type& l)
{
return symbol_type (token::COLOR, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
@ -3837,16 +3890,61 @@ switch (yykind)
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INTEGER (std::string v, location_type l)
make_INT_DEC (std::string v, location_type l)
{
return symbol_type (token::INTEGER, std::move (v), std::move (l));
return symbol_type (token::INT_DEC, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INTEGER (const std::string& v, const location_type& l)
make_INT_DEC (const std::string& v, const location_type& l)
{
return symbol_type (token::INTEGER, v, l);
return symbol_type (token::INT_DEC, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_OCT (std::string v, location_type l)
{
return symbol_type (token::INT_OCT, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_OCT (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_OCT, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_BIN (std::string v, location_type l)
{
return symbol_type (token::INT_BIN, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_BIN (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_BIN, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_HEX (std::string v, location_type l)
{
return symbol_type (token::INT_HEX, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_HEX (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_HEX, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
@ -4328,8 +4426,8 @@ switch (yykind)
/// Constants.
enum
{
yylast_ = 1842, ///< Last index in yytable_.
yynnts_ = 77, ///< Number of nonterminal symbols.
yylast_ = 1883, ///< Last index in yytable_.
yynnts_ = 76, ///< Number of nonterminal symbols.
yyfinal_ = 15 ///< Termination state number.
};
@ -4369,6 +4467,10 @@ switch (yykind)
value.copy< animtree_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_color: // color
value.copy< color_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_constant: // constant
value.copy< constant_ptr > (YY_MOVE (that.value));
break;
@ -4419,7 +4521,6 @@ switch (yykind)
value.copy< file_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.copy< float_ptr > (YY_MOVE (that.value));
break;
@ -4432,7 +4533,6 @@ switch (yykind)
value.copy< include_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.copy< integer_ptr > (YY_MOVE (that.value));
break;
@ -4474,8 +4574,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.copy< std::string > (YY_MOVE (that.value));
break;
@ -4650,6 +4754,10 @@ switch (yykind)
value.move< animtree_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_color: // color
value.move< color_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_constant: // constant
value.move< constant_ptr > (YY_MOVE (s.value));
break;
@ -4700,7 +4808,6 @@ switch (yykind)
value.move< file_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.move< float_ptr > (YY_MOVE (s.value));
break;
@ -4713,7 +4820,6 @@ switch (yykind)
value.move< include_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.move< integer_ptr > (YY_MOVE (s.value));
break;
@ -4755,8 +4861,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.move< std::string > (YY_MOVE (s.value));
break;
@ -4953,7 +5063,7 @@ switch (yykind)
#line 13 "parser.ypp"
} } } // xsk::gsc::h1
#line 4957 "parser.hpp"
#line 5067 "parser.hpp"

View File

@ -791,6 +791,7 @@ void compiler::emit_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr)
case gsc::node_t::data_name: emit_local_variable(ctx, expr.as_name); break;
case gsc::node_t::data_istring: emit_istring(ctx, expr.as_istring); break;
case gsc::node_t::data_string: emit_string(ctx, expr.as_string); break;
case gsc::node_t::data_color: emit_color(ctx, expr.as_color); break;
case gsc::node_t::data_vector: emit_vector(ctx, expr.as_vector); break;
case gsc::node_t::data_float: emit_float(ctx, expr.as_float); break;
case gsc::node_t::data_integer: emit_integer(ctx, expr.as_integer); break;
@ -1612,6 +1613,30 @@ void compiler::emit_string(const gsc::context_ptr& ctx, const gsc::string_ptr& s
emit_opcode(ctx, opcode::OP_GetString, str->value);
}
void compiler::emit_color(const gsc::context_ptr& ctx, const gsc::color_ptr& color)
{
std::vector<std::string> data;
std::string x, y, z;
if(color->value.size() == 3)
{
x = "0x" + color->value.substr(0, 1) + color->value.substr(0, 1);
y = "0x" + color->value.substr(1, 1) + color->value.substr(1, 1);
z = "0x" + color->value.substr(2, 1) + color->value.substr(2, 1);
}
else
{
x = "0x" + color->value.substr(0, 2);
y = "0x" + color->value.substr(2, 2);
z = "0x" + color->value.substr(4, 2);
}
data.push_back(gsc::utils::string::hex_to_dec(x.data()));
data.push_back(gsc::utils::string::hex_to_dec(y.data()));
data.push_back(gsc::utils::string::hex_to_dec(z.data()));
emit_opcode(ctx, opcode::OP_GetVector, data);
}
void compiler::emit_vector(const gsc::context_ptr& ctx, const gsc::vector_ptr& vec)
{
std::vector<std::string> data;

View File

@ -102,6 +102,7 @@ private:
void emit_animation(const gsc::context_ptr& ctx, const gsc::animation_ptr& animation);
void emit_istring(const gsc::context_ptr& ctx, const gsc::istring_ptr& str);
void emit_string(const gsc::context_ptr& ctx, const gsc::string_ptr& str);
void emit_color(const gsc::context_ptr& ctx, const gsc::color_ptr& color);
void emit_vector(const gsc::context_ptr& ctx, const gsc::vector_ptr& vec);
void emit_float(const gsc::context_ptr& ctx, const gsc::float_ptr& num);
void emit_integer(const gsc::context_ptr& ctx, const gsc::integer_ptr& num);

File diff suppressed because it is too large Load Diff

View File

@ -700,7 +700,7 @@ extern int yylex (yyscan_t yyscanner);
#undef yyTABLES_NAME
#endif
#line 150 "lexer.lpp"
#line 158 "lexer.lpp"
#line 706 "lexer.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -417,31 +417,34 @@ namespace xsk { namespace gsc { namespace h2 {
// animtree
char dummy3[sizeof (animtree_ptr)];
// color
char dummy4[sizeof (color_ptr)];
// constant
char dummy4[sizeof (constant_ptr)];
char dummy5[sizeof (constant_ptr)];
// define
char dummy5[sizeof (define_ptr)];
char dummy6[sizeof (define_ptr)];
// empty_array
char dummy6[sizeof (empty_array_ptr)];
char dummy7[sizeof (empty_array_ptr)];
// expr_arguments
// expr_arguments_filled
// expr_arguments_empty
char dummy7[sizeof (expr_arguments_ptr)];
char dummy8[sizeof (expr_arguments_ptr)];
// expr_assign
char dummy8[sizeof (expr_assign_ptr)];
char dummy9[sizeof (expr_assign_ptr)];
// expr_call
// expr_call_thread
// expr_call_childthread
char dummy9[sizeof (expr_call_ptr)];
char dummy10[sizeof (expr_call_ptr)];
// expr_call_function
// expr_call_pointer
char dummy10[sizeof (expr_call_type_ptr)];
char dummy11[sizeof (expr_call_type_ptr)];
// for_expr
// expr
@ -449,36 +452,34 @@ namespace xsk { namespace gsc { namespace h2 {
// expr_ternary
// expr_binary
// expr_primitive
char dummy11[sizeof (expr_ptr)];
char dummy12[sizeof (expr_ptr)];
// false
char dummy12[sizeof (false_ptr)];
char dummy13[sizeof (false_ptr)];
// file
char dummy13[sizeof (file_ptr)];
char dummy14[sizeof (file_ptr)];
// neg_float
// float
char dummy14[sizeof (float_ptr)];
char dummy15[sizeof (float_ptr)];
// game
char dummy15[sizeof (game_ptr)];
char dummy16[sizeof (game_ptr)];
// include
char dummy16[sizeof (include_ptr)];
char dummy17[sizeof (include_ptr)];
// neg_integer
// integer
char dummy17[sizeof (integer_ptr)];
char dummy18[sizeof (integer_ptr)];
// istring
char dummy18[sizeof (istring_ptr)];
char dummy19[sizeof (istring_ptr)];
// level
char dummy19[sizeof (level_ptr)];
char dummy20[sizeof (level_ptr)];
// name
char dummy20[sizeof (name_ptr)];
char dummy21[sizeof (name_ptr)];
// expr_function
// expr_add_array
@ -486,122 +487,126 @@ namespace xsk { namespace gsc { namespace h2 {
// expr_field
// expr_size
// object
char dummy21[sizeof (node_ptr)];
char dummy22[sizeof (node_ptr)];
// parameters
char dummy22[sizeof (parameters_ptr)];
char dummy23[sizeof (parameters_ptr)];
// program
char dummy23[sizeof (program_ptr)];
char dummy24[sizeof (program_ptr)];
// self
char dummy24[sizeof (self_ptr)];
char dummy25[sizeof (self_ptr)];
// "file path"
// "identifier"
// "string literal"
// "localized string"
// "color"
// "float"
// "int"
char dummy25[sizeof (std::string)];
// "octal int"
// "binary int"
// "hexadecimal int"
char dummy26[sizeof (std::string)];
// stmt_assign
char dummy26[sizeof (stmt_assign_ptr)];
char dummy27[sizeof (stmt_assign_ptr)];
// stmt_break
char dummy27[sizeof (stmt_break_ptr)];
char dummy28[sizeof (stmt_break_ptr)];
// stmt_breakpoint
char dummy28[sizeof (stmt_breakpoint_ptr)];
char dummy29[sizeof (stmt_breakpoint_ptr)];
// stmt_call
char dummy29[sizeof (stmt_call_ptr)];
char dummy30[sizeof (stmt_call_ptr)];
// stmt_case
char dummy30[sizeof (stmt_case_ptr)];
char dummy31[sizeof (stmt_case_ptr)];
// stmt_continue
char dummy31[sizeof (stmt_continue_ptr)];
char dummy32[sizeof (stmt_continue_ptr)];
// stmt_default
char dummy32[sizeof (stmt_default_ptr)];
char dummy33[sizeof (stmt_default_ptr)];
// stmt_endon
char dummy33[sizeof (stmt_endon_ptr)];
char dummy34[sizeof (stmt_endon_ptr)];
// stmt_for
char dummy34[sizeof (stmt_for_ptr)];
char dummy35[sizeof (stmt_for_ptr)];
// stmt_foreach
char dummy35[sizeof (stmt_foreach_ptr)];
char dummy36[sizeof (stmt_foreach_ptr)];
// stmt_if
char dummy36[sizeof (stmt_if_ptr)];
char dummy37[sizeof (stmt_if_ptr)];
// stmt_ifelse
char dummy37[sizeof (stmt_ifelse_ptr)];
char dummy38[sizeof (stmt_ifelse_ptr)];
// stmt_block
// stmt_list
char dummy38[sizeof (stmt_list_ptr)];
char dummy39[sizeof (stmt_list_ptr)];
// stmt_notify
char dummy39[sizeof (stmt_notify_ptr)];
char dummy40[sizeof (stmt_notify_ptr)];
// stmt_prof_begin
char dummy40[sizeof (stmt_prof_begin_ptr)];
char dummy41[sizeof (stmt_prof_begin_ptr)];
// stmt_prof_end
char dummy41[sizeof (stmt_prof_end_ptr)];
char dummy42[sizeof (stmt_prof_end_ptr)];
// stmt
// for_stmt
char dummy42[sizeof (stmt_ptr)];
char dummy43[sizeof (stmt_ptr)];
// stmt_return
char dummy43[sizeof (stmt_return_ptr)];
char dummy44[sizeof (stmt_return_ptr)];
// stmt_switch
char dummy44[sizeof (stmt_switch_ptr)];
char dummy45[sizeof (stmt_switch_ptr)];
// stmt_wait
char dummy45[sizeof (stmt_wait_ptr)];
char dummy46[sizeof (stmt_wait_ptr)];
// stmt_waitframe
char dummy46[sizeof (stmt_waitframe_ptr)];
char dummy47[sizeof (stmt_waitframe_ptr)];
// stmt_waittill
char dummy47[sizeof (stmt_waittill_ptr)];
char dummy48[sizeof (stmt_waittill_ptr)];
// stmt_waittillframeend
char dummy48[sizeof (stmt_waittillframeend_ptr)];
char dummy49[sizeof (stmt_waittillframeend_ptr)];
// stmt_waittillmatch
char dummy49[sizeof (stmt_waittillmatch_ptr)];
char dummy50[sizeof (stmt_waittillmatch_ptr)];
// stmt_while
char dummy50[sizeof (stmt_while_ptr)];
char dummy51[sizeof (stmt_while_ptr)];
// string
char dummy51[sizeof (string_ptr)];
char dummy52[sizeof (string_ptr)];
// thisthread
char dummy52[sizeof (thisthread_ptr)];
char dummy53[sizeof (thisthread_ptr)];
// thread
char dummy53[sizeof (thread_ptr)];
char dummy54[sizeof (thread_ptr)];
// true
char dummy54[sizeof (true_ptr)];
char dummy55[sizeof (true_ptr)];
// undefined
char dummy55[sizeof (undefined_ptr)];
char dummy56[sizeof (undefined_ptr)];
// usingtree
char dummy56[sizeof (usingtree_ptr)];
char dummy57[sizeof (usingtree_ptr)];
// vector
char dummy57[sizeof (vector_ptr)];
char dummy58[sizeof (vector_ptr)];
};
/// The size of the largest semantic type.
@ -739,17 +744,21 @@ namespace xsk { namespace gsc { namespace h2 {
NAME = 86, // "identifier"
STRING = 87, // "string literal"
ISTRING = 88, // "localized string"
FLOAT = 89, // "float"
INTEGER = 90, // "int"
ADD_ARRAY = 91, // ADD_ARRAY
THEN = 92, // THEN
TERN = 93, // TERN
NEG = 94, // NEG
ANIMREF = 95, // ANIMREF
PREINC = 96, // PREINC
PREDEC = 97, // PREDEC
POSTINC = 98, // POSTINC
POSTDEC = 99 // POSTDEC
COLOR = 89, // "color"
FLOAT = 90, // "float"
INT_DEC = 91, // "int"
INT_OCT = 92, // "octal int"
INT_BIN = 93, // "binary int"
INT_HEX = 94, // "hexadecimal int"
ADD_ARRAY = 95, // ADD_ARRAY
THEN = 96, // THEN
TERN = 97, // TERN
NEG = 98, // NEG
ANIMREF = 99, // ANIMREF
PREINC = 100, // PREINC
PREDEC = 101, // PREDEC
POSTINC = 102, // POSTINC
POSTDEC = 103 // POSTDEC
};
/// Backward compatibility alias (Bison 3.6).
typedef token_kind_type yytokentype;
@ -766,7 +775,7 @@ namespace xsk { namespace gsc { namespace h2 {
{
enum symbol_kind_type
{
YYNTOKENS = 100, ///< Number of tokens.
YYNTOKENS = 104, ///< Number of tokens.
S_YYEMPTY = -2,
S_YYEOF = 0, // "end of file"
S_YYerror = 1, // error
@ -857,94 +866,97 @@ namespace xsk { namespace gsc { namespace h2 {
S_NAME = 86, // "identifier"
S_STRING = 87, // "string literal"
S_ISTRING = 88, // "localized string"
S_FLOAT = 89, // "float"
S_INTEGER = 90, // "int"
S_ADD_ARRAY = 91, // ADD_ARRAY
S_THEN = 92, // THEN
S_TERN = 93, // TERN
S_NEG = 94, // NEG
S_ANIMREF = 95, // ANIMREF
S_PREINC = 96, // PREINC
S_PREDEC = 97, // PREDEC
S_POSTINC = 98, // POSTINC
S_POSTDEC = 99, // POSTDEC
S_YYACCEPT = 100, // $accept
S_root = 101, // root
S_program = 102, // program
S_include = 103, // include
S_define = 104, // define
S_usingtree = 105, // usingtree
S_constant = 106, // constant
S_thread = 107, // thread
S_parameters = 108, // parameters
S_stmt = 109, // stmt
S_stmt_block = 110, // stmt_block
S_stmt_list = 111, // stmt_list
S_stmt_call = 112, // stmt_call
S_stmt_assign = 113, // stmt_assign
S_stmt_endon = 114, // stmt_endon
S_stmt_notify = 115, // stmt_notify
S_stmt_wait = 116, // stmt_wait
S_stmt_waittill = 117, // stmt_waittill
S_stmt_waittillmatch = 118, // stmt_waittillmatch
S_stmt_waittillframeend = 119, // stmt_waittillframeend
S_stmt_waitframe = 120, // stmt_waitframe
S_stmt_if = 121, // stmt_if
S_stmt_ifelse = 122, // stmt_ifelse
S_stmt_while = 123, // stmt_while
S_stmt_for = 124, // stmt_for
S_stmt_foreach = 125, // stmt_foreach
S_stmt_switch = 126, // stmt_switch
S_stmt_case = 127, // stmt_case
S_stmt_default = 128, // stmt_default
S_stmt_break = 129, // stmt_break
S_stmt_continue = 130, // stmt_continue
S_stmt_return = 131, // stmt_return
S_stmt_breakpoint = 132, // stmt_breakpoint
S_stmt_prof_begin = 133, // stmt_prof_begin
S_stmt_prof_end = 134, // stmt_prof_end
S_for_stmt = 135, // for_stmt
S_for_expr = 136, // for_expr
S_expr = 137, // expr
S_expr_assign = 138, // expr_assign
S_expr_compare = 139, // expr_compare
S_expr_ternary = 140, // expr_ternary
S_expr_binary = 141, // expr_binary
S_expr_primitive = 142, // expr_primitive
S_expr_call = 143, // expr_call
S_expr_call_thread = 144, // expr_call_thread
S_expr_call_childthread = 145, // expr_call_childthread
S_expr_call_function = 146, // expr_call_function
S_expr_call_pointer = 147, // expr_call_pointer
S_expr_arguments = 148, // expr_arguments
S_expr_arguments_filled = 149, // expr_arguments_filled
S_expr_arguments_empty = 150, // expr_arguments_empty
S_expr_function = 151, // expr_function
S_expr_add_array = 152, // expr_add_array
S_expr_array = 153, // expr_array
S_expr_field = 154, // expr_field
S_expr_size = 155, // expr_size
S_object = 156, // object
S_thisthread = 157, // thisthread
S_empty_array = 158, // empty_array
S_undefined = 159, // undefined
S_game = 160, // game
S_self = 161, // self
S_anim = 162, // anim
S_level = 163, // level
S_animation = 164, // animation
S_animtree = 165, // animtree
S_name = 166, // name
S_file = 167, // file
S_istring = 168, // istring
S_string = 169, // string
S_vector = 170, // vector
S_neg_float = 171, // neg_float
S_neg_integer = 172, // neg_integer
S_float = 173, // float
S_integer = 174, // integer
S_false = 175, // false
S_true = 176 // true
S_COLOR = 89, // "color"
S_FLOAT = 90, // "float"
S_INT_DEC = 91, // "int"
S_INT_OCT = 92, // "octal int"
S_INT_BIN = 93, // "binary int"
S_INT_HEX = 94, // "hexadecimal int"
S_ADD_ARRAY = 95, // ADD_ARRAY
S_THEN = 96, // THEN
S_TERN = 97, // TERN
S_NEG = 98, // NEG
S_ANIMREF = 99, // ANIMREF
S_PREINC = 100, // PREINC
S_PREDEC = 101, // PREDEC
S_POSTINC = 102, // POSTINC
S_POSTDEC = 103, // POSTDEC
S_YYACCEPT = 104, // $accept
S_root = 105, // root
S_program = 106, // program
S_include = 107, // include
S_define = 108, // define
S_usingtree = 109, // usingtree
S_constant = 110, // constant
S_thread = 111, // thread
S_parameters = 112, // parameters
S_stmt = 113, // stmt
S_stmt_block = 114, // stmt_block
S_stmt_list = 115, // stmt_list
S_stmt_call = 116, // stmt_call
S_stmt_assign = 117, // stmt_assign
S_stmt_endon = 118, // stmt_endon
S_stmt_notify = 119, // stmt_notify
S_stmt_wait = 120, // stmt_wait
S_stmt_waittill = 121, // stmt_waittill
S_stmt_waittillmatch = 122, // stmt_waittillmatch
S_stmt_waittillframeend = 123, // stmt_waittillframeend
S_stmt_waitframe = 124, // stmt_waitframe
S_stmt_if = 125, // stmt_if
S_stmt_ifelse = 126, // stmt_ifelse
S_stmt_while = 127, // stmt_while
S_stmt_for = 128, // stmt_for
S_stmt_foreach = 129, // stmt_foreach
S_stmt_switch = 130, // stmt_switch
S_stmt_case = 131, // stmt_case
S_stmt_default = 132, // stmt_default
S_stmt_break = 133, // stmt_break
S_stmt_continue = 134, // stmt_continue
S_stmt_return = 135, // stmt_return
S_stmt_breakpoint = 136, // stmt_breakpoint
S_stmt_prof_begin = 137, // stmt_prof_begin
S_stmt_prof_end = 138, // stmt_prof_end
S_for_stmt = 139, // for_stmt
S_for_expr = 140, // for_expr
S_expr = 141, // expr
S_expr_assign = 142, // expr_assign
S_expr_compare = 143, // expr_compare
S_expr_ternary = 144, // expr_ternary
S_expr_binary = 145, // expr_binary
S_expr_primitive = 146, // expr_primitive
S_expr_call = 147, // expr_call
S_expr_call_thread = 148, // expr_call_thread
S_expr_call_childthread = 149, // expr_call_childthread
S_expr_call_function = 150, // expr_call_function
S_expr_call_pointer = 151, // expr_call_pointer
S_expr_arguments = 152, // expr_arguments
S_expr_arguments_filled = 153, // expr_arguments_filled
S_expr_arguments_empty = 154, // expr_arguments_empty
S_expr_function = 155, // expr_function
S_expr_add_array = 156, // expr_add_array
S_expr_array = 157, // expr_array
S_expr_field = 158, // expr_field
S_expr_size = 159, // expr_size
S_object = 160, // object
S_float = 161, // float
S_integer = 162, // integer
S_thisthread = 163, // thisthread
S_empty_array = 164, // empty_array
S_undefined = 165, // undefined
S_game = 166, // game
S_self = 167, // self
S_anim = 168, // anim
S_level = 169, // level
S_animation = 170, // animation
S_animtree = 171, // animtree
S_name = 172, // name
S_file = 173, // file
S_istring = 174, // istring
S_string = 175, // string
S_color = 176, // color
S_vector = 177, // vector
S_false = 178, // false
S_true = 179 // true
};
};
@ -993,6 +1005,10 @@ namespace xsk { namespace gsc { namespace h2 {
value.move< animtree_ptr > (std::move (that.value));
break;
case symbol_kind::S_color: // color
value.move< color_ptr > (std::move (that.value));
break;
case symbol_kind::S_constant: // constant
value.move< constant_ptr > (std::move (that.value));
break;
@ -1043,7 +1059,6 @@ namespace xsk { namespace gsc { namespace h2 {
value.move< file_ptr > (std::move (that.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.move< float_ptr > (std::move (that.value));
break;
@ -1056,7 +1071,6 @@ namespace xsk { namespace gsc { namespace h2 {
value.move< include_ptr > (std::move (that.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.move< integer_ptr > (std::move (that.value));
break;
@ -1098,8 +1112,12 @@ namespace xsk { namespace gsc { namespace h2 {
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.move< std::string > (std::move (that.value));
break;
@ -1298,6 +1316,20 @@ namespace xsk { namespace gsc { namespace h2 {
{}
#endif
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, color_ptr&& v, location_type&& l)
: Base (t)
, value (std::move (v))
, location (std::move (l))
{}
#else
basic_symbol (typename Base::kind_type t, const color_ptr& v, const location_type& l)
: Base (t)
, value (v)
, location (l)
{}
#endif
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, constant_ptr&& v, location_type&& l)
: Base (t)
@ -2088,6 +2120,10 @@ switch (yykind)
value.template destroy< animtree_ptr > ();
break;
case symbol_kind::S_color: // color
value.template destroy< color_ptr > ();
break;
case symbol_kind::S_constant: // constant
value.template destroy< constant_ptr > ();
break;
@ -2138,7 +2174,6 @@ switch (yykind)
value.template destroy< file_ptr > ();
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.template destroy< float_ptr > ();
break;
@ -2151,7 +2186,6 @@ switch (yykind)
value.template destroy< include_ptr > ();
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.template destroy< integer_ptr > ();
break;
@ -2193,8 +2227,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.template destroy< std::string > ();
break;
@ -2434,7 +2472,7 @@ switch (yykind)
: super_type(token_type (tok), v, l)
#endif
{
H2_ASSERT ((token::FILE <= tok && tok <= token::INTEGER));
H2_ASSERT ((token::FILE <= tok && tok <= token::INT_HEX));
}
};
@ -3819,6 +3857,21 @@ switch (yykind)
return symbol_type (token::ISTRING, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_COLOR (std::string v, location_type l)
{
return symbol_type (token::COLOR, std::move (v), std::move (l));
}
#else
static
symbol_type
make_COLOR (const std::string& v, const location_type& l)
{
return symbol_type (token::COLOR, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
@ -3837,16 +3890,61 @@ switch (yykind)
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INTEGER (std::string v, location_type l)
make_INT_DEC (std::string v, location_type l)
{
return symbol_type (token::INTEGER, std::move (v), std::move (l));
return symbol_type (token::INT_DEC, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INTEGER (const std::string& v, const location_type& l)
make_INT_DEC (const std::string& v, const location_type& l)
{
return symbol_type (token::INTEGER, v, l);
return symbol_type (token::INT_DEC, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_OCT (std::string v, location_type l)
{
return symbol_type (token::INT_OCT, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_OCT (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_OCT, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_BIN (std::string v, location_type l)
{
return symbol_type (token::INT_BIN, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_BIN (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_BIN, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_HEX (std::string v, location_type l)
{
return symbol_type (token::INT_HEX, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_HEX (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_HEX, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
@ -4328,8 +4426,8 @@ switch (yykind)
/// Constants.
enum
{
yylast_ = 1842, ///< Last index in yytable_.
yynnts_ = 77, ///< Number of nonterminal symbols.
yylast_ = 1883, ///< Last index in yytable_.
yynnts_ = 76, ///< Number of nonterminal symbols.
yyfinal_ = 15 ///< Termination state number.
};
@ -4369,6 +4467,10 @@ switch (yykind)
value.copy< animtree_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_color: // color
value.copy< color_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_constant: // constant
value.copy< constant_ptr > (YY_MOVE (that.value));
break;
@ -4419,7 +4521,6 @@ switch (yykind)
value.copy< file_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.copy< float_ptr > (YY_MOVE (that.value));
break;
@ -4432,7 +4533,6 @@ switch (yykind)
value.copy< include_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.copy< integer_ptr > (YY_MOVE (that.value));
break;
@ -4474,8 +4574,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.copy< std::string > (YY_MOVE (that.value));
break;
@ -4650,6 +4754,10 @@ switch (yykind)
value.move< animtree_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_color: // color
value.move< color_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_constant: // constant
value.move< constant_ptr > (YY_MOVE (s.value));
break;
@ -4700,7 +4808,6 @@ switch (yykind)
value.move< file_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.move< float_ptr > (YY_MOVE (s.value));
break;
@ -4713,7 +4820,6 @@ switch (yykind)
value.move< include_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.move< integer_ptr > (YY_MOVE (s.value));
break;
@ -4755,8 +4861,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.move< std::string > (YY_MOVE (s.value));
break;
@ -4953,7 +5063,7 @@ switch (yykind)
#line 13 "parser.ypp"
} } } // xsk::gsc::h2
#line 4957 "parser.hpp"
#line 5067 "parser.hpp"

View File

@ -785,6 +785,7 @@ void compiler::emit_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr)
case gsc::node_t::data_name: emit_local_variable(ctx, expr.as_name); break;
case gsc::node_t::data_istring: emit_istring(ctx, expr.as_istring); break;
case gsc::node_t::data_string: emit_string(ctx, expr.as_string); break;
case gsc::node_t::data_color: emit_color(ctx, expr.as_color); break;
case gsc::node_t::data_vector: emit_vector(ctx, expr.as_vector); break;
case gsc::node_t::data_float: emit_float(ctx, expr.as_float); break;
case gsc::node_t::data_integer: emit_integer(ctx, expr.as_integer); break;
@ -1606,6 +1607,30 @@ void compiler::emit_string(const gsc::context_ptr& ctx, const gsc::string_ptr& s
emit_opcode(ctx, opcode::OP_GetString, str->value);
}
void compiler::emit_color(const gsc::context_ptr& ctx, const gsc::color_ptr& color)
{
std::vector<std::string> data;
std::string x, y, z;
if(color->value.size() == 3)
{
x = "0x" + color->value.substr(0, 1) + color->value.substr(0, 1);
y = "0x" + color->value.substr(1, 1) + color->value.substr(1, 1);
z = "0x" + color->value.substr(2, 1) + color->value.substr(2, 1);
}
else
{
x = "0x" + color->value.substr(0, 2);
y = "0x" + color->value.substr(2, 2);
z = "0x" + color->value.substr(4, 2);
}
data.push_back(gsc::utils::string::hex_to_dec(x.data()));
data.push_back(gsc::utils::string::hex_to_dec(y.data()));
data.push_back(gsc::utils::string::hex_to_dec(z.data()));
emit_opcode(ctx, opcode::OP_GetVector, data);
}
void compiler::emit_vector(const gsc::context_ptr& ctx, const gsc::vector_ptr& vec)
{
std::vector<std::string> data;

View File

@ -101,6 +101,7 @@ private:
void emit_animation(const gsc::context_ptr& ctx, const gsc::animation_ptr& animation);
void emit_istring(const gsc::context_ptr& ctx, const gsc::istring_ptr& str);
void emit_string(const gsc::context_ptr& ctx, const gsc::string_ptr& str);
void emit_color(const gsc::context_ptr& ctx, const gsc::color_ptr& color);
void emit_vector(const gsc::context_ptr& ctx, const gsc::vector_ptr& vec);
void emit_float(const gsc::context_ptr& ctx, const gsc::float_ptr& num);
void emit_integer(const gsc::context_ptr& ctx, const gsc::integer_ptr& num);

File diff suppressed because it is too large Load Diff

View File

@ -700,7 +700,7 @@ extern int yylex (yyscan_t yyscanner);
#undef yyTABLES_NAME
#endif
#line 149 "lexer.lpp"
#line 157 "lexer.lpp"
#line 706 "lexer.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -417,31 +417,34 @@ namespace xsk { namespace gsc { namespace iw5 {
// animtree
char dummy3[sizeof (animtree_ptr)];
// color
char dummy4[sizeof (color_ptr)];
// constant
char dummy4[sizeof (constant_ptr)];
char dummy5[sizeof (constant_ptr)];
// define
char dummy5[sizeof (define_ptr)];
char dummy6[sizeof (define_ptr)];
// empty_array
char dummy6[sizeof (empty_array_ptr)];
char dummy7[sizeof (empty_array_ptr)];
// expr_arguments
// expr_arguments_filled
// expr_arguments_empty
char dummy7[sizeof (expr_arguments_ptr)];
char dummy8[sizeof (expr_arguments_ptr)];
// expr_assign
char dummy8[sizeof (expr_assign_ptr)];
char dummy9[sizeof (expr_assign_ptr)];
// expr_call
// expr_call_thread
// expr_call_childthread
char dummy9[sizeof (expr_call_ptr)];
char dummy10[sizeof (expr_call_ptr)];
// expr_call_function
// expr_call_pointer
char dummy10[sizeof (expr_call_type_ptr)];
char dummy11[sizeof (expr_call_type_ptr)];
// for_expr
// expr
@ -449,36 +452,34 @@ namespace xsk { namespace gsc { namespace iw5 {
// expr_ternary
// expr_binary
// expr_primitive
char dummy11[sizeof (expr_ptr)];
char dummy12[sizeof (expr_ptr)];
// false
char dummy12[sizeof (false_ptr)];
char dummy13[sizeof (false_ptr)];
// file
char dummy13[sizeof (file_ptr)];
char dummy14[sizeof (file_ptr)];
// neg_float
// float
char dummy14[sizeof (float_ptr)];
char dummy15[sizeof (float_ptr)];
// game
char dummy15[sizeof (game_ptr)];
char dummy16[sizeof (game_ptr)];
// include
char dummy16[sizeof (include_ptr)];
char dummy17[sizeof (include_ptr)];
// neg_integer
// integer
char dummy17[sizeof (integer_ptr)];
char dummy18[sizeof (integer_ptr)];
// istring
char dummy18[sizeof (istring_ptr)];
char dummy19[sizeof (istring_ptr)];
// level
char dummy19[sizeof (level_ptr)];
char dummy20[sizeof (level_ptr)];
// name
char dummy20[sizeof (name_ptr)];
char dummy21[sizeof (name_ptr)];
// expr_function
// expr_add_array
@ -486,119 +487,123 @@ namespace xsk { namespace gsc { namespace iw5 {
// expr_field
// expr_size
// object
char dummy21[sizeof (node_ptr)];
char dummy22[sizeof (node_ptr)];
// parameters
char dummy22[sizeof (parameters_ptr)];
char dummy23[sizeof (parameters_ptr)];
// program
char dummy23[sizeof (program_ptr)];
char dummy24[sizeof (program_ptr)];
// self
char dummy24[sizeof (self_ptr)];
char dummy25[sizeof (self_ptr)];
// "file path"
// "identifier"
// "string literal"
// "localized string"
// "color"
// "float"
// "int"
char dummy25[sizeof (std::string)];
// "octal int"
// "binary int"
// "hexadecimal int"
char dummy26[sizeof (std::string)];
// stmt_assign
char dummy26[sizeof (stmt_assign_ptr)];
char dummy27[sizeof (stmt_assign_ptr)];
// stmt_break
char dummy27[sizeof (stmt_break_ptr)];
char dummy28[sizeof (stmt_break_ptr)];
// stmt_breakpoint
char dummy28[sizeof (stmt_breakpoint_ptr)];
char dummy29[sizeof (stmt_breakpoint_ptr)];
// stmt_call
char dummy29[sizeof (stmt_call_ptr)];
char dummy30[sizeof (stmt_call_ptr)];
// stmt_case
char dummy30[sizeof (stmt_case_ptr)];
char dummy31[sizeof (stmt_case_ptr)];
// stmt_continue
char dummy31[sizeof (stmt_continue_ptr)];
char dummy32[sizeof (stmt_continue_ptr)];
// stmt_default
char dummy32[sizeof (stmt_default_ptr)];
char dummy33[sizeof (stmt_default_ptr)];
// stmt_endon
char dummy33[sizeof (stmt_endon_ptr)];
char dummy34[sizeof (stmt_endon_ptr)];
// stmt_for
char dummy34[sizeof (stmt_for_ptr)];
char dummy35[sizeof (stmt_for_ptr)];
// stmt_foreach
char dummy35[sizeof (stmt_foreach_ptr)];
char dummy36[sizeof (stmt_foreach_ptr)];
// stmt_if
char dummy36[sizeof (stmt_if_ptr)];
char dummy37[sizeof (stmt_if_ptr)];
// stmt_ifelse
char dummy37[sizeof (stmt_ifelse_ptr)];
char dummy38[sizeof (stmt_ifelse_ptr)];
// stmt_block
// stmt_list
char dummy38[sizeof (stmt_list_ptr)];
char dummy39[sizeof (stmt_list_ptr)];
// stmt_notify
char dummy39[sizeof (stmt_notify_ptr)];
char dummy40[sizeof (stmt_notify_ptr)];
// stmt_prof_begin
char dummy40[sizeof (stmt_prof_begin_ptr)];
char dummy41[sizeof (stmt_prof_begin_ptr)];
// stmt_prof_end
char dummy41[sizeof (stmt_prof_end_ptr)];
char dummy42[sizeof (stmt_prof_end_ptr)];
// stmt
// for_stmt
char dummy42[sizeof (stmt_ptr)];
char dummy43[sizeof (stmt_ptr)];
// stmt_return
char dummy43[sizeof (stmt_return_ptr)];
char dummy44[sizeof (stmt_return_ptr)];
// stmt_switch
char dummy44[sizeof (stmt_switch_ptr)];
char dummy45[sizeof (stmt_switch_ptr)];
// stmt_wait
char dummy45[sizeof (stmt_wait_ptr)];
char dummy46[sizeof (stmt_wait_ptr)];
// stmt_waittill
char dummy46[sizeof (stmt_waittill_ptr)];
char dummy47[sizeof (stmt_waittill_ptr)];
// stmt_waittillframeend
char dummy47[sizeof (stmt_waittillframeend_ptr)];
char dummy48[sizeof (stmt_waittillframeend_ptr)];
// stmt_waittillmatch
char dummy48[sizeof (stmt_waittillmatch_ptr)];
char dummy49[sizeof (stmt_waittillmatch_ptr)];
// stmt_while
char dummy49[sizeof (stmt_while_ptr)];
char dummy50[sizeof (stmt_while_ptr)];
// string
char dummy50[sizeof (string_ptr)];
char dummy51[sizeof (string_ptr)];
// thisthread
char dummy51[sizeof (thisthread_ptr)];
char dummy52[sizeof (thisthread_ptr)];
// thread
char dummy52[sizeof (thread_ptr)];
char dummy53[sizeof (thread_ptr)];
// true
char dummy53[sizeof (true_ptr)];
char dummy54[sizeof (true_ptr)];
// undefined
char dummy54[sizeof (undefined_ptr)];
char dummy55[sizeof (undefined_ptr)];
// usingtree
char dummy55[sizeof (usingtree_ptr)];
char dummy56[sizeof (usingtree_ptr)];
// vector
char dummy56[sizeof (vector_ptr)];
char dummy57[sizeof (vector_ptr)];
};
/// The size of the largest semantic type.
@ -735,17 +740,21 @@ namespace xsk { namespace gsc { namespace iw5 {
NAME = 85, // "identifier"
STRING = 86, // "string literal"
ISTRING = 87, // "localized string"
FLOAT = 88, // "float"
INTEGER = 89, // "int"
ADD_ARRAY = 90, // ADD_ARRAY
THEN = 91, // THEN
TERN = 92, // TERN
NEG = 93, // NEG
ANIMREF = 94, // ANIMREF
PREINC = 95, // PREINC
PREDEC = 96, // PREDEC
POSTINC = 97, // POSTINC
POSTDEC = 98 // POSTDEC
COLOR = 88, // "color"
FLOAT = 89, // "float"
INT_DEC = 90, // "int"
INT_OCT = 91, // "octal int"
INT_BIN = 92, // "binary int"
INT_HEX = 93, // "hexadecimal int"
ADD_ARRAY = 94, // ADD_ARRAY
THEN = 95, // THEN
TERN = 96, // TERN
NEG = 97, // NEG
ANIMREF = 98, // ANIMREF
PREINC = 99, // PREINC
PREDEC = 100, // PREDEC
POSTINC = 101, // POSTINC
POSTDEC = 102 // POSTDEC
};
/// Backward compatibility alias (Bison 3.6).
typedef token_kind_type yytokentype;
@ -762,7 +771,7 @@ namespace xsk { namespace gsc { namespace iw5 {
{
enum symbol_kind_type
{
YYNTOKENS = 99, ///< Number of tokens.
YYNTOKENS = 103, ///< Number of tokens.
S_YYEMPTY = -2,
S_YYEOF = 0, // "end of file"
S_YYerror = 1, // error
@ -852,93 +861,96 @@ namespace xsk { namespace gsc { namespace iw5 {
S_NAME = 85, // "identifier"
S_STRING = 86, // "string literal"
S_ISTRING = 87, // "localized string"
S_FLOAT = 88, // "float"
S_INTEGER = 89, // "int"
S_ADD_ARRAY = 90, // ADD_ARRAY
S_THEN = 91, // THEN
S_TERN = 92, // TERN
S_NEG = 93, // NEG
S_ANIMREF = 94, // ANIMREF
S_PREINC = 95, // PREINC
S_PREDEC = 96, // PREDEC
S_POSTINC = 97, // POSTINC
S_POSTDEC = 98, // POSTDEC
S_YYACCEPT = 99, // $accept
S_root = 100, // root
S_program = 101, // program
S_include = 102, // include
S_define = 103, // define
S_usingtree = 104, // usingtree
S_constant = 105, // constant
S_thread = 106, // thread
S_parameters = 107, // parameters
S_stmt = 108, // stmt
S_stmt_block = 109, // stmt_block
S_stmt_list = 110, // stmt_list
S_stmt_call = 111, // stmt_call
S_stmt_assign = 112, // stmt_assign
S_stmt_endon = 113, // stmt_endon
S_stmt_notify = 114, // stmt_notify
S_stmt_wait = 115, // stmt_wait
S_stmt_waittill = 116, // stmt_waittill
S_stmt_waittillmatch = 117, // stmt_waittillmatch
S_stmt_waittillframeend = 118, // stmt_waittillframeend
S_stmt_if = 119, // stmt_if
S_stmt_ifelse = 120, // stmt_ifelse
S_stmt_while = 121, // stmt_while
S_stmt_for = 122, // stmt_for
S_stmt_foreach = 123, // stmt_foreach
S_stmt_switch = 124, // stmt_switch
S_stmt_case = 125, // stmt_case
S_stmt_default = 126, // stmt_default
S_stmt_break = 127, // stmt_break
S_stmt_continue = 128, // stmt_continue
S_stmt_return = 129, // stmt_return
S_stmt_breakpoint = 130, // stmt_breakpoint
S_stmt_prof_begin = 131, // stmt_prof_begin
S_stmt_prof_end = 132, // stmt_prof_end
S_for_stmt = 133, // for_stmt
S_for_expr = 134, // for_expr
S_expr = 135, // expr
S_expr_assign = 136, // expr_assign
S_expr_compare = 137, // expr_compare
S_expr_ternary = 138, // expr_ternary
S_expr_binary = 139, // expr_binary
S_expr_primitive = 140, // expr_primitive
S_expr_call = 141, // expr_call
S_expr_call_thread = 142, // expr_call_thread
S_expr_call_childthread = 143, // expr_call_childthread
S_expr_call_function = 144, // expr_call_function
S_expr_call_pointer = 145, // expr_call_pointer
S_expr_arguments = 146, // expr_arguments
S_expr_arguments_filled = 147, // expr_arguments_filled
S_expr_arguments_empty = 148, // expr_arguments_empty
S_expr_function = 149, // expr_function
S_expr_add_array = 150, // expr_add_array
S_expr_array = 151, // expr_array
S_expr_field = 152, // expr_field
S_expr_size = 153, // expr_size
S_object = 154, // object
S_thisthread = 155, // thisthread
S_empty_array = 156, // empty_array
S_undefined = 157, // undefined
S_game = 158, // game
S_self = 159, // self
S_anim = 160, // anim
S_level = 161, // level
S_animation = 162, // animation
S_animtree = 163, // animtree
S_name = 164, // name
S_file = 165, // file
S_istring = 166, // istring
S_string = 167, // string
S_vector = 168, // vector
S_neg_float = 169, // neg_float
S_neg_integer = 170, // neg_integer
S_float = 171, // float
S_integer = 172, // integer
S_false = 173, // false
S_true = 174 // true
S_COLOR = 88, // "color"
S_FLOAT = 89, // "float"
S_INT_DEC = 90, // "int"
S_INT_OCT = 91, // "octal int"
S_INT_BIN = 92, // "binary int"
S_INT_HEX = 93, // "hexadecimal int"
S_ADD_ARRAY = 94, // ADD_ARRAY
S_THEN = 95, // THEN
S_TERN = 96, // TERN
S_NEG = 97, // NEG
S_ANIMREF = 98, // ANIMREF
S_PREINC = 99, // PREINC
S_PREDEC = 100, // PREDEC
S_POSTINC = 101, // POSTINC
S_POSTDEC = 102, // POSTDEC
S_YYACCEPT = 103, // $accept
S_root = 104, // root
S_program = 105, // program
S_include = 106, // include
S_define = 107, // define
S_usingtree = 108, // usingtree
S_constant = 109, // constant
S_thread = 110, // thread
S_parameters = 111, // parameters
S_stmt = 112, // stmt
S_stmt_block = 113, // stmt_block
S_stmt_list = 114, // stmt_list
S_stmt_call = 115, // stmt_call
S_stmt_assign = 116, // stmt_assign
S_stmt_endon = 117, // stmt_endon
S_stmt_notify = 118, // stmt_notify
S_stmt_wait = 119, // stmt_wait
S_stmt_waittill = 120, // stmt_waittill
S_stmt_waittillmatch = 121, // stmt_waittillmatch
S_stmt_waittillframeend = 122, // stmt_waittillframeend
S_stmt_if = 123, // stmt_if
S_stmt_ifelse = 124, // stmt_ifelse
S_stmt_while = 125, // stmt_while
S_stmt_for = 126, // stmt_for
S_stmt_foreach = 127, // stmt_foreach
S_stmt_switch = 128, // stmt_switch
S_stmt_case = 129, // stmt_case
S_stmt_default = 130, // stmt_default
S_stmt_break = 131, // stmt_break
S_stmt_continue = 132, // stmt_continue
S_stmt_return = 133, // stmt_return
S_stmt_breakpoint = 134, // stmt_breakpoint
S_stmt_prof_begin = 135, // stmt_prof_begin
S_stmt_prof_end = 136, // stmt_prof_end
S_for_stmt = 137, // for_stmt
S_for_expr = 138, // for_expr
S_expr = 139, // expr
S_expr_assign = 140, // expr_assign
S_expr_compare = 141, // expr_compare
S_expr_ternary = 142, // expr_ternary
S_expr_binary = 143, // expr_binary
S_expr_primitive = 144, // expr_primitive
S_expr_call = 145, // expr_call
S_expr_call_thread = 146, // expr_call_thread
S_expr_call_childthread = 147, // expr_call_childthread
S_expr_call_function = 148, // expr_call_function
S_expr_call_pointer = 149, // expr_call_pointer
S_expr_arguments = 150, // expr_arguments
S_expr_arguments_filled = 151, // expr_arguments_filled
S_expr_arguments_empty = 152, // expr_arguments_empty
S_expr_function = 153, // expr_function
S_expr_add_array = 154, // expr_add_array
S_expr_array = 155, // expr_array
S_expr_field = 156, // expr_field
S_expr_size = 157, // expr_size
S_object = 158, // object
S_float = 159, // float
S_integer = 160, // integer
S_thisthread = 161, // thisthread
S_empty_array = 162, // empty_array
S_undefined = 163, // undefined
S_game = 164, // game
S_self = 165, // self
S_anim = 166, // anim
S_level = 167, // level
S_animation = 168, // animation
S_animtree = 169, // animtree
S_name = 170, // name
S_file = 171, // file
S_istring = 172, // istring
S_string = 173, // string
S_color = 174, // color
S_vector = 175, // vector
S_false = 176, // false
S_true = 177 // true
};
};
@ -987,6 +999,10 @@ namespace xsk { namespace gsc { namespace iw5 {
value.move< animtree_ptr > (std::move (that.value));
break;
case symbol_kind::S_color: // color
value.move< color_ptr > (std::move (that.value));
break;
case symbol_kind::S_constant: // constant
value.move< constant_ptr > (std::move (that.value));
break;
@ -1037,7 +1053,6 @@ namespace xsk { namespace gsc { namespace iw5 {
value.move< file_ptr > (std::move (that.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.move< float_ptr > (std::move (that.value));
break;
@ -1050,7 +1065,6 @@ namespace xsk { namespace gsc { namespace iw5 {
value.move< include_ptr > (std::move (that.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.move< integer_ptr > (std::move (that.value));
break;
@ -1092,8 +1106,12 @@ namespace xsk { namespace gsc { namespace iw5 {
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.move< std::string > (std::move (that.value));
break;
@ -1288,6 +1306,20 @@ namespace xsk { namespace gsc { namespace iw5 {
{}
#endif
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, color_ptr&& v, location_type&& l)
: Base (t)
, value (std::move (v))
, location (std::move (l))
{}
#else
basic_symbol (typename Base::kind_type t, const color_ptr& v, const location_type& l)
: Base (t)
, value (v)
, location (l)
{}
#endif
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, constant_ptr&& v, location_type&& l)
: Base (t)
@ -2064,6 +2096,10 @@ switch (yykind)
value.template destroy< animtree_ptr > ();
break;
case symbol_kind::S_color: // color
value.template destroy< color_ptr > ();
break;
case symbol_kind::S_constant: // constant
value.template destroy< constant_ptr > ();
break;
@ -2114,7 +2150,6 @@ switch (yykind)
value.template destroy< file_ptr > ();
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.template destroy< float_ptr > ();
break;
@ -2127,7 +2162,6 @@ switch (yykind)
value.template destroy< include_ptr > ();
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.template destroy< integer_ptr > ();
break;
@ -2169,8 +2203,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.template destroy< std::string > ();
break;
@ -2406,7 +2444,7 @@ switch (yykind)
: super_type(token_type (tok), v, l)
#endif
{
IW5_ASSERT ((token::FILE <= tok && tok <= token::INTEGER));
IW5_ASSERT ((token::FILE <= tok && tok <= token::INT_HEX));
}
};
@ -3776,6 +3814,21 @@ switch (yykind)
return symbol_type (token::ISTRING, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_COLOR (std::string v, location_type l)
{
return symbol_type (token::COLOR, std::move (v), std::move (l));
}
#else
static
symbol_type
make_COLOR (const std::string& v, const location_type& l)
{
return symbol_type (token::COLOR, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
@ -3794,16 +3847,61 @@ switch (yykind)
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INTEGER (std::string v, location_type l)
make_INT_DEC (std::string v, location_type l)
{
return symbol_type (token::INTEGER, std::move (v), std::move (l));
return symbol_type (token::INT_DEC, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INTEGER (const std::string& v, const location_type& l)
make_INT_DEC (const std::string& v, const location_type& l)
{
return symbol_type (token::INTEGER, v, l);
return symbol_type (token::INT_DEC, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_OCT (std::string v, location_type l)
{
return symbol_type (token::INT_OCT, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_OCT (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_OCT, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_BIN (std::string v, location_type l)
{
return symbol_type (token::INT_BIN, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_BIN (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_BIN, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_HEX (std::string v, location_type l)
{
return symbol_type (token::INT_HEX, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_HEX (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_HEX, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
@ -4285,8 +4383,8 @@ switch (yykind)
/// Constants.
enum
{
yylast_ = 1892, ///< Last index in yytable_.
yynnts_ = 76, ///< Number of nonterminal symbols.
yylast_ = 1813, ///< Last index in yytable_.
yynnts_ = 75, ///< Number of nonterminal symbols.
yyfinal_ = 15 ///< Termination state number.
};
@ -4326,6 +4424,10 @@ switch (yykind)
value.copy< animtree_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_color: // color
value.copy< color_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_constant: // constant
value.copy< constant_ptr > (YY_MOVE (that.value));
break;
@ -4376,7 +4478,6 @@ switch (yykind)
value.copy< file_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.copy< float_ptr > (YY_MOVE (that.value));
break;
@ -4389,7 +4490,6 @@ switch (yykind)
value.copy< include_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.copy< integer_ptr > (YY_MOVE (that.value));
break;
@ -4431,8 +4531,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.copy< std::string > (YY_MOVE (that.value));
break;
@ -4603,6 +4707,10 @@ switch (yykind)
value.move< animtree_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_color: // color
value.move< color_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_constant: // constant
value.move< constant_ptr > (YY_MOVE (s.value));
break;
@ -4653,7 +4761,6 @@ switch (yykind)
value.move< file_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.move< float_ptr > (YY_MOVE (s.value));
break;
@ -4666,7 +4773,6 @@ switch (yykind)
value.move< include_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.move< integer_ptr > (YY_MOVE (s.value));
break;
@ -4708,8 +4814,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.move< std::string > (YY_MOVE (s.value));
break;
@ -4902,7 +5012,7 @@ switch (yykind)
#line 13 "parser.ypp"
} } } // xsk::gsc::iw5
#line 4906 "parser.hpp"
#line 5016 "parser.hpp"

View File

@ -785,6 +785,7 @@ void compiler::emit_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr)
case gsc::node_t::data_name: emit_local_variable(ctx, expr.as_name); break;
case gsc::node_t::data_istring: emit_istring(ctx, expr.as_istring); break;
case gsc::node_t::data_string: emit_string(ctx, expr.as_string); break;
case gsc::node_t::data_color: emit_color(ctx, expr.as_color); break;
case gsc::node_t::data_vector: emit_vector(ctx, expr.as_vector); break;
case gsc::node_t::data_float: emit_float(ctx, expr.as_float); break;
case gsc::node_t::data_integer: emit_integer(ctx, expr.as_integer); break;
@ -1606,6 +1607,30 @@ void compiler::emit_string(const gsc::context_ptr& ctx, const gsc::string_ptr& s
emit_opcode(ctx, opcode::OP_GetString, str->value);
}
void compiler::emit_color(const gsc::context_ptr& ctx, const gsc::color_ptr& color)
{
std::vector<std::string> data;
std::string x, y, z;
if(color->value.size() == 3)
{
x = "0x" + color->value.substr(0, 1) + color->value.substr(0, 1);
y = "0x" + color->value.substr(1, 1) + color->value.substr(1, 1);
z = "0x" + color->value.substr(2, 1) + color->value.substr(2, 1);
}
else
{
x = "0x" + color->value.substr(0, 2);
y = "0x" + color->value.substr(2, 2);
z = "0x" + color->value.substr(4, 2);
}
data.push_back(gsc::utils::string::hex_to_dec(x.data()));
data.push_back(gsc::utils::string::hex_to_dec(y.data()));
data.push_back(gsc::utils::string::hex_to_dec(z.data()));
emit_opcode(ctx, opcode::OP_GetVector, data);
}
void compiler::emit_vector(const gsc::context_ptr& ctx, const gsc::vector_ptr& vec)
{
std::vector<std::string> data;

View File

@ -101,6 +101,7 @@ private:
void emit_animation(const gsc::context_ptr& ctx, const gsc::animation_ptr& animation);
void emit_istring(const gsc::context_ptr& ctx, const gsc::istring_ptr& str);
void emit_string(const gsc::context_ptr& ctx, const gsc::string_ptr& str);
void emit_color(const gsc::context_ptr& ctx, const gsc::color_ptr& color);
void emit_vector(const gsc::context_ptr& ctx, const gsc::vector_ptr& vec);
void emit_float(const gsc::context_ptr& ctx, const gsc::float_ptr& num);
void emit_integer(const gsc::context_ptr& ctx, const gsc::integer_ptr& num);

File diff suppressed because it is too large Load Diff

View File

@ -700,7 +700,7 @@ extern int yylex (yyscan_t yyscanner);
#undef yyTABLES_NAME
#endif
#line 149 "lexer.lpp"
#line 157 "lexer.lpp"
#line 706 "lexer.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -417,31 +417,34 @@ namespace xsk { namespace gsc { namespace iw6 {
// animtree
char dummy3[sizeof (animtree_ptr)];
// color
char dummy4[sizeof (color_ptr)];
// constant
char dummy4[sizeof (constant_ptr)];
char dummy5[sizeof (constant_ptr)];
// define
char dummy5[sizeof (define_ptr)];
char dummy6[sizeof (define_ptr)];
// empty_array
char dummy6[sizeof (empty_array_ptr)];
char dummy7[sizeof (empty_array_ptr)];
// expr_arguments
// expr_arguments_filled
// expr_arguments_empty
char dummy7[sizeof (expr_arguments_ptr)];
char dummy8[sizeof (expr_arguments_ptr)];
// expr_assign
char dummy8[sizeof (expr_assign_ptr)];
char dummy9[sizeof (expr_assign_ptr)];
// expr_call
// expr_call_thread
// expr_call_childthread
char dummy9[sizeof (expr_call_ptr)];
char dummy10[sizeof (expr_call_ptr)];
// expr_call_function
// expr_call_pointer
char dummy10[sizeof (expr_call_type_ptr)];
char dummy11[sizeof (expr_call_type_ptr)];
// for_expr
// expr
@ -449,36 +452,34 @@ namespace xsk { namespace gsc { namespace iw6 {
// expr_ternary
// expr_binary
// expr_primitive
char dummy11[sizeof (expr_ptr)];
char dummy12[sizeof (expr_ptr)];
// false
char dummy12[sizeof (false_ptr)];
char dummy13[sizeof (false_ptr)];
// file
char dummy13[sizeof (file_ptr)];
char dummy14[sizeof (file_ptr)];
// neg_float
// float
char dummy14[sizeof (float_ptr)];
char dummy15[sizeof (float_ptr)];
// game
char dummy15[sizeof (game_ptr)];
char dummy16[sizeof (game_ptr)];
// include
char dummy16[sizeof (include_ptr)];
char dummy17[sizeof (include_ptr)];
// neg_integer
// integer
char dummy17[sizeof (integer_ptr)];
char dummy18[sizeof (integer_ptr)];
// istring
char dummy18[sizeof (istring_ptr)];
char dummy19[sizeof (istring_ptr)];
// level
char dummy19[sizeof (level_ptr)];
char dummy20[sizeof (level_ptr)];
// name
char dummy20[sizeof (name_ptr)];
char dummy21[sizeof (name_ptr)];
// expr_function
// expr_add_array
@ -486,119 +487,123 @@ namespace xsk { namespace gsc { namespace iw6 {
// expr_field
// expr_size
// object
char dummy21[sizeof (node_ptr)];
char dummy22[sizeof (node_ptr)];
// parameters
char dummy22[sizeof (parameters_ptr)];
char dummy23[sizeof (parameters_ptr)];
// program
char dummy23[sizeof (program_ptr)];
char dummy24[sizeof (program_ptr)];
// self
char dummy24[sizeof (self_ptr)];
char dummy25[sizeof (self_ptr)];
// "file path"
// "identifier"
// "string literal"
// "localized string"
// "color"
// "float"
// "int"
char dummy25[sizeof (std::string)];
// "octal int"
// "binary int"
// "hexadecimal int"
char dummy26[sizeof (std::string)];
// stmt_assign
char dummy26[sizeof (stmt_assign_ptr)];
char dummy27[sizeof (stmt_assign_ptr)];
// stmt_break
char dummy27[sizeof (stmt_break_ptr)];
char dummy28[sizeof (stmt_break_ptr)];
// stmt_breakpoint
char dummy28[sizeof (stmt_breakpoint_ptr)];
char dummy29[sizeof (stmt_breakpoint_ptr)];
// stmt_call
char dummy29[sizeof (stmt_call_ptr)];
char dummy30[sizeof (stmt_call_ptr)];
// stmt_case
char dummy30[sizeof (stmt_case_ptr)];
char dummy31[sizeof (stmt_case_ptr)];
// stmt_continue
char dummy31[sizeof (stmt_continue_ptr)];
char dummy32[sizeof (stmt_continue_ptr)];
// stmt_default
char dummy32[sizeof (stmt_default_ptr)];
char dummy33[sizeof (stmt_default_ptr)];
// stmt_endon
char dummy33[sizeof (stmt_endon_ptr)];
char dummy34[sizeof (stmt_endon_ptr)];
// stmt_for
char dummy34[sizeof (stmt_for_ptr)];
char dummy35[sizeof (stmt_for_ptr)];
// stmt_foreach
char dummy35[sizeof (stmt_foreach_ptr)];
char dummy36[sizeof (stmt_foreach_ptr)];
// stmt_if
char dummy36[sizeof (stmt_if_ptr)];
char dummy37[sizeof (stmt_if_ptr)];
// stmt_ifelse
char dummy37[sizeof (stmt_ifelse_ptr)];
char dummy38[sizeof (stmt_ifelse_ptr)];
// stmt_block
// stmt_list
char dummy38[sizeof (stmt_list_ptr)];
char dummy39[sizeof (stmt_list_ptr)];
// stmt_notify
char dummy39[sizeof (stmt_notify_ptr)];
char dummy40[sizeof (stmt_notify_ptr)];
// stmt_prof_begin
char dummy40[sizeof (stmt_prof_begin_ptr)];
char dummy41[sizeof (stmt_prof_begin_ptr)];
// stmt_prof_end
char dummy41[sizeof (stmt_prof_end_ptr)];
char dummy42[sizeof (stmt_prof_end_ptr)];
// stmt
// for_stmt
char dummy42[sizeof (stmt_ptr)];
char dummy43[sizeof (stmt_ptr)];
// stmt_return
char dummy43[sizeof (stmt_return_ptr)];
char dummy44[sizeof (stmt_return_ptr)];
// stmt_switch
char dummy44[sizeof (stmt_switch_ptr)];
char dummy45[sizeof (stmt_switch_ptr)];
// stmt_wait
char dummy45[sizeof (stmt_wait_ptr)];
char dummy46[sizeof (stmt_wait_ptr)];
// stmt_waittill
char dummy46[sizeof (stmt_waittill_ptr)];
char dummy47[sizeof (stmt_waittill_ptr)];
// stmt_waittillframeend
char dummy47[sizeof (stmt_waittillframeend_ptr)];
char dummy48[sizeof (stmt_waittillframeend_ptr)];
// stmt_waittillmatch
char dummy48[sizeof (stmt_waittillmatch_ptr)];
char dummy49[sizeof (stmt_waittillmatch_ptr)];
// stmt_while
char dummy49[sizeof (stmt_while_ptr)];
char dummy50[sizeof (stmt_while_ptr)];
// string
char dummy50[sizeof (string_ptr)];
char dummy51[sizeof (string_ptr)];
// thisthread
char dummy51[sizeof (thisthread_ptr)];
char dummy52[sizeof (thisthread_ptr)];
// thread
char dummy52[sizeof (thread_ptr)];
char dummy53[sizeof (thread_ptr)];
// true
char dummy53[sizeof (true_ptr)];
char dummy54[sizeof (true_ptr)];
// undefined
char dummy54[sizeof (undefined_ptr)];
char dummy55[sizeof (undefined_ptr)];
// usingtree
char dummy55[sizeof (usingtree_ptr)];
char dummy56[sizeof (usingtree_ptr)];
// vector
char dummy56[sizeof (vector_ptr)];
char dummy57[sizeof (vector_ptr)];
};
/// The size of the largest semantic type.
@ -735,17 +740,21 @@ namespace xsk { namespace gsc { namespace iw6 {
NAME = 85, // "identifier"
STRING = 86, // "string literal"
ISTRING = 87, // "localized string"
FLOAT = 88, // "float"
INTEGER = 89, // "int"
ADD_ARRAY = 90, // ADD_ARRAY
THEN = 91, // THEN
TERN = 92, // TERN
NEG = 93, // NEG
ANIMREF = 94, // ANIMREF
PREINC = 95, // PREINC
PREDEC = 96, // PREDEC
POSTINC = 97, // POSTINC
POSTDEC = 98 // POSTDEC
COLOR = 88, // "color"
FLOAT = 89, // "float"
INT_DEC = 90, // "int"
INT_OCT = 91, // "octal int"
INT_BIN = 92, // "binary int"
INT_HEX = 93, // "hexadecimal int"
ADD_ARRAY = 94, // ADD_ARRAY
THEN = 95, // THEN
TERN = 96, // TERN
NEG = 97, // NEG
ANIMREF = 98, // ANIMREF
PREINC = 99, // PREINC
PREDEC = 100, // PREDEC
POSTINC = 101, // POSTINC
POSTDEC = 102 // POSTDEC
};
/// Backward compatibility alias (Bison 3.6).
typedef token_kind_type yytokentype;
@ -762,7 +771,7 @@ namespace xsk { namespace gsc { namespace iw6 {
{
enum symbol_kind_type
{
YYNTOKENS = 99, ///< Number of tokens.
YYNTOKENS = 103, ///< Number of tokens.
S_YYEMPTY = -2,
S_YYEOF = 0, // "end of file"
S_YYerror = 1, // error
@ -852,93 +861,96 @@ namespace xsk { namespace gsc { namespace iw6 {
S_NAME = 85, // "identifier"
S_STRING = 86, // "string literal"
S_ISTRING = 87, // "localized string"
S_FLOAT = 88, // "float"
S_INTEGER = 89, // "int"
S_ADD_ARRAY = 90, // ADD_ARRAY
S_THEN = 91, // THEN
S_TERN = 92, // TERN
S_NEG = 93, // NEG
S_ANIMREF = 94, // ANIMREF
S_PREINC = 95, // PREINC
S_PREDEC = 96, // PREDEC
S_POSTINC = 97, // POSTINC
S_POSTDEC = 98, // POSTDEC
S_YYACCEPT = 99, // $accept
S_root = 100, // root
S_program = 101, // program
S_include = 102, // include
S_define = 103, // define
S_usingtree = 104, // usingtree
S_constant = 105, // constant
S_thread = 106, // thread
S_parameters = 107, // parameters
S_stmt = 108, // stmt
S_stmt_block = 109, // stmt_block
S_stmt_list = 110, // stmt_list
S_stmt_call = 111, // stmt_call
S_stmt_assign = 112, // stmt_assign
S_stmt_endon = 113, // stmt_endon
S_stmt_notify = 114, // stmt_notify
S_stmt_wait = 115, // stmt_wait
S_stmt_waittill = 116, // stmt_waittill
S_stmt_waittillmatch = 117, // stmt_waittillmatch
S_stmt_waittillframeend = 118, // stmt_waittillframeend
S_stmt_if = 119, // stmt_if
S_stmt_ifelse = 120, // stmt_ifelse
S_stmt_while = 121, // stmt_while
S_stmt_for = 122, // stmt_for
S_stmt_foreach = 123, // stmt_foreach
S_stmt_switch = 124, // stmt_switch
S_stmt_case = 125, // stmt_case
S_stmt_default = 126, // stmt_default
S_stmt_break = 127, // stmt_break
S_stmt_continue = 128, // stmt_continue
S_stmt_return = 129, // stmt_return
S_stmt_breakpoint = 130, // stmt_breakpoint
S_stmt_prof_begin = 131, // stmt_prof_begin
S_stmt_prof_end = 132, // stmt_prof_end
S_for_stmt = 133, // for_stmt
S_for_expr = 134, // for_expr
S_expr = 135, // expr
S_expr_assign = 136, // expr_assign
S_expr_compare = 137, // expr_compare
S_expr_ternary = 138, // expr_ternary
S_expr_binary = 139, // expr_binary
S_expr_primitive = 140, // expr_primitive
S_expr_call = 141, // expr_call
S_expr_call_thread = 142, // expr_call_thread
S_expr_call_childthread = 143, // expr_call_childthread
S_expr_call_function = 144, // expr_call_function
S_expr_call_pointer = 145, // expr_call_pointer
S_expr_arguments = 146, // expr_arguments
S_expr_arguments_filled = 147, // expr_arguments_filled
S_expr_arguments_empty = 148, // expr_arguments_empty
S_expr_function = 149, // expr_function
S_expr_add_array = 150, // expr_add_array
S_expr_array = 151, // expr_array
S_expr_field = 152, // expr_field
S_expr_size = 153, // expr_size
S_object = 154, // object
S_thisthread = 155, // thisthread
S_empty_array = 156, // empty_array
S_undefined = 157, // undefined
S_game = 158, // game
S_self = 159, // self
S_anim = 160, // anim
S_level = 161, // level
S_animation = 162, // animation
S_animtree = 163, // animtree
S_name = 164, // name
S_file = 165, // file
S_istring = 166, // istring
S_string = 167, // string
S_vector = 168, // vector
S_neg_float = 169, // neg_float
S_neg_integer = 170, // neg_integer
S_float = 171, // float
S_integer = 172, // integer
S_false = 173, // false
S_true = 174 // true
S_COLOR = 88, // "color"
S_FLOAT = 89, // "float"
S_INT_DEC = 90, // "int"
S_INT_OCT = 91, // "octal int"
S_INT_BIN = 92, // "binary int"
S_INT_HEX = 93, // "hexadecimal int"
S_ADD_ARRAY = 94, // ADD_ARRAY
S_THEN = 95, // THEN
S_TERN = 96, // TERN
S_NEG = 97, // NEG
S_ANIMREF = 98, // ANIMREF
S_PREINC = 99, // PREINC
S_PREDEC = 100, // PREDEC
S_POSTINC = 101, // POSTINC
S_POSTDEC = 102, // POSTDEC
S_YYACCEPT = 103, // $accept
S_root = 104, // root
S_program = 105, // program
S_include = 106, // include
S_define = 107, // define
S_usingtree = 108, // usingtree
S_constant = 109, // constant
S_thread = 110, // thread
S_parameters = 111, // parameters
S_stmt = 112, // stmt
S_stmt_block = 113, // stmt_block
S_stmt_list = 114, // stmt_list
S_stmt_call = 115, // stmt_call
S_stmt_assign = 116, // stmt_assign
S_stmt_endon = 117, // stmt_endon
S_stmt_notify = 118, // stmt_notify
S_stmt_wait = 119, // stmt_wait
S_stmt_waittill = 120, // stmt_waittill
S_stmt_waittillmatch = 121, // stmt_waittillmatch
S_stmt_waittillframeend = 122, // stmt_waittillframeend
S_stmt_if = 123, // stmt_if
S_stmt_ifelse = 124, // stmt_ifelse
S_stmt_while = 125, // stmt_while
S_stmt_for = 126, // stmt_for
S_stmt_foreach = 127, // stmt_foreach
S_stmt_switch = 128, // stmt_switch
S_stmt_case = 129, // stmt_case
S_stmt_default = 130, // stmt_default
S_stmt_break = 131, // stmt_break
S_stmt_continue = 132, // stmt_continue
S_stmt_return = 133, // stmt_return
S_stmt_breakpoint = 134, // stmt_breakpoint
S_stmt_prof_begin = 135, // stmt_prof_begin
S_stmt_prof_end = 136, // stmt_prof_end
S_for_stmt = 137, // for_stmt
S_for_expr = 138, // for_expr
S_expr = 139, // expr
S_expr_assign = 140, // expr_assign
S_expr_compare = 141, // expr_compare
S_expr_ternary = 142, // expr_ternary
S_expr_binary = 143, // expr_binary
S_expr_primitive = 144, // expr_primitive
S_expr_call = 145, // expr_call
S_expr_call_thread = 146, // expr_call_thread
S_expr_call_childthread = 147, // expr_call_childthread
S_expr_call_function = 148, // expr_call_function
S_expr_call_pointer = 149, // expr_call_pointer
S_expr_arguments = 150, // expr_arguments
S_expr_arguments_filled = 151, // expr_arguments_filled
S_expr_arguments_empty = 152, // expr_arguments_empty
S_expr_function = 153, // expr_function
S_expr_add_array = 154, // expr_add_array
S_expr_array = 155, // expr_array
S_expr_field = 156, // expr_field
S_expr_size = 157, // expr_size
S_object = 158, // object
S_float = 159, // float
S_integer = 160, // integer
S_thisthread = 161, // thisthread
S_empty_array = 162, // empty_array
S_undefined = 163, // undefined
S_game = 164, // game
S_self = 165, // self
S_anim = 166, // anim
S_level = 167, // level
S_animation = 168, // animation
S_animtree = 169, // animtree
S_name = 170, // name
S_file = 171, // file
S_istring = 172, // istring
S_string = 173, // string
S_color = 174, // color
S_vector = 175, // vector
S_false = 176, // false
S_true = 177 // true
};
};
@ -987,6 +999,10 @@ namespace xsk { namespace gsc { namespace iw6 {
value.move< animtree_ptr > (std::move (that.value));
break;
case symbol_kind::S_color: // color
value.move< color_ptr > (std::move (that.value));
break;
case symbol_kind::S_constant: // constant
value.move< constant_ptr > (std::move (that.value));
break;
@ -1037,7 +1053,6 @@ namespace xsk { namespace gsc { namespace iw6 {
value.move< file_ptr > (std::move (that.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.move< float_ptr > (std::move (that.value));
break;
@ -1050,7 +1065,6 @@ namespace xsk { namespace gsc { namespace iw6 {
value.move< include_ptr > (std::move (that.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.move< integer_ptr > (std::move (that.value));
break;
@ -1092,8 +1106,12 @@ namespace xsk { namespace gsc { namespace iw6 {
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.move< std::string > (std::move (that.value));
break;
@ -1288,6 +1306,20 @@ namespace xsk { namespace gsc { namespace iw6 {
{}
#endif
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, color_ptr&& v, location_type&& l)
: Base (t)
, value (std::move (v))
, location (std::move (l))
{}
#else
basic_symbol (typename Base::kind_type t, const color_ptr& v, const location_type& l)
: Base (t)
, value (v)
, location (l)
{}
#endif
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, constant_ptr&& v, location_type&& l)
: Base (t)
@ -2064,6 +2096,10 @@ switch (yykind)
value.template destroy< animtree_ptr > ();
break;
case symbol_kind::S_color: // color
value.template destroy< color_ptr > ();
break;
case symbol_kind::S_constant: // constant
value.template destroy< constant_ptr > ();
break;
@ -2114,7 +2150,6 @@ switch (yykind)
value.template destroy< file_ptr > ();
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.template destroy< float_ptr > ();
break;
@ -2127,7 +2162,6 @@ switch (yykind)
value.template destroy< include_ptr > ();
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.template destroy< integer_ptr > ();
break;
@ -2169,8 +2203,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.template destroy< std::string > ();
break;
@ -2406,7 +2444,7 @@ switch (yykind)
: super_type(token_type (tok), v, l)
#endif
{
IW6_ASSERT ((token::FILE <= tok && tok <= token::INTEGER));
IW6_ASSERT ((token::FILE <= tok && tok <= token::INT_HEX));
}
};
@ -3776,6 +3814,21 @@ switch (yykind)
return symbol_type (token::ISTRING, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_COLOR (std::string v, location_type l)
{
return symbol_type (token::COLOR, std::move (v), std::move (l));
}
#else
static
symbol_type
make_COLOR (const std::string& v, const location_type& l)
{
return symbol_type (token::COLOR, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
@ -3794,16 +3847,61 @@ switch (yykind)
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INTEGER (std::string v, location_type l)
make_INT_DEC (std::string v, location_type l)
{
return symbol_type (token::INTEGER, std::move (v), std::move (l));
return symbol_type (token::INT_DEC, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INTEGER (const std::string& v, const location_type& l)
make_INT_DEC (const std::string& v, const location_type& l)
{
return symbol_type (token::INTEGER, v, l);
return symbol_type (token::INT_DEC, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_OCT (std::string v, location_type l)
{
return symbol_type (token::INT_OCT, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_OCT (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_OCT, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_BIN (std::string v, location_type l)
{
return symbol_type (token::INT_BIN, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_BIN (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_BIN, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_HEX (std::string v, location_type l)
{
return symbol_type (token::INT_HEX, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_HEX (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_HEX, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
@ -4285,8 +4383,8 @@ switch (yykind)
/// Constants.
enum
{
yylast_ = 1836, ///< Last index in yytable_.
yynnts_ = 76, ///< Number of nonterminal symbols.
yylast_ = 1811, ///< Last index in yytable_.
yynnts_ = 75, ///< Number of nonterminal symbols.
yyfinal_ = 15 ///< Termination state number.
};
@ -4326,6 +4424,10 @@ switch (yykind)
value.copy< animtree_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_color: // color
value.copy< color_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_constant: // constant
value.copy< constant_ptr > (YY_MOVE (that.value));
break;
@ -4376,7 +4478,6 @@ switch (yykind)
value.copy< file_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.copy< float_ptr > (YY_MOVE (that.value));
break;
@ -4389,7 +4490,6 @@ switch (yykind)
value.copy< include_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.copy< integer_ptr > (YY_MOVE (that.value));
break;
@ -4431,8 +4531,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.copy< std::string > (YY_MOVE (that.value));
break;
@ -4603,6 +4707,10 @@ switch (yykind)
value.move< animtree_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_color: // color
value.move< color_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_constant: // constant
value.move< constant_ptr > (YY_MOVE (s.value));
break;
@ -4653,7 +4761,6 @@ switch (yykind)
value.move< file_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.move< float_ptr > (YY_MOVE (s.value));
break;
@ -4666,7 +4773,6 @@ switch (yykind)
value.move< include_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.move< integer_ptr > (YY_MOVE (s.value));
break;
@ -4708,8 +4814,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.move< std::string > (YY_MOVE (s.value));
break;
@ -4902,7 +5012,7 @@ switch (yykind)
#line 13 "parser.ypp"
} } } // xsk::gsc::iw6
#line 4906 "parser.hpp"
#line 5016 "parser.hpp"

View File

@ -785,6 +785,7 @@ void compiler::emit_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr)
case gsc::node_t::data_name: emit_local_variable(ctx, expr.as_name); break;
case gsc::node_t::data_istring: emit_istring(ctx, expr.as_istring); break;
case gsc::node_t::data_string: emit_string(ctx, expr.as_string); break;
case gsc::node_t::data_color: emit_color(ctx, expr.as_color); break;
case gsc::node_t::data_vector: emit_vector(ctx, expr.as_vector); break;
case gsc::node_t::data_float: emit_float(ctx, expr.as_float); break;
case gsc::node_t::data_integer: emit_integer(ctx, expr.as_integer); break;
@ -1606,6 +1607,30 @@ void compiler::emit_string(const gsc::context_ptr& ctx, const gsc::string_ptr& s
emit_opcode(ctx, opcode::OP_GetString, str->value);
}
void compiler::emit_color(const gsc::context_ptr& ctx, const gsc::color_ptr& color)
{
std::vector<std::string> data;
std::string x, y, z;
if(color->value.size() == 3)
{
x = "0x" + color->value.substr(0, 1) + color->value.substr(0, 1);
y = "0x" + color->value.substr(1, 1) + color->value.substr(1, 1);
z = "0x" + color->value.substr(2, 1) + color->value.substr(2, 1);
}
else
{
x = "0x" + color->value.substr(0, 2);
y = "0x" + color->value.substr(2, 2);
z = "0x" + color->value.substr(4, 2);
}
data.push_back(gsc::utils::string::hex_to_dec(x.data()));
data.push_back(gsc::utils::string::hex_to_dec(y.data()));
data.push_back(gsc::utils::string::hex_to_dec(z.data()));
emit_opcode(ctx, opcode::OP_GetVector, data);
}
void compiler::emit_vector(const gsc::context_ptr& ctx, const gsc::vector_ptr& vec)
{
std::vector<std::string> data;

View File

@ -101,6 +101,7 @@ private:
void emit_animation(const gsc::context_ptr& ctx, const gsc::animation_ptr& animation);
void emit_istring(const gsc::context_ptr& ctx, const gsc::istring_ptr& str);
void emit_string(const gsc::context_ptr& ctx, const gsc::string_ptr& str);
void emit_color(const gsc::context_ptr& ctx, const gsc::color_ptr& color);
void emit_vector(const gsc::context_ptr& ctx, const gsc::vector_ptr& vec);
void emit_float(const gsc::context_ptr& ctx, const gsc::float_ptr& num);
void emit_integer(const gsc::context_ptr& ctx, const gsc::integer_ptr& num);

File diff suppressed because it is too large Load Diff

View File

@ -700,7 +700,7 @@ extern int yylex (yyscan_t yyscanner);
#undef yyTABLES_NAME
#endif
#line 149 "lexer.lpp"
#line 157 "lexer.lpp"
#line 706 "lexer.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -417,31 +417,34 @@ namespace xsk { namespace gsc { namespace iw7 {
// animtree
char dummy3[sizeof (animtree_ptr)];
// color
char dummy4[sizeof (color_ptr)];
// constant
char dummy4[sizeof (constant_ptr)];
char dummy5[sizeof (constant_ptr)];
// define
char dummy5[sizeof (define_ptr)];
char dummy6[sizeof (define_ptr)];
// empty_array
char dummy6[sizeof (empty_array_ptr)];
char dummy7[sizeof (empty_array_ptr)];
// expr_arguments
// expr_arguments_filled
// expr_arguments_empty
char dummy7[sizeof (expr_arguments_ptr)];
char dummy8[sizeof (expr_arguments_ptr)];
// expr_assign
char dummy8[sizeof (expr_assign_ptr)];
char dummy9[sizeof (expr_assign_ptr)];
// expr_call
// expr_call_thread
// expr_call_childthread
char dummy9[sizeof (expr_call_ptr)];
char dummy10[sizeof (expr_call_ptr)];
// expr_call_function
// expr_call_pointer
char dummy10[sizeof (expr_call_type_ptr)];
char dummy11[sizeof (expr_call_type_ptr)];
// for_expr
// expr
@ -449,36 +452,34 @@ namespace xsk { namespace gsc { namespace iw7 {
// expr_ternary
// expr_binary
// expr_primitive
char dummy11[sizeof (expr_ptr)];
char dummy12[sizeof (expr_ptr)];
// false
char dummy12[sizeof (false_ptr)];
char dummy13[sizeof (false_ptr)];
// file
char dummy13[sizeof (file_ptr)];
char dummy14[sizeof (file_ptr)];
// neg_float
// float
char dummy14[sizeof (float_ptr)];
char dummy15[sizeof (float_ptr)];
// game
char dummy15[sizeof (game_ptr)];
char dummy16[sizeof (game_ptr)];
// include
char dummy16[sizeof (include_ptr)];
char dummy17[sizeof (include_ptr)];
// neg_integer
// integer
char dummy17[sizeof (integer_ptr)];
char dummy18[sizeof (integer_ptr)];
// istring
char dummy18[sizeof (istring_ptr)];
char dummy19[sizeof (istring_ptr)];
// level
char dummy19[sizeof (level_ptr)];
char dummy20[sizeof (level_ptr)];
// name
char dummy20[sizeof (name_ptr)];
char dummy21[sizeof (name_ptr)];
// expr_function
// expr_add_array
@ -486,119 +487,123 @@ namespace xsk { namespace gsc { namespace iw7 {
// expr_field
// expr_size
// object
char dummy21[sizeof (node_ptr)];
char dummy22[sizeof (node_ptr)];
// parameters
char dummy22[sizeof (parameters_ptr)];
char dummy23[sizeof (parameters_ptr)];
// program
char dummy23[sizeof (program_ptr)];
char dummy24[sizeof (program_ptr)];
// self
char dummy24[sizeof (self_ptr)];
char dummy25[sizeof (self_ptr)];
// "file path"
// "identifier"
// "string literal"
// "localized string"
// "color"
// "float"
// "int"
char dummy25[sizeof (std::string)];
// "octal int"
// "binary int"
// "hexadecimal int"
char dummy26[sizeof (std::string)];
// stmt_assign
char dummy26[sizeof (stmt_assign_ptr)];
char dummy27[sizeof (stmt_assign_ptr)];
// stmt_break
char dummy27[sizeof (stmt_break_ptr)];
char dummy28[sizeof (stmt_break_ptr)];
// stmt_breakpoint
char dummy28[sizeof (stmt_breakpoint_ptr)];
char dummy29[sizeof (stmt_breakpoint_ptr)];
// stmt_call
char dummy29[sizeof (stmt_call_ptr)];
char dummy30[sizeof (stmt_call_ptr)];
// stmt_case
char dummy30[sizeof (stmt_case_ptr)];
char dummy31[sizeof (stmt_case_ptr)];
// stmt_continue
char dummy31[sizeof (stmt_continue_ptr)];
char dummy32[sizeof (stmt_continue_ptr)];
// stmt_default
char dummy32[sizeof (stmt_default_ptr)];
char dummy33[sizeof (stmt_default_ptr)];
// stmt_endon
char dummy33[sizeof (stmt_endon_ptr)];
char dummy34[sizeof (stmt_endon_ptr)];
// stmt_for
char dummy34[sizeof (stmt_for_ptr)];
char dummy35[sizeof (stmt_for_ptr)];
// stmt_foreach
char dummy35[sizeof (stmt_foreach_ptr)];
char dummy36[sizeof (stmt_foreach_ptr)];
// stmt_if
char dummy36[sizeof (stmt_if_ptr)];
char dummy37[sizeof (stmt_if_ptr)];
// stmt_ifelse
char dummy37[sizeof (stmt_ifelse_ptr)];
char dummy38[sizeof (stmt_ifelse_ptr)];
// stmt_block
// stmt_list
char dummy38[sizeof (stmt_list_ptr)];
char dummy39[sizeof (stmt_list_ptr)];
// stmt_notify
char dummy39[sizeof (stmt_notify_ptr)];
char dummy40[sizeof (stmt_notify_ptr)];
// stmt_prof_begin
char dummy40[sizeof (stmt_prof_begin_ptr)];
char dummy41[sizeof (stmt_prof_begin_ptr)];
// stmt_prof_end
char dummy41[sizeof (stmt_prof_end_ptr)];
char dummy42[sizeof (stmt_prof_end_ptr)];
// stmt
// for_stmt
char dummy42[sizeof (stmt_ptr)];
char dummy43[sizeof (stmt_ptr)];
// stmt_return
char dummy43[sizeof (stmt_return_ptr)];
char dummy44[sizeof (stmt_return_ptr)];
// stmt_switch
char dummy44[sizeof (stmt_switch_ptr)];
char dummy45[sizeof (stmt_switch_ptr)];
// stmt_wait
char dummy45[sizeof (stmt_wait_ptr)];
char dummy46[sizeof (stmt_wait_ptr)];
// stmt_waittill
char dummy46[sizeof (stmt_waittill_ptr)];
char dummy47[sizeof (stmt_waittill_ptr)];
// stmt_waittillframeend
char dummy47[sizeof (stmt_waittillframeend_ptr)];
char dummy48[sizeof (stmt_waittillframeend_ptr)];
// stmt_waittillmatch
char dummy48[sizeof (stmt_waittillmatch_ptr)];
char dummy49[sizeof (stmt_waittillmatch_ptr)];
// stmt_while
char dummy49[sizeof (stmt_while_ptr)];
char dummy50[sizeof (stmt_while_ptr)];
// string
char dummy50[sizeof (string_ptr)];
char dummy51[sizeof (string_ptr)];
// thisthread
char dummy51[sizeof (thisthread_ptr)];
char dummy52[sizeof (thisthread_ptr)];
// thread
char dummy52[sizeof (thread_ptr)];
char dummy53[sizeof (thread_ptr)];
// true
char dummy53[sizeof (true_ptr)];
char dummy54[sizeof (true_ptr)];
// undefined
char dummy54[sizeof (undefined_ptr)];
char dummy55[sizeof (undefined_ptr)];
// usingtree
char dummy55[sizeof (usingtree_ptr)];
char dummy56[sizeof (usingtree_ptr)];
// vector
char dummy56[sizeof (vector_ptr)];
char dummy57[sizeof (vector_ptr)];
};
/// The size of the largest semantic type.
@ -735,17 +740,21 @@ namespace xsk { namespace gsc { namespace iw7 {
NAME = 85, // "identifier"
STRING = 86, // "string literal"
ISTRING = 87, // "localized string"
FLOAT = 88, // "float"
INTEGER = 89, // "int"
ADD_ARRAY = 90, // ADD_ARRAY
THEN = 91, // THEN
TERN = 92, // TERN
NEG = 93, // NEG
ANIMREF = 94, // ANIMREF
PREINC = 95, // PREINC
PREDEC = 96, // PREDEC
POSTINC = 97, // POSTINC
POSTDEC = 98 // POSTDEC
COLOR = 88, // "color"
FLOAT = 89, // "float"
INT_DEC = 90, // "int"
INT_OCT = 91, // "octal int"
INT_BIN = 92, // "binary int"
INT_HEX = 93, // "hexadecimal int"
ADD_ARRAY = 94, // ADD_ARRAY
THEN = 95, // THEN
TERN = 96, // TERN
NEG = 97, // NEG
ANIMREF = 98, // ANIMREF
PREINC = 99, // PREINC
PREDEC = 100, // PREDEC
POSTINC = 101, // POSTINC
POSTDEC = 102 // POSTDEC
};
/// Backward compatibility alias (Bison 3.6).
typedef token_kind_type yytokentype;
@ -762,7 +771,7 @@ namespace xsk { namespace gsc { namespace iw7 {
{
enum symbol_kind_type
{
YYNTOKENS = 99, ///< Number of tokens.
YYNTOKENS = 103, ///< Number of tokens.
S_YYEMPTY = -2,
S_YYEOF = 0, // "end of file"
S_YYerror = 1, // error
@ -852,93 +861,96 @@ namespace xsk { namespace gsc { namespace iw7 {
S_NAME = 85, // "identifier"
S_STRING = 86, // "string literal"
S_ISTRING = 87, // "localized string"
S_FLOAT = 88, // "float"
S_INTEGER = 89, // "int"
S_ADD_ARRAY = 90, // ADD_ARRAY
S_THEN = 91, // THEN
S_TERN = 92, // TERN
S_NEG = 93, // NEG
S_ANIMREF = 94, // ANIMREF
S_PREINC = 95, // PREINC
S_PREDEC = 96, // PREDEC
S_POSTINC = 97, // POSTINC
S_POSTDEC = 98, // POSTDEC
S_YYACCEPT = 99, // $accept
S_root = 100, // root
S_program = 101, // program
S_include = 102, // include
S_define = 103, // define
S_usingtree = 104, // usingtree
S_constant = 105, // constant
S_thread = 106, // thread
S_parameters = 107, // parameters
S_stmt = 108, // stmt
S_stmt_block = 109, // stmt_block
S_stmt_list = 110, // stmt_list
S_stmt_call = 111, // stmt_call
S_stmt_assign = 112, // stmt_assign
S_stmt_endon = 113, // stmt_endon
S_stmt_notify = 114, // stmt_notify
S_stmt_wait = 115, // stmt_wait
S_stmt_waittill = 116, // stmt_waittill
S_stmt_waittillmatch = 117, // stmt_waittillmatch
S_stmt_waittillframeend = 118, // stmt_waittillframeend
S_stmt_if = 119, // stmt_if
S_stmt_ifelse = 120, // stmt_ifelse
S_stmt_while = 121, // stmt_while
S_stmt_for = 122, // stmt_for
S_stmt_foreach = 123, // stmt_foreach
S_stmt_switch = 124, // stmt_switch
S_stmt_case = 125, // stmt_case
S_stmt_default = 126, // stmt_default
S_stmt_break = 127, // stmt_break
S_stmt_continue = 128, // stmt_continue
S_stmt_return = 129, // stmt_return
S_stmt_breakpoint = 130, // stmt_breakpoint
S_stmt_prof_begin = 131, // stmt_prof_begin
S_stmt_prof_end = 132, // stmt_prof_end
S_for_stmt = 133, // for_stmt
S_for_expr = 134, // for_expr
S_expr = 135, // expr
S_expr_assign = 136, // expr_assign
S_expr_compare = 137, // expr_compare
S_expr_ternary = 138, // expr_ternary
S_expr_binary = 139, // expr_binary
S_expr_primitive = 140, // expr_primitive
S_expr_call = 141, // expr_call
S_expr_call_thread = 142, // expr_call_thread
S_expr_call_childthread = 143, // expr_call_childthread
S_expr_call_function = 144, // expr_call_function
S_expr_call_pointer = 145, // expr_call_pointer
S_expr_arguments = 146, // expr_arguments
S_expr_arguments_filled = 147, // expr_arguments_filled
S_expr_arguments_empty = 148, // expr_arguments_empty
S_expr_function = 149, // expr_function
S_expr_add_array = 150, // expr_add_array
S_expr_array = 151, // expr_array
S_expr_field = 152, // expr_field
S_expr_size = 153, // expr_size
S_object = 154, // object
S_thisthread = 155, // thisthread
S_empty_array = 156, // empty_array
S_undefined = 157, // undefined
S_game = 158, // game
S_self = 159, // self
S_anim = 160, // anim
S_level = 161, // level
S_animation = 162, // animation
S_animtree = 163, // animtree
S_name = 164, // name
S_file = 165, // file
S_istring = 166, // istring
S_string = 167, // string
S_vector = 168, // vector
S_neg_float = 169, // neg_float
S_neg_integer = 170, // neg_integer
S_float = 171, // float
S_integer = 172, // integer
S_false = 173, // false
S_true = 174 // true
S_COLOR = 88, // "color"
S_FLOAT = 89, // "float"
S_INT_DEC = 90, // "int"
S_INT_OCT = 91, // "octal int"
S_INT_BIN = 92, // "binary int"
S_INT_HEX = 93, // "hexadecimal int"
S_ADD_ARRAY = 94, // ADD_ARRAY
S_THEN = 95, // THEN
S_TERN = 96, // TERN
S_NEG = 97, // NEG
S_ANIMREF = 98, // ANIMREF
S_PREINC = 99, // PREINC
S_PREDEC = 100, // PREDEC
S_POSTINC = 101, // POSTINC
S_POSTDEC = 102, // POSTDEC
S_YYACCEPT = 103, // $accept
S_root = 104, // root
S_program = 105, // program
S_include = 106, // include
S_define = 107, // define
S_usingtree = 108, // usingtree
S_constant = 109, // constant
S_thread = 110, // thread
S_parameters = 111, // parameters
S_stmt = 112, // stmt
S_stmt_block = 113, // stmt_block
S_stmt_list = 114, // stmt_list
S_stmt_call = 115, // stmt_call
S_stmt_assign = 116, // stmt_assign
S_stmt_endon = 117, // stmt_endon
S_stmt_notify = 118, // stmt_notify
S_stmt_wait = 119, // stmt_wait
S_stmt_waittill = 120, // stmt_waittill
S_stmt_waittillmatch = 121, // stmt_waittillmatch
S_stmt_waittillframeend = 122, // stmt_waittillframeend
S_stmt_if = 123, // stmt_if
S_stmt_ifelse = 124, // stmt_ifelse
S_stmt_while = 125, // stmt_while
S_stmt_for = 126, // stmt_for
S_stmt_foreach = 127, // stmt_foreach
S_stmt_switch = 128, // stmt_switch
S_stmt_case = 129, // stmt_case
S_stmt_default = 130, // stmt_default
S_stmt_break = 131, // stmt_break
S_stmt_continue = 132, // stmt_continue
S_stmt_return = 133, // stmt_return
S_stmt_breakpoint = 134, // stmt_breakpoint
S_stmt_prof_begin = 135, // stmt_prof_begin
S_stmt_prof_end = 136, // stmt_prof_end
S_for_stmt = 137, // for_stmt
S_for_expr = 138, // for_expr
S_expr = 139, // expr
S_expr_assign = 140, // expr_assign
S_expr_compare = 141, // expr_compare
S_expr_ternary = 142, // expr_ternary
S_expr_binary = 143, // expr_binary
S_expr_primitive = 144, // expr_primitive
S_expr_call = 145, // expr_call
S_expr_call_thread = 146, // expr_call_thread
S_expr_call_childthread = 147, // expr_call_childthread
S_expr_call_function = 148, // expr_call_function
S_expr_call_pointer = 149, // expr_call_pointer
S_expr_arguments = 150, // expr_arguments
S_expr_arguments_filled = 151, // expr_arguments_filled
S_expr_arguments_empty = 152, // expr_arguments_empty
S_expr_function = 153, // expr_function
S_expr_add_array = 154, // expr_add_array
S_expr_array = 155, // expr_array
S_expr_field = 156, // expr_field
S_expr_size = 157, // expr_size
S_object = 158, // object
S_float = 159, // float
S_integer = 160, // integer
S_thisthread = 161, // thisthread
S_empty_array = 162, // empty_array
S_undefined = 163, // undefined
S_game = 164, // game
S_self = 165, // self
S_anim = 166, // anim
S_level = 167, // level
S_animation = 168, // animation
S_animtree = 169, // animtree
S_name = 170, // name
S_file = 171, // file
S_istring = 172, // istring
S_string = 173, // string
S_color = 174, // color
S_vector = 175, // vector
S_false = 176, // false
S_true = 177 // true
};
};
@ -987,6 +999,10 @@ namespace xsk { namespace gsc { namespace iw7 {
value.move< animtree_ptr > (std::move (that.value));
break;
case symbol_kind::S_color: // color
value.move< color_ptr > (std::move (that.value));
break;
case symbol_kind::S_constant: // constant
value.move< constant_ptr > (std::move (that.value));
break;
@ -1037,7 +1053,6 @@ namespace xsk { namespace gsc { namespace iw7 {
value.move< file_ptr > (std::move (that.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.move< float_ptr > (std::move (that.value));
break;
@ -1050,7 +1065,6 @@ namespace xsk { namespace gsc { namespace iw7 {
value.move< include_ptr > (std::move (that.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.move< integer_ptr > (std::move (that.value));
break;
@ -1092,8 +1106,12 @@ namespace xsk { namespace gsc { namespace iw7 {
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.move< std::string > (std::move (that.value));
break;
@ -1288,6 +1306,20 @@ namespace xsk { namespace gsc { namespace iw7 {
{}
#endif
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, color_ptr&& v, location_type&& l)
: Base (t)
, value (std::move (v))
, location (std::move (l))
{}
#else
basic_symbol (typename Base::kind_type t, const color_ptr& v, const location_type& l)
: Base (t)
, value (v)
, location (l)
{}
#endif
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, constant_ptr&& v, location_type&& l)
: Base (t)
@ -2064,6 +2096,10 @@ switch (yykind)
value.template destroy< animtree_ptr > ();
break;
case symbol_kind::S_color: // color
value.template destroy< color_ptr > ();
break;
case symbol_kind::S_constant: // constant
value.template destroy< constant_ptr > ();
break;
@ -2114,7 +2150,6 @@ switch (yykind)
value.template destroy< file_ptr > ();
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.template destroy< float_ptr > ();
break;
@ -2127,7 +2162,6 @@ switch (yykind)
value.template destroy< include_ptr > ();
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.template destroy< integer_ptr > ();
break;
@ -2169,8 +2203,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.template destroy< std::string > ();
break;
@ -2406,7 +2444,7 @@ switch (yykind)
: super_type(token_type (tok), v, l)
#endif
{
IW7_ASSERT ((token::FILE <= tok && tok <= token::INTEGER));
IW7_ASSERT ((token::FILE <= tok && tok <= token::INT_HEX));
}
};
@ -3776,6 +3814,21 @@ switch (yykind)
return symbol_type (token::ISTRING, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_COLOR (std::string v, location_type l)
{
return symbol_type (token::COLOR, std::move (v), std::move (l));
}
#else
static
symbol_type
make_COLOR (const std::string& v, const location_type& l)
{
return symbol_type (token::COLOR, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
@ -3794,16 +3847,61 @@ switch (yykind)
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INTEGER (std::string v, location_type l)
make_INT_DEC (std::string v, location_type l)
{
return symbol_type (token::INTEGER, std::move (v), std::move (l));
return symbol_type (token::INT_DEC, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INTEGER (const std::string& v, const location_type& l)
make_INT_DEC (const std::string& v, const location_type& l)
{
return symbol_type (token::INTEGER, v, l);
return symbol_type (token::INT_DEC, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_OCT (std::string v, location_type l)
{
return symbol_type (token::INT_OCT, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_OCT (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_OCT, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_BIN (std::string v, location_type l)
{
return symbol_type (token::INT_BIN, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_BIN (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_BIN, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_HEX (std::string v, location_type l)
{
return symbol_type (token::INT_HEX, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_HEX (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_HEX, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
@ -4285,8 +4383,8 @@ switch (yykind)
/// Constants.
enum
{
yylast_ = 1836, ///< Last index in yytable_.
yynnts_ = 76, ///< Number of nonterminal symbols.
yylast_ = 1811, ///< Last index in yytable_.
yynnts_ = 75, ///< Number of nonterminal symbols.
yyfinal_ = 15 ///< Termination state number.
};
@ -4326,6 +4424,10 @@ switch (yykind)
value.copy< animtree_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_color: // color
value.copy< color_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_constant: // constant
value.copy< constant_ptr > (YY_MOVE (that.value));
break;
@ -4376,7 +4478,6 @@ switch (yykind)
value.copy< file_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.copy< float_ptr > (YY_MOVE (that.value));
break;
@ -4389,7 +4490,6 @@ switch (yykind)
value.copy< include_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.copy< integer_ptr > (YY_MOVE (that.value));
break;
@ -4431,8 +4531,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.copy< std::string > (YY_MOVE (that.value));
break;
@ -4603,6 +4707,10 @@ switch (yykind)
value.move< animtree_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_color: // color
value.move< color_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_constant: // constant
value.move< constant_ptr > (YY_MOVE (s.value));
break;
@ -4653,7 +4761,6 @@ switch (yykind)
value.move< file_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.move< float_ptr > (YY_MOVE (s.value));
break;
@ -4666,7 +4773,6 @@ switch (yykind)
value.move< include_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.move< integer_ptr > (YY_MOVE (s.value));
break;
@ -4708,8 +4814,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.move< std::string > (YY_MOVE (s.value));
break;
@ -4902,7 +5012,7 @@ switch (yykind)
#line 13 "parser.ypp"
} } } // xsk::gsc::iw7
#line 4906 "parser.hpp"
#line 5016 "parser.hpp"

View File

@ -791,6 +791,7 @@ void compiler::emit_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr)
case gsc::node_t::data_name: emit_local_variable(ctx, expr.as_name); break;
case gsc::node_t::data_istring: emit_istring(ctx, expr.as_istring); break;
case gsc::node_t::data_string: emit_string(ctx, expr.as_string); break;
case gsc::node_t::data_color: emit_color(ctx, expr.as_color); break;
case gsc::node_t::data_vector: emit_vector(ctx, expr.as_vector); break;
case gsc::node_t::data_float: emit_float(ctx, expr.as_float); break;
case gsc::node_t::data_integer: emit_integer(ctx, expr.as_integer); break;
@ -1612,6 +1613,30 @@ void compiler::emit_string(const gsc::context_ptr& ctx, const gsc::string_ptr& s
emit_opcode(ctx, opcode::OP_GetString, str->value);
}
void compiler::emit_color(const gsc::context_ptr& ctx, const gsc::color_ptr& color)
{
std::vector<std::string> data;
std::string x, y, z;
if(color->value.size() == 3)
{
x = "0x" + color->value.substr(0, 1) + color->value.substr(0, 1);
y = "0x" + color->value.substr(1, 1) + color->value.substr(1, 1);
z = "0x" + color->value.substr(2, 1) + color->value.substr(2, 1);
}
else
{
x = "0x" + color->value.substr(0, 2);
y = "0x" + color->value.substr(2, 2);
z = "0x" + color->value.substr(4, 2);
}
data.push_back(gsc::utils::string::hex_to_dec(x.data()));
data.push_back(gsc::utils::string::hex_to_dec(y.data()));
data.push_back(gsc::utils::string::hex_to_dec(z.data()));
emit_opcode(ctx, opcode::OP_GetVector, data);
}
void compiler::emit_vector(const gsc::context_ptr& ctx, const gsc::vector_ptr& vec)
{
std::vector<std::string> data;

View File

@ -102,6 +102,7 @@ private:
void emit_animation(const gsc::context_ptr& ctx, const gsc::animation_ptr& animation);
void emit_istring(const gsc::context_ptr& ctx, const gsc::istring_ptr& str);
void emit_string(const gsc::context_ptr& ctx, const gsc::string_ptr& str);
void emit_color(const gsc::context_ptr& ctx, const gsc::color_ptr& color);
void emit_vector(const gsc::context_ptr& ctx, const gsc::vector_ptr& vec);
void emit_float(const gsc::context_ptr& ctx, const gsc::float_ptr& num);
void emit_integer(const gsc::context_ptr& ctx, const gsc::integer_ptr& num);

File diff suppressed because it is too large Load Diff

View File

@ -700,7 +700,7 @@ extern int yylex (yyscan_t yyscanner);
#undef yyTABLES_NAME
#endif
#line 150 "lexer.lpp"
#line 158 "lexer.lpp"
#line 706 "lexer.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -417,31 +417,34 @@ namespace xsk { namespace gsc { namespace s1 {
// animtree
char dummy3[sizeof (animtree_ptr)];
// color
char dummy4[sizeof (color_ptr)];
// constant
char dummy4[sizeof (constant_ptr)];
char dummy5[sizeof (constant_ptr)];
// define
char dummy5[sizeof (define_ptr)];
char dummy6[sizeof (define_ptr)];
// empty_array
char dummy6[sizeof (empty_array_ptr)];
char dummy7[sizeof (empty_array_ptr)];
// expr_arguments
// expr_arguments_filled
// expr_arguments_empty
char dummy7[sizeof (expr_arguments_ptr)];
char dummy8[sizeof (expr_arguments_ptr)];
// expr_assign
char dummy8[sizeof (expr_assign_ptr)];
char dummy9[sizeof (expr_assign_ptr)];
// expr_call
// expr_call_thread
// expr_call_childthread
char dummy9[sizeof (expr_call_ptr)];
char dummy10[sizeof (expr_call_ptr)];
// expr_call_function
// expr_call_pointer
char dummy10[sizeof (expr_call_type_ptr)];
char dummy11[sizeof (expr_call_type_ptr)];
// for_expr
// expr
@ -449,36 +452,34 @@ namespace xsk { namespace gsc { namespace s1 {
// expr_ternary
// expr_binary
// expr_primitive
char dummy11[sizeof (expr_ptr)];
char dummy12[sizeof (expr_ptr)];
// false
char dummy12[sizeof (false_ptr)];
char dummy13[sizeof (false_ptr)];
// file
char dummy13[sizeof (file_ptr)];
char dummy14[sizeof (file_ptr)];
// neg_float
// float
char dummy14[sizeof (float_ptr)];
char dummy15[sizeof (float_ptr)];
// game
char dummy15[sizeof (game_ptr)];
char dummy16[sizeof (game_ptr)];
// include
char dummy16[sizeof (include_ptr)];
char dummy17[sizeof (include_ptr)];
// neg_integer
// integer
char dummy17[sizeof (integer_ptr)];
char dummy18[sizeof (integer_ptr)];
// istring
char dummy18[sizeof (istring_ptr)];
char dummy19[sizeof (istring_ptr)];
// level
char dummy19[sizeof (level_ptr)];
char dummy20[sizeof (level_ptr)];
// name
char dummy20[sizeof (name_ptr)];
char dummy21[sizeof (name_ptr)];
// expr_function
// expr_add_array
@ -486,122 +487,126 @@ namespace xsk { namespace gsc { namespace s1 {
// expr_field
// expr_size
// object
char dummy21[sizeof (node_ptr)];
char dummy22[sizeof (node_ptr)];
// parameters
char dummy22[sizeof (parameters_ptr)];
char dummy23[sizeof (parameters_ptr)];
// program
char dummy23[sizeof (program_ptr)];
char dummy24[sizeof (program_ptr)];
// self
char dummy24[sizeof (self_ptr)];
char dummy25[sizeof (self_ptr)];
// "file path"
// "identifier"
// "string literal"
// "localized string"
// "color"
// "float"
// "int"
char dummy25[sizeof (std::string)];
// "octal int"
// "binary int"
// "hexadecimal int"
char dummy26[sizeof (std::string)];
// stmt_assign
char dummy26[sizeof (stmt_assign_ptr)];
char dummy27[sizeof (stmt_assign_ptr)];
// stmt_break
char dummy27[sizeof (stmt_break_ptr)];
char dummy28[sizeof (stmt_break_ptr)];
// stmt_breakpoint
char dummy28[sizeof (stmt_breakpoint_ptr)];
char dummy29[sizeof (stmt_breakpoint_ptr)];
// stmt_call
char dummy29[sizeof (stmt_call_ptr)];
char dummy30[sizeof (stmt_call_ptr)];
// stmt_case
char dummy30[sizeof (stmt_case_ptr)];
char dummy31[sizeof (stmt_case_ptr)];
// stmt_continue
char dummy31[sizeof (stmt_continue_ptr)];
char dummy32[sizeof (stmt_continue_ptr)];
// stmt_default
char dummy32[sizeof (stmt_default_ptr)];
char dummy33[sizeof (stmt_default_ptr)];
// stmt_endon
char dummy33[sizeof (stmt_endon_ptr)];
char dummy34[sizeof (stmt_endon_ptr)];
// stmt_for
char dummy34[sizeof (stmt_for_ptr)];
char dummy35[sizeof (stmt_for_ptr)];
// stmt_foreach
char dummy35[sizeof (stmt_foreach_ptr)];
char dummy36[sizeof (stmt_foreach_ptr)];
// stmt_if
char dummy36[sizeof (stmt_if_ptr)];
char dummy37[sizeof (stmt_if_ptr)];
// stmt_ifelse
char dummy37[sizeof (stmt_ifelse_ptr)];
char dummy38[sizeof (stmt_ifelse_ptr)];
// stmt_block
// stmt_list
char dummy38[sizeof (stmt_list_ptr)];
char dummy39[sizeof (stmt_list_ptr)];
// stmt_notify
char dummy39[sizeof (stmt_notify_ptr)];
char dummy40[sizeof (stmt_notify_ptr)];
// stmt_prof_begin
char dummy40[sizeof (stmt_prof_begin_ptr)];
char dummy41[sizeof (stmt_prof_begin_ptr)];
// stmt_prof_end
char dummy41[sizeof (stmt_prof_end_ptr)];
char dummy42[sizeof (stmt_prof_end_ptr)];
// stmt
// for_stmt
char dummy42[sizeof (stmt_ptr)];
char dummy43[sizeof (stmt_ptr)];
// stmt_return
char dummy43[sizeof (stmt_return_ptr)];
char dummy44[sizeof (stmt_return_ptr)];
// stmt_switch
char dummy44[sizeof (stmt_switch_ptr)];
char dummy45[sizeof (stmt_switch_ptr)];
// stmt_wait
char dummy45[sizeof (stmt_wait_ptr)];
char dummy46[sizeof (stmt_wait_ptr)];
// stmt_waitframe
char dummy46[sizeof (stmt_waitframe_ptr)];
char dummy47[sizeof (stmt_waitframe_ptr)];
// stmt_waittill
char dummy47[sizeof (stmt_waittill_ptr)];
char dummy48[sizeof (stmt_waittill_ptr)];
// stmt_waittillframeend
char dummy48[sizeof (stmt_waittillframeend_ptr)];
char dummy49[sizeof (stmt_waittillframeend_ptr)];
// stmt_waittillmatch
char dummy49[sizeof (stmt_waittillmatch_ptr)];
char dummy50[sizeof (stmt_waittillmatch_ptr)];
// stmt_while
char dummy50[sizeof (stmt_while_ptr)];
char dummy51[sizeof (stmt_while_ptr)];
// string
char dummy51[sizeof (string_ptr)];
char dummy52[sizeof (string_ptr)];
// thisthread
char dummy52[sizeof (thisthread_ptr)];
char dummy53[sizeof (thisthread_ptr)];
// thread
char dummy53[sizeof (thread_ptr)];
char dummy54[sizeof (thread_ptr)];
// true
char dummy54[sizeof (true_ptr)];
char dummy55[sizeof (true_ptr)];
// undefined
char dummy55[sizeof (undefined_ptr)];
char dummy56[sizeof (undefined_ptr)];
// usingtree
char dummy56[sizeof (usingtree_ptr)];
char dummy57[sizeof (usingtree_ptr)];
// vector
char dummy57[sizeof (vector_ptr)];
char dummy58[sizeof (vector_ptr)];
};
/// The size of the largest semantic type.
@ -739,17 +744,21 @@ namespace xsk { namespace gsc { namespace s1 {
NAME = 86, // "identifier"
STRING = 87, // "string literal"
ISTRING = 88, // "localized string"
FLOAT = 89, // "float"
INTEGER = 90, // "int"
ADD_ARRAY = 91, // ADD_ARRAY
THEN = 92, // THEN
TERN = 93, // TERN
NEG = 94, // NEG
ANIMREF = 95, // ANIMREF
PREINC = 96, // PREINC
PREDEC = 97, // PREDEC
POSTINC = 98, // POSTINC
POSTDEC = 99 // POSTDEC
COLOR = 89, // "color"
FLOAT = 90, // "float"
INT_DEC = 91, // "int"
INT_OCT = 92, // "octal int"
INT_BIN = 93, // "binary int"
INT_HEX = 94, // "hexadecimal int"
ADD_ARRAY = 95, // ADD_ARRAY
THEN = 96, // THEN
TERN = 97, // TERN
NEG = 98, // NEG
ANIMREF = 99, // ANIMREF
PREINC = 100, // PREINC
PREDEC = 101, // PREDEC
POSTINC = 102, // POSTINC
POSTDEC = 103 // POSTDEC
};
/// Backward compatibility alias (Bison 3.6).
typedef token_kind_type yytokentype;
@ -766,7 +775,7 @@ namespace xsk { namespace gsc { namespace s1 {
{
enum symbol_kind_type
{
YYNTOKENS = 100, ///< Number of tokens.
YYNTOKENS = 104, ///< Number of tokens.
S_YYEMPTY = -2,
S_YYEOF = 0, // "end of file"
S_YYerror = 1, // error
@ -857,94 +866,97 @@ namespace xsk { namespace gsc { namespace s1 {
S_NAME = 86, // "identifier"
S_STRING = 87, // "string literal"
S_ISTRING = 88, // "localized string"
S_FLOAT = 89, // "float"
S_INTEGER = 90, // "int"
S_ADD_ARRAY = 91, // ADD_ARRAY
S_THEN = 92, // THEN
S_TERN = 93, // TERN
S_NEG = 94, // NEG
S_ANIMREF = 95, // ANIMREF
S_PREINC = 96, // PREINC
S_PREDEC = 97, // PREDEC
S_POSTINC = 98, // POSTINC
S_POSTDEC = 99, // POSTDEC
S_YYACCEPT = 100, // $accept
S_root = 101, // root
S_program = 102, // program
S_include = 103, // include
S_define = 104, // define
S_usingtree = 105, // usingtree
S_constant = 106, // constant
S_thread = 107, // thread
S_parameters = 108, // parameters
S_stmt = 109, // stmt
S_stmt_block = 110, // stmt_block
S_stmt_list = 111, // stmt_list
S_stmt_call = 112, // stmt_call
S_stmt_assign = 113, // stmt_assign
S_stmt_endon = 114, // stmt_endon
S_stmt_notify = 115, // stmt_notify
S_stmt_wait = 116, // stmt_wait
S_stmt_waittill = 117, // stmt_waittill
S_stmt_waittillmatch = 118, // stmt_waittillmatch
S_stmt_waittillframeend = 119, // stmt_waittillframeend
S_stmt_waitframe = 120, // stmt_waitframe
S_stmt_if = 121, // stmt_if
S_stmt_ifelse = 122, // stmt_ifelse
S_stmt_while = 123, // stmt_while
S_stmt_for = 124, // stmt_for
S_stmt_foreach = 125, // stmt_foreach
S_stmt_switch = 126, // stmt_switch
S_stmt_case = 127, // stmt_case
S_stmt_default = 128, // stmt_default
S_stmt_break = 129, // stmt_break
S_stmt_continue = 130, // stmt_continue
S_stmt_return = 131, // stmt_return
S_stmt_breakpoint = 132, // stmt_breakpoint
S_stmt_prof_begin = 133, // stmt_prof_begin
S_stmt_prof_end = 134, // stmt_prof_end
S_for_stmt = 135, // for_stmt
S_for_expr = 136, // for_expr
S_expr = 137, // expr
S_expr_assign = 138, // expr_assign
S_expr_compare = 139, // expr_compare
S_expr_ternary = 140, // expr_ternary
S_expr_binary = 141, // expr_binary
S_expr_primitive = 142, // expr_primitive
S_expr_call = 143, // expr_call
S_expr_call_thread = 144, // expr_call_thread
S_expr_call_childthread = 145, // expr_call_childthread
S_expr_call_function = 146, // expr_call_function
S_expr_call_pointer = 147, // expr_call_pointer
S_expr_arguments = 148, // expr_arguments
S_expr_arguments_filled = 149, // expr_arguments_filled
S_expr_arguments_empty = 150, // expr_arguments_empty
S_expr_function = 151, // expr_function
S_expr_add_array = 152, // expr_add_array
S_expr_array = 153, // expr_array
S_expr_field = 154, // expr_field
S_expr_size = 155, // expr_size
S_object = 156, // object
S_thisthread = 157, // thisthread
S_empty_array = 158, // empty_array
S_undefined = 159, // undefined
S_game = 160, // game
S_self = 161, // self
S_anim = 162, // anim
S_level = 163, // level
S_animation = 164, // animation
S_animtree = 165, // animtree
S_name = 166, // name
S_file = 167, // file
S_istring = 168, // istring
S_string = 169, // string
S_vector = 170, // vector
S_neg_float = 171, // neg_float
S_neg_integer = 172, // neg_integer
S_float = 173, // float
S_integer = 174, // integer
S_false = 175, // false
S_true = 176 // true
S_COLOR = 89, // "color"
S_FLOAT = 90, // "float"
S_INT_DEC = 91, // "int"
S_INT_OCT = 92, // "octal int"
S_INT_BIN = 93, // "binary int"
S_INT_HEX = 94, // "hexadecimal int"
S_ADD_ARRAY = 95, // ADD_ARRAY
S_THEN = 96, // THEN
S_TERN = 97, // TERN
S_NEG = 98, // NEG
S_ANIMREF = 99, // ANIMREF
S_PREINC = 100, // PREINC
S_PREDEC = 101, // PREDEC
S_POSTINC = 102, // POSTINC
S_POSTDEC = 103, // POSTDEC
S_YYACCEPT = 104, // $accept
S_root = 105, // root
S_program = 106, // program
S_include = 107, // include
S_define = 108, // define
S_usingtree = 109, // usingtree
S_constant = 110, // constant
S_thread = 111, // thread
S_parameters = 112, // parameters
S_stmt = 113, // stmt
S_stmt_block = 114, // stmt_block
S_stmt_list = 115, // stmt_list
S_stmt_call = 116, // stmt_call
S_stmt_assign = 117, // stmt_assign
S_stmt_endon = 118, // stmt_endon
S_stmt_notify = 119, // stmt_notify
S_stmt_wait = 120, // stmt_wait
S_stmt_waittill = 121, // stmt_waittill
S_stmt_waittillmatch = 122, // stmt_waittillmatch
S_stmt_waittillframeend = 123, // stmt_waittillframeend
S_stmt_waitframe = 124, // stmt_waitframe
S_stmt_if = 125, // stmt_if
S_stmt_ifelse = 126, // stmt_ifelse
S_stmt_while = 127, // stmt_while
S_stmt_for = 128, // stmt_for
S_stmt_foreach = 129, // stmt_foreach
S_stmt_switch = 130, // stmt_switch
S_stmt_case = 131, // stmt_case
S_stmt_default = 132, // stmt_default
S_stmt_break = 133, // stmt_break
S_stmt_continue = 134, // stmt_continue
S_stmt_return = 135, // stmt_return
S_stmt_breakpoint = 136, // stmt_breakpoint
S_stmt_prof_begin = 137, // stmt_prof_begin
S_stmt_prof_end = 138, // stmt_prof_end
S_for_stmt = 139, // for_stmt
S_for_expr = 140, // for_expr
S_expr = 141, // expr
S_expr_assign = 142, // expr_assign
S_expr_compare = 143, // expr_compare
S_expr_ternary = 144, // expr_ternary
S_expr_binary = 145, // expr_binary
S_expr_primitive = 146, // expr_primitive
S_expr_call = 147, // expr_call
S_expr_call_thread = 148, // expr_call_thread
S_expr_call_childthread = 149, // expr_call_childthread
S_expr_call_function = 150, // expr_call_function
S_expr_call_pointer = 151, // expr_call_pointer
S_expr_arguments = 152, // expr_arguments
S_expr_arguments_filled = 153, // expr_arguments_filled
S_expr_arguments_empty = 154, // expr_arguments_empty
S_expr_function = 155, // expr_function
S_expr_add_array = 156, // expr_add_array
S_expr_array = 157, // expr_array
S_expr_field = 158, // expr_field
S_expr_size = 159, // expr_size
S_object = 160, // object
S_float = 161, // float
S_integer = 162, // integer
S_thisthread = 163, // thisthread
S_empty_array = 164, // empty_array
S_undefined = 165, // undefined
S_game = 166, // game
S_self = 167, // self
S_anim = 168, // anim
S_level = 169, // level
S_animation = 170, // animation
S_animtree = 171, // animtree
S_name = 172, // name
S_file = 173, // file
S_istring = 174, // istring
S_string = 175, // string
S_color = 176, // color
S_vector = 177, // vector
S_false = 178, // false
S_true = 179 // true
};
};
@ -993,6 +1005,10 @@ namespace xsk { namespace gsc { namespace s1 {
value.move< animtree_ptr > (std::move (that.value));
break;
case symbol_kind::S_color: // color
value.move< color_ptr > (std::move (that.value));
break;
case symbol_kind::S_constant: // constant
value.move< constant_ptr > (std::move (that.value));
break;
@ -1043,7 +1059,6 @@ namespace xsk { namespace gsc { namespace s1 {
value.move< file_ptr > (std::move (that.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.move< float_ptr > (std::move (that.value));
break;
@ -1056,7 +1071,6 @@ namespace xsk { namespace gsc { namespace s1 {
value.move< include_ptr > (std::move (that.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.move< integer_ptr > (std::move (that.value));
break;
@ -1098,8 +1112,12 @@ namespace xsk { namespace gsc { namespace s1 {
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.move< std::string > (std::move (that.value));
break;
@ -1298,6 +1316,20 @@ namespace xsk { namespace gsc { namespace s1 {
{}
#endif
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, color_ptr&& v, location_type&& l)
: Base (t)
, value (std::move (v))
, location (std::move (l))
{}
#else
basic_symbol (typename Base::kind_type t, const color_ptr& v, const location_type& l)
: Base (t)
, value (v)
, location (l)
{}
#endif
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, constant_ptr&& v, location_type&& l)
: Base (t)
@ -2088,6 +2120,10 @@ switch (yykind)
value.template destroy< animtree_ptr > ();
break;
case symbol_kind::S_color: // color
value.template destroy< color_ptr > ();
break;
case symbol_kind::S_constant: // constant
value.template destroy< constant_ptr > ();
break;
@ -2138,7 +2174,6 @@ switch (yykind)
value.template destroy< file_ptr > ();
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.template destroy< float_ptr > ();
break;
@ -2151,7 +2186,6 @@ switch (yykind)
value.template destroy< include_ptr > ();
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.template destroy< integer_ptr > ();
break;
@ -2193,8 +2227,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.template destroy< std::string > ();
break;
@ -2434,7 +2472,7 @@ switch (yykind)
: super_type(token_type (tok), v, l)
#endif
{
S1_ASSERT ((token::FILE <= tok && tok <= token::INTEGER));
S1_ASSERT ((token::FILE <= tok && tok <= token::INT_HEX));
}
};
@ -3819,6 +3857,21 @@ switch (yykind)
return symbol_type (token::ISTRING, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_COLOR (std::string v, location_type l)
{
return symbol_type (token::COLOR, std::move (v), std::move (l));
}
#else
static
symbol_type
make_COLOR (const std::string& v, const location_type& l)
{
return symbol_type (token::COLOR, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
@ -3837,16 +3890,61 @@ switch (yykind)
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INTEGER (std::string v, location_type l)
make_INT_DEC (std::string v, location_type l)
{
return symbol_type (token::INTEGER, std::move (v), std::move (l));
return symbol_type (token::INT_DEC, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INTEGER (const std::string& v, const location_type& l)
make_INT_DEC (const std::string& v, const location_type& l)
{
return symbol_type (token::INTEGER, v, l);
return symbol_type (token::INT_DEC, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_OCT (std::string v, location_type l)
{
return symbol_type (token::INT_OCT, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_OCT (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_OCT, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_BIN (std::string v, location_type l)
{
return symbol_type (token::INT_BIN, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_BIN (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_BIN, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_HEX (std::string v, location_type l)
{
return symbol_type (token::INT_HEX, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_HEX (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_HEX, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
@ -4328,8 +4426,8 @@ switch (yykind)
/// Constants.
enum
{
yylast_ = 1842, ///< Last index in yytable_.
yynnts_ = 77, ///< Number of nonterminal symbols.
yylast_ = 1883, ///< Last index in yytable_.
yynnts_ = 76, ///< Number of nonterminal symbols.
yyfinal_ = 15 ///< Termination state number.
};
@ -4369,6 +4467,10 @@ switch (yykind)
value.copy< animtree_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_color: // color
value.copy< color_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_constant: // constant
value.copy< constant_ptr > (YY_MOVE (that.value));
break;
@ -4419,7 +4521,6 @@ switch (yykind)
value.copy< file_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.copy< float_ptr > (YY_MOVE (that.value));
break;
@ -4432,7 +4533,6 @@ switch (yykind)
value.copy< include_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.copy< integer_ptr > (YY_MOVE (that.value));
break;
@ -4474,8 +4574,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.copy< std::string > (YY_MOVE (that.value));
break;
@ -4650,6 +4754,10 @@ switch (yykind)
value.move< animtree_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_color: // color
value.move< color_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_constant: // constant
value.move< constant_ptr > (YY_MOVE (s.value));
break;
@ -4700,7 +4808,6 @@ switch (yykind)
value.move< file_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.move< float_ptr > (YY_MOVE (s.value));
break;
@ -4713,7 +4820,6 @@ switch (yykind)
value.move< include_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.move< integer_ptr > (YY_MOVE (s.value));
break;
@ -4755,8 +4861,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.move< std::string > (YY_MOVE (s.value));
break;
@ -4953,7 +5063,7 @@ switch (yykind)
#line 13 "parser.ypp"
} } } // xsk::gsc::s1
#line 4957 "parser.hpp"
#line 5067 "parser.hpp"

View File

@ -791,6 +791,7 @@ void compiler::emit_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& expr)
case gsc::node_t::data_name: emit_local_variable(ctx, expr.as_name); break;
case gsc::node_t::data_istring: emit_istring(ctx, expr.as_istring); break;
case gsc::node_t::data_string: emit_string(ctx, expr.as_string); break;
case gsc::node_t::data_color: emit_color(ctx, expr.as_color); break;
case gsc::node_t::data_vector: emit_vector(ctx, expr.as_vector); break;
case gsc::node_t::data_float: emit_float(ctx, expr.as_float); break;
case gsc::node_t::data_integer: emit_integer(ctx, expr.as_integer); break;
@ -1612,6 +1613,30 @@ void compiler::emit_string(const gsc::context_ptr& ctx, const gsc::string_ptr& s
emit_opcode(ctx, opcode::OP_GetString, str->value);
}
void compiler::emit_color(const gsc::context_ptr& ctx, const gsc::color_ptr& color)
{
std::vector<std::string> data;
std::string x, y, z;
if(color->value.size() == 3)
{
x = "0x" + color->value.substr(0, 1) + color->value.substr(0, 1);
y = "0x" + color->value.substr(1, 1) + color->value.substr(1, 1);
z = "0x" + color->value.substr(2, 1) + color->value.substr(2, 1);
}
else
{
x = "0x" + color->value.substr(0, 2);
y = "0x" + color->value.substr(2, 2);
z = "0x" + color->value.substr(4, 2);
}
data.push_back(gsc::utils::string::hex_to_dec(x.data()));
data.push_back(gsc::utils::string::hex_to_dec(y.data()));
data.push_back(gsc::utils::string::hex_to_dec(z.data()));
emit_opcode(ctx, opcode::OP_GetVector, data);
}
void compiler::emit_vector(const gsc::context_ptr& ctx, const gsc::vector_ptr& vec)
{
std::vector<std::string> data;

View File

@ -102,6 +102,7 @@ private:
void emit_animation(const gsc::context_ptr& ctx, const gsc::animation_ptr& animation);
void emit_istring(const gsc::context_ptr& ctx, const gsc::istring_ptr& str);
void emit_string(const gsc::context_ptr& ctx, const gsc::string_ptr& str);
void emit_color(const gsc::context_ptr& ctx, const gsc::color_ptr& color);
void emit_vector(const gsc::context_ptr& ctx, const gsc::vector_ptr& vec);
void emit_float(const gsc::context_ptr& ctx, const gsc::float_ptr& num);
void emit_integer(const gsc::context_ptr& ctx, const gsc::integer_ptr& num);

File diff suppressed because it is too large Load Diff

View File

@ -700,7 +700,7 @@ extern int yylex (yyscan_t yyscanner);
#undef yyTABLES_NAME
#endif
#line 150 "lexer.lpp"
#line 158 "lexer.lpp"
#line 706 "lexer.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -417,31 +417,34 @@ namespace xsk { namespace gsc { namespace s2 {
// animtree
char dummy3[sizeof (animtree_ptr)];
// color
char dummy4[sizeof (color_ptr)];
// constant
char dummy4[sizeof (constant_ptr)];
char dummy5[sizeof (constant_ptr)];
// define
char dummy5[sizeof (define_ptr)];
char dummy6[sizeof (define_ptr)];
// empty_array
char dummy6[sizeof (empty_array_ptr)];
char dummy7[sizeof (empty_array_ptr)];
// expr_arguments
// expr_arguments_filled
// expr_arguments_empty
char dummy7[sizeof (expr_arguments_ptr)];
char dummy8[sizeof (expr_arguments_ptr)];
// expr_assign
char dummy8[sizeof (expr_assign_ptr)];
char dummy9[sizeof (expr_assign_ptr)];
// expr_call
// expr_call_thread
// expr_call_childthread
char dummy9[sizeof (expr_call_ptr)];
char dummy10[sizeof (expr_call_ptr)];
// expr_call_function
// expr_call_pointer
char dummy10[sizeof (expr_call_type_ptr)];
char dummy11[sizeof (expr_call_type_ptr)];
// for_expr
// expr
@ -449,36 +452,34 @@ namespace xsk { namespace gsc { namespace s2 {
// expr_ternary
// expr_binary
// expr_primitive
char dummy11[sizeof (expr_ptr)];
char dummy12[sizeof (expr_ptr)];
// false
char dummy12[sizeof (false_ptr)];
char dummy13[sizeof (false_ptr)];
// file
char dummy13[sizeof (file_ptr)];
char dummy14[sizeof (file_ptr)];
// neg_float
// float
char dummy14[sizeof (float_ptr)];
char dummy15[sizeof (float_ptr)];
// game
char dummy15[sizeof (game_ptr)];
char dummy16[sizeof (game_ptr)];
// include
char dummy16[sizeof (include_ptr)];
char dummy17[sizeof (include_ptr)];
// neg_integer
// integer
char dummy17[sizeof (integer_ptr)];
char dummy18[sizeof (integer_ptr)];
// istring
char dummy18[sizeof (istring_ptr)];
char dummy19[sizeof (istring_ptr)];
// level
char dummy19[sizeof (level_ptr)];
char dummy20[sizeof (level_ptr)];
// name
char dummy20[sizeof (name_ptr)];
char dummy21[sizeof (name_ptr)];
// expr_function
// expr_add_array
@ -486,122 +487,126 @@ namespace xsk { namespace gsc { namespace s2 {
// expr_field
// expr_size
// object
char dummy21[sizeof (node_ptr)];
char dummy22[sizeof (node_ptr)];
// parameters
char dummy22[sizeof (parameters_ptr)];
char dummy23[sizeof (parameters_ptr)];
// program
char dummy23[sizeof (program_ptr)];
char dummy24[sizeof (program_ptr)];
// self
char dummy24[sizeof (self_ptr)];
char dummy25[sizeof (self_ptr)];
// "file path"
// "identifier"
// "string literal"
// "localized string"
// "color"
// "float"
// "int"
char dummy25[sizeof (std::string)];
// "octal int"
// "binary int"
// "hexadecimal int"
char dummy26[sizeof (std::string)];
// stmt_assign
char dummy26[sizeof (stmt_assign_ptr)];
char dummy27[sizeof (stmt_assign_ptr)];
// stmt_break
char dummy27[sizeof (stmt_break_ptr)];
char dummy28[sizeof (stmt_break_ptr)];
// stmt_breakpoint
char dummy28[sizeof (stmt_breakpoint_ptr)];
char dummy29[sizeof (stmt_breakpoint_ptr)];
// stmt_call
char dummy29[sizeof (stmt_call_ptr)];
char dummy30[sizeof (stmt_call_ptr)];
// stmt_case
char dummy30[sizeof (stmt_case_ptr)];
char dummy31[sizeof (stmt_case_ptr)];
// stmt_continue
char dummy31[sizeof (stmt_continue_ptr)];
char dummy32[sizeof (stmt_continue_ptr)];
// stmt_default
char dummy32[sizeof (stmt_default_ptr)];
char dummy33[sizeof (stmt_default_ptr)];
// stmt_endon
char dummy33[sizeof (stmt_endon_ptr)];
char dummy34[sizeof (stmt_endon_ptr)];
// stmt_for
char dummy34[sizeof (stmt_for_ptr)];
char dummy35[sizeof (stmt_for_ptr)];
// stmt_foreach
char dummy35[sizeof (stmt_foreach_ptr)];
char dummy36[sizeof (stmt_foreach_ptr)];
// stmt_if
char dummy36[sizeof (stmt_if_ptr)];
char dummy37[sizeof (stmt_if_ptr)];
// stmt_ifelse
char dummy37[sizeof (stmt_ifelse_ptr)];
char dummy38[sizeof (stmt_ifelse_ptr)];
// stmt_block
// stmt_list
char dummy38[sizeof (stmt_list_ptr)];
char dummy39[sizeof (stmt_list_ptr)];
// stmt_notify
char dummy39[sizeof (stmt_notify_ptr)];
char dummy40[sizeof (stmt_notify_ptr)];
// stmt_prof_begin
char dummy40[sizeof (stmt_prof_begin_ptr)];
char dummy41[sizeof (stmt_prof_begin_ptr)];
// stmt_prof_end
char dummy41[sizeof (stmt_prof_end_ptr)];
char dummy42[sizeof (stmt_prof_end_ptr)];
// stmt
// for_stmt
char dummy42[sizeof (stmt_ptr)];
char dummy43[sizeof (stmt_ptr)];
// stmt_return
char dummy43[sizeof (stmt_return_ptr)];
char dummy44[sizeof (stmt_return_ptr)];
// stmt_switch
char dummy44[sizeof (stmt_switch_ptr)];
char dummy45[sizeof (stmt_switch_ptr)];
// stmt_wait
char dummy45[sizeof (stmt_wait_ptr)];
char dummy46[sizeof (stmt_wait_ptr)];
// stmt_waitframe
char dummy46[sizeof (stmt_waitframe_ptr)];
char dummy47[sizeof (stmt_waitframe_ptr)];
// stmt_waittill
char dummy47[sizeof (stmt_waittill_ptr)];
char dummy48[sizeof (stmt_waittill_ptr)];
// stmt_waittillframeend
char dummy48[sizeof (stmt_waittillframeend_ptr)];
char dummy49[sizeof (stmt_waittillframeend_ptr)];
// stmt_waittillmatch
char dummy49[sizeof (stmt_waittillmatch_ptr)];
char dummy50[sizeof (stmt_waittillmatch_ptr)];
// stmt_while
char dummy50[sizeof (stmt_while_ptr)];
char dummy51[sizeof (stmt_while_ptr)];
// string
char dummy51[sizeof (string_ptr)];
char dummy52[sizeof (string_ptr)];
// thisthread
char dummy52[sizeof (thisthread_ptr)];
char dummy53[sizeof (thisthread_ptr)];
// thread
char dummy53[sizeof (thread_ptr)];
char dummy54[sizeof (thread_ptr)];
// true
char dummy54[sizeof (true_ptr)];
char dummy55[sizeof (true_ptr)];
// undefined
char dummy55[sizeof (undefined_ptr)];
char dummy56[sizeof (undefined_ptr)];
// usingtree
char dummy56[sizeof (usingtree_ptr)];
char dummy57[sizeof (usingtree_ptr)];
// vector
char dummy57[sizeof (vector_ptr)];
char dummy58[sizeof (vector_ptr)];
};
/// The size of the largest semantic type.
@ -739,17 +744,21 @@ namespace xsk { namespace gsc { namespace s2 {
NAME = 86, // "identifier"
STRING = 87, // "string literal"
ISTRING = 88, // "localized string"
FLOAT = 89, // "float"
INTEGER = 90, // "int"
ADD_ARRAY = 91, // ADD_ARRAY
THEN = 92, // THEN
TERN = 93, // TERN
NEG = 94, // NEG
ANIMREF = 95, // ANIMREF
PREINC = 96, // PREINC
PREDEC = 97, // PREDEC
POSTINC = 98, // POSTINC
POSTDEC = 99 // POSTDEC
COLOR = 89, // "color"
FLOAT = 90, // "float"
INT_DEC = 91, // "int"
INT_OCT = 92, // "octal int"
INT_BIN = 93, // "binary int"
INT_HEX = 94, // "hexadecimal int"
ADD_ARRAY = 95, // ADD_ARRAY
THEN = 96, // THEN
TERN = 97, // TERN
NEG = 98, // NEG
ANIMREF = 99, // ANIMREF
PREINC = 100, // PREINC
PREDEC = 101, // PREDEC
POSTINC = 102, // POSTINC
POSTDEC = 103 // POSTDEC
};
/// Backward compatibility alias (Bison 3.6).
typedef token_kind_type yytokentype;
@ -766,7 +775,7 @@ namespace xsk { namespace gsc { namespace s2 {
{
enum symbol_kind_type
{
YYNTOKENS = 100, ///< Number of tokens.
YYNTOKENS = 104, ///< Number of tokens.
S_YYEMPTY = -2,
S_YYEOF = 0, // "end of file"
S_YYerror = 1, // error
@ -857,94 +866,97 @@ namespace xsk { namespace gsc { namespace s2 {
S_NAME = 86, // "identifier"
S_STRING = 87, // "string literal"
S_ISTRING = 88, // "localized string"
S_FLOAT = 89, // "float"
S_INTEGER = 90, // "int"
S_ADD_ARRAY = 91, // ADD_ARRAY
S_THEN = 92, // THEN
S_TERN = 93, // TERN
S_NEG = 94, // NEG
S_ANIMREF = 95, // ANIMREF
S_PREINC = 96, // PREINC
S_PREDEC = 97, // PREDEC
S_POSTINC = 98, // POSTINC
S_POSTDEC = 99, // POSTDEC
S_YYACCEPT = 100, // $accept
S_root = 101, // root
S_program = 102, // program
S_include = 103, // include
S_define = 104, // define
S_usingtree = 105, // usingtree
S_constant = 106, // constant
S_thread = 107, // thread
S_parameters = 108, // parameters
S_stmt = 109, // stmt
S_stmt_block = 110, // stmt_block
S_stmt_list = 111, // stmt_list
S_stmt_call = 112, // stmt_call
S_stmt_assign = 113, // stmt_assign
S_stmt_endon = 114, // stmt_endon
S_stmt_notify = 115, // stmt_notify
S_stmt_wait = 116, // stmt_wait
S_stmt_waittill = 117, // stmt_waittill
S_stmt_waittillmatch = 118, // stmt_waittillmatch
S_stmt_waittillframeend = 119, // stmt_waittillframeend
S_stmt_waitframe = 120, // stmt_waitframe
S_stmt_if = 121, // stmt_if
S_stmt_ifelse = 122, // stmt_ifelse
S_stmt_while = 123, // stmt_while
S_stmt_for = 124, // stmt_for
S_stmt_foreach = 125, // stmt_foreach
S_stmt_switch = 126, // stmt_switch
S_stmt_case = 127, // stmt_case
S_stmt_default = 128, // stmt_default
S_stmt_break = 129, // stmt_break
S_stmt_continue = 130, // stmt_continue
S_stmt_return = 131, // stmt_return
S_stmt_breakpoint = 132, // stmt_breakpoint
S_stmt_prof_begin = 133, // stmt_prof_begin
S_stmt_prof_end = 134, // stmt_prof_end
S_for_stmt = 135, // for_stmt
S_for_expr = 136, // for_expr
S_expr = 137, // expr
S_expr_assign = 138, // expr_assign
S_expr_compare = 139, // expr_compare
S_expr_ternary = 140, // expr_ternary
S_expr_binary = 141, // expr_binary
S_expr_primitive = 142, // expr_primitive
S_expr_call = 143, // expr_call
S_expr_call_thread = 144, // expr_call_thread
S_expr_call_childthread = 145, // expr_call_childthread
S_expr_call_function = 146, // expr_call_function
S_expr_call_pointer = 147, // expr_call_pointer
S_expr_arguments = 148, // expr_arguments
S_expr_arguments_filled = 149, // expr_arguments_filled
S_expr_arguments_empty = 150, // expr_arguments_empty
S_expr_function = 151, // expr_function
S_expr_add_array = 152, // expr_add_array
S_expr_array = 153, // expr_array
S_expr_field = 154, // expr_field
S_expr_size = 155, // expr_size
S_object = 156, // object
S_thisthread = 157, // thisthread
S_empty_array = 158, // empty_array
S_undefined = 159, // undefined
S_game = 160, // game
S_self = 161, // self
S_anim = 162, // anim
S_level = 163, // level
S_animation = 164, // animation
S_animtree = 165, // animtree
S_name = 166, // name
S_file = 167, // file
S_istring = 168, // istring
S_string = 169, // string
S_vector = 170, // vector
S_neg_float = 171, // neg_float
S_neg_integer = 172, // neg_integer
S_float = 173, // float
S_integer = 174, // integer
S_false = 175, // false
S_true = 176 // true
S_COLOR = 89, // "color"
S_FLOAT = 90, // "float"
S_INT_DEC = 91, // "int"
S_INT_OCT = 92, // "octal int"
S_INT_BIN = 93, // "binary int"
S_INT_HEX = 94, // "hexadecimal int"
S_ADD_ARRAY = 95, // ADD_ARRAY
S_THEN = 96, // THEN
S_TERN = 97, // TERN
S_NEG = 98, // NEG
S_ANIMREF = 99, // ANIMREF
S_PREINC = 100, // PREINC
S_PREDEC = 101, // PREDEC
S_POSTINC = 102, // POSTINC
S_POSTDEC = 103, // POSTDEC
S_YYACCEPT = 104, // $accept
S_root = 105, // root
S_program = 106, // program
S_include = 107, // include
S_define = 108, // define
S_usingtree = 109, // usingtree
S_constant = 110, // constant
S_thread = 111, // thread
S_parameters = 112, // parameters
S_stmt = 113, // stmt
S_stmt_block = 114, // stmt_block
S_stmt_list = 115, // stmt_list
S_stmt_call = 116, // stmt_call
S_stmt_assign = 117, // stmt_assign
S_stmt_endon = 118, // stmt_endon
S_stmt_notify = 119, // stmt_notify
S_stmt_wait = 120, // stmt_wait
S_stmt_waittill = 121, // stmt_waittill
S_stmt_waittillmatch = 122, // stmt_waittillmatch
S_stmt_waittillframeend = 123, // stmt_waittillframeend
S_stmt_waitframe = 124, // stmt_waitframe
S_stmt_if = 125, // stmt_if
S_stmt_ifelse = 126, // stmt_ifelse
S_stmt_while = 127, // stmt_while
S_stmt_for = 128, // stmt_for
S_stmt_foreach = 129, // stmt_foreach
S_stmt_switch = 130, // stmt_switch
S_stmt_case = 131, // stmt_case
S_stmt_default = 132, // stmt_default
S_stmt_break = 133, // stmt_break
S_stmt_continue = 134, // stmt_continue
S_stmt_return = 135, // stmt_return
S_stmt_breakpoint = 136, // stmt_breakpoint
S_stmt_prof_begin = 137, // stmt_prof_begin
S_stmt_prof_end = 138, // stmt_prof_end
S_for_stmt = 139, // for_stmt
S_for_expr = 140, // for_expr
S_expr = 141, // expr
S_expr_assign = 142, // expr_assign
S_expr_compare = 143, // expr_compare
S_expr_ternary = 144, // expr_ternary
S_expr_binary = 145, // expr_binary
S_expr_primitive = 146, // expr_primitive
S_expr_call = 147, // expr_call
S_expr_call_thread = 148, // expr_call_thread
S_expr_call_childthread = 149, // expr_call_childthread
S_expr_call_function = 150, // expr_call_function
S_expr_call_pointer = 151, // expr_call_pointer
S_expr_arguments = 152, // expr_arguments
S_expr_arguments_filled = 153, // expr_arguments_filled
S_expr_arguments_empty = 154, // expr_arguments_empty
S_expr_function = 155, // expr_function
S_expr_add_array = 156, // expr_add_array
S_expr_array = 157, // expr_array
S_expr_field = 158, // expr_field
S_expr_size = 159, // expr_size
S_object = 160, // object
S_float = 161, // float
S_integer = 162, // integer
S_thisthread = 163, // thisthread
S_empty_array = 164, // empty_array
S_undefined = 165, // undefined
S_game = 166, // game
S_self = 167, // self
S_anim = 168, // anim
S_level = 169, // level
S_animation = 170, // animation
S_animtree = 171, // animtree
S_name = 172, // name
S_file = 173, // file
S_istring = 174, // istring
S_string = 175, // string
S_color = 176, // color
S_vector = 177, // vector
S_false = 178, // false
S_true = 179 // true
};
};
@ -993,6 +1005,10 @@ namespace xsk { namespace gsc { namespace s2 {
value.move< animtree_ptr > (std::move (that.value));
break;
case symbol_kind::S_color: // color
value.move< color_ptr > (std::move (that.value));
break;
case symbol_kind::S_constant: // constant
value.move< constant_ptr > (std::move (that.value));
break;
@ -1043,7 +1059,6 @@ namespace xsk { namespace gsc { namespace s2 {
value.move< file_ptr > (std::move (that.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.move< float_ptr > (std::move (that.value));
break;
@ -1056,7 +1071,6 @@ namespace xsk { namespace gsc { namespace s2 {
value.move< include_ptr > (std::move (that.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.move< integer_ptr > (std::move (that.value));
break;
@ -1098,8 +1112,12 @@ namespace xsk { namespace gsc { namespace s2 {
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.move< std::string > (std::move (that.value));
break;
@ -1298,6 +1316,20 @@ namespace xsk { namespace gsc { namespace s2 {
{}
#endif
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, color_ptr&& v, location_type&& l)
: Base (t)
, value (std::move (v))
, location (std::move (l))
{}
#else
basic_symbol (typename Base::kind_type t, const color_ptr& v, const location_type& l)
: Base (t)
, value (v)
, location (l)
{}
#endif
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, constant_ptr&& v, location_type&& l)
: Base (t)
@ -2088,6 +2120,10 @@ switch (yykind)
value.template destroy< animtree_ptr > ();
break;
case symbol_kind::S_color: // color
value.template destroy< color_ptr > ();
break;
case symbol_kind::S_constant: // constant
value.template destroy< constant_ptr > ();
break;
@ -2138,7 +2174,6 @@ switch (yykind)
value.template destroy< file_ptr > ();
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.template destroy< float_ptr > ();
break;
@ -2151,7 +2186,6 @@ switch (yykind)
value.template destroy< include_ptr > ();
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.template destroy< integer_ptr > ();
break;
@ -2193,8 +2227,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.template destroy< std::string > ();
break;
@ -2434,7 +2472,7 @@ switch (yykind)
: super_type(token_type (tok), v, l)
#endif
{
S2_ASSERT ((token::FILE <= tok && tok <= token::INTEGER));
S2_ASSERT ((token::FILE <= tok && tok <= token::INT_HEX));
}
};
@ -3819,6 +3857,21 @@ switch (yykind)
return symbol_type (token::ISTRING, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_COLOR (std::string v, location_type l)
{
return symbol_type (token::COLOR, std::move (v), std::move (l));
}
#else
static
symbol_type
make_COLOR (const std::string& v, const location_type& l)
{
return symbol_type (token::COLOR, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
@ -3837,16 +3890,61 @@ switch (yykind)
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INTEGER (std::string v, location_type l)
make_INT_DEC (std::string v, location_type l)
{
return symbol_type (token::INTEGER, std::move (v), std::move (l));
return symbol_type (token::INT_DEC, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INTEGER (const std::string& v, const location_type& l)
make_INT_DEC (const std::string& v, const location_type& l)
{
return symbol_type (token::INTEGER, v, l);
return symbol_type (token::INT_DEC, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_OCT (std::string v, location_type l)
{
return symbol_type (token::INT_OCT, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_OCT (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_OCT, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_BIN (std::string v, location_type l)
{
return symbol_type (token::INT_BIN, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_BIN (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_BIN, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_INT_HEX (std::string v, location_type l)
{
return symbol_type (token::INT_HEX, std::move (v), std::move (l));
}
#else
static
symbol_type
make_INT_HEX (const std::string& v, const location_type& l)
{
return symbol_type (token::INT_HEX, v, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
@ -4328,8 +4426,8 @@ switch (yykind)
/// Constants.
enum
{
yylast_ = 1842, ///< Last index in yytable_.
yynnts_ = 77, ///< Number of nonterminal symbols.
yylast_ = 1883, ///< Last index in yytable_.
yynnts_ = 76, ///< Number of nonterminal symbols.
yyfinal_ = 15 ///< Termination state number.
};
@ -4369,6 +4467,10 @@ switch (yykind)
value.copy< animtree_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_color: // color
value.copy< color_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_constant: // constant
value.copy< constant_ptr > (YY_MOVE (that.value));
break;
@ -4419,7 +4521,6 @@ switch (yykind)
value.copy< file_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.copy< float_ptr > (YY_MOVE (that.value));
break;
@ -4432,7 +4533,6 @@ switch (yykind)
value.copy< include_ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.copy< integer_ptr > (YY_MOVE (that.value));
break;
@ -4474,8 +4574,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.copy< std::string > (YY_MOVE (that.value));
break;
@ -4650,6 +4754,10 @@ switch (yykind)
value.move< animtree_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_color: // color
value.move< color_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_constant: // constant
value.move< constant_ptr > (YY_MOVE (s.value));
break;
@ -4700,7 +4808,6 @@ switch (yykind)
value.move< file_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_neg_float: // neg_float
case symbol_kind::S_float: // float
value.move< float_ptr > (YY_MOVE (s.value));
break;
@ -4713,7 +4820,6 @@ switch (yykind)
value.move< include_ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_neg_integer: // neg_integer
case symbol_kind::S_integer: // integer
value.move< integer_ptr > (YY_MOVE (s.value));
break;
@ -4755,8 +4861,12 @@ switch (yykind)
case symbol_kind::S_NAME: // "identifier"
case symbol_kind::S_STRING: // "string literal"
case symbol_kind::S_ISTRING: // "localized string"
case symbol_kind::S_COLOR: // "color"
case symbol_kind::S_FLOAT: // "float"
case symbol_kind::S_INTEGER: // "int"
case symbol_kind::S_INT_DEC: // "int"
case symbol_kind::S_INT_OCT: // "octal int"
case symbol_kind::S_INT_BIN: // "binary int"
case symbol_kind::S_INT_HEX: // "hexadecimal int"
value.move< std::string > (YY_MOVE (s.value));
break;
@ -4953,7 +5063,7 @@ switch (yykind)
#line 13 "parser.ypp"
} } } // xsk::gsc::s2
#line 4957 "parser.hpp"
#line 5067 "parser.hpp"

View File

@ -16,6 +16,7 @@ enum class node_t
data_integer,
data_float,
data_vector,
data_color,
data_string,
data_istring,
data_file,
@ -126,6 +127,7 @@ struct node_false;
struct node_integer;
struct node_float;
struct node_vector;
struct node_color;
struct node_string;
struct node_istring;
struct node_file;
@ -234,6 +236,7 @@ using false_ptr = std::unique_ptr<node_false>;
using integer_ptr = std::unique_ptr<node_integer>;
using float_ptr = std::unique_ptr<node_float>;
using vector_ptr = std::unique_ptr<node_vector>;
using color_ptr = std::unique_ptr<node_color>;
using string_ptr = std::unique_ptr<node_string>;
using istring_ptr = std::unique_ptr<node_istring>;
using file_ptr = std::unique_ptr<node_file>;
@ -358,6 +361,7 @@ union expr_ptr
integer_ptr as_integer;
float_ptr as_float;
vector_ptr as_vector;
color_ptr as_color;
string_ptr as_string;
istring_ptr as_istring;
file_ptr as_file;
@ -699,6 +703,27 @@ struct node_vector : public node
}
};
struct node_color : public node
{
std::string value;
node_color(const std::string& value)
: node(node_t::data_color), value(value) {}
node_color(const location& loc, const std::string& value)
: node(node_t::data_color, loc), value(value) {}
auto print() -> std::string override
{
return "#"s += value;
}
friend bool operator==(const node_color& lhs, const node_color& rhs)
{
return lhs.value == rhs.value;
}
};
struct node_string : public node
{
std::string value;

View File

@ -8,6 +8,21 @@
namespace xsk::gsc::utils
{
auto string::oct_to_dec(const char* str) -> std::string
{
return std::to_string(std::stoi(str, nullptr, 8));
}
auto string::bin_to_dec(const char* str) -> std::string
{
return std::to_string(std::stoi(&str[2], nullptr, 2)); // str must prefix 0[bB]
}
auto string::hex_to_dec(const char* str) -> std::string
{
return std::to_string(std::stoi(&str[2], nullptr, 16)); // str must prefix 0[xX]
}
auto string::iequals(const std::string& a, const std::string& b) -> bool
{
return (a.size() == b.size()) && std::equal(a.begin(), a.end(), b.begin(), b.end(),

View File

@ -21,6 +21,9 @@ public:
return std::string(buf.data(), buf.data() + size - 1);
}
static auto oct_to_dec(const char* str) -> std::string;
static auto bin_to_dec(const char* str) -> std::string;
static auto hex_to_dec(const char* str) -> std::string;
static auto iequals(const std::string& a, const std::string& b) -> bool;
static auto is_number(const std::string& s) -> bool;
static auto is_hex_number(const std::string& s) -> bool;

View File

@ -35,6 +35,7 @@ expr_ptr::~expr_ptr()
case node_t::data_integer: as_integer.~integer_ptr(); break;
case node_t::data_float: as_float.~float_ptr(); break;
case node_t::data_vector: as_vector.~vector_ptr(); break;
case node_t::data_color: as_color.~color_ptr(); break;
case node_t::data_string: as_string.~string_ptr(); break;
case node_t::data_istring: as_istring.~istring_ptr(); break;
case node_t::data_file: as_file.~file_ptr(); break;
@ -156,6 +157,7 @@ bool expr_ptr::operator==(const expr_ptr& rhs) const
case node_t::data_integer: return *as_integer == *rhs.as_integer;
case node_t::data_float: return *as_float == *rhs.as_float;
case node_t::data_vector: return *as_vector == *rhs.as_vector;
case node_t::data_color: return *as_color == *rhs.as_color;
case node_t::data_string: return *as_string == *rhs.as_string;
case node_t::data_istring: return *as_istring == *rhs.as_istring;
case node_t::data_file: return *as_file == *rhs.as_file;