summaryrefslogtreecommitdiff
path: root/giscanner/scannerparser.y
diff options
context:
space:
mode:
Diffstat (limited to 'giscanner/scannerparser.y')
-rw-r--r--giscanner/scannerparser.y108
1 files changed, 54 insertions, 54 deletions
diff --git a/giscanner/scannerparser.y b/giscanner/scannerparser.y
index 3457b499..d440fd38 100644
--- a/giscanner/scannerparser.y
+++ b/giscanner/scannerparser.y
@@ -225,7 +225,7 @@ primary_expression
{
$$ = g_hash_table_lookup (const_table, $1);
if ($$ == NULL) {
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
} else {
$$ = gi_source_symbol_ref ($$);
}
@@ -234,7 +234,7 @@ primary_expression
{
char *rest;
guint64 value;
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, lineno);
$$->const_int_set = TRUE;
if (g_str_has_prefix (yytext, "0x") && strlen (yytext) > 2) {
value = g_ascii_strtoull (yytext + 2, &rest, 16);
@@ -248,13 +248,13 @@ primary_expression
}
| CHARACTER
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, lineno);
$$->const_int_set = TRUE;
$$->const_int = g_utf8_get_char(yytext + 1);
}
| FLOATING
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, lineno);
$$->const_double_set = TRUE;
$$->const_double = 0.0;
sscanf (yytext, "%lf", &($$->const_double));
@@ -266,7 +266,7 @@ primary_expression
}
| EXTENSION '(' '{' block_item_list '}' ')'
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
}
;
@@ -274,7 +274,7 @@ primary_expression
strings
: STRING
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, lineno);
yytext[strlen (yytext) - 1] = '\0';
$$->const_string = parse_c_string_literal (yytext + 1);
if (!g_utf8_validate ($$->const_string, -1, NULL))
@@ -316,31 +316,31 @@ postfix_expression
: primary_expression
| postfix_expression '[' expression ']'
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
}
| postfix_expression '(' argument_expression_list ')'
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
}
| postfix_expression '(' ')'
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
}
| postfix_expression '.' identifier_or_typedef_name
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
}
| postfix_expression ARROW identifier_or_typedef_name
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
}
| postfix_expression PLUSPLUS
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
}
| postfix_expression MINUSMINUS
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
}
;
@@ -353,11 +353,11 @@ unary_expression
: postfix_expression
| PLUSPLUS unary_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
}
| MINUSMINUS unary_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
}
| unary_operator cast_expression
{
@@ -378,7 +378,7 @@ unary_expression
$$->const_int = !gi_source_symbol_get_const_boolean ($2);
break;
default:
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
break;
}
}
@@ -398,12 +398,12 @@ unary_expression
}
| SIZEOF unary_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
}
| SIZEOF '(' type_name ')'
{
ctype_free ($3);
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
}
;
@@ -451,13 +451,13 @@ multiplicative_expression
: cast_expression
| multiplicative_expression '*' cast_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int * $3->const_int;
}
| multiplicative_expression '/' cast_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, lineno);
$$->const_int_set = TRUE;
if ($3->const_int != 0) {
$$->const_int = $1->const_int / $3->const_int;
@@ -465,7 +465,7 @@ multiplicative_expression
}
| multiplicative_expression '%' cast_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, lineno);
$$->const_int_set = TRUE;
if ($3->const_int != 0) {
$$->const_int = $1->const_int % $3->const_int;
@@ -477,13 +477,13 @@ additive_expression
: multiplicative_expression
| additive_expression '+' multiplicative_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int + $3->const_int;
}
| additive_expression '-' multiplicative_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int - $3->const_int;
}
@@ -493,7 +493,7 @@ shift_expression
: additive_expression
| shift_expression SL additive_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int << $3->const_int;
@@ -505,7 +505,7 @@ shift_expression
}
| shift_expression SR additive_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int >> $3->const_int;
}
@@ -515,25 +515,25 @@ relational_expression
: shift_expression
| relational_expression '<' shift_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int < $3->const_int;
}
| relational_expression '>' shift_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, 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, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, 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, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int >= $3->const_int;
}
@@ -543,13 +543,13 @@ equality_expression
: relational_expression
| equality_expression EQ relational_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, 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, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int != $3->const_int;
}
@@ -559,7 +559,7 @@ and_expression
: equality_expression
| and_expression '&' equality_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int & $3->const_int;
}
@@ -569,7 +569,7 @@ exclusive_or_expression
: and_expression
| exclusive_or_expression '^' and_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int ^ $3->const_int;
}
@@ -579,7 +579,7 @@ inclusive_or_expression
: exclusive_or_expression
| inclusive_or_expression '|' exclusive_or_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, lineno);
$$->const_int_set = TRUE;
$$->const_int = $1->const_int | $3->const_int;
}
@@ -589,7 +589,7 @@ logical_and_expression
: inclusive_or_expression
| logical_and_expression ANDAND inclusive_or_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, lineno);
$$->const_int_set = TRUE;
$$->const_int =
gi_source_symbol_get_const_boolean ($1) &&
@@ -601,7 +601,7 @@ logical_or_expression
: logical_and_expression
| logical_or_expression OROR logical_and_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST, scanner->current_file, lineno);
$$->const_int_set = TRUE;
$$->const_int =
gi_source_symbol_get_const_boolean ($1) ||
@@ -621,7 +621,7 @@ assignment_expression
: conditional_expression
| unary_expression assignment_operator assignment_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
}
;
@@ -644,7 +644,7 @@ expression
| expression ',' assignment_expression
| EXTENSION expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
}
;
@@ -823,7 +823,7 @@ struct_or_union_specifier
$$->name = $2;
$$->child_list = $4;
- sym = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ sym = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
if ($$->type == CTYPE_STRUCT) {
sym->type = CSYMBOL_TYPE_STRUCT;
} else if ($$->type == CTYPE_UNION) {
@@ -922,12 +922,12 @@ struct_declarator_list
struct_declarator
: /* empty, support for anonymous structs and unions */
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
}
| declarator
| ':' constant_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
}
| declarator ':' constant_expression
{
@@ -1003,7 +1003,7 @@ enumerator_list
enumerator
: identifier
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_OBJECT, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_OBJECT, scanner->current_file, lineno);
$$->ident = $1;
$$->const_int_set = TRUE;
$$->const_int = ++last_enum_value;
@@ -1011,7 +1011,7 @@ enumerator
}
| identifier '=' constant_expression
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_OBJECT, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_OBJECT, scanner->current_file, lineno);
$$->ident = $1;
$$->const_int_set = TRUE;
$$->const_int = $3->const_int;
@@ -1058,7 +1058,7 @@ declarator
direct_declarator
: identifier
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
$$->ident = $1;
}
| '(' declarator ')'
@@ -1165,25 +1165,25 @@ parameter_declaration
}
| declaration_specifiers
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
$$->base_type = $1;
}
| ELLIPSIS
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_ELLIPSIS, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_ELLIPSIS, scanner->current_file, lineno);
}
;
identifier_list
: identifier
{
- GISourceSymbol *sym = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ GISourceSymbol *sym = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
sym->ident = $1;
$$ = g_list_append (NULL, sym);
}
| identifier_list ',' identifier
{
- GISourceSymbol *sym = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ GISourceSymbol *sym = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
sym->ident = $3;
$$ = g_list_append ($1, sym);
}
@@ -1197,7 +1197,7 @@ type_name
abstract_declarator
: pointer
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
gi_source_symbol_merge_type ($$, $1);
}
| direct_abstract_declarator
@@ -1215,12 +1215,12 @@ direct_abstract_declarator
}
| '[' ']'
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
gi_source_symbol_merge_type ($$, gi_source_array_new (NULL));
}
| '[' assignment_expression ']'
{
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
gi_source_symbol_merge_type ($$, gi_source_array_new ($2));
}
| direct_abstract_declarator '[' ']'
@@ -1236,7 +1236,7 @@ direct_abstract_declarator
| '(' ')'
{
GISourceType *func = gi_source_function_new ();
- $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
gi_source_symbol_merge_type ($$, func);
}
| '(' parameter_list ')'
@@ -1246,7 +1246,7 @@ direct_abstract_declarator
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, scanner->current_filename, lineno);
+ $$ = gi_source_symbol_new (CSYMBOL_TYPE_INVALID, scanner->current_file, lineno);
gi_source_symbol_merge_type ($$, func);
}
| direct_abstract_declarator '(' ')'
@@ -1418,7 +1418,7 @@ yyerror (GISourceScanner *scanner, const char *s)
if (!scanner->macro_scan)
{
fprintf(stderr, "%s:%d: %s in '%s' at '%s'\n",
- scanner->current_filename, lineno, s, linebuf, yytext);
+ g_file_get_parse_name (scanner->current_file), lineno, s, linebuf, yytext);
}
}