{
$$ = g_hash_table_lookup (const_table, $1);
if ($$ == NULL) {
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
} else {
$$ = gi_source_symbol_ref ($$);
}
}
| INTEGER
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_int_set = TRUE;
if (g_str_has_prefix (yytext, "0x") && strlen (yytext) > 2) {
$$->const_int = strtol (yytext + 2, NULL, 16);
}
| CHARACTER
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
}
| FLOATING
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_double_set = TRUE;
$$->const_double = 0.0;
sscanf (yytext, "%lf", &($$->const_double));
strings
: STRING
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
yytext[strlen (yytext) - 1] = '\0';
$$->const_string = g_strcompress (yytext + 1);
if (!g_utf8_validate ($$->const_string, -1, NULL))
: primary_expression
| postfix_expression '[' expression ']'
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
}
| postfix_expression '(' argument_expression_list ')'
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
}
| postfix_expression '(' ')'
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
}
| postfix_expression '.' identifier_or_typedef_name
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
}
| postfix_expression ARROW identifier_or_typedef_name
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
}
| postfix_expression PLUSPLUS
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
}
| postfix_expression MINUSMINUS
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
}
;
: postfix_expression
| PLUSPLUS unary_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
}
| MINUSMINUS unary_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
}
| unary_operator cast_expression
{
$$->const_int = !gi_source_symbol_get_const_boolean ($2);
break;
default:
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
break;
}
}
| SIZEOF unary_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
}
| SIZEOF '(' type_name ')'
{
ctype_free ($3);
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
}
;
: cast_expression
| multiplicative_expression '*' cast_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int * $3->const_int;
}
| multiplicative_expression '/' cast_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_int_set = TRUE;
if ($3->const_int != 0) {
$$->const_int = $1->const_int / $3->const_int;
}
| multiplicative_expression '%' cast_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_int_set = TRUE;
if ($3->const_int != 0) {
$$->const_int = $1->const_int % $3->const_int;
: multiplicative_expression
| additive_expression '+' multiplicative_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int + $3->const_int;
}
| additive_expression '-' multiplicative_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int - $3->const_int;
}
: additive_expression
| shift_expression SL additive_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int << $3->const_int;
}
| shift_expression SR additive_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int >> $3->const_int;
}
: shift_expression
| relational_expression '<' shift_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int < $3->const_int;
}
| relational_expression '>' shift_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int > $3->const_int;
}
| relational_expression LTEQ shift_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int <= $3->const_int;
}
| relational_expression GTEQ shift_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int >= $3->const_int;
}
: relational_expression
| equality_expression EQ relational_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int == $3->const_int;
}
| equality_expression NOTEQ relational_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int != $3->const_int;
}
: equality_expression
| and_expression '&' equality_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int & $3->const_int;
}
: and_expression
| exclusive_or_expression '^' and_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int ^ $3->const_int;
}
: exclusive_or_expression
| inclusive_or_expression '|' exclusive_or_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int | $3->const_int;
}
: inclusive_or_expression
| logical_and_expression ANDAND inclusive_or_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_int_set = TRUE;
$$->const_int =
gi_source_symbol_get_const_boolean ($1) &&
: logical_and_expression
| logical_or_expression OROR logical_and_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, lineno);
$$->const_int_set = TRUE;
$$->const_int =
gi_source_symbol_get_const_boolean ($1) ||
: conditional_expression
| unary_expression assignment_operator assignment_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
}
;
| expression ',' assignment_expression
| EXTENSION expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
}
;
$$->name = $2;
$$->child_list = $4;
- GISourceSymbol *sym = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ GISourceSymbol *sym = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
if ($$->type == CTYPE_STRUCT) {
sym->type = CSYMBOL_TYPE_STRUCT;
} else if ($$->type == CTYPE_UNION) {
struct_declarator
: /* empty, support for anonymous structs and unions */
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
}
| declarator
| ':' constant_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
}
| declarator ':' constant_expression
{
enumerator
: identifier
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_OBJECT);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_OBJECT, lineno);
$$->ident = $1;
$$->const_int_set = TRUE;
$$->const_int = ++last_enum_value;
}
| identifier '=' constant_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_OBJECT);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_OBJECT, lineno);
$$->ident = $1;
$$->const_int_set = TRUE;
$$->const_int = $3->const_int;
direct_declarator
: identifier
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
$$->ident = $1;
}
| '(' declarator ')'
}
| declaration_specifiers
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
$$->base_type = $1;
}
| ELLIPSIS
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_ELLIPSIS);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_ELLIPSIS, lineno);
}
;
identifier_list
: identifier
{
- GISourceSymbol *sym = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ GISourceSymbol *sym = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
sym->ident = $1;
$$ = g_list_append (NULL, sym);
}
| identifier_list ',' identifier
{
- GISourceSymbol *sym = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ GISourceSymbol *sym = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
sym->ident = $3;
$$ = g_list_append ($1, sym);
}
abstract_declarator
: pointer
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
gi_source_symbol_merge_type ($$, $1);
}
| direct_abstract_declarator
}
| '[' ']'
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
gi_source_symbol_merge_type ($$, gi_source_array_new (NULL));
}
| '[' assignment_expression ']'
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
gi_source_symbol_merge_type ($$, gi_source_array_new ($2));
}
| direct_abstract_declarator '[' ']'
| '(' ')'
{
GISourceType *func = gi_source_function_new ();
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
gi_source_symbol_merge_type ($$, func);
}
| '(' parameter_list ')'
if ($2 != NULL && ($2->next != NULL || ((GISourceSymbol *) $2->data)->base_type->type != CTYPE_VOID)) {
func->child_list = $2;
}
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, lineno);
gi_source_symbol_merge_type ($$, func);
}
| direct_abstract_declarator '(' ')'