1 /* A Bison parser, made by GNU Bison 2.5. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
43 /* Identify Bison output. */
47 #define YYBISON_VERSION "2.5"
50 #define YYSKELETON_NAME "yacc.c"
61 /* Using locations. */
62 #define YYLSP_NEEDED 1
64 /* Substitute the variable and function names. */
65 #define yyparse hlsl_parse
66 #define yylex hlsl_lex
67 #define yyerror hlsl_error
68 #define yylval hlsl_lval
69 #define yychar hlsl_char
70 #define yydebug hlsl_debug
71 #define yynerrs hlsl_nerrs
72 #define yylloc hlsl_lloc
74 /* Copy the first part of user declarations. */
76 /* Line 268 of yacc.c */
79 #include "d3dcompiler_private.h"
81 WINE_DEFAULT_DEBUG_CHANNEL(hlsl_parser
);
85 struct hlsl_parse_ctx hlsl_ctx
;
88 static void set_location(struct source_location
*loc
, const struct YYLTYPE
*l
);
90 void hlsl_message(const char *fmt
, ...)
95 compilation_message(&hlsl_ctx
.messages
, fmt
, args
);
99 static const char *hlsl_get_error_level_name(enum hlsl_error_level level
)
101 const char *names
[] =
110 void hlsl_report_message(const char *filename
, DWORD line
, DWORD column
,
111 enum hlsl_error_level level
, const char *fmt
, ...)
120 rc
= vsnprintf(string
, size
, fmt
, args
);
123 if (rc
>= 0 && rc
< size
)
129 size
= size
? size
* 2 : 32;
132 string
= d3dcompiler_alloc(size
);
134 string
= d3dcompiler_realloc(string
, size
);
137 ERR("Error reallocating memory for a string.\n");
142 hlsl_message("%s:%u:%u: %s: %s\n", filename
, line
, column
, hlsl_get_error_level_name(level
), string
);
143 d3dcompiler_free(string
);
145 if (level
== HLSL_LEVEL_ERROR
)
146 set_parse_status(&hlsl_ctx
.status
, PARSE_ERR
);
147 else if (level
== HLSL_LEVEL_WARNING
)
148 set_parse_status(&hlsl_ctx
.status
, PARSE_WARN
);
151 static void hlsl_error(const char *s
)
153 hlsl_report_message(hlsl_ctx
.source_file
, hlsl_ctx
.line_no
, hlsl_ctx
.column
, HLSL_LEVEL_ERROR
, "%s", s
);
156 static void debug_dump_decl(struct hlsl_type
*type
, DWORD modifiers
, const char *declname
, unsigned int line_no
)
158 TRACE("Line %u: ", line_no
);
160 TRACE("%s ", debug_modifiers(modifiers
));
161 TRACE("%s %s;\n", debug_hlsl_type(type
), declname
);
164 static void check_invalid_matrix_modifiers(DWORD modifiers
, struct source_location
*loc
)
166 if (modifiers
& (HLSL_MODIFIER_ROW_MAJOR
| HLSL_MODIFIER_COLUMN_MAJOR
))
168 hlsl_report_message(loc
->file
, loc
->line
, loc
->col
, HLSL_LEVEL_ERROR
,
169 "'row_major' or 'column_major' modifiers are only allowed for matrices");
173 static BOOL
declare_variable(struct hlsl_ir_var
*decl
, BOOL local
)
177 TRACE("Declaring variable %s.\n", decl
->name
);
178 if (decl
->node
.data_type
->type
== HLSL_CLASS_MATRIX
)
180 if (!(decl
->modifiers
& (HLSL_MODIFIER_ROW_MAJOR
| HLSL_MODIFIER_COLUMN_MAJOR
)))
182 decl
->modifiers
|= hlsl_ctx
.matrix_majority
== HLSL_ROW_MAJOR
183 ? HLSL_MODIFIER_ROW_MAJOR
: HLSL_MODIFIER_COLUMN_MAJOR
;
187 check_invalid_matrix_modifiers(decl
->modifiers
, &decl
->node
.loc
);
191 DWORD invalid
= decl
->modifiers
& (HLSL_STORAGE_EXTERN
| HLSL_STORAGE_SHARED
192 | HLSL_STORAGE_GROUPSHARED
| HLSL_STORAGE_UNIFORM
);
195 hlsl_report_message(decl
->node
.loc
.file
, decl
->node
.loc
.line
, decl
->node
.loc
.col
, HLSL_LEVEL_ERROR
,
196 "modifier '%s' invalid for local variables", debug_modifiers(invalid
));
200 hlsl_report_message(decl
->node
.loc
.file
, decl
->node
.loc
.line
, decl
->node
.loc
.col
, HLSL_LEVEL_ERROR
,
201 "semantics are not allowed on local variables");
207 if (find_function(decl
->name
))
209 hlsl_report_message(decl
->node
.loc
.file
, decl
->node
.loc
.line
, decl
->node
.loc
.col
, HLSL_LEVEL_ERROR
,
210 "redefinition of '%s'", decl
->name
);
214 ret
= add_declaration(hlsl_ctx
.cur_scope
, decl
, local
);
217 struct hlsl_ir_var
*old
= get_variable(hlsl_ctx
.cur_scope
, decl
->name
);
219 hlsl_report_message(decl
->node
.loc
.file
, decl
->node
.loc
.line
, decl
->node
.loc
.col
, HLSL_LEVEL_ERROR
,
220 "\"%s\" already declared", decl
->name
);
221 hlsl_report_message(old
->node
.loc
.file
, old
->node
.loc
.line
, old
->node
.loc
.col
, HLSL_LEVEL_NOTE
,
222 "\"%s\" was previously declared here", old
->name
);
228 static DWORD
add_modifier(DWORD modifiers
, DWORD mod
, const struct YYLTYPE
*loc
);
230 static BOOL
check_type_modifiers(DWORD modifiers
, struct source_location
*loc
)
232 if (modifiers
& ~HLSL_TYPE_MODIFIERS_MASK
)
234 hlsl_report_message(loc
->file
, loc
->line
, loc
->col
, HLSL_LEVEL_ERROR
,
235 "modifier not allowed on typedefs");
241 static BOOL
add_type_to_scope(struct hlsl_scope
*scope
, struct hlsl_type
*def
)
243 if (get_type(scope
, def
->name
, FALSE
))
246 wine_rb_put(&scope
->types
, def
->name
, &def
->scope_entry
);
250 static void declare_predefined_types(struct hlsl_scope
*scope
)
252 struct hlsl_type
*type
;
253 unsigned int x
, y
, bt
;
254 static const char *names
[] =
265 for (bt
= 0; bt
<= HLSL_TYPE_LAST_SCALAR
; ++bt
)
267 for (y
= 1; y
<= 4; ++y
)
269 for (x
= 1; x
<= 4; ++x
)
271 sprintf(name
, "%s%ux%u", names
[bt
], x
, y
);
272 type
= new_hlsl_type(d3dcompiler_strdup(name
), HLSL_CLASS_MATRIX
, bt
, x
, y
);
273 add_type_to_scope(scope
, type
);
277 sprintf(name
, "%s%u", names
[bt
], x
);
278 type
= new_hlsl_type(d3dcompiler_strdup(name
), HLSL_CLASS_VECTOR
, bt
, x
, y
);
279 add_type_to_scope(scope
, type
);
283 sprintf(name
, "%s", names
[bt
]);
284 type
= new_hlsl_type(d3dcompiler_strdup(name
), HLSL_CLASS_SCALAR
, bt
, x
, y
);
285 add_type_to_scope(scope
, type
);
292 /* DX8 effects predefined types */
293 type
= new_hlsl_type(d3dcompiler_strdup("DWORD"), HLSL_CLASS_SCALAR
, HLSL_TYPE_INT
, 1, 1);
294 add_type_to_scope(scope
, type
);
295 type
= new_hlsl_type(d3dcompiler_strdup("FLOAT"), HLSL_CLASS_SCALAR
, HLSL_TYPE_FLOAT
, 1, 1);
296 add_type_to_scope(scope
, type
);
297 type
= new_hlsl_type(d3dcompiler_strdup("VECTOR"), HLSL_CLASS_VECTOR
, HLSL_TYPE_FLOAT
, 4, 1);
298 add_type_to_scope(scope
, type
);
299 type
= new_hlsl_type(d3dcompiler_strdup("MATRIX"), HLSL_CLASS_MATRIX
, HLSL_TYPE_FLOAT
, 4, 4);
300 add_type_to_scope(scope
, type
);
301 type
= new_hlsl_type(d3dcompiler_strdup("STRING"), HLSL_CLASS_OBJECT
, HLSL_TYPE_STRING
, 1, 1);
302 add_type_to_scope(scope
, type
);
303 type
= new_hlsl_type(d3dcompiler_strdup("TEXTURE"), HLSL_CLASS_OBJECT
, HLSL_TYPE_TEXTURE
, 1, 1);
304 add_type_to_scope(scope
, type
);
305 type
= new_hlsl_type(d3dcompiler_strdup("PIXELSHADER"), HLSL_CLASS_OBJECT
, HLSL_TYPE_PIXELSHADER
, 1, 1);
306 add_type_to_scope(scope
, type
);
307 type
= new_hlsl_type(d3dcompiler_strdup("VERTEXSHADER"), HLSL_CLASS_OBJECT
, HLSL_TYPE_VERTEXSHADER
, 1, 1);
308 add_type_to_scope(scope
, type
);
311 static struct hlsl_ir_if
*loop_condition(struct list
*cond_list
)
313 struct hlsl_ir_if
*out_cond
;
314 struct hlsl_ir_expr
*not_cond
;
315 struct hlsl_ir_node
*cond
, *operands
[3];
316 struct hlsl_ir_jump
*jump
;
317 unsigned int count
= list_count(cond_list
);
322 ERR("Got multiple expressions in a for condition.\n");
324 cond
= LIST_ENTRY(list_head(cond_list
), struct hlsl_ir_node
, entry
);
325 out_cond
= d3dcompiler_alloc(sizeof(*out_cond
));
328 ERR("Out of memory.\n");
331 out_cond
->node
.type
= HLSL_IR_IF
;
333 operands
[1] = operands
[2] = NULL
;
334 not_cond
= new_expr(HLSL_IR_UNOP_LOGIC_NOT
, operands
, &cond
->loc
);
337 ERR("Out of memory.\n");
338 d3dcompiler_free(out_cond
);
341 out_cond
->condition
= ¬_cond
->node
;
342 jump
= d3dcompiler_alloc(sizeof(*jump
));
345 ERR("Out of memory.\n");
346 d3dcompiler_free(out_cond
);
347 d3dcompiler_free(not_cond
);
350 jump
->node
.type
= HLSL_IR_JUMP
;
351 jump
->type
= HLSL_IR_JUMP_BREAK
;
352 out_cond
->then_instrs
= d3dcompiler_alloc(sizeof(*out_cond
->then_instrs
));
353 if (!out_cond
->then_instrs
)
355 ERR("Out of memory.\n");
356 d3dcompiler_free(out_cond
);
357 d3dcompiler_free(not_cond
);
358 d3dcompiler_free(jump
);
361 list_init(out_cond
->then_instrs
);
362 list_add_head(out_cond
->then_instrs
, &jump
->node
.entry
);
374 static struct list
*create_loop(enum loop_type type
, struct list
*init
, struct list
*cond
,
375 struct hlsl_ir_node
*iter
, struct list
*body
, struct source_location
*loc
)
377 struct list
*list
= NULL
;
378 struct hlsl_ir_loop
*loop
= NULL
;
379 struct hlsl_ir_if
*cond_jump
= NULL
;
381 list
= d3dcompiler_alloc(sizeof(*list
));
387 list_move_head(list
, init
);
389 loop
= d3dcompiler_alloc(sizeof(*loop
));
392 loop
->node
.type
= HLSL_IR_LOOP
;
393 loop
->node
.loc
= *loc
;
394 list_add_tail(list
, &loop
->node
.entry
);
395 loop
->body
= d3dcompiler_alloc(sizeof(*loop
->body
));
398 list_init(loop
->body
);
400 cond_jump
= loop_condition(cond
);
404 if (type
!= LOOP_DO_WHILE
)
405 list_add_tail(loop
->body
, &cond_jump
->node
.entry
);
407 list_move_tail(loop
->body
, body
);
410 list_add_tail(loop
->body
, &iter
->entry
);
412 if (type
== LOOP_DO_WHILE
)
413 list_add_tail(loop
->body
, &cond_jump
->node
.entry
);
415 d3dcompiler_free(init
);
416 d3dcompiler_free(cond
);
417 d3dcompiler_free(body
);
421 ERR("Out of memory.\n");
423 d3dcompiler_free(loop
->body
);
424 d3dcompiler_free(loop
);
425 d3dcompiler_free(cond_jump
);
426 d3dcompiler_free(list
);
427 free_instr_list(init
);
428 free_instr_list(cond
);
430 free_instr_list(body
);
434 static unsigned int initializer_size(struct list
*initializer
)
436 unsigned int count
= 0;
437 struct hlsl_ir_node
*node
;
439 LIST_FOR_EACH_ENTRY(node
, initializer
, struct hlsl_ir_node
, entry
)
441 count
+= components_count_type(node
->data_type
);
443 TRACE("Initializer size = %u\n", count
);
447 static unsigned int components_count_expr_list(struct list
*list
)
449 struct hlsl_ir_node
*node
;
450 unsigned int count
= 0;
452 LIST_FOR_EACH_ENTRY(node
, list
, struct hlsl_ir_node
, entry
)
454 count
+= components_count_type(node
->data_type
);
459 static struct hlsl_ir_swizzle
*new_swizzle(DWORD s
, unsigned int components
,
460 struct hlsl_ir_node
*val
, struct source_location
*loc
)
462 struct hlsl_ir_swizzle
*swizzle
= d3dcompiler_alloc(sizeof(*swizzle
));
466 swizzle
->node
.type
= HLSL_IR_SWIZZLE
;
467 swizzle
->node
.loc
= *loc
;
468 swizzle
->node
.data_type
= new_hlsl_type(NULL
, HLSL_CLASS_VECTOR
, val
->data_type
->base_type
, components
, 1);
470 swizzle
->swizzle
= s
;
474 static struct hlsl_ir_swizzle
*get_swizzle(struct hlsl_ir_node
*value
, const char *swizzle
,
475 struct source_location
*loc
)
477 unsigned int len
= strlen(swizzle
), component
= 0;
478 unsigned int i
, set
, swiz
= 0;
481 if (value
->data_type
->type
== HLSL_CLASS_MATRIX
)
485 unsigned int inc
, x
, y
;
487 if (len
< 3 || swizzle
[0] != '_')
489 m_swizzle
= swizzle
[1] == 'm';
490 inc
= m_swizzle
? 4 : 3;
492 if (len
% inc
|| len
> inc
* 4)
495 for (i
= 0; i
< len
; i
+= inc
)
497 if (swizzle
[i
] != '_')
501 if (swizzle
[i
+ 1] != 'm')
503 x
= swizzle
[i
+ 2] - '0';
504 y
= swizzle
[i
+ 3] - '0';
508 x
= swizzle
[i
+ 1] - '1';
509 y
= swizzle
[i
+ 2] - '1';
512 if (x
>= value
->data_type
->dimx
|| y
>= value
->data_type
->dimy
)
514 swiz
|= (y
<< 4 | x
) << component
* 8;
517 return new_swizzle(swiz
, component
, value
, loc
);
524 for (set
= 0; set
< 2; ++set
)
528 for (i
= 0; i
< len
; ++i
)
530 char c
[2][4] = {{'x', 'y', 'z', 'w'}, {'r', 'g', 'b', 'a'}};
533 for (s
= 0; s
< 4; ++s
)
535 if (swizzle
[i
] == c
[set
][s
])
544 if (s
>= value
->data_type
->dimx
)
546 swiz
|= s
<< component
* 2;
550 return new_swizzle(swiz
, component
, value
, loc
);
556 static void struct_var_initializer(struct list
*list
, struct hlsl_ir_var
*var
, struct list
*initializer
)
558 struct hlsl_type
*type
= var
->node
.data_type
;
559 struct hlsl_ir_node
*node
;
560 struct hlsl_struct_field
*field
;
561 struct list
*cur_node
;
562 struct hlsl_ir_node
*assignment
;
563 struct hlsl_ir_deref
*deref
;
565 if (initializer_size(initializer
) != components_count_type(type
))
567 hlsl_report_message(var
->node
.loc
.file
, var
->node
.loc
.line
, var
->node
.loc
.col
, HLSL_LEVEL_ERROR
,
568 "structure initializer mismatch");
569 free_instr_list(initializer
);
572 cur_node
= list_head(initializer
);
574 node
= LIST_ENTRY(cur_node
, struct hlsl_ir_node
, entry
);
575 LIST_FOR_EACH_ENTRY(field
, type
->e
.elements
, struct hlsl_struct_field
, entry
)
579 d3dcompiler_free(initializer
);
582 if (components_count_type(field
->type
) == components_count_type(node
->data_type
))
584 deref
= new_record_deref(&var
->node
, field
);
587 ERR("Out of memory.\n");
590 deref
->node
.loc
= node
->loc
;
591 assignment
= make_assignment(&deref
->node
, ASSIGN_OP_ASSIGN
, BWRITERSP_WRITEMASK_ALL
, node
);
592 list_add_tail(list
, &assignment
->entry
);
595 FIXME("Initializing with \"mismatched\" fields is not supported yet.\n");
596 cur_node
= list_next(initializer
, cur_node
);
597 node
= LIST_ENTRY(cur_node
, struct hlsl_ir_node
, entry
);
600 /* Free initializer elements in excess. */
603 struct list
*next
= list_next(initializer
, cur_node
);
606 node
= LIST_ENTRY(cur_node
, struct hlsl_ir_node
, entry
);
608 d3dcompiler_free(initializer
);
611 static struct list
*declare_vars(struct hlsl_type
*basic_type
, DWORD modifiers
, struct list
*var_list
)
613 struct hlsl_type
*type
;
614 struct parse_variable_def
*v
, *v_next
;
615 struct hlsl_ir_var
*var
;
616 struct hlsl_ir_node
*assignment
;
617 BOOL ret
, local
= TRUE
;
618 struct list
*statements_list
= d3dcompiler_alloc(sizeof(*statements_list
));
620 if (!statements_list
)
622 ERR("Out of memory.\n");
623 LIST_FOR_EACH_ENTRY_SAFE(v
, v_next
, var_list
, struct parse_variable_def
, entry
)
625 d3dcompiler_free(var_list
);
628 list_init(statements_list
);
631 return statements_list
;
633 LIST_FOR_EACH_ENTRY_SAFE(v
, v_next
, var_list
, struct parse_variable_def
, entry
)
635 var
= d3dcompiler_alloc(sizeof(*var
));
638 ERR("Out of memory.\n");
642 var
->node
.type
= HLSL_IR_VAR
;
644 type
= new_array_type(basic_type
, v
->array_size
);
647 var
->node
.data_type
= type
;
648 var
->node
.loc
= v
->loc
;
650 var
->modifiers
= modifiers
;
651 var
->semantic
= v
->semantic
;
652 debug_dump_decl(type
, modifiers
, v
->name
, v
->loc
.line
);
654 if (hlsl_ctx
.cur_scope
== hlsl_ctx
.globals
)
656 var
->modifiers
|= HLSL_STORAGE_UNIFORM
;
660 if (var
->modifiers
& HLSL_MODIFIER_CONST
&& !(var
->modifiers
& HLSL_STORAGE_UNIFORM
) && !v
->initializer
)
662 hlsl_report_message(v
->loc
.file
, v
->loc
.line
, v
->loc
.col
,
663 HLSL_LEVEL_ERROR
, "const variable without initializer");
664 free_declaration(var
);
669 ret
= declare_variable(var
, local
);
672 free_declaration(var
);
676 TRACE("Declared variable %s.\n", var
->name
);
680 unsigned int size
= initializer_size(v
->initializer
);
681 struct hlsl_ir_node
*node
;
683 TRACE("Variable with initializer.\n");
684 if (type
->type
<= HLSL_CLASS_LAST_NUMERIC
685 && type
->dimx
* type
->dimy
!= size
&& size
!= 1)
687 if (size
< type
->dimx
* type
->dimy
)
689 hlsl_report_message(v
->loc
.file
, v
->loc
.line
, v
->loc
.col
, HLSL_LEVEL_ERROR
,
690 "'%s' initializer does not match", v
->name
);
691 free_instr_list(v
->initializer
);
696 if ((type
->type
== HLSL_CLASS_STRUCT
|| type
->type
== HLSL_CLASS_ARRAY
)
697 && components_count_type(type
) != size
)
699 hlsl_report_message(v
->loc
.file
, v
->loc
.line
, v
->loc
.col
, HLSL_LEVEL_ERROR
,
700 "'%s' initializer does not match", v
->name
);
701 free_instr_list(v
->initializer
);
706 if (type
->type
== HLSL_CLASS_STRUCT
)
708 struct_var_initializer(statements_list
, var
, v
->initializer
);
712 if (type
->type
> HLSL_CLASS_LAST_NUMERIC
)
714 FIXME("Initializers for non scalar/struct variables not supported yet.\n");
715 free_instr_list(v
->initializer
);
719 if (v
->array_size
> 0)
721 FIXME("Initializing arrays is not supported yet.\n");
722 free_instr_list(v
->initializer
);
726 if (list_count(v
->initializer
) > 1)
728 FIXME("Complex initializers are not supported yet.\n");
729 free_instr_list(v
->initializer
);
733 node
= LIST_ENTRY(list_head(v
->initializer
), struct hlsl_ir_node
, entry
);
734 assignment
= make_assignment(&var
->node
, ASSIGN_OP_ASSIGN
,
735 BWRITERSP_WRITEMASK_ALL
, node
);
736 list_add_tail(statements_list
, &assignment
->entry
);
737 d3dcompiler_free(v
->initializer
);
741 d3dcompiler_free(var_list
);
742 return statements_list
;
745 static BOOL
add_struct_field(struct list
*fields
, struct hlsl_struct_field
*field
)
747 struct hlsl_struct_field
*f
;
749 LIST_FOR_EACH_ENTRY(f
, fields
, struct hlsl_struct_field
, entry
)
751 if (!strcmp(f
->name
, field
->name
))
754 list_add_tail(fields
, &field
->entry
);
758 static struct list
*gen_struct_fields(struct hlsl_type
*type
, DWORD modifiers
, struct list
*fields
)
760 struct parse_variable_def
*v
, *v_next
;
761 struct hlsl_struct_field
*field
;
764 list
= d3dcompiler_alloc(sizeof(*list
));
767 ERR("Out of memory.\n");
771 LIST_FOR_EACH_ENTRY_SAFE(v
, v_next
, fields
, struct parse_variable_def
, entry
)
773 debug_dump_decl(type
, 0, v
->name
, v
->loc
.line
);
774 field
= d3dcompiler_alloc(sizeof(*field
));
777 ERR("Out of memory.\n");
782 field
->name
= v
->name
;
783 field
->modifiers
= modifiers
;
784 field
->semantic
= v
->semantic
;
787 hlsl_report_message(v
->loc
.file
, v
->loc
.line
, v
->loc
.col
, HLSL_LEVEL_ERROR
,
788 "struct field with an initializer.\n");
789 free_instr_list(v
->initializer
);
791 list_add_tail(list
, &field
->entry
);
794 d3dcompiler_free(fields
);
798 static struct hlsl_type
*new_struct_type(const char *name
, DWORD modifiers
, struct list
*fields
)
800 struct hlsl_type
*type
= d3dcompiler_alloc(sizeof(*type
));
804 ERR("Out of memory.\n");
807 type
->type
= HLSL_CLASS_STRUCT
;
809 type
->dimx
= type
->dimy
= 1;
810 type
->modifiers
= modifiers
;
811 type
->e
.elements
= fields
;
813 list_add_tail(&hlsl_ctx
.types
, &type
->entry
);
818 static BOOL
add_typedef(DWORD modifiers
, struct hlsl_type
*orig_type
, struct list
*list
,
819 struct source_location
*loc
)
822 struct hlsl_type
*type
;
823 struct parse_variable_def
*v
, *v_next
;
825 if (!check_type_modifiers(modifiers
, loc
))
827 LIST_FOR_EACH_ENTRY_SAFE(v
, v_next
, list
, struct parse_variable_def
, entry
)
829 d3dcompiler_free(list
);
833 LIST_FOR_EACH_ENTRY_SAFE(v
, v_next
, list
, struct parse_variable_def
, entry
)
836 type
= new_array_type(orig_type
, v
->array_size
);
838 type
= clone_hlsl_type(orig_type
);
841 ERR("Out of memory\n");
844 d3dcompiler_free((void *)type
->name
);
845 type
->name
= v
->name
;
846 type
->modifiers
|= modifiers
;
848 if (type
->type
!= HLSL_CLASS_MATRIX
)
849 check_invalid_matrix_modifiers(type
->modifiers
, &v
->loc
);
851 ret
= add_type_to_scope(hlsl_ctx
.cur_scope
, type
);
854 hlsl_report_message(v
->loc
.file
, v
->loc
.line
, v
->loc
.col
, HLSL_LEVEL_ERROR
,
855 "redefinition of custom type '%s'", v
->name
);
859 d3dcompiler_free(list
);
863 static const struct hlsl_ir_function_decl
*get_overloaded_func(struct wine_rb_tree
*funcs
, char *name
,
864 struct list
*params
, BOOL exact_signature
)
866 struct hlsl_ir_function
*func
;
867 struct wine_rb_entry
*entry
;
869 entry
= wine_rb_get(funcs
, name
);
872 func
= WINE_RB_ENTRY_VALUE(entry
, struct hlsl_ir_function
, entry
);
874 entry
= wine_rb_get(&func
->overloads
, params
);
877 if (!exact_signature
)
878 FIXME("No exact match, search for a compatible overloaded function (if any).\n");
881 return WINE_RB_ENTRY_VALUE(entry
, struct hlsl_ir_function_decl
, entry
);
888 /* Line 268 of yacc.c */
889 #line 895 "hlsl.tab.c"
891 /* Enabling traces. */
896 /* Enabling verbose error messages. */
897 #ifdef YYERROR_VERBOSE
898 # undef YYERROR_VERBOSE
899 # define YYERROR_VERBOSE 1
901 # define YYERROR_VERBOSE 1
904 /* Enabling the token table. */
905 #ifndef YYTOKEN_TABLE
906 # define YYTOKEN_TABLE 0
913 /* Put the tokens into the symbol table, so that GDB and other debuggers
920 KW_COLUMN_MAJOR
= 262,
924 KW_DEPTHSTENCILSTATE
= 266,
925 KW_DEPTHSTENCILVIEW
= 267,
933 KW_GEOMETRYSHADER
= 275,
934 KW_GROUPSHARED
= 276,
941 KW_NOINTERPOLATION
= 283,
944 KW_PIXELSHADER
= 286,
946 KW_RASTERIZERSTATE
= 288,
947 KW_RENDERTARGETVIEW
= 289,
955 KW_SAMPLERCUBE
= 297,
956 KW_SAMPLER_STATE
= 298,
957 KW_SAMPLERCOMPARISONSTATE
= 299,
960 KW_STATEBLOCK_STATE
= 302,
967 KW_TECHNIQUE10
= 309,
970 KW_TEXTURE1DARRAY
= 312,
972 KW_TEXTURE2DARRAY
= 314,
973 KW_TEXTURE2DMS
= 315,
974 KW_TEXTURE2DMSARRAY
= 316,
976 KW_TEXTURE3DARRAY
= 318,
977 KW_TEXTURECUBE
= 319,
982 KW_VERTEXSHADER
= 324,
992 OP_LEFTSHIFTASSIGN
= 334,
994 OP_RIGHTSHIFTASSIGN
= 336,
1012 VAR_IDENTIFIER
= 354,
1013 TYPE_IDENTIFIER
= 355,
1014 NEW_IDENTIFIER
= 356,
1023 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1024 typedef union YYSTYPE
1027 /* Line 293 of yacc.c */
1030 struct hlsl_type
*type
;
1036 struct hlsl_ir_var
*var
;
1037 struct hlsl_ir_node
*instr
;
1039 struct parse_function function
;
1040 struct parse_parameter parameter
;
1041 struct parse_variable_def
*variable_def
;
1042 struct parse_if_body if_body
;
1043 enum parse_unary_op unary_op
;
1044 enum parse_assign_op assign_op
;
1048 /* Line 293 of yacc.c */
1049 #line 1055 "hlsl.tab.c"
1051 # define YYSTYPE_IS_TRIVIAL 1
1052 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1053 # define YYSTYPE_IS_DECLARED 1
1056 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
1057 typedef struct YYLTYPE
1064 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
1065 # define YYLTYPE_IS_DECLARED 1
1066 # define YYLTYPE_IS_TRIVIAL 1
1070 /* Copy the second part of user declarations. */
1073 /* Line 343 of yacc.c */
1074 #line 1080 "hlsl.tab.c"
1081 typedef YYTYPE_UINT8 yytype_uint8
;
1083 typedef unsigned char yytype_uint8
;
1087 typedef YYTYPE_INT8 yytype_int8
;
1088 #elif (defined __STDC__ || defined __C99__FUNC__ \
1089 || defined __cplusplus || defined _MSC_VER)
1090 typedef signed char yytype_int8
;
1092 typedef short int yytype_int8
;
1095 #ifdef YYTYPE_UINT16
1096 typedef YYTYPE_UINT16 yytype_uint16
;
1098 typedef unsigned short int yytype_uint16
;
1102 typedef YYTYPE_INT16 yytype_int16
;
1104 typedef short int yytype_int16
;
1108 # ifdef __SIZE_TYPE__
1109 # define YYSIZE_T __SIZE_TYPE__
1110 # elif defined size_t
1111 # define YYSIZE_T size_t
1112 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1113 || defined __cplusplus || defined _MSC_VER)
1114 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1115 # define YYSIZE_T size_t
1117 # define YYSIZE_T unsigned int
1121 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1124 # if defined YYENABLE_NLS && YYENABLE_NLS
1126 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1127 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1131 # define YY_(msgid) msgid
1135 /* Suppress unused-variable warnings by "using" E. */
1136 #if ! defined lint || defined __GNUC__
1137 # define YYUSE(e) ((void) (e))
1139 # define YYUSE(e) /* empty */
1142 /* Identity function, used to suppress warnings about constant conditions. */
1144 # define YYID(n) (n)
1146 #if (defined __STDC__ || defined __C99__FUNC__ \
1147 || defined __cplusplus || defined _MSC_VER)
1160 #if ! defined yyoverflow || YYERROR_VERBOSE
1162 /* The parser invokes alloca or malloc; define the necessary symbols. */
1164 # ifdef YYSTACK_USE_ALLOCA
1165 # if YYSTACK_USE_ALLOCA
1167 # define YYSTACK_ALLOC __builtin_alloca
1168 # elif defined __BUILTIN_VA_ARG_INCR
1169 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1171 # define YYSTACK_ALLOC __alloca
1172 # elif defined _MSC_VER
1173 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1174 # define alloca _alloca
1176 # define YYSTACK_ALLOC alloca
1177 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
1178 || defined __cplusplus || defined _MSC_VER)
1179 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1180 # ifndef EXIT_SUCCESS
1181 # define EXIT_SUCCESS 0
1188 # ifdef YYSTACK_ALLOC
1189 /* Pacify GCC's `empty if-body' warning. */
1190 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1191 # ifndef YYSTACK_ALLOC_MAXIMUM
1192 /* The OS might guarantee only one guard page at the bottom of the stack,
1193 and a page size can be as small as 4096 bytes. So we cannot safely
1194 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1195 to allow for a few compiler-allocated temporary stack slots. */
1196 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1199 # define YYSTACK_ALLOC YYMALLOC
1200 # define YYSTACK_FREE YYFREE
1201 # ifndef YYSTACK_ALLOC_MAXIMUM
1202 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1204 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
1205 && ! ((defined YYMALLOC || defined malloc) \
1206 && (defined YYFREE || defined free)))
1207 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1208 # ifndef EXIT_SUCCESS
1209 # define EXIT_SUCCESS 0
1213 # define YYMALLOC malloc
1214 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
1215 || defined __cplusplus || defined _MSC_VER)
1216 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
1220 # define YYFREE free
1221 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
1222 || defined __cplusplus || defined _MSC_VER)
1223 void free (void *); /* INFRINGES ON USER NAME SPACE */
1227 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1230 #if (! defined yyoverflow \
1231 && (! defined __cplusplus \
1232 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
1233 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1235 /* A type that is properly aligned for any stack member. */
1238 yytype_int16 yyss_alloc
;
1243 /* The size of the maximum gap between one aligned stack and the next. */
1244 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1246 /* The size of an array large to enough to hold all stacks, each with
1248 # define YYSTACK_BYTES(N) \
1249 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
1250 + 2 * YYSTACK_GAP_MAXIMUM)
1252 # define YYCOPY_NEEDED 1
1254 /* Relocate STACK from its old location to the new one. The
1255 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1256 elements in the stack, and YYPTR gives the new location of the
1257 stack. Advance YYPTR to a properly aligned location for the next
1259 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
1262 YYSIZE_T yynewbytes; \
1263 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
1264 Stack = &yyptr->Stack_alloc; \
1265 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1266 yyptr += yynewbytes / sizeof (*yyptr); \
1272 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
1273 /* Copy COUNT objects from FROM to TO. The source and destination do
1276 # if defined __GNUC__ && 1 < __GNUC__
1277 # define YYCOPY(To, From, Count) \
1278 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1280 # define YYCOPY(To, From, Count) \
1284 for (yyi = 0; yyi < (Count); yyi++) \
1285 (To)[yyi] = (From)[yyi]; \
1290 #endif /* !YYCOPY_NEEDED */
1292 /* YYFINAL -- State number of the termination state. */
1294 /* YYLAST -- Last index in YYTABLE. */
1297 /* YYNTOKENS -- Number of terminals. */
1298 #define YYNTOKENS 129
1299 /* YYNNTS -- Number of nonterminals. */
1301 /* YYNRULES -- Number of rules. */
1302 #define YYNRULES 171
1303 /* YYNRULES -- Number of states. */
1304 #define YYNSTATES 312
1306 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1307 #define YYUNDEFTOK 2
1308 #define YYMAXUTOK 359
1310 #define YYTRANSLATE(YYX) \
1311 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1313 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1314 static const yytype_uint8 yytranslate
[] =
1316 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1317 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1318 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1319 2, 2, 2, 120, 2, 2, 2, 124, 125, 2,
1320 108, 109, 122, 118, 111, 119, 117, 123, 2, 2,
1321 2, 2, 2, 2, 2, 2, 2, 2, 110, 105,
1322 112, 114, 113, 128, 2, 2, 2, 2, 2, 2,
1323 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1324 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1325 2, 115, 2, 116, 126, 2, 2, 2, 2, 2,
1326 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1327 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1328 2, 2, 2, 106, 127, 107, 121, 2, 2, 2,
1329 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1330 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1331 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1332 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1333 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1334 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1335 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1336 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1337 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1338 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1339 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1340 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1341 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1342 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1343 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1344 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1345 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1346 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1347 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1348 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1349 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1350 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1351 95, 96, 97, 98, 99, 100, 101, 102, 103, 104
1355 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1357 static const yytype_uint16 yyprhs
[] =
1359 0, 0, 3, 4, 7, 10, 13, 16, 19, 23,
1360 25, 27, 34, 40, 42, 44, 46, 47, 50, 55,
1361 59, 62, 65, 73, 76, 81, 82, 84, 86, 87,
1362 90, 92, 95, 97, 101, 107, 108, 111, 113, 115,
1363 117, 119, 126, 135, 137, 139, 141, 143, 145, 147,
1364 149, 152, 154, 156, 158, 164, 169, 171, 175, 178,
1365 183, 184, 186, 188, 192, 196, 202, 203, 207, 208,
1366 211, 214, 217, 220, 223, 226, 229, 232, 235, 238,
1367 241, 243, 247, 252, 254, 256, 260, 262, 264, 266,
1368 269, 271, 273, 275, 277, 279, 281, 285, 291, 293,
1369 297, 303, 311, 320, 329, 331, 334, 336, 338, 340,
1370 342, 346, 348, 350, 353, 356, 360, 365, 371, 373,
1371 376, 379, 382, 389, 391, 393, 395, 397, 399, 403,
1372 407, 411, 413, 417, 421, 423, 427, 431, 433, 437,
1373 441, 445, 449, 451, 455, 459, 461, 465, 467, 471,
1374 473, 477, 479, 483, 485, 489, 491, 497, 499, 503,
1375 505, 507, 509, 511, 513, 515, 517, 519, 521, 523,
1379 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1380 static const yytype_int16 yyrhs
[] =
1382 130, 0, -1, -1, 130, 139, -1, 130, 152, -1,
1383 130, 131, -1, 130, 105, -1, 98, 102, -1, 133,
1384 157, 105, -1, 134, -1, 135, -1, 161, 50, 136,
1385 106, 137, 107, -1, 161, 50, 106, 137, 107, -1,
1386 99, -1, 100, -1, 101, -1, -1, 137, 138, -1,
1387 161, 150, 158, 105, -1, 135, 158, 105, -1, 140,
1388 141, -1, 140, 105, -1, 161, 150, 143, 108, 145,
1389 109, 144, -1, 106, 107, -1, 106, 142, 166, 107,
1390 -1, -1, 99, -1, 101, -1, -1, 110, 136, -1,
1391 142, -1, 142, 146, -1, 147, -1, 146, 111, 147,
1392 -1, 148, 161, 150, 136, 144, -1, -1, 148, 149,
1393 -1, 23, -1, 29, -1, 25, -1, 151, -1, 68,
1394 112, 151, 111, 104, 113, -1, 26, 112, 151, 111,
1395 104, 111, 104, 113, -1, 70, -1, 38, -1, 39,
1396 -1, 40, -1, 41, -1, 42, -1, 100, -1, 50,
1397 100, -1, 156, -1, 132, -1, 153, -1, 66, 161,
1398 150, 154, 105, -1, 66, 133, 154, 105, -1, 155,
1399 -1, 154, 111, 155, -1, 136, 160, -1, 161, 150,
1400 158, 105, -1, -1, 158, -1, 159, -1, 158, 111,
1401 159, -1, 136, 160, 144, -1, 136, 160, 144, 114,
1402 162, -1, -1, 115, 191, 116, -1, -1, 17, 161,
1403 -1, 28, 161, -1, 32, 161, -1, 45, 161, -1,
1404 21, 161, -1, 48, 161, -1, 67, 161, -1, 71,
1405 161, -1, 9, 161, -1, 37, 161, -1, 7, 161,
1406 -1, 163, -1, 106, 164, 107, -1, 106, 164, 111,
1407 107, -1, 189, -1, 163, -1, 164, 111, 163, -1,
1408 65, -1, 18, -1, 167, -1, 166, 167, -1, 152,
1409 -1, 172, -1, 141, -1, 168, -1, 169, -1, 171,
1410 -1, 35, 191, 105, -1, 22, 108, 191, 109, 170,
1411 -1, 167, -1, 167, 16, 167, -1, 72, 108, 191,
1412 109, 167, -1, 14, 167, 72, 108, 191, 109, 105,
1413 -1, 19, 108, 142, 172, 172, 191, 109, 167, -1,
1414 19, 108, 142, 156, 172, 191, 109, 167, -1, 105,
1415 -1, 191, 105, -1, 103, -1, 104, -1, 165, -1,
1416 174, -1, 108, 191, 109, -1, 99, -1, 173, -1,
1417 175, 73, -1, 175, 74, -1, 175, 117, 136, -1,
1418 175, 115, 191, 116, -1, 161, 150, 108, 164, 109,
1419 -1, 175, -1, 73, 176, -1, 74, 176, -1, 177,
1420 176, -1, 108, 161, 150, 160, 109, 176, -1, 118,
1421 -1, 119, -1, 120, -1, 121, -1, 176, -1, 178,
1422 122, 176, -1, 178, 123, 176, -1, 178, 124, 176,
1423 -1, 178, -1, 179, 118, 178, -1, 179, 119, 178,
1424 -1, 179, -1, 180, 78, 179, -1, 180, 80, 179,
1425 -1, 180, -1, 181, 112, 180, -1, 181, 113, 180,
1426 -1, 181, 83, 180, -1, 181, 84, 180, -1, 181,
1427 -1, 182, 77, 181, -1, 182, 85, 181, -1, 182,
1428 -1, 183, 125, 182, -1, 183, -1, 184, 126, 183,
1429 -1, 184, -1, 185, 127, 184, -1, 185, -1, 186,
1430 75, 185, -1, 186, -1, 187, 76, 186, -1, 187,
1431 -1, 187, 128, 191, 110, 189, -1, 188, -1, 176,
1432 190, 189, -1, 114, -1, 86, -1, 87, -1, 88,
1433 -1, 89, -1, 90, -1, 79, -1, 81, -1, 91,
1434 -1, 92, -1, 93, -1, 189, -1, 191, 111, 189,
1438 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1439 static const yytype_uint16 yyrline
[] =
1441 0, 1022, 1022, 1024, 1061, 1065, 1068, 1073, 1092, 1109,
1442 1110, 1112, 1138, 1148, 1149, 1150, 1153, 1157, 1176, 1180,
1443 1185, 1192, 1199, 1224, 1229, 1236, 1240, 1241, 1244, 1247,
1444 1252, 1257, 1262, 1276, 1290, 1300, 1303, 1314, 1318, 1322,
1445 1327, 1331, 1350, 1370, 1374, 1379, 1384, 1389, 1394, 1399,
1446 1408, 1427, 1428, 1429, 1440, 1448, 1457, 1463, 1469, 1477,
1447 1483, 1486, 1491, 1497, 1503, 1511, 1523, 1526, 1534, 1537,
1448 1541, 1545, 1549, 1553, 1557, 1561, 1565, 1569, 1573, 1577,
1449 1582, 1588, 1592, 1597, 1602, 1608, 1614, 1618, 1623, 1627,
1450 1634, 1635, 1636, 1637, 1638, 1639, 1642, 1665, 1689, 1694,
1451 1700, 1715, 1730, 1738, 1750, 1755, 1763, 1777, 1791, 1805,
1452 1816, 1821, 1835, 1839, 1858, 1877, 1931, 1991, 2027, 2031,
1453 2047, 2063, 2083, 2115, 2119, 2123, 2127, 2132, 2136, 2143,
1454 2150, 2158, 2162, 2169, 2177, 2181, 2185, 2190, 2194, 2201,
1455 2208, 2215, 2223, 2227, 2234, 2242, 2246, 2251, 2255, 2260,
1456 2264, 2269, 2273, 2278, 2282, 2287, 2291, 2296, 2300, 2317,
1457 2321, 2325, 2329, 2333, 2337, 2341, 2345, 2349, 2353, 2357,
1462 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1463 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1464 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1465 static const char *const yytname
[] =
1467 "$end", "error", "$undefined", "KW_BLENDSTATE", "KW_BREAK", "KW_BUFFER",
1468 "KW_CBUFFER", "KW_COLUMN_MAJOR", "KW_COMPILE", "KW_CONST", "KW_CONTINUE",
1469 "KW_DEPTHSTENCILSTATE", "KW_DEPTHSTENCILVIEW", "KW_DISCARD", "KW_DO",
1470 "KW_DOUBLE", "KW_ELSE", "KW_EXTERN", "KW_FALSE", "KW_FOR",
1471 "KW_GEOMETRYSHADER", "KW_GROUPSHARED", "KW_IF", "KW_IN", "KW_INLINE",
1472 "KW_INOUT", "KW_MATRIX", "KW_NAMESPACE", "KW_NOINTERPOLATION", "KW_OUT",
1473 "KW_PASS", "KW_PIXELSHADER", "KW_PRECISE", "KW_RASTERIZERSTATE",
1474 "KW_RENDERTARGETVIEW", "KW_RETURN", "KW_REGISTER", "KW_ROW_MAJOR",
1475 "KW_SAMPLER", "KW_SAMPLER1D", "KW_SAMPLER2D", "KW_SAMPLER3D",
1476 "KW_SAMPLERCUBE", "KW_SAMPLER_STATE", "KW_SAMPLERCOMPARISONSTATE",
1477 "KW_SHARED", "KW_STATEBLOCK", "KW_STATEBLOCK_STATE", "KW_STATIC",
1478 "KW_STRING", "KW_STRUCT", "KW_SWITCH", "KW_TBUFFER", "KW_TECHNIQUE",
1479 "KW_TECHNIQUE10", "KW_TEXTURE", "KW_TEXTURE1D", "KW_TEXTURE1DARRAY",
1480 "KW_TEXTURE2D", "KW_TEXTURE2DARRAY", "KW_TEXTURE2DMS",
1481 "KW_TEXTURE2DMSARRAY", "KW_TEXTURE3D", "KW_TEXTURE3DARRAY",
1482 "KW_TEXTURECUBE", "KW_TRUE", "KW_TYPEDEF", "KW_UNIFORM", "KW_VECTOR",
1483 "KW_VERTEXSHADER", "KW_VOID", "KW_VOLATILE", "KW_WHILE", "OP_INC",
1484 "OP_DEC", "OP_AND", "OP_OR", "OP_EQ", "OP_LEFTSHIFT",
1485 "OP_LEFTSHIFTASSIGN", "OP_RIGHTSHIFT", "OP_RIGHTSHIFTASSIGN",
1486 "OP_ELLIPSIS", "OP_LE", "OP_GE", "OP_NE", "OP_ADDASSIGN", "OP_SUBASSIGN",
1487 "OP_MULASSIGN", "OP_DIVASSIGN", "OP_MODASSIGN", "OP_ANDASSIGN",
1488 "OP_ORASSIGN", "OP_XORASSIGN", "OP_UNKNOWN1", "OP_UNKNOWN2",
1489 "OP_UNKNOWN3", "OP_UNKNOWN4", "PRE_LINE", "VAR_IDENTIFIER",
1490 "TYPE_IDENTIFIER", "NEW_IDENTIFIER", "STRING", "C_FLOAT", "C_INTEGER",
1491 "';'", "'{'", "'}'", "'('", "')'", "':'", "','", "'<'", "'>'", "'='",
1492 "'['", "']'", "'.'", "'+'", "'-'", "'!'", "'~'", "'*'", "'/'", "'%'",
1493 "'&'", "'^'", "'|'", "'?'", "$accept", "hlsl_prog", "preproc_directive",
1494 "struct_declaration", "struct_spec", "named_struct_spec",
1495 "unnamed_struct_spec", "any_identifier", "fields_list", "field",
1496 "func_declaration", "func_prototype", "compound_statement",
1497 "scope_start", "var_identifier", "semantic", "parameters", "param_list",
1498 "parameter", "input_mods", "input_mod", "type", "base_type",
1499 "declaration_statement", "typedef", "type_specs", "type_spec",
1500 "declaration", "variables_def_optional", "variables_def", "variable_def",
1501 "array", "var_modifiers", "complex_initializer", "initializer_expr",
1502 "initializer_expr_list", "boolean", "statement_list", "statement",
1503 "jump_statement", "selection_statement", "if_body", "loop_statement",
1504 "expr_statement", "primary_expr", "variable", "postfix_expr",
1505 "unary_expr", "unary_op", "mul_expr", "add_expr", "shift_expr",
1506 "relational_expr", "equality_expr", "bitand_expr", "bitxor_expr",
1507 "bitor_expr", "logicand_expr", "logicor_expr", "conditional_expr",
1508 "assignment_expr", "assign_op", "expr", 0
1513 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1515 static const yytype_uint16 yytoknum
[] =
1517 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1518 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1519 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1520 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1521 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1522 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1523 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1524 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1525 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1526 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1527 355, 356, 357, 358, 359, 59, 123, 125, 40, 41,
1528 58, 44, 60, 62, 61, 91, 93, 46, 43, 45,
1529 33, 126, 42, 47, 37, 38, 94, 124, 63
1533 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1534 static const yytype_uint8 yyr1
[] =
1536 0, 129, 130, 130, 130, 130, 130, 131, 132, 133,
1537 133, 134, 135, 136, 136, 136, 137, 137, 138, 138,
1538 139, 139, 140, 141, 141, 142, 143, 143, 144, 144,
1539 145, 145, 146, 146, 147, 148, 148, 149, 149, 149,
1540 150, 150, 150, 151, 151, 151, 151, 151, 151, 151,
1541 151, 152, 152, 152, 153, 153, 154, 154, 155, 156,
1542 157, 157, 158, 158, 159, 159, 160, 160, 161, 161,
1543 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
1544 162, 162, 162, 163, 164, 164, 165, 165, 166, 166,
1545 167, 167, 167, 167, 167, 167, 168, 169, 170, 170,
1546 171, 171, 171, 171, 172, 172, 173, 173, 173, 173,
1547 173, 174, 175, 175, 175, 175, 175, 175, 176, 176,
1548 176, 176, 176, 177, 177, 177, 177, 178, 178, 178,
1549 178, 179, 179, 179, 180, 180, 180, 181, 181, 181,
1550 181, 181, 182, 182, 182, 183, 183, 184, 184, 185,
1551 185, 186, 186, 187, 187, 188, 188, 189, 189, 190,
1552 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
1556 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1557 static const yytype_uint8 yyr2
[] =
1559 0, 2, 0, 2, 2, 2, 2, 2, 3, 1,
1560 1, 6, 5, 1, 1, 1, 0, 2, 4, 3,
1561 2, 2, 7, 2, 4, 0, 1, 1, 0, 2,
1562 1, 2, 1, 3, 5, 0, 2, 1, 1, 1,
1563 1, 6, 8, 1, 1, 1, 1, 1, 1, 1,
1564 2, 1, 1, 1, 5, 4, 1, 3, 2, 4,
1565 0, 1, 1, 3, 3, 5, 0, 3, 0, 2,
1566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1567 1, 3, 4, 1, 1, 3, 1, 1, 1, 2,
1568 1, 1, 1, 1, 1, 1, 3, 5, 1, 3,
1569 5, 7, 8, 8, 1, 2, 1, 1, 1, 1,
1570 3, 1, 1, 2, 2, 3, 4, 5, 1, 2,
1571 2, 2, 6, 1, 1, 1, 1, 1, 3, 3,
1572 3, 1, 3, 3, 1, 3, 3, 1, 3, 3,
1573 3, 3, 1, 3, 3, 1, 3, 1, 3, 1,
1574 3, 1, 3, 1, 3, 1, 5, 1, 3, 1,
1575 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1579 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
1580 Performed when YYTABLE doesn't specify something else to do. Zero
1581 means the default is an error. */
1582 static const yytype_uint8 yydefact
[] =
1584 2, 68, 1, 68, 68, 68, 68, 68, 68, 68,
1585 68, 68, 68, 68, 68, 0, 6, 5, 52, 60,
1586 9, 10, 3, 0, 4, 53, 51, 0, 79, 77,
1587 69, 73, 70, 71, 78, 72, 74, 0, 0, 75,
1588 76, 7, 13, 14, 15, 66, 0, 61, 62, 21,
1589 25, 20, 0, 44, 45, 46, 47, 48, 0, 0,
1590 43, 49, 0, 40, 66, 0, 56, 0, 68, 28,
1591 8, 0, 23, 68, 0, 50, 16, 0, 0, 13,
1592 15, 0, 0, 58, 55, 0, 0, 87, 86, 68,
1593 68, 111, 106, 107, 68, 123, 124, 125, 126, 0,
1594 108, 112, 109, 118, 127, 68, 131, 134, 137, 142,
1595 145, 147, 149, 151, 153, 155, 157, 170, 0, 0,
1596 64, 63, 68, 0, 0, 68, 0, 104, 92, 90,
1597 0, 68, 88, 93, 94, 95, 91, 0, 0, 0,
1598 68, 16, 0, 25, 59, 57, 54, 119, 120, 0,
1599 0, 0, 113, 114, 68, 0, 165, 166, 160, 161,
1600 162, 163, 164, 167, 168, 169, 159, 68, 121, 68,
1601 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
1602 68, 68, 68, 68, 68, 68, 68, 68, 68, 67,
1603 29, 68, 0, 25, 68, 0, 68, 0, 24, 89,
1604 105, 50, 0, 12, 0, 17, 0, 68, 0, 35,
1605 0, 66, 110, 68, 0, 115, 158, 128, 129, 130,
1606 127, 132, 133, 135, 136, 140, 141, 138, 139, 143,
1607 144, 146, 148, 150, 152, 154, 0, 171, 68, 65,
1608 80, 83, 0, 68, 0, 96, 0, 0, 0, 0,
1609 0, 11, 0, 31, 32, 68, 28, 0, 84, 0,
1610 116, 68, 0, 68, 68, 0, 68, 68, 68, 0,
1611 19, 0, 41, 35, 37, 39, 38, 36, 0, 22,
1612 68, 117, 68, 156, 81, 68, 0, 68, 68, 98,
1613 97, 100, 0, 18, 33, 0, 122, 85, 82, 0,
1614 0, 0, 68, 42, 28, 101, 68, 68, 99, 34,
1618 /* YYDEFGOTO[NTERM-NUM]. */
1619 static const yytype_int16 yydefgoto
[] =
1621 -1, 1, 17, 18, 19, 20, 21, 45, 140, 205,
1622 22, 23, 128, 73, 81, 120, 210, 253, 254, 255,
1623 277, 197, 63, 129, 25, 65, 66, 26, 46, 82,
1624 48, 69, 99, 239, 258, 259, 100, 131, 132, 133,
1625 134, 290, 135, 136, 101, 102, 103, 104, 105, 106,
1626 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
1630 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1632 #define YYPACT_NINF -231
1633 static const yytype_int16 yypact
[] =
1635 -231, 640, -231, 777, 777, 777, 777, 777, 777, 777,
1636 777, 777, 777, 777, 777, -69, -231, -231, -231, 32,
1637 -231, -231, -231, 118, -231, -231, -231, 12, -231, -231,
1638 -231, -231, -231, -231, -231, -231, -231, 32, 12, -231,
1639 -231, -231, -231, -231, -231, -67, -41, -26, -231, -231,
1640 8, -231, -20, -231, -231, -231, -231, -231, -60, 14,
1641 -231, -231, 72, -231, -67, -81, -231, 32, 579, -39,
1642 -231, 32, -231, 320, 145, 28, -231, 34, 145, 15,
1643 35, 74, -15, -231, -231, 32, -10, -231, -231, 579,
1644 579, -231, -231, -231, 579, -231, -231, -231, -231, 37,
1645 -231, -231, -231, -18, 182, 579, 52, 86, -19, -55,
1646 -40, 66, 70, 90, 126, -44, -231, -231, 2, 32,
1647 127, -231, 320, 105, 124, 579, 135, -231, -231, -231,
1648 12, 212, -231, -231, -231, -231, -231, -7, 125, 137,
1649 684, -231, 141, -231, -231, -231, -231, -231, -231, 37,
1650 79, 147, -231, -231, 579, 32, -231, -231, -231, -231,
1651 -231, -231, -231, -231, -231, -231, -231, 579, -231, 579,
1652 579, 579, 579, 579, 579, 579, 579, 579, 579, 579,
1653 579, 579, 579, 579, 579, 579, 579, 579, 579, -231,
1654 -231, 399, 181, -231, 579, -5, 579, -65, -231, -231,
1655 -231, -231, 154, -231, 32, -231, 139, 716, 158, 155,
1656 167, -48, -231, 579, 11, -231, -231, -231, -231, -231,
1657 -231, 52, 52, 86, 86, -19, -19, -19, -19, -55,
1658 -55, -40, 66, 70, 90, 126, 117, -231, 579, -231,
1659 -231, -231, 174, 439, 83, -231, 88, 176, -2, 10,
1660 32, -231, 175, 178, -231, 745, -39, 183, -231, 99,
1661 -231, 579, 17, 579, 439, 37, 439, 320, 320, 186,
1662 -231, 9, -231, -231, -231, -231, -231, -231, 37, -231,
1663 579, -231, 579, -231, -231, 518, 103, 579, 579, 275,
1664 -231, -231, 180, -231, -231, 32, -231, -231, -231, 189,
1665 107, 111, 320, -231, -39, -231, 320, 320, -231, -231,
1669 /* YYPGOTO[NTERM-NUM]. */
1670 static const yytype_int16 yypgoto
[] =
1672 -231, -231, -231, -231, 283, -231, -119, -36, 156, -231,
1673 -231, -231, 276, -123, -231, -230, -231, -231, 25, -231,
1674 -231, -13, 51, 299, -231, 235, 218, 61, -231, -4,
1675 236, -45, -1, -231, -174, 71, -231, -231, -104, -231,
1676 -231, -231, -231, -175, -231, -231, -231, -24, -231, 65,
1677 76, -9, 100, 128, 129, 130, 123, 136, -231, -231,
1681 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1682 positive, shift that token. If negative, reduce the rule which
1683 number is the opposite. If YYTABLE_NINF, syntax error. */
1684 #define YYTABLE_NINF -31
1685 static const yytype_int16 yytable
[] =
1687 27, 64, 28, 29, 30, 31, 32, 33, 34, 35,
1688 36, 38, 39, 40, 62, 47, 118, 240, 192, 83,
1689 209, 204, 77, 216, 84, 67, 279, 199, 176, 177,
1690 85, 64, 186, 41, 42, 43, 44, 180, 52, 42,
1691 75, 44, 150, 213, 237, 181, 76, 241, 68, 64,
1692 53, 54, 55, 56, 57, 152, 153, 178, 179, 174,
1693 213, 175, 58, 52, 70, 147, 148, 68, 266, 241,
1694 243, 119, 130, 195, 309, 53, 54, 55, 56, 57,
1695 59, 168, 60, 190, 187, 71, 151, 138, 204, 287,
1696 144, 288, 74, 149, 241, 146, 71, 154, 200, 155,
1697 245, 85, 214, 270, 188, 59, 188, 60, 297, 71,
1698 201, 297, 61, 188, 293, 72, 76, 283, 189, 215,
1699 71, 130, 188, -26, 284, 139, 78, 260, 285, 142,
1700 130, 42, 43, 44, -14, 236, 211, 61, 241, 206,
1701 141, 241, 244, -27, 246, 217, 218, 219, 220, 220,
1702 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
1703 220, 220, 220, 289, 291, 52, 257, 225, 226, 227,
1704 228, 79, 43, 80, 169, 170, 171, 53, 54, 55,
1705 56, 57, 143, 53, 54, 55, 56, 57, 212, 249,
1706 188, 182, 267, 250, 188, 138, 183, 268, 308, 188,
1707 248, 185, 310, 311, 172, 173, 206, 59, 281, 60,
1708 282, 286, 299, 193, 188, 60, 306, 184, 188, 3,
1709 307, 4, 188, 49, 50, 201, 122, 261, 188, 5,
1710 87, 123, 194, 6, 124, 300, 301, 221, 222, 61,
1711 7, 191, 265, 196, 8, 61, 271, 125, 202, 9,
1712 223, 224, 208, 242, 278, 213, 296, 10, 247, 304,
1713 11, 156, 252, 157, -30, 295, 130, 130, 158, 159,
1714 160, 161, 162, 163, 164, 165, 256, 88, 12, 13,
1715 229, 230, 263, 14, 126, 89, 90, 269, 272, 273,
1716 292, 302, 280, 303, 305, 37, 166, 207, 294, 51,
1717 24, 130, 86, 145, 264, 130, 130, 121, 234, 262,
1718 231, 91, 232, 0, 233, 92, 93, 127, 50, 198,
1719 94, 0, 235, 0, 0, 0, 0, 3, 0, 4,
1720 95, 96, 97, 98, 122, 0, 0, 5, 87, 123,
1721 0, 6, 124, 0, 0, 0, 0, 0, 7, 0,
1722 0, 0, 8, 0, 0, 125, 0, 9, 0, 0,
1723 0, 0, 0, 0, 0, 10, 0, 0, 11, 0,
1724 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1725 0, 0, 0, 0, 0, 88, 12, 13, 0, 0,
1726 0, 14, 126, 89, 90, 0, 0, 0, 0, 0,
1727 0, 0, 0, 0, 0, 0, 3, 0, 4, 0,
1728 0, 0, 0, 0, 0, 0, 5, 87, 0, 91,
1729 6, 0, 0, 92, 93, 127, 50, 7, 94, 0,
1730 0, 8, 0, 0, 0, 0, 9, 0, 95, 96,
1731 97, 98, 0, 0, 10, 0, 3, 11, 4, 0,
1732 0, 0, 0, 0, 0, 0, 5, 87, 0, 0,
1733 6, 0, 0, 0, 88, 0, 13, 7, 0, 0,
1734 14, 8, 89, 90, 0, 0, 9, 0, 0, 0,
1735 0, 0, 0, 0, 10, 0, 0, 11, 0, 0,
1736 0, 0, 0, 0, 0, 0, 0, 0, 91, 0,
1737 0, 0, 92, 93, 88, 238, 13, 94, 0, 0,
1738 14, 0, 89, 90, 0, 0, 0, 95, 96, 97,
1739 98, 0, 0, 0, 0, 3, 0, 4, 0, 0,
1740 0, 0, 0, 0, 0, 5, 87, 0, 91, 6,
1741 0, 0, 92, 93, 127, 0, 7, 94, 0, 0,
1742 8, 0, 0, 0, 0, 9, 0, 95, 96, 97,
1743 98, 0, 0, 10, 0, 0, 11, 0, 0, 0,
1744 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1745 0, 0, 0, 88, 0, 13, 3, 0, 4, 14,
1746 0, 89, 90, 0, 0, 0, 5, 87, 0, 0,
1747 6, 0, 0, 0, 0, 0, 0, 7, 0, 0,
1748 0, 8, 0, 0, 0, 0, 9, 91, 0, 0,
1749 0, 92, 93, 0, 10, 298, 94, 11, 0, 0,
1750 0, 0, 0, 0, 0, 0, 95, 96, 97, 98,
1751 2, 0, 0, 0, 88, 0, 13, 3, 0, 4,
1752 14, 0, 89, 90, 0, 0, 0, 5, 0, 0,
1753 0, 6, 0, 0, 0, 0, 0, 0, 7, 0,
1754 0, 0, 8, 0, 0, 0, 0, 9, 91, 0,
1755 0, 0, 92, 93, 0, 10, 0, 94, 11, 0,
1756 0, 3, 0, 4, 0, 0, 0, 95, 96, 97,
1757 98, 5, 0, 0, 0, 6, 12, 13, 0, 0,
1758 0, 14, 7, 0, 0, 0, 8, 0, 0, 0,
1759 0, 9, 0, 3, 0, 4, 0, 0, 0, 10,
1760 0, 0, 11, 5, 0, 0, 0, 6, 15, 0,
1761 0, 0, 0, 0, 7, 16, 0, 0, 8, 0,
1762 0, 13, 3, 9, 4, 14, 0, 0, 0, 0,
1763 0, 10, 5, 0, 11, 0, 6, 0, 274, 0,
1764 275, 0, 0, 7, 276, 0, 0, 8, 0, 0,
1765 0, 0, 9, 13, 3, 0, 4, 14, 0, 0,
1766 10, 203, 0, 11, 5, 0, 0, 0, 6, 0,
1767 0, 0, 0, 0, 0, 7, 0, 0, 0, 8,
1768 0, 0, 13, 0, 9, 0, 14, 0, 0, 0,
1769 0, 0, 10, 251, 0, 11, 0, 0, 0, 0,
1770 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1771 0, 0, 0, 0, 13, 0, 0, 0, 14
1774 #define yypact_value_is_default(yystate) \
1775 ((yystate) == (-231))
1777 #define yytable_value_is_error(yytable_value) \
1780 static const yytype_int16 yycheck
[] =
1782 1, 37, 3, 4, 5, 6, 7, 8, 9, 10,
1783 11, 12, 13, 14, 27, 19, 68, 191, 122, 64,
1784 143, 140, 58, 167, 105, 38, 256, 131, 83, 84,
1785 111, 67, 76, 102, 99, 100, 101, 77, 26, 99,
1786 100, 101, 94, 108, 188, 85, 106, 191, 115, 85,
1787 38, 39, 40, 41, 42, 73, 74, 112, 113, 78,
1788 108, 80, 50, 26, 105, 89, 90, 115, 243, 213,
1789 193, 110, 73, 125, 304, 38, 39, 40, 41, 42,
1790 68, 105, 70, 119, 128, 111, 99, 50, 207, 264,
1791 105, 266, 112, 94, 238, 105, 111, 115, 105, 117,
1792 105, 111, 154, 105, 111, 68, 111, 70, 282, 111,
1793 100, 285, 100, 111, 105, 107, 106, 261, 116, 155,
1794 111, 122, 111, 108, 107, 74, 112, 116, 111, 78,
1795 131, 99, 100, 101, 106, 187, 149, 100, 282, 140,
1796 106, 285, 194, 108, 196, 169, 170, 171, 172, 173,
1797 174, 175, 176, 177, 178, 179, 180, 181, 182, 183,
1798 184, 185, 186, 267, 268, 26, 211, 176, 177, 178,
1799 179, 99, 100, 101, 122, 123, 124, 38, 39, 40,
1800 41, 42, 108, 38, 39, 40, 41, 42, 109, 50,
1801 111, 125, 109, 206, 111, 50, 126, 109, 302, 111,
1802 204, 75, 306, 307, 118, 119, 207, 68, 109, 70,
1803 111, 263, 109, 108, 111, 70, 109, 127, 111, 7,
1804 109, 9, 111, 105, 106, 100, 14, 110, 111, 17,
1805 18, 19, 108, 21, 22, 287, 288, 172, 173, 100,
1806 28, 114, 243, 108, 32, 100, 250, 35, 111, 37,
1807 174, 175, 111, 72, 255, 108, 280, 45, 104, 295,
1808 48, 79, 104, 81, 109, 278, 267, 268, 86, 87,
1809 88, 89, 90, 91, 92, 93, 109, 65, 66, 67,
1810 180, 181, 108, 71, 72, 73, 74, 111, 113, 111,
1811 104, 16, 109, 113, 105, 12, 114, 141, 273, 23,
1812 1, 302, 67, 85, 243, 306, 307, 71, 185, 238,
1813 182, 99, 183, -1, 184, 103, 104, 105, 106, 107,
1814 108, -1, 186, -1, -1, -1, -1, 7, -1, 9,
1815 118, 119, 120, 121, 14, -1, -1, 17, 18, 19,
1816 -1, 21, 22, -1, -1, -1, -1, -1, 28, -1,
1817 -1, -1, 32, -1, -1, 35, -1, 37, -1, -1,
1818 -1, -1, -1, -1, -1, 45, -1, -1, 48, -1,
1819 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1820 -1, -1, -1, -1, -1, 65, 66, 67, -1, -1,
1821 -1, 71, 72, 73, 74, -1, -1, -1, -1, -1,
1822 -1, -1, -1, -1, -1, -1, 7, -1, 9, -1,
1823 -1, -1, -1, -1, -1, -1, 17, 18, -1, 99,
1824 21, -1, -1, 103, 104, 105, 106, 28, 108, -1,
1825 -1, 32, -1, -1, -1, -1, 37, -1, 118, 119,
1826 120, 121, -1, -1, 45, -1, 7, 48, 9, -1,
1827 -1, -1, -1, -1, -1, -1, 17, 18, -1, -1,
1828 21, -1, -1, -1, 65, -1, 67, 28, -1, -1,
1829 71, 32, 73, 74, -1, -1, 37, -1, -1, -1,
1830 -1, -1, -1, -1, 45, -1, -1, 48, -1, -1,
1831 -1, -1, -1, -1, -1, -1, -1, -1, 99, -1,
1832 -1, -1, 103, 104, 65, 106, 67, 108, -1, -1,
1833 71, -1, 73, 74, -1, -1, -1, 118, 119, 120,
1834 121, -1, -1, -1, -1, 7, -1, 9, -1, -1,
1835 -1, -1, -1, -1, -1, 17, 18, -1, 99, 21,
1836 -1, -1, 103, 104, 105, -1, 28, 108, -1, -1,
1837 32, -1, -1, -1, -1, 37, -1, 118, 119, 120,
1838 121, -1, -1, 45, -1, -1, 48, -1, -1, -1,
1839 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1840 -1, -1, -1, 65, -1, 67, 7, -1, 9, 71,
1841 -1, 73, 74, -1, -1, -1, 17, 18, -1, -1,
1842 21, -1, -1, -1, -1, -1, -1, 28, -1, -1,
1843 -1, 32, -1, -1, -1, -1, 37, 99, -1, -1,
1844 -1, 103, 104, -1, 45, 107, 108, 48, -1, -1,
1845 -1, -1, -1, -1, -1, -1, 118, 119, 120, 121,
1846 0, -1, -1, -1, 65, -1, 67, 7, -1, 9,
1847 71, -1, 73, 74, -1, -1, -1, 17, -1, -1,
1848 -1, 21, -1, -1, -1, -1, -1, -1, 28, -1,
1849 -1, -1, 32, -1, -1, -1, -1, 37, 99, -1,
1850 -1, -1, 103, 104, -1, 45, -1, 108, 48, -1,
1851 -1, 7, -1, 9, -1, -1, -1, 118, 119, 120,
1852 121, 17, -1, -1, -1, 21, 66, 67, -1, -1,
1853 -1, 71, 28, -1, -1, -1, 32, -1, -1, -1,
1854 -1, 37, -1, 7, -1, 9, -1, -1, -1, 45,
1855 -1, -1, 48, 17, -1, -1, -1, 21, 98, -1,
1856 -1, -1, -1, -1, 28, 105, -1, -1, 32, -1,
1857 -1, 67, 7, 37, 9, 71, -1, -1, -1, -1,
1858 -1, 45, 17, -1, 48, -1, 21, -1, 23, -1,
1859 25, -1, -1, 28, 29, -1, -1, 32, -1, -1,
1860 -1, -1, 37, 67, 7, -1, 9, 71, -1, -1,
1861 45, 107, -1, 48, 17, -1, -1, -1, 21, -1,
1862 -1, -1, -1, -1, -1, 28, -1, -1, -1, 32,
1863 -1, -1, 67, -1, 37, -1, 71, -1, -1, -1,
1864 -1, -1, 45, 107, -1, 48, -1, -1, -1, -1,
1865 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1866 -1, -1, -1, -1, 67, -1, -1, -1, 71
1869 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1870 symbol of state STATE-NUM. */
1871 static const yytype_uint8 yystos
[] =
1873 0, 130, 0, 7, 9, 17, 21, 28, 32, 37,
1874 45, 48, 66, 67, 71, 98, 105, 131, 132, 133,
1875 134, 135, 139, 140, 152, 153, 156, 161, 161, 161,
1876 161, 161, 161, 161, 161, 161, 161, 133, 161, 161,
1877 161, 102, 99, 100, 101, 136, 157, 158, 159, 105,
1878 106, 141, 26, 38, 39, 40, 41, 42, 50, 68,
1879 70, 100, 150, 151, 136, 154, 155, 150, 115, 160,
1880 105, 111, 107, 142, 112, 100, 106, 136, 112, 99,
1881 101, 143, 158, 160, 105, 111, 154, 18, 65, 73,
1882 74, 99, 103, 104, 108, 118, 119, 120, 121, 161,
1883 165, 173, 174, 175, 176, 177, 178, 179, 180, 181,
1884 182, 183, 184, 185, 186, 187, 188, 189, 191, 110,
1885 144, 159, 14, 19, 22, 35, 72, 105, 141, 152,
1886 161, 166, 167, 168, 169, 171, 172, 191, 50, 151,
1887 137, 106, 151, 108, 105, 155, 105, 176, 176, 161,
1888 191, 150, 73, 74, 115, 117, 79, 81, 86, 87,
1889 88, 89, 90, 91, 92, 93, 114, 190, 176, 122,
1890 123, 124, 118, 119, 78, 80, 83, 84, 112, 113,
1891 77, 85, 125, 126, 127, 75, 76, 128, 111, 116,
1892 136, 114, 167, 108, 108, 191, 108, 150, 107, 167,
1893 105, 100, 111, 107, 135, 138, 161, 137, 111, 142,
1894 145, 150, 109, 108, 191, 136, 189, 176, 176, 176,
1895 176, 178, 178, 179, 179, 180, 180, 180, 180, 181,
1896 181, 182, 183, 184, 185, 186, 191, 189, 106, 162,
1897 163, 189, 72, 142, 191, 105, 191, 104, 158, 50,
1898 150, 107, 104, 146, 147, 148, 109, 160, 163, 164,
1899 116, 110, 164, 108, 156, 161, 172, 109, 109, 111,
1900 105, 158, 113, 111, 23, 25, 29, 149, 161, 144,
1901 109, 109, 111, 189, 107, 111, 191, 172, 172, 167,
1902 170, 167, 104, 105, 147, 150, 176, 163, 107, 109,
1903 191, 191, 16, 113, 136, 105, 109, 109, 167, 144,
1907 #define yyerrok (yyerrstatus = 0)
1908 #define yyclearin (yychar = YYEMPTY)
1909 #define YYEMPTY (-2)
1912 #define YYACCEPT goto yyacceptlab
1913 #define YYABORT goto yyabortlab
1914 #define YYERROR goto yyerrorlab
1917 /* Like YYERROR except do call yyerror. This remains here temporarily
1918 to ease the transition to the new meaning of YYERROR, for GCC.
1919 Once GCC version 2 has supplanted version 1, this can go. However,
1920 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
1921 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
1924 #define YYFAIL goto yyerrlab
1926 /* This is here to suppress warnings from the GCC cpp's
1927 -Wunused-macros. Normally we don't worry about that warning, but
1928 some users do, and we want to make it easy for users to remove
1929 YYFAIL uses, which will produce warnings from Bison 2.5. */
1932 #define YYRECOVERING() (!!yyerrstatus)
1934 #define YYBACKUP(Token, Value) \
1936 if (yychar == YYEMPTY && yylen == 1) \
1945 yyerror (YY_("syntax error: cannot back up")); \
1952 #define YYERRCODE 256
1955 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1956 If N is 0, then set CURRENT to the empty location which ends
1957 the previous symbol: RHS[0] (always defined). */
1959 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1960 #ifndef YYLLOC_DEFAULT
1961 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1965 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1966 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1967 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1968 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1972 (Current).first_line = (Current).last_line = \
1973 YYRHSLOC (Rhs, 0).last_line; \
1974 (Current).first_column = (Current).last_column = \
1975 YYRHSLOC (Rhs, 0).last_column; \
1981 /* YY_LOCATION_PRINT -- Print the location on the stream.
1982 This macro was not mandated originally: define only if we know
1983 we won't break user code: when these are the locations we know. */
1985 #ifndef YY_LOCATION_PRINT
1986 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1987 # define YY_LOCATION_PRINT(File, Loc) \
1988 fprintf (File, "%d.%d-%d.%d", \
1989 (Loc).first_line, (Loc).first_column, \
1990 (Loc).last_line, (Loc).last_column)
1992 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1997 /* YYLEX -- calling `yylex' with the right arguments. */
2000 # define YYLEX yylex (YYLEX_PARAM)
2002 # define YYLEX yylex ()
2005 /* Enable debugging if requested. */
2009 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2010 # define YYFPRINTF fprintf
2013 # define YYDPRINTF(Args) \
2019 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2023 YYFPRINTF (stderr, "%s ", Title); \
2024 yy_symbol_print (stderr, \
2025 Type, Value, Location); \
2026 YYFPRINTF (stderr, "\n"); \
2031 /*--------------------------------.
2032 | Print this symbol on YYOUTPUT. |
2033 `--------------------------------*/
2036 #if (defined __STDC__ || defined __C99__FUNC__ \
2037 || defined __cplusplus || defined _MSC_VER)
2039 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
2042 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
)
2045 YYSTYPE
const * const yyvaluep
;
2046 YYLTYPE
const * const yylocationp
;
2051 YYUSE (yylocationp
);
2053 if (yytype
< YYNTOKENS
)
2054 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
2066 /*--------------------------------.
2067 | Print this symbol on YYOUTPUT. |
2068 `--------------------------------*/
2070 #if (defined __STDC__ || defined __C99__FUNC__ \
2071 || defined __cplusplus || defined _MSC_VER)
2073 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
2076 yy_symbol_print (yyoutput
, yytype
, yyvaluep
, yylocationp
)
2079 YYSTYPE
const * const yyvaluep
;
2080 YYLTYPE
const * const yylocationp
;
2083 if (yytype
< YYNTOKENS
)
2084 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
2086 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
2088 YY_LOCATION_PRINT (yyoutput
, *yylocationp
);
2089 YYFPRINTF (yyoutput
, ": ");
2090 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
);
2091 YYFPRINTF (yyoutput
, ")");
2094 /*------------------------------------------------------------------.
2095 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2097 `------------------------------------------------------------------*/
2099 #if (defined __STDC__ || defined __C99__FUNC__ \
2100 || defined __cplusplus || defined _MSC_VER)
2102 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
2105 yy_stack_print (yybottom
, yytop
)
2106 yytype_int16
*yybottom
;
2107 yytype_int16
*yytop
;
2110 YYFPRINTF (stderr
, "Stack now");
2111 for (; yybottom
<= yytop
; yybottom
++)
2113 int yybot
= *yybottom
;
2114 YYFPRINTF (stderr
, " %d", yybot
);
2116 YYFPRINTF (stderr
, "\n");
2119 # define YY_STACK_PRINT(Bottom, Top) \
2122 yy_stack_print ((Bottom), (Top)); \
2126 /*------------------------------------------------.
2127 | Report that the YYRULE is going to be reduced. |
2128 `------------------------------------------------*/
2130 #if (defined __STDC__ || defined __C99__FUNC__ \
2131 || defined __cplusplus || defined _MSC_VER)
2133 yy_reduce_print (YYSTYPE
*yyvsp
, YYLTYPE
*yylsp
, int yyrule
)
2136 yy_reduce_print (yyvsp
, yylsp
, yyrule
)
2142 int yynrhs
= yyr2
[yyrule
];
2144 unsigned long int yylno
= yyrline
[yyrule
];
2145 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
2147 /* The symbols being reduced. */
2148 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
2150 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
2151 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
2152 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
2153 , &(yylsp
[(yyi
+ 1) - (yynrhs
)]) );
2154 YYFPRINTF (stderr
, "\n");
2158 # define YY_REDUCE_PRINT(Rule) \
2161 yy_reduce_print (yyvsp, yylsp, Rule); \
2164 /* Nonzero means print parse trace. It is left uninitialized so that
2165 multiple parsers can coexist. */
2167 #else /* !YYDEBUG */
2168 # define YYDPRINTF(Args)
2169 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2170 # define YY_STACK_PRINT(Bottom, Top)
2171 # define YY_REDUCE_PRINT(Rule)
2172 #endif /* !YYDEBUG */
2175 /* YYINITDEPTH -- initial size of the parser's stacks. */
2177 # define YYINITDEPTH 200
2180 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2181 if the built-in stack extension method is used).
2183 Do not make this value too large; the results are undefined if
2184 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2185 evaluated with infinite-precision integer arithmetic. */
2188 # define YYMAXDEPTH 10000
2195 # if defined __GLIBC__ && defined _STRING_H
2196 # define yystrlen strlen
2198 /* Return the length of YYSTR. */
2199 #if (defined __STDC__ || defined __C99__FUNC__ \
2200 || defined __cplusplus || defined _MSC_VER)
2202 yystrlen (const char *yystr
)
2210 for (yylen
= 0; yystr
[yylen
]; yylen
++)
2218 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2219 # define yystpcpy stpcpy
2221 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2223 #if (defined __STDC__ || defined __C99__FUNC__ \
2224 || defined __cplusplus || defined _MSC_VER)
2226 yystpcpy (char *yydest
, const char *yysrc
)
2229 yystpcpy (yydest
, yysrc
)
2235 const char *yys
= yysrc
;
2237 while ((*yyd
++ = *yys
++) != '\0')
2246 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2247 quotes and backslashes, so that it's suitable for yyerror. The
2248 heuristic is that double-quoting is unnecessary unless the string
2249 contains an apostrophe, a comma, or backslash (other than
2250 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2251 null, do not copy; instead, return the length of what the result
2254 yytnamerr (char *yyres
, const char *yystr
)
2259 char const *yyp
= yystr
;
2266 goto do_not_strip_quotes
;
2270 goto do_not_strip_quotes
;
2283 do_not_strip_quotes
: ;
2287 return yystrlen (yystr
);
2289 return yystpcpy (yyres
, yystr
) - yyres
;
2293 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
2294 about the unexpected token YYTOKEN for the state stack whose top is
2297 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
2298 not large enough to hold the message. In that case, also set
2299 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
2300 required number of bytes is too large to store. */
2302 yysyntax_error (YYSIZE_T
*yymsg_alloc
, char **yymsg
,
2303 yytype_int16
*yyssp
, int yytoken
)
2305 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytoken
]);
2306 YYSIZE_T yysize
= yysize0
;
2308 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
2309 /* Internationalized format string. */
2310 const char *yyformat
= 0;
2311 /* Arguments of yyformat. */
2312 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
2313 /* Number of reported tokens (one for the "unexpected", one per
2317 /* There are many possibilities here to consider:
2318 - Assume YYFAIL is not used. It's too flawed to consider. See
2319 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
2320 for details. YYERROR is fine as it does not invoke this
2322 - If this state is a consistent state with a default action, then
2323 the only way this function was invoked is if the default action
2324 is an error action. In that case, don't check for expected
2325 tokens because there are none.
2326 - The only way there can be no lookahead present (in yychar) is if
2327 this state is a consistent state with a default action. Thus,
2328 detecting the absence of a lookahead is sufficient to determine
2329 that there is no unexpected or expected token to report. In that
2330 case, just report a simple "syntax error".
2331 - Don't assume there isn't a lookahead just because this state is a
2332 consistent state with a default action. There might have been a
2333 previous inconsistent state, consistent state with a non-default
2334 action, or user semantic action that manipulated yychar.
2335 - Of course, the expected token list depends on states to have
2336 correct lookahead information, and it depends on the parser not
2337 to perform extra reductions after fetching a lookahead from the
2338 scanner and before detecting a syntax error. Thus, state merging
2339 (from LALR or IELR) and default reductions corrupt the expected
2340 token list. However, the list is correct for canonical LR with
2341 one exception: it will still contain any token that will not be
2342 accepted due to an error action in a later state.
2344 if (yytoken
!= YYEMPTY
)
2346 int yyn
= yypact
[*yyssp
];
2347 yyarg
[yycount
++] = yytname
[yytoken
];
2348 if (!yypact_value_is_default (yyn
))
2350 /* Start YYX at -YYN if negative to avoid negative indexes in
2351 YYCHECK. In other words, skip the first -YYN actions for
2352 this state because they are default actions. */
2353 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
2354 /* Stay within bounds of both yycheck and yytname. */
2355 int yychecklim
= YYLAST
- yyn
+ 1;
2356 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
2359 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
2360 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
2361 && !yytable_value_is_error (yytable
[yyx
+ yyn
]))
2363 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
2369 yyarg
[yycount
++] = yytname
[yyx
];
2370 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
2371 if (! (yysize
<= yysize1
2372 && yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
2381 # define YYCASE_(N, S) \
2385 YYCASE_(0, YY_("syntax error"));
2386 YYCASE_(1, YY_("syntax error, unexpected %s"));
2387 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
2388 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
2389 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
2390 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
2394 yysize1
= yysize
+ yystrlen (yyformat
);
2395 if (! (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
2399 if (*yymsg_alloc
< yysize
)
2401 *yymsg_alloc
= 2 * yysize
;
2402 if (! (yysize
<= *yymsg_alloc
2403 && *yymsg_alloc
<= YYSTACK_ALLOC_MAXIMUM
))
2404 *yymsg_alloc
= YYSTACK_ALLOC_MAXIMUM
;
2408 /* Avoid sprintf, as that infringes on the user's name space.
2409 Don't have undefined behavior even if the translation
2410 produced a string with the wrong number of "%s"s. */
2414 while ((*yyp
= *yyformat
) != '\0')
2415 if (*yyp
== '%' && yyformat
[1] == 's' && yyi
< yycount
)
2417 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
2428 #endif /* YYERROR_VERBOSE */
2430 /*-----------------------------------------------.
2431 | Release the memory associated to this symbol. |
2432 `-----------------------------------------------*/
2435 #if (defined __STDC__ || defined __C99__FUNC__ \
2436 || defined __cplusplus || defined _MSC_VER)
2438 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
)
2441 yydestruct (yymsg
, yytype
, yyvaluep
, yylocationp
)
2445 YYLTYPE
*yylocationp
;
2449 YYUSE (yylocationp
);
2453 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
2464 /* Prevent warnings from -Wmissing-prototypes. */
2465 #ifdef YYPARSE_PARAM
2466 #if defined __STDC__ || defined __cplusplus
2467 int yyparse (void *YYPARSE_PARAM
);
2471 #else /* ! YYPARSE_PARAM */
2472 #if defined __STDC__ || defined __cplusplus
2477 #endif /* ! YYPARSE_PARAM */
2480 /* The lookahead symbol. */
2483 /* The semantic value of the lookahead symbol. */
2486 /* Location data for the lookahead symbol. */
2489 /* Number of syntax errors so far. */
2497 #ifdef YYPARSE_PARAM
2498 #if (defined __STDC__ || defined __C99__FUNC__ \
2499 || defined __cplusplus || defined _MSC_VER)
2501 yyparse (void *YYPARSE_PARAM
)
2504 yyparse (YYPARSE_PARAM
)
2505 void *YYPARSE_PARAM
;
2507 #else /* ! YYPARSE_PARAM */
2508 #if (defined __STDC__ || defined __C99__FUNC__ \
2509 || defined __cplusplus || defined _MSC_VER)
2520 /* Number of tokens to shift before error messages enabled. */
2523 /* The stacks and their tools:
2524 `yyss': related to states.
2525 `yyvs': related to semantic values.
2526 `yyls': related to locations.
2528 Refer to the stacks thru separate pointers, to allow yyoverflow
2529 to reallocate them elsewhere. */
2531 /* The state stack. */
2532 yytype_int16 yyssa
[YYINITDEPTH
];
2534 yytype_int16
*yyssp
;
2536 /* The semantic value stack. */
2537 YYSTYPE yyvsa
[YYINITDEPTH
];
2541 /* The location stack. */
2542 YYLTYPE yylsa
[YYINITDEPTH
];
2546 /* The locations where the error started and ended. */
2547 YYLTYPE yyerror_range
[3];
2549 YYSIZE_T yystacksize
;
2553 /* Lookahead token as an internal (translated) token number. */
2555 /* The variables used to return semantic value and location from the
2561 /* Buffer for error messages, and its allocated size. */
2563 char *yymsg
= yymsgbuf
;
2564 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
2567 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
2569 /* The number of symbols on the RHS of the reduced rule.
2570 Keep to zero when no symbol should be popped. */
2577 yystacksize
= YYINITDEPTH
;
2579 YYDPRINTF ((stderr
, "Starting parse\n"));
2584 yychar
= YYEMPTY
; /* Cause a token to be read. */
2586 /* Initialize stack pointers.
2587 Waste one element of value and location stack
2588 so that they stay on the same level as the state stack.
2589 The wasted elements are never initialized. */
2594 #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2595 /* Initialize the default location before parsing starts. */
2596 yylloc
.first_line
= yylloc
.last_line
= 1;
2597 yylloc
.first_column
= yylloc
.last_column
= 1;
2602 /*------------------------------------------------------------.
2603 | yynewstate -- Push a new state, which is found in yystate. |
2604 `------------------------------------------------------------*/
2606 /* In all cases, when you get here, the value and location stacks
2607 have just been pushed. So pushing a state here evens the stacks. */
2613 if (yyss
+ yystacksize
- 1 <= yyssp
)
2615 /* Get the current used size of the three stacks, in elements. */
2616 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
2620 /* Give user a chance to reallocate the stack. Use copies of
2621 these so that the &'s don't force the real ones into
2623 YYSTYPE
*yyvs1
= yyvs
;
2624 yytype_int16
*yyss1
= yyss
;
2625 YYLTYPE
*yyls1
= yyls
;
2627 /* Each stack pointer address is followed by the size of the
2628 data in use in that stack, in bytes. This used to be a
2629 conditional around just the two extra args, but that might
2630 be undefined if yyoverflow is a macro. */
2631 yyoverflow (YY_("memory exhausted"),
2632 &yyss1
, yysize
* sizeof (*yyssp
),
2633 &yyvs1
, yysize
* sizeof (*yyvsp
),
2634 &yyls1
, yysize
* sizeof (*yylsp
),
2641 #else /* no yyoverflow */
2642 # ifndef YYSTACK_RELOCATE
2643 goto yyexhaustedlab
;
2645 /* Extend the stack our own way. */
2646 if (YYMAXDEPTH
<= yystacksize
)
2647 goto yyexhaustedlab
;
2649 if (YYMAXDEPTH
< yystacksize
)
2650 yystacksize
= YYMAXDEPTH
;
2653 yytype_int16
*yyss1
= yyss
;
2654 union yyalloc
*yyptr
=
2655 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
2657 goto yyexhaustedlab
;
2658 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
2659 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
2660 YYSTACK_RELOCATE (yyls_alloc
, yyls
);
2661 # undef YYSTACK_RELOCATE
2663 YYSTACK_FREE (yyss1
);
2666 #endif /* no yyoverflow */
2668 yyssp
= yyss
+ yysize
- 1;
2669 yyvsp
= yyvs
+ yysize
- 1;
2670 yylsp
= yyls
+ yysize
- 1;
2672 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
2673 (unsigned long int) yystacksize
));
2675 if (yyss
+ yystacksize
- 1 <= yyssp
)
2679 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
2681 if (yystate
== YYFINAL
)
2691 /* Do appropriate processing given the current state. Read a
2692 lookahead token if we need one and don't already have one. */
2694 /* First try to decide what to do without reference to lookahead token. */
2695 yyn
= yypact
[yystate
];
2696 if (yypact_value_is_default (yyn
))
2699 /* Not known => get a lookahead token if don't already have one. */
2701 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
2702 if (yychar
== YYEMPTY
)
2704 YYDPRINTF ((stderr
, "Reading a token: "));
2708 if (yychar
<= YYEOF
)
2710 yychar
= yytoken
= YYEOF
;
2711 YYDPRINTF ((stderr
, "Now at end of input.\n"));
2715 yytoken
= YYTRANSLATE (yychar
);
2716 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
2719 /* If the proper action on seeing token YYTOKEN is to reduce or to
2720 detect an error, take that action. */
2722 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
2727 if (yytable_value_is_error (yyn
))
2733 /* Count tokens shifted since error; after three, turn off error
2738 /* Shift the lookahead token. */
2739 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
2741 /* Discard the shifted token. */
2750 /*-----------------------------------------------------------.
2751 | yydefault -- do the default action for the current state. |
2752 `-----------------------------------------------------------*/
2754 yyn
= yydefact
[yystate
];
2760 /*-----------------------------.
2761 | yyreduce -- Do a reduction. |
2762 `-----------------------------*/
2764 /* yyn is the number of a rule to reduce with. */
2767 /* If YYLEN is nonzero, implement the default value of the action:
2770 Otherwise, the following line sets YYVAL to garbage.
2771 This behavior is undocumented and Bison
2772 users should not rely upon it. Assigning to YYVAL
2773 unconditionally makes the parser a bit smaller, and it avoids a
2774 GCC warning that YYVAL may be used uninitialized. */
2775 yyval
= yyvsp
[1-yylen
];
2777 /* Default location. */
2778 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
2779 YY_REDUCE_PRINT (yyn
);
2784 /* Line 1806 of yacc.c */
2792 /* Line 1806 of yacc.c */
2795 const struct hlsl_ir_function_decl
*decl
;
2797 decl
= get_overloaded_func(&hlsl_ctx
.functions
, (yyvsp
[(2) - (2)].function
).name
, (yyvsp
[(2) - (2)].function
).decl
->parameters
, TRUE
);
2798 if (decl
&& !decl
->func
->intrinsic
)
2800 if (decl
->body
&& (yyvsp
[(2) - (2)].function
).decl
->body
)
2802 hlsl_report_message((yyvsp
[(2) - (2)].function
).decl
->node
.loc
.file
, (yyvsp
[(2) - (2)].function
).decl
->node
.loc
.line
,
2803 (yyvsp
[(2) - (2)].function
).decl
->node
.loc
.col
, HLSL_LEVEL_ERROR
,
2804 "redefinition of function %s", debugstr_a((yyvsp
[(2) - (2)].function
).name
));
2807 else if (!compare_hlsl_types(decl
->node
.data_type
, (yyvsp
[(2) - (2)].function
).decl
->node
.data_type
))
2809 hlsl_report_message((yyvsp
[(2) - (2)].function
).decl
->node
.loc
.file
, (yyvsp
[(2) - (2)].function
).decl
->node
.loc
.line
,
2810 (yyvsp
[(2) - (2)].function
).decl
->node
.loc
.col
, HLSL_LEVEL_ERROR
,
2811 "redefining function %s with a different return type",
2812 debugstr_a((yyvsp
[(2) - (2)].function
).name
));
2813 hlsl_report_message(decl
->node
.loc
.file
, decl
->node
.loc
.line
, decl
->node
.loc
.col
, HLSL_LEVEL_NOTE
,
2814 "%s previously declared here",
2815 debugstr_a((yyvsp
[(2) - (2)].function
).name
));
2820 if ((yyvsp
[(2) - (2)].function
).decl
->node
.data_type
->base_type
== HLSL_TYPE_VOID
&& (yyvsp
[(2) - (2)].function
).decl
->semantic
)
2822 hlsl_report_message((yyvsp
[(2) - (2)].function
).decl
->node
.loc
.file
, (yyvsp
[(2) - (2)].function
).decl
->node
.loc
.line
,
2823 (yyvsp
[(2) - (2)].function
).decl
->node
.loc
.col
, HLSL_LEVEL_ERROR
,
2824 "void function with a semantic");
2827 TRACE("Adding function '%s' to the function list.\n", (yyvsp
[(2) - (2)].function
).name
);
2828 add_function_decl(&hlsl_ctx
.functions
, (yyvsp
[(2) - (2)].function
).name
, (yyvsp
[(2) - (2)].function
).decl
, FALSE
);
2834 /* Line 1806 of yacc.c */
2837 TRACE("Declaration statement parsed.\n");
2843 /* Line 1806 of yacc.c */
2851 /* Line 1806 of yacc.c */
2854 TRACE("Skipping stray semicolon.\n");
2860 /* Line 1806 of yacc.c */
2863 TRACE("Updating line information to file %s, line %u\n", debugstr_a((yyvsp
[(2) - (2)].name
)), (yyvsp
[(1) - (2)].intval
));
2864 hlsl_ctx
.line_no
= (yyvsp
[(1) - (2)].intval
);
2865 if (strcmp((yyvsp
[(2) - (2)].name
), hlsl_ctx
.source_file
))
2867 const char **new_array
;
2869 hlsl_ctx
.source_file
= (yyvsp
[(2) - (2)].name
);
2870 new_array
= d3dcompiler_realloc(hlsl_ctx
.source_files
,
2871 sizeof(*hlsl_ctx
.source_files
) * hlsl_ctx
.source_files_count
+ 1);
2874 hlsl_ctx
.source_files
= new_array
;
2875 hlsl_ctx
.source_files
[hlsl_ctx
.source_files_count
++] = (yyvsp
[(2) - (2)].name
);
2883 /* Line 1806 of yacc.c */
2886 struct source_location loc
;
2888 set_location(&loc
, &(yylsp
[(3) - (3)]));
2889 if (!(yyvsp
[(2) - (3)].list
))
2891 if (!(yyvsp
[(1) - (3)].type
)->name
)
2893 hlsl_report_message(loc
.file
, loc
.line
, loc
.col
,
2894 HLSL_LEVEL_ERROR
, "anonymous struct declaration with no variables");
2896 check_type_modifiers((yyvsp
[(1) - (3)].type
)->modifiers
, &loc
);
2898 (yyval
.list
) = declare_vars((yyvsp
[(1) - (3)].type
), 0, (yyvsp
[(2) - (3)].list
));
2904 /* Line 1806 of yacc.c */
2908 struct source_location loc
;
2910 TRACE("Structure %s declaration.\n", debugstr_a((yyvsp
[(3) - (6)].name
)));
2911 set_location(&loc
, &(yylsp
[(1) - (6)]));
2912 check_invalid_matrix_modifiers((yyvsp
[(1) - (6)].modifiers
), &loc
);
2913 (yyval
.type
) = new_struct_type((yyvsp
[(3) - (6)].name
), (yyvsp
[(1) - (6)].modifiers
), (yyvsp
[(5) - (6)].list
));
2915 if (get_variable(hlsl_ctx
.cur_scope
, (yyvsp
[(3) - (6)].name
)))
2917 hlsl_report_message(hlsl_ctx
.source_file
, (yylsp
[(3) - (6)]).first_line
, (yylsp
[(3) - (6)]).first_column
,
2918 HLSL_LEVEL_ERROR
, "redefinition of '%s'", (yyvsp
[(3) - (6)].name
));
2922 ret
= add_type_to_scope(hlsl_ctx
.cur_scope
, (yyval
.type
));
2925 hlsl_report_message(hlsl_ctx
.source_file
, (yylsp
[(3) - (6)]).first_line
, (yylsp
[(3) - (6)]).first_column
,
2926 HLSL_LEVEL_ERROR
, "redefinition of struct '%s'", (yyvsp
[(3) - (6)].name
));
2934 /* Line 1806 of yacc.c */
2937 struct source_location loc
;
2939 TRACE("Anonymous structure declaration.\n");
2940 set_location(&loc
, &(yylsp
[(1) - (5)]));
2941 check_invalid_matrix_modifiers((yyvsp
[(1) - (5)].modifiers
), &loc
);
2942 (yyval
.type
) = new_struct_type(NULL
, (yyvsp
[(1) - (5)].modifiers
), (yyvsp
[(4) - (5)].list
));
2948 /* Line 1806 of yacc.c */
2951 (yyval
.list
) = d3dcompiler_alloc(sizeof(*(yyval
.list
)));
2952 list_init((yyval
.list
));
2958 /* Line 1806 of yacc.c */
2962 struct hlsl_struct_field
*field
, *next
;
2964 (yyval
.list
) = (yyvsp
[(1) - (2)].list
);
2965 LIST_FOR_EACH_ENTRY_SAFE(field
, next
, (yyvsp
[(2) - (2)].list
), struct hlsl_struct_field
, entry
)
2967 ret
= add_struct_field((yyval
.list
), field
);
2970 hlsl_report_message(hlsl_ctx
.source_file
, (yylsp
[(2) - (2)]).first_line
, (yylsp
[(2) - (2)]).first_column
,
2971 HLSL_LEVEL_ERROR
, "redefinition of '%s'", field
->name
);
2972 d3dcompiler_free(field
);
2975 d3dcompiler_free((yyvsp
[(2) - (2)].list
));
2981 /* Line 1806 of yacc.c */
2984 (yyval
.list
) = gen_struct_fields((yyvsp
[(2) - (4)].type
), (yyvsp
[(1) - (4)].modifiers
), (yyvsp
[(3) - (4)].list
));
2990 /* Line 1806 of yacc.c */
2993 (yyval
.list
) = gen_struct_fields((yyvsp
[(1) - (3)].type
), 0, (yyvsp
[(2) - (3)].list
));
2999 /* Line 1806 of yacc.c */
3002 TRACE("Function %s parsed.\n", (yyvsp
[(1) - (2)].function
).name
);
3003 (yyval
.function
) = (yyvsp
[(1) - (2)].function
);
3004 (yyval
.function
).decl
->body
= (yyvsp
[(2) - (2)].list
);
3005 pop_scope(&hlsl_ctx
);
3011 /* Line 1806 of yacc.c */
3014 TRACE("Function prototype for %s.\n", (yyvsp
[(1) - (2)].function
).name
);
3015 (yyval
.function
) = (yyvsp
[(1) - (2)].function
);
3016 pop_scope(&hlsl_ctx
);
3022 /* Line 1806 of yacc.c */
3025 if (get_variable(hlsl_ctx
.globals
, (yyvsp
[(3) - (7)].name
)))
3027 hlsl_report_message(hlsl_ctx
.source_file
, (yylsp
[(3) - (7)]).first_line
, (yylsp
[(3) - (7)]).first_column
,
3028 HLSL_LEVEL_ERROR
, "redefinition of '%s'\n", (yyvsp
[(3) - (7)].name
));
3031 if ((yyvsp
[(2) - (7)].type
)->base_type
== HLSL_TYPE_VOID
&& (yyvsp
[(7) - (7)].name
))
3033 hlsl_report_message(hlsl_ctx
.source_file
, (yylsp
[(7) - (7)]).first_line
, (yylsp
[(7) - (7)]).first_column
,
3034 HLSL_LEVEL_ERROR
, "void function with a semantic");
3037 (yyval
.function
).decl
= new_func_decl((yyvsp
[(2) - (7)].type
), (yyvsp
[(5) - (7)].list
));
3038 if (!(yyval
.function
).decl
)
3040 ERR("Out of memory.\n");
3043 (yyval
.function
).name
= (yyvsp
[(3) - (7)].name
);
3044 (yyval
.function
).decl
->semantic
= (yyvsp
[(7) - (7)].name
);
3045 set_location(&(yyval
.function
).decl
->node
.loc
, &(yylsp
[(3) - (7)]));
3051 /* Line 1806 of yacc.c */
3054 (yyval
.list
) = d3dcompiler_alloc(sizeof(*(yyval
.list
)));
3055 list_init((yyval
.list
));
3061 /* Line 1806 of yacc.c */
3064 pop_scope(&hlsl_ctx
);
3065 (yyval
.list
) = (yyvsp
[(3) - (4)].list
);
3071 /* Line 1806 of yacc.c */
3074 push_scope(&hlsl_ctx
);
3080 /* Line 1806 of yacc.c */
3083 (yyval
.name
) = NULL
;
3089 /* Line 1806 of yacc.c */
3092 (yyval
.name
) = (yyvsp
[(2) - (2)].name
);
3098 /* Line 1806 of yacc.c */
3101 (yyval
.list
) = d3dcompiler_alloc(sizeof(*(yyval
.list
)));
3102 list_init((yyval
.list
));
3108 /* Line 1806 of yacc.c */
3111 (yyval
.list
) = (yyvsp
[(2) - (2)].list
);
3117 /* Line 1806 of yacc.c */
3120 struct source_location loc
;
3122 (yyval
.list
) = d3dcompiler_alloc(sizeof(*(yyval
.list
)));
3123 list_init((yyval
.list
));
3124 set_location(&loc
, &(yylsp
[(1) - (1)]));
3125 if (!add_func_parameter((yyval
.list
), &(yyvsp
[(1) - (1)].parameter
), &loc
))
3127 ERR("Error adding function parameter %s.\n", (yyvsp
[(1) - (1)].parameter
).name
);
3128 set_parse_status(&hlsl_ctx
.status
, PARSE_ERR
);
3136 /* Line 1806 of yacc.c */
3139 struct source_location loc
;
3141 (yyval
.list
) = (yyvsp
[(1) - (3)].list
);
3142 set_location(&loc
, &(yylsp
[(3) - (3)]));
3143 if (!add_func_parameter((yyval
.list
), &(yyvsp
[(3) - (3)].parameter
), &loc
))
3145 hlsl_report_message(loc
.file
, loc
.line
, loc
.col
, HLSL_LEVEL_ERROR
,
3146 "duplicate parameter %s", (yyvsp
[(3) - (3)].parameter
).name
);
3154 /* Line 1806 of yacc.c */
3157 (yyval
.parameter
).modifiers
= (yyvsp
[(1) - (5)].modifiers
) ? (yyvsp
[(1) - (5)].modifiers
) : HLSL_MODIFIER_IN
;
3158 (yyval
.parameter
).modifiers
|= (yyvsp
[(2) - (5)].modifiers
);
3159 (yyval
.parameter
).type
= (yyvsp
[(3) - (5)].type
);
3160 (yyval
.parameter
).name
= (yyvsp
[(4) - (5)].name
);
3161 (yyval
.parameter
).semantic
= (yyvsp
[(5) - (5)].name
);
3167 /* Line 1806 of yacc.c */
3170 (yyval
.modifiers
) = 0;
3176 /* Line 1806 of yacc.c */
3179 if ((yyvsp
[(1) - (2)].modifiers
) & (yyvsp
[(2) - (2)].modifiers
))
3181 hlsl_report_message(hlsl_ctx
.source_file
, (yylsp
[(2) - (2)]).first_line
, (yylsp
[(2) - (2)]).first_column
,
3182 HLSL_LEVEL_ERROR
, "duplicate input-output modifiers");
3185 (yyval
.modifiers
) = (yyvsp
[(1) - (2)].modifiers
) | (yyvsp
[(2) - (2)].modifiers
);
3191 /* Line 1806 of yacc.c */
3194 (yyval
.modifiers
) = HLSL_MODIFIER_IN
;
3200 /* Line 1806 of yacc.c */
3203 (yyval
.modifiers
) = HLSL_MODIFIER_OUT
;
3209 /* Line 1806 of yacc.c */
3212 (yyval
.modifiers
) = HLSL_MODIFIER_IN
| HLSL_MODIFIER_OUT
;
3218 /* Line 1806 of yacc.c */
3221 (yyval
.type
) = (yyvsp
[(1) - (1)].type
);
3227 /* Line 1806 of yacc.c */
3230 if ((yyvsp
[(3) - (6)].type
)->type
!= HLSL_CLASS_SCALAR
)
3232 hlsl_message("Line %u: vectors of non-scalar types are not allowed.\n",
3234 set_parse_status(&hlsl_ctx
.status
, PARSE_ERR
);
3237 if ((yyvsp
[(5) - (6)].intval
) < 1 || (yyvsp
[(5) - (6)].intval
) > 4)
3239 hlsl_message("Line %u: vector size must be between 1 and 4.\n",
3241 set_parse_status(&hlsl_ctx
.status
, PARSE_ERR
);
3245 (yyval
.type
) = new_hlsl_type(NULL
, HLSL_CLASS_VECTOR
, (yyvsp
[(3) - (6)].type
)->base_type
, (yyvsp
[(5) - (6)].intval
), 1);
3251 /* Line 1806 of yacc.c */
3254 if ((yyvsp
[(3) - (8)].type
)->type
!= HLSL_CLASS_SCALAR
)
3256 hlsl_message("Line %u: matrices of non-scalar types are not allowed.\n",
3258 set_parse_status(&hlsl_ctx
.status
, PARSE_ERR
);
3261 if ((yyvsp
[(5) - (8)].intval
) < 1 || (yyvsp
[(5) - (8)].intval
) > 4 || (yyvsp
[(7) - (8)].intval
) < 1 || (yyvsp
[(7) - (8)].intval
) > 4)
3263 hlsl_message("Line %u: matrix dimensions must be between 1 and 4.\n",
3265 set_parse_status(&hlsl_ctx
.status
, PARSE_ERR
);
3269 (yyval
.type
) = new_hlsl_type(NULL
, HLSL_CLASS_MATRIX
, (yyvsp
[(3) - (8)].type
)->base_type
, (yyvsp
[(5) - (8)].intval
), (yyvsp
[(7) - (8)].intval
));
3275 /* Line 1806 of yacc.c */
3278 (yyval
.type
) = new_hlsl_type(d3dcompiler_strdup("void"), HLSL_CLASS_OBJECT
, HLSL_TYPE_VOID
, 1, 1);
3284 /* Line 1806 of yacc.c */
3287 (yyval
.type
) = new_hlsl_type(d3dcompiler_strdup("sampler"), HLSL_CLASS_OBJECT
, HLSL_TYPE_SAMPLER
, 1, 1);
3288 (yyval
.type
)->sampler_dim
= HLSL_SAMPLER_DIM_GENERIC
;
3294 /* Line 1806 of yacc.c */
3297 (yyval
.type
) = new_hlsl_type(d3dcompiler_strdup("sampler1D"), HLSL_CLASS_OBJECT
, HLSL_TYPE_SAMPLER
, 1, 1);
3298 (yyval
.type
)->sampler_dim
= HLSL_SAMPLER_DIM_1D
;
3304 /* Line 1806 of yacc.c */
3307 (yyval
.type
) = new_hlsl_type(d3dcompiler_strdup("sampler2D"), HLSL_CLASS_OBJECT
, HLSL_TYPE_SAMPLER
, 1, 1);
3308 (yyval
.type
)->sampler_dim
= HLSL_SAMPLER_DIM_2D
;
3314 /* Line 1806 of yacc.c */
3317 (yyval
.type
) = new_hlsl_type(d3dcompiler_strdup("sampler3D"), HLSL_CLASS_OBJECT
, HLSL_TYPE_SAMPLER
, 1, 1);
3318 (yyval
.type
)->sampler_dim
= HLSL_SAMPLER_DIM_3D
;
3324 /* Line 1806 of yacc.c */
3327 (yyval
.type
) = new_hlsl_type(d3dcompiler_strdup("samplerCUBE"), HLSL_CLASS_OBJECT
, HLSL_TYPE_SAMPLER
, 1, 1);
3328 (yyval
.type
)->sampler_dim
= HLSL_SAMPLER_DIM_CUBE
;
3334 /* Line 1806 of yacc.c */
3337 struct hlsl_type
*type
;
3339 TRACE("Type %s.\n", (yyvsp
[(1) - (1)].name
));
3340 type
= get_type(hlsl_ctx
.cur_scope
, (yyvsp
[(1) - (1)].name
), TRUE
);
3341 (yyval
.type
) = type
;
3342 d3dcompiler_free((yyvsp
[(1) - (1)].name
));
3348 /* Line 1806 of yacc.c */
3351 struct hlsl_type
*type
;
3353 TRACE("Struct type %s.\n", (yyvsp
[(2) - (2)].name
));
3354 type
= get_type(hlsl_ctx
.cur_scope
, (yyvsp
[(2) - (2)].name
), TRUE
);
3355 if (type
->type
!= HLSL_CLASS_STRUCT
)
3357 hlsl_message("Line %u: redefining %s as a structure.\n",
3358 hlsl_ctx
.line_no
, (yyvsp
[(2) - (2)].name
));
3359 set_parse_status(&hlsl_ctx
.status
, PARSE_ERR
);
3363 (yyval
.type
) = type
;
3365 d3dcompiler_free((yyvsp
[(2) - (2)].name
));
3371 /* Line 1806 of yacc.c */
3374 (yyval
.list
) = d3dcompiler_alloc(sizeof(*(yyval
.list
)));
3377 ERR("Out of memory\n");
3380 list_init((yyval
.list
));
3386 /* Line 1806 of yacc.c */
3389 struct source_location loc
;
3391 set_location(&loc
, &(yylsp
[(1) - (5)]));
3392 if (!add_typedef((yyvsp
[(2) - (5)].modifiers
), (yyvsp
[(3) - (5)].type
), (yyvsp
[(4) - (5)].list
), &loc
))
3399 /* Line 1806 of yacc.c */
3402 struct source_location loc
;
3404 set_location(&loc
, &(yylsp
[(1) - (4)]));
3405 if (!add_typedef(0, (yyvsp
[(2) - (4)].type
), (yyvsp
[(3) - (4)].list
), &loc
))
3412 /* Line 1806 of yacc.c */
3415 (yyval
.list
) = d3dcompiler_alloc(sizeof(*(yyval
.list
)));
3416 list_init((yyval
.list
));
3417 list_add_head((yyval
.list
), &(yyvsp
[(1) - (1)].variable_def
)->entry
);
3423 /* Line 1806 of yacc.c */
3426 (yyval
.list
) = (yyvsp
[(1) - (3)].list
);
3427 list_add_tail((yyval
.list
), &(yyvsp
[(3) - (3)].variable_def
)->entry
);
3433 /* Line 1806 of yacc.c */
3436 (yyval
.variable_def
) = d3dcompiler_alloc(sizeof(*(yyval
.variable_def
)));
3437 set_location(&(yyval
.variable_def
)->loc
, &(yylsp
[(1) - (2)]));
3438 (yyval
.variable_def
)->name
= (yyvsp
[(1) - (2)].name
);
3439 (yyval
.variable_def
)->array_size
= (yyvsp
[(2) - (2)].intval
);
3445 /* Line 1806 of yacc.c */
3448 (yyval
.list
) = declare_vars((yyvsp
[(2) - (4)].type
), (yyvsp
[(1) - (4)].modifiers
), (yyvsp
[(3) - (4)].list
));
3454 /* Line 1806 of yacc.c */
3457 (yyval
.list
) = NULL
;
3463 /* Line 1806 of yacc.c */
3466 (yyval
.list
) = (yyvsp
[(1) - (1)].list
);
3472 /* Line 1806 of yacc.c */
3475 (yyval
.list
) = d3dcompiler_alloc(sizeof(*(yyval
.list
)));
3476 list_init((yyval
.list
));
3477 list_add_head((yyval
.list
), &(yyvsp
[(1) - (1)].variable_def
)->entry
);
3483 /* Line 1806 of yacc.c */
3486 (yyval
.list
) = (yyvsp
[(1) - (3)].list
);
3487 list_add_tail((yyval
.list
), &(yyvsp
[(3) - (3)].variable_def
)->entry
);
3493 /* Line 1806 of yacc.c */
3496 (yyval
.variable_def
) = d3dcompiler_alloc(sizeof(*(yyval
.variable_def
)));
3497 set_location(&(yyval
.variable_def
)->loc
, &(yylsp
[(1) - (3)]));
3498 (yyval
.variable_def
)->name
= (yyvsp
[(1) - (3)].name
);
3499 (yyval
.variable_def
)->array_size
= (yyvsp
[(2) - (3)].intval
);
3500 (yyval
.variable_def
)->semantic
= (yyvsp
[(3) - (3)].name
);
3506 /* Line 1806 of yacc.c */
3509 TRACE("Declaration with initializer.\n");
3510 (yyval
.variable_def
) = d3dcompiler_alloc(sizeof(*(yyval
.variable_def
)));
3511 set_location(&(yyval
.variable_def
)->loc
, &(yylsp
[(1) - (5)]));
3512 (yyval
.variable_def
)->name
= (yyvsp
[(1) - (5)].name
);
3513 (yyval
.variable_def
)->array_size
= (yyvsp
[(2) - (5)].intval
);
3514 (yyval
.variable_def
)->semantic
= (yyvsp
[(3) - (5)].name
);
3515 (yyval
.variable_def
)->initializer
= (yyvsp
[(5) - (5)].list
);
3521 /* Line 1806 of yacc.c */
3530 /* Line 1806 of yacc.c */
3535 free_instr((yyvsp
[(2) - (3)].instr
));
3541 /* Line 1806 of yacc.c */
3544 (yyval
.modifiers
) = 0;
3550 /* Line 1806 of yacc.c */
3553 (yyval
.modifiers
) = add_modifier((yyvsp
[(2) - (2)].modifiers
), HLSL_STORAGE_EXTERN
, &(yylsp
[(1) - (2)]));
3559 /* Line 1806 of yacc.c */
3562 (yyval
.modifiers
) = add_modifier((yyvsp
[(2) - (2)].modifiers
), HLSL_STORAGE_NOINTERPOLATION
, &(yylsp
[(1) - (2)]));
3568 /* Line 1806 of yacc.c */
3571 (yyval
.modifiers
) = add_modifier((yyvsp
[(2) - (2)].modifiers
), HLSL_MODIFIER_PRECISE
, &(yylsp
[(1) - (2)]));
3577 /* Line 1806 of yacc.c */
3580 (yyval
.modifiers
) = add_modifier((yyvsp
[(2) - (2)].modifiers
), HLSL_STORAGE_SHARED
, &(yylsp
[(1) - (2)]));
3586 /* Line 1806 of yacc.c */
3589 (yyval
.modifiers
) = add_modifier((yyvsp
[(2) - (2)].modifiers
), HLSL_STORAGE_GROUPSHARED
, &(yylsp
[(1) - (2)]));
3595 /* Line 1806 of yacc.c */
3598 (yyval
.modifiers
) = add_modifier((yyvsp
[(2) - (2)].modifiers
), HLSL_STORAGE_STATIC
, &(yylsp
[(1) - (2)]));
3604 /* Line 1806 of yacc.c */
3607 (yyval
.modifiers
) = add_modifier((yyvsp
[(2) - (2)].modifiers
), HLSL_STORAGE_UNIFORM
, &(yylsp
[(1) - (2)]));
3613 /* Line 1806 of yacc.c */
3616 (yyval
.modifiers
) = add_modifier((yyvsp
[(2) - (2)].modifiers
), HLSL_STORAGE_VOLATILE
, &(yylsp
[(1) - (2)]));
3622 /* Line 1806 of yacc.c */
3625 (yyval
.modifiers
) = add_modifier((yyvsp
[(2) - (2)].modifiers
), HLSL_MODIFIER_CONST
, &(yylsp
[(1) - (2)]));
3631 /* Line 1806 of yacc.c */
3634 (yyval
.modifiers
) = add_modifier((yyvsp
[(2) - (2)].modifiers
), HLSL_MODIFIER_ROW_MAJOR
, &(yylsp
[(1) - (2)]));
3640 /* Line 1806 of yacc.c */
3643 (yyval
.modifiers
) = add_modifier((yyvsp
[(2) - (2)].modifiers
), HLSL_MODIFIER_COLUMN_MAJOR
, &(yylsp
[(1) - (2)]));
3649 /* Line 1806 of yacc.c */
3652 (yyval
.list
) = d3dcompiler_alloc(sizeof(*(yyval
.list
)));
3653 list_init((yyval
.list
));
3654 list_add_head((yyval
.list
), &(yyvsp
[(1) - (1)].instr
)->entry
);
3660 /* Line 1806 of yacc.c */
3663 (yyval
.list
) = (yyvsp
[(2) - (3)].list
);
3669 /* Line 1806 of yacc.c */
3672 (yyval
.list
) = (yyvsp
[(2) - (4)].list
);
3678 /* Line 1806 of yacc.c */
3681 (yyval
.instr
) = (yyvsp
[(1) - (1)].instr
);
3687 /* Line 1806 of yacc.c */
3690 (yyval
.list
) = d3dcompiler_alloc(sizeof(*(yyval
.list
)));
3691 list_init((yyval
.list
));
3692 list_add_head((yyval
.list
), &(yyvsp
[(1) - (1)].instr
)->entry
);
3698 /* Line 1806 of yacc.c */
3701 (yyval
.list
) = (yyvsp
[(1) - (3)].list
);
3702 list_add_tail((yyval
.list
), &(yyvsp
[(3) - (3)].instr
)->entry
);
3708 /* Line 1806 of yacc.c */
3711 (yyval
.boolval
) = TRUE
;
3717 /* Line 1806 of yacc.c */
3720 (yyval
.boolval
) = FALSE
;
3726 /* Line 1806 of yacc.c */
3729 (yyval
.list
) = (yyvsp
[(1) - (1)].list
);
3735 /* Line 1806 of yacc.c */
3738 (yyval
.list
) = (yyvsp
[(1) - (2)].list
);
3739 list_move_tail((yyval
.list
), (yyvsp
[(2) - (2)].list
));
3740 d3dcompiler_free((yyvsp
[(2) - (2)].list
));
3746 /* Line 1806 of yacc.c */
3749 struct hlsl_ir_jump
*jump
= d3dcompiler_alloc(sizeof(*jump
));
3752 ERR("Out of memory\n");
3755 jump
->node
.type
= HLSL_IR_JUMP
;
3756 set_location(&jump
->node
.loc
, &(yylsp
[(1) - (3)]));
3757 jump
->type
= HLSL_IR_JUMP_RETURN
;
3758 jump
->node
.data_type
= (yyvsp
[(2) - (3)].instr
)->data_type
;
3759 jump
->return_value
= (yyvsp
[(2) - (3)].instr
);
3761 FIXME("Check for valued return on void function.\n");
3762 FIXME("Implicit conversion to the return type if needed, "
3763 "error out if conversion not possible.\n");
3765 (yyval
.list
) = d3dcompiler_alloc(sizeof(*(yyval
.list
)));
3766 list_init((yyval
.list
));
3767 list_add_tail((yyval
.list
), &jump
->node
.entry
);
3773 /* Line 1806 of yacc.c */
3776 struct hlsl_ir_if
*instr
= d3dcompiler_alloc(sizeof(*instr
));
3779 ERR("Out of memory\n");
3782 instr
->node
.type
= HLSL_IR_IF
;
3783 set_location(&instr
->node
.loc
, &(yylsp
[(1) - (5)]));
3784 instr
->condition
= (yyvsp
[(3) - (5)].instr
);
3785 instr
->then_instrs
= (yyvsp
[(5) - (5)].if_body
).then_instrs
;
3786 instr
->else_instrs
= (yyvsp
[(5) - (5)].if_body
).else_instrs
;
3787 if ((yyvsp
[(3) - (5)].instr
)->data_type
->dimx
> 1 || (yyvsp
[(3) - (5)].instr
)->data_type
->dimy
> 1)
3789 hlsl_report_message(instr
->node
.loc
.file
, instr
->node
.loc
.line
,
3790 instr
->node
.loc
.col
, HLSL_LEVEL_ERROR
,
3791 "if condition requires a scalar");
3793 (yyval
.list
) = d3dcompiler_alloc(sizeof(*(yyval
.list
)));
3794 list_init((yyval
.list
));
3795 list_add_head((yyval
.list
), &instr
->node
.entry
);
3801 /* Line 1806 of yacc.c */
3804 (yyval
.if_body
).then_instrs
= (yyvsp
[(1) - (1)].list
);
3805 (yyval
.if_body
).else_instrs
= NULL
;
3811 /* Line 1806 of yacc.c */
3814 (yyval
.if_body
).then_instrs
= (yyvsp
[(1) - (3)].list
);
3815 (yyval
.if_body
).else_instrs
= (yyvsp
[(3) - (3)].list
);
3821 /* Line 1806 of yacc.c */
3824 struct source_location loc
;
3825 struct list
*cond
= d3dcompiler_alloc(sizeof(*cond
));
3829 ERR("Out of memory.\n");
3833 list_add_head(cond
, &(yyvsp
[(3) - (5)].instr
)->entry
);
3834 set_location(&loc
, &(yylsp
[(1) - (5)]));
3835 (yyval
.list
) = create_loop(LOOP_WHILE
, NULL
, cond
, NULL
, (yyvsp
[(5) - (5)].list
), &loc
);
3841 /* Line 1806 of yacc.c */
3844 struct source_location loc
;
3845 struct list
*cond
= d3dcompiler_alloc(sizeof(*cond
));
3849 ERR("Out of memory.\n");
3853 list_add_head(cond
, &(yyvsp
[(5) - (7)].instr
)->entry
);
3854 set_location(&loc
, &(yylsp
[(1) - (7)]));
3855 (yyval
.list
) = create_loop(LOOP_DO_WHILE
, NULL
, cond
, NULL
, (yyvsp
[(2) - (7)].list
), &loc
);
3861 /* Line 1806 of yacc.c */
3864 struct source_location loc
;
3866 set_location(&loc
, &(yylsp
[(1) - (8)]));
3867 (yyval
.list
) = create_loop(LOOP_FOR
, (yyvsp
[(4) - (8)].list
), (yyvsp
[(5) - (8)].list
), (yyvsp
[(6) - (8)].instr
), (yyvsp
[(8) - (8)].list
), &loc
);
3868 pop_scope(&hlsl_ctx
);
3874 /* Line 1806 of yacc.c */
3877 struct source_location loc
;
3879 set_location(&loc
, &(yylsp
[(1) - (8)]));
3880 if (!(yyvsp
[(4) - (8)].list
))
3881 hlsl_report_message(loc
.file
, loc
.line
, loc
.col
, HLSL_LEVEL_WARNING
,
3882 "no expressions in for loop initializer");
3883 (yyval
.list
) = create_loop(LOOP_FOR
, (yyvsp
[(4) - (8)].list
), (yyvsp
[(5) - (8)].list
), (yyvsp
[(6) - (8)].instr
), (yyvsp
[(8) - (8)].list
), &loc
);
3884 pop_scope(&hlsl_ctx
);
3890 /* Line 1806 of yacc.c */
3893 (yyval
.list
) = d3dcompiler_alloc(sizeof(*(yyval
.list
)));
3894 list_init((yyval
.list
));
3900 /* Line 1806 of yacc.c */
3903 (yyval
.list
) = d3dcompiler_alloc(sizeof(*(yyval
.list
)));
3904 list_init((yyval
.list
));
3905 if ((yyvsp
[(1) - (2)].instr
))
3906 list_add_head((yyval
.list
), &(yyvsp
[(1) - (2)].instr
)->entry
);
3912 /* Line 1806 of yacc.c */
3915 struct hlsl_ir_constant
*c
= d3dcompiler_alloc(sizeof(*c
));
3918 ERR("Out of memory.\n");
3921 c
->node
.type
= HLSL_IR_CONSTANT
;
3922 set_location(&c
->node
.loc
, &yylloc
);
3923 c
->node
.data_type
= new_hlsl_type(d3dcompiler_strdup("float"), HLSL_CLASS_SCALAR
, HLSL_TYPE_FLOAT
, 1, 1);
3924 c
->v
.value
.f
[0] = (yyvsp
[(1) - (1)].floatval
);
3925 (yyval
.instr
) = &c
->node
;
3931 /* Line 1806 of yacc.c */
3934 struct hlsl_ir_constant
*c
= d3dcompiler_alloc(sizeof(*c
));
3937 ERR("Out of memory.\n");
3940 c
->node
.type
= HLSL_IR_CONSTANT
;
3941 set_location(&c
->node
.loc
, &yylloc
);
3942 c
->node
.data_type
= new_hlsl_type(d3dcompiler_strdup("int"), HLSL_CLASS_SCALAR
, HLSL_TYPE_INT
, 1, 1);
3943 c
->v
.value
.i
[0] = (yyvsp
[(1) - (1)].intval
);
3944 (yyval
.instr
) = &c
->node
;
3950 /* Line 1806 of yacc.c */
3953 struct hlsl_ir_constant
*c
= d3dcompiler_alloc(sizeof(*c
));
3956 ERR("Out of memory.\n");
3959 c
->node
.type
= HLSL_IR_CONSTANT
;
3960 set_location(&c
->node
.loc
, &yylloc
);
3961 c
->node
.data_type
= new_hlsl_type(d3dcompiler_strdup("bool"), HLSL_CLASS_SCALAR
, HLSL_TYPE_BOOL
, 1, 1);
3962 c
->v
.value
.b
[0] = (yyvsp
[(1) - (1)].boolval
);
3963 (yyval
.instr
) = &c
->node
;
3969 /* Line 1806 of yacc.c */
3972 struct hlsl_ir_deref
*deref
= new_var_deref((yyvsp
[(1) - (1)].var
));
3975 (yyval
.instr
) = &deref
->node
;
3976 set_location(&(yyval
.instr
)->loc
, &(yylsp
[(1) - (1)]));
3979 (yyval
.instr
) = NULL
;
3985 /* Line 1806 of yacc.c */
3988 (yyval
.instr
) = (yyvsp
[(2) - (3)].instr
);
3994 /* Line 1806 of yacc.c */
3997 struct hlsl_ir_var
*var
;
3998 var
= get_variable(hlsl_ctx
.cur_scope
, (yyvsp
[(1) - (1)].name
));
4001 hlsl_message("Line %d: variable '%s' not declared\n",
4002 hlsl_ctx
.line_no
, (yyvsp
[(1) - (1)].name
));
4003 set_parse_status(&hlsl_ctx
.status
, PARSE_ERR
);
4012 /* Line 1806 of yacc.c */
4015 (yyval
.instr
) = (yyvsp
[(1) - (1)].instr
);
4021 /* Line 1806 of yacc.c */
4024 struct hlsl_ir_node
*operands
[3];
4025 struct source_location loc
;
4027 set_location(&loc
, &(yylsp
[(2) - (2)]));
4028 if ((yyvsp
[(1) - (2)].instr
)->data_type
->modifiers
& HLSL_MODIFIER_CONST
)
4030 hlsl_report_message(loc
.file
, loc
.line
, loc
.col
, HLSL_LEVEL_ERROR
,
4031 "modifying a const expression");
4034 operands
[0] = (yyvsp
[(1) - (2)].instr
);
4035 operands
[1] = operands
[2] = NULL
;
4036 (yyval
.instr
) = &new_expr(HLSL_IR_BINOP_POSTINC
, operands
, &loc
)->node
;
4037 /* Post increment/decrement expressions are considered const */
4038 (yyval
.instr
)->data_type
= clone_hlsl_type((yyval
.instr
)->data_type
);
4039 (yyval
.instr
)->data_type
->modifiers
|= HLSL_MODIFIER_CONST
;
4045 /* Line 1806 of yacc.c */
4048 struct hlsl_ir_node
*operands
[3];
4049 struct source_location loc
;
4051 set_location(&loc
, &(yylsp
[(2) - (2)]));
4052 if ((yyvsp
[(1) - (2)].instr
)->data_type
->modifiers
& HLSL_MODIFIER_CONST
)
4054 hlsl_report_message(loc
.file
, loc
.line
, loc
.col
, HLSL_LEVEL_ERROR
,
4055 "modifying a const expression");
4058 operands
[0] = (yyvsp
[(1) - (2)].instr
);
4059 operands
[1] = operands
[2] = NULL
;
4060 (yyval
.instr
) = &new_expr(HLSL_IR_BINOP_POSTDEC
, operands
, &loc
)->node
;
4061 /* Post increment/decrement expressions are considered const */
4062 (yyval
.instr
)->data_type
= clone_hlsl_type((yyval
.instr
)->data_type
);
4063 (yyval
.instr
)->data_type
->modifiers
|= HLSL_MODIFIER_CONST
;
4069 /* Line 1806 of yacc.c */
4072 struct source_location loc
;
4074 set_location(&loc
, &(yylsp
[(2) - (3)]));
4075 if ((yyvsp
[(1) - (3)].instr
)->data_type
->type
== HLSL_CLASS_STRUCT
)
4077 struct hlsl_type
*type
= (yyvsp
[(1) - (3)].instr
)->data_type
;
4078 struct hlsl_struct_field
*field
;
4080 (yyval
.instr
) = NULL
;
4081 LIST_FOR_EACH_ENTRY(field
, type
->e
.elements
, struct hlsl_struct_field
, entry
)
4083 if (!strcmp((yyvsp
[(3) - (3)].name
), field
->name
))
4085 struct hlsl_ir_deref
*deref
= new_record_deref((yyvsp
[(1) - (3)].instr
), field
);
4089 ERR("Out of memory\n");
4092 deref
->node
.loc
= loc
;
4093 (yyval
.instr
) = &deref
->node
;
4099 hlsl_report_message(loc
.file
, loc
.line
, loc
.col
, HLSL_LEVEL_ERROR
,
4100 "invalid subscript %s", debugstr_a((yyvsp
[(3) - (3)].name
)));
4104 else if ((yyvsp
[(1) - (3)].instr
)->data_type
->type
<= HLSL_CLASS_LAST_NUMERIC
)
4106 struct hlsl_ir_swizzle
*swizzle
;
4108 swizzle
= get_swizzle((yyvsp
[(1) - (3)].instr
), (yyvsp
[(3) - (3)].name
), &loc
);
4111 hlsl_report_message(loc
.file
, loc
.line
, loc
.col
, HLSL_LEVEL_ERROR
,
4112 "invalid swizzle %s", debugstr_a((yyvsp
[(3) - (3)].name
)));
4115 (yyval
.instr
) = &swizzle
->node
;
4119 hlsl_report_message(loc
.file
, loc
.line
, loc
.col
, HLSL_LEVEL_ERROR
,
4120 "invalid subscript %s", debugstr_a((yyvsp
[(3) - (3)].name
)));
4128 /* Line 1806 of yacc.c */
4131 /* This may be an array dereference or a vector/matrix
4132 * subcomponent access.
4133 * We store it as an array dereference in any case. */
4134 struct hlsl_ir_deref
*deref
= d3dcompiler_alloc(sizeof(*deref
));
4135 struct hlsl_type
*expr_type
= (yyvsp
[(1) - (4)].instr
)->data_type
;
4136 struct source_location loc
;
4138 TRACE("Array dereference from type %s\n", debug_hlsl_type(expr_type
));
4141 ERR("Out of memory\n");
4144 deref
->node
.type
= HLSL_IR_DEREF
;
4145 set_location(&loc
, &(yylsp
[(2) - (4)]));
4146 deref
->node
.loc
= loc
;
4147 if (expr_type
->type
== HLSL_CLASS_ARRAY
)
4149 deref
->node
.data_type
= expr_type
->e
.array
.type
;
4151 else if (expr_type
->type
== HLSL_CLASS_MATRIX
)
4153 deref
->node
.data_type
= new_hlsl_type(NULL
, HLSL_CLASS_VECTOR
, expr_type
->base_type
, expr_type
->dimx
, 1);
4155 else if (expr_type
->type
== HLSL_CLASS_VECTOR
)
4157 deref
->node
.data_type
= new_hlsl_type(NULL
, HLSL_CLASS_SCALAR
, expr_type
->base_type
, 1, 1);
4161 if (expr_type
->type
== HLSL_CLASS_SCALAR
)
4162 hlsl_report_message(loc
.file
, loc
.line
, loc
.col
, HLSL_LEVEL_ERROR
,
4163 "array-indexed expression is scalar");
4165 hlsl_report_message(loc
.file
, loc
.line
, loc
.col
, HLSL_LEVEL_ERROR
,
4166 "expression is not array-indexable");
4167 d3dcompiler_free(deref
);
4168 free_instr((yyvsp
[(1) - (4)].instr
));
4169 free_instr((yyvsp
[(3) - (4)].instr
));
4172 if ((yyvsp
[(3) - (4)].instr
)->data_type
->type
!= HLSL_CLASS_SCALAR
)
4174 hlsl_report_message(loc
.file
, loc
.line
, loc
.col
, HLSL_LEVEL_ERROR
,
4175 "array index is not scalar");
4176 d3dcompiler_free(deref
);
4177 free_instr((yyvsp
[(1) - (4)].instr
));
4178 free_instr((yyvsp
[(3) - (4)].instr
));
4181 deref
->type
= HLSL_IR_DEREF_ARRAY
;
4182 deref
->v
.array
.array
= (yyvsp
[(1) - (4)].instr
);
4183 deref
->v
.array
.index
= (yyvsp
[(3) - (4)].instr
);
4185 (yyval
.instr
) = &deref
->node
;
4191 /* Line 1806 of yacc.c */
4194 struct hlsl_ir_constructor
*constructor
;
4196 TRACE("%s constructor.\n", debug_hlsl_type((yyvsp
[(2) - (5)].type
)));
4197 if ((yyvsp
[(1) - (5)].modifiers
))
4199 hlsl_message("Line %u: unexpected modifier in a constructor.\n",
4201 set_parse_status(&hlsl_ctx
.status
, PARSE_ERR
);
4204 if ((yyvsp
[(2) - (5)].type
)->type
> HLSL_CLASS_LAST_NUMERIC
)
4206 hlsl_message("Line %u: constructors are allowed only for numeric data types.\n",
4208 set_parse_status(&hlsl_ctx
.status
, PARSE_ERR
);
4211 if ((yyvsp
[(2) - (5)].type
)->dimx
* (yyvsp
[(2) - (5)].type
)->dimy
!= components_count_expr_list((yyvsp
[(4) - (5)].list
)))
4213 hlsl_message("Line %u: wrong number of components in constructor.\n",
4215 set_parse_status(&hlsl_ctx
.status
, PARSE_ERR
);
4219 constructor
= d3dcompiler_alloc(sizeof(*constructor
));
4220 constructor
->node
.type
= HLSL_IR_CONSTRUCTOR
;
4221 set_location(&constructor
->node
.loc
, &(yylsp
[(3) - (5)]));
4222 constructor
->node
.data_type
= (yyvsp
[(2) - (5)].type
);
4223 constructor
->arguments
= (yyvsp
[(4) - (5)].list
);
4225 (yyval
.instr
) = &constructor
->node
;
4231 /* Line 1806 of yacc.c */
4234 (yyval
.instr
) = (yyvsp
[(1) - (1)].instr
);
4240 /* Line 1806 of yacc.c */
4243 struct hlsl_ir_node
*operands
[3];
4244 struct source_location loc
;
4246 set_location(&loc
, &(yylsp
[(1) - (2)]));
4247 if ((yyvsp
[(2) - (2)].instr
)->data_type
->modifiers
& HLSL_MODIFIER_CONST
)
4249 hlsl_report_message(loc
.file
, loc
.line
, loc
.col
, HLSL_LEVEL_ERROR
,
4250 "modifying a const expression");
4253 operands
[0] = (yyvsp
[(2) - (2)].instr
);
4254 operands
[1] = operands
[2] = NULL
;
4255 (yyval
.instr
) = &new_expr(HLSL_IR_BINOP_PREINC
, operands
, &loc
)->node
;
4261 /* Line 1806 of yacc.c */
4264 struct hlsl_ir_node
*operands
[3];
4265 struct source_location loc
;
4267 set_location(&loc
, &(yylsp
[(1) - (2)]));
4268 if ((yyvsp
[(2) - (2)].instr
)->data_type
->modifiers
& HLSL_MODIFIER_CONST
)
4270 hlsl_report_message(loc
.file
, loc
.line
, loc
.col
, HLSL_LEVEL_ERROR
,
4271 "modifying a const expression");
4274 operands
[0] = (yyvsp
[(2) - (2)].instr
);
4275 operands
[1] = operands
[2] = NULL
;
4276 (yyval
.instr
) = &new_expr(HLSL_IR_BINOP_PREDEC
, operands
, &loc
)->node
;
4282 /* Line 1806 of yacc.c */
4285 enum hlsl_ir_expr_op ops
[] = {0, HLSL_IR_UNOP_NEG
,
4286 HLSL_IR_UNOP_LOGIC_NOT
, HLSL_IR_UNOP_BIT_NOT
};
4287 struct hlsl_ir_node
*operands
[3];
4288 struct source_location loc
;
4290 if ((yyvsp
[(1) - (2)].unary_op
) == UNARY_OP_PLUS
)
4292 (yyval
.instr
) = (yyvsp
[(2) - (2)].instr
);
4296 operands
[0] = (yyvsp
[(2) - (2)].instr
);
4297 operands
[1] = operands
[2] = NULL
;
4298 set_location(&loc
, &(yylsp
[(1) - (2)]));
4299 (yyval
.instr
) = &new_expr(ops
[(yyvsp
[(1) - (2)].unary_op
)], operands
, &loc
)->node
;
4306 /* Line 1806 of yacc.c */
4309 struct hlsl_ir_expr
*expr
;
4310 struct hlsl_type
*src_type
= (yyvsp
[(6) - (6)].instr
)->data_type
;
4311 struct hlsl_type
*dst_type
;
4312 struct source_location loc
;
4314 set_location(&loc
, &(yylsp
[(3) - (6)]));
4315 if ((yyvsp
[(2) - (6)].modifiers
))
4317 hlsl_report_message(loc
.file
, loc
.line
, loc
.col
, HLSL_LEVEL_ERROR
,
4318 "unexpected modifier in a cast");
4322 if ((yyvsp
[(4) - (6)].intval
))
4323 dst_type
= new_array_type((yyvsp
[(3) - (6)].type
), (yyvsp
[(4) - (6)].intval
));
4325 dst_type
= (yyvsp
[(3) - (6)].type
);
4327 if (!compatible_data_types(src_type
, dst_type
))
4329 hlsl_report_message(loc
.file
, loc
.line
, loc
.col
, HLSL_LEVEL_ERROR
,
4330 "can't cast from %s to %s",
4331 debug_hlsl_type(src_type
), debug_hlsl_type(dst_type
));
4335 expr
= new_cast((yyvsp
[(6) - (6)].instr
), dst_type
, &loc
);
4336 (yyval
.instr
) = expr
? &expr
->node
: NULL
;
4342 /* Line 1806 of yacc.c */
4345 (yyval
.unary_op
) = UNARY_OP_PLUS
;
4351 /* Line 1806 of yacc.c */
4354 (yyval
.unary_op
) = UNARY_OP_MINUS
;
4360 /* Line 1806 of yacc.c */
4363 (yyval
.unary_op
) = UNARY_OP_LOGICNOT
;
4369 /* Line 1806 of yacc.c */
4372 (yyval
.unary_op
) = UNARY_OP_BITNOT
;
4378 /* Line 1806 of yacc.c */
4381 (yyval
.instr
) = (yyvsp
[(1) - (1)].instr
);
4387 /* Line 1806 of yacc.c */
4390 struct source_location loc
;
4392 set_location(&loc
, &(yylsp
[(2) - (3)]));
4393 (yyval
.instr
) = &hlsl_mul((yyvsp
[(1) - (3)].instr
), (yyvsp
[(3) - (3)].instr
), &loc
)->node
;
4399 /* Line 1806 of yacc.c */
4402 struct source_location loc
;
4404 set_location(&loc
, &(yylsp
[(2) - (3)]));
4405 (yyval
.instr
) = &hlsl_div((yyvsp
[(1) - (3)].instr
), (yyvsp
[(3) - (3)].instr
), &loc
)->node
;
4411 /* Line 1806 of yacc.c */
4414 struct source_location loc
;
4416 set_location(&loc
, &(yylsp
[(2) - (3)]));
4417 (yyval
.instr
) = &hlsl_mod((yyvsp
[(1) - (3)].instr
), (yyvsp
[(3) - (3)].instr
), &loc
)->node
;
4423 /* Line 1806 of yacc.c */
4426 (yyval
.instr
) = (yyvsp
[(1) - (1)].instr
);
4432 /* Line 1806 of yacc.c */
4435 struct source_location loc
;
4437 set_location(&loc
, &(yylsp
[(2) - (3)]));
4438 (yyval
.instr
) = &hlsl_add((yyvsp
[(1) - (3)].instr
), (yyvsp
[(3) - (3)].instr
), &loc
)->node
;
4444 /* Line 1806 of yacc.c */
4447 struct source_location loc
;
4449 set_location(&loc
, &(yylsp
[(2) - (3)]));
4450 (yyval
.instr
) = &hlsl_sub((yyvsp
[(1) - (3)].instr
), (yyvsp
[(3) - (3)].instr
), &loc
)->node
;
4456 /* Line 1806 of yacc.c */
4459 (yyval
.instr
) = (yyvsp
[(1) - (1)].instr
);
4465 /* Line 1806 of yacc.c */
4468 FIXME("Left shift\n");
4474 /* Line 1806 of yacc.c */
4477 FIXME("Right shift\n");
4483 /* Line 1806 of yacc.c */
4486 (yyval
.instr
) = (yyvsp
[(1) - (1)].instr
);
4492 /* Line 1806 of yacc.c */
4495 struct source_location loc
;
4497 set_location(&loc
, &(yylsp
[(2) - (3)]));
4498 (yyval
.instr
) = &hlsl_lt((yyvsp
[(1) - (3)].instr
), (yyvsp
[(3) - (3)].instr
), &loc
)->node
;
4504 /* Line 1806 of yacc.c */
4507 struct source_location loc
;
4509 set_location(&loc
, &(yylsp
[(2) - (3)]));
4510 (yyval
.instr
) = &hlsl_gt((yyvsp
[(1) - (3)].instr
), (yyvsp
[(3) - (3)].instr
), &loc
)->node
;
4516 /* Line 1806 of yacc.c */
4519 struct source_location loc
;
4521 set_location(&loc
, &(yylsp
[(2) - (3)]));
4522 (yyval
.instr
) = &hlsl_le((yyvsp
[(1) - (3)].instr
), (yyvsp
[(3) - (3)].instr
), &loc
)->node
;
4528 /* Line 1806 of yacc.c */
4531 struct source_location loc
;
4533 set_location(&loc
, &(yylsp
[(2) - (3)]));
4534 (yyval
.instr
) = &hlsl_ge((yyvsp
[(1) - (3)].instr
), (yyvsp
[(3) - (3)].instr
), &loc
)->node
;
4540 /* Line 1806 of yacc.c */
4543 (yyval
.instr
) = (yyvsp
[(1) - (1)].instr
);
4549 /* Line 1806 of yacc.c */
4552 struct source_location loc
;
4554 set_location(&loc
, &(yylsp
[(2) - (3)]));
4555 (yyval
.instr
) = &hlsl_eq((yyvsp
[(1) - (3)].instr
), (yyvsp
[(3) - (3)].instr
), &loc
)->node
;
4561 /* Line 1806 of yacc.c */
4564 struct source_location loc
;
4566 set_location(&loc
, &(yylsp
[(2) - (3)]));
4567 (yyval
.instr
) = &hlsl_ne((yyvsp
[(1) - (3)].instr
), (yyvsp
[(3) - (3)].instr
), &loc
)->node
;
4573 /* Line 1806 of yacc.c */
4576 (yyval
.instr
) = (yyvsp
[(1) - (1)].instr
);
4582 /* Line 1806 of yacc.c */
4585 FIXME("bitwise AND\n");
4591 /* Line 1806 of yacc.c */
4594 (yyval
.instr
) = (yyvsp
[(1) - (1)].instr
);
4600 /* Line 1806 of yacc.c */
4603 FIXME("bitwise XOR\n");
4609 /* Line 1806 of yacc.c */
4612 (yyval
.instr
) = (yyvsp
[(1) - (1)].instr
);
4618 /* Line 1806 of yacc.c */
4621 FIXME("bitwise OR\n");
4627 /* Line 1806 of yacc.c */
4630 (yyval
.instr
) = (yyvsp
[(1) - (1)].instr
);
4636 /* Line 1806 of yacc.c */
4639 FIXME("logic AND\n");
4645 /* Line 1806 of yacc.c */
4648 (yyval
.instr
) = (yyvsp
[(1) - (1)].instr
);
4654 /* Line 1806 of yacc.c */
4657 FIXME("logic OR\n");
4663 /* Line 1806 of yacc.c */
4666 (yyval
.instr
) = (yyvsp
[(1) - (1)].instr
);
4672 /* Line 1806 of yacc.c */
4675 FIXME("ternary operator\n");
4681 /* Line 1806 of yacc.c */
4684 (yyval
.instr
) = (yyvsp
[(1) - (1)].instr
);
4690 /* Line 1806 of yacc.c */
4693 struct source_location loc
;
4695 set_location(&loc
, &(yylsp
[(2) - (3)]));
4696 if ((yyvsp
[(1) - (3)].instr
)->data_type
->modifiers
& HLSL_MODIFIER_CONST
)
4698 hlsl_report_message(loc
.file
, loc
.line
, loc
.col
, HLSL_LEVEL_ERROR
,
4699 "l-value is const");
4702 (yyval
.instr
) = make_assignment((yyvsp
[(1) - (3)].instr
), (yyvsp
[(2) - (3)].assign_op
), BWRITERSP_WRITEMASK_ALL
, (yyvsp
[(3) - (3)].instr
));
4705 (yyval
.instr
)->loc
= loc
;
4711 /* Line 1806 of yacc.c */
4714 (yyval
.assign_op
) = ASSIGN_OP_ASSIGN
;
4720 /* Line 1806 of yacc.c */
4723 (yyval
.assign_op
) = ASSIGN_OP_ADD
;
4729 /* Line 1806 of yacc.c */
4732 (yyval
.assign_op
) = ASSIGN_OP_SUB
;
4738 /* Line 1806 of yacc.c */
4741 (yyval
.assign_op
) = ASSIGN_OP_MUL
;
4747 /* Line 1806 of yacc.c */
4750 (yyval
.assign_op
) = ASSIGN_OP_DIV
;
4756 /* Line 1806 of yacc.c */
4759 (yyval
.assign_op
) = ASSIGN_OP_MOD
;
4765 /* Line 1806 of yacc.c */
4768 (yyval
.assign_op
) = ASSIGN_OP_LSHIFT
;
4774 /* Line 1806 of yacc.c */
4777 (yyval
.assign_op
) = ASSIGN_OP_RSHIFT
;
4783 /* Line 1806 of yacc.c */
4786 (yyval
.assign_op
) = ASSIGN_OP_AND
;
4792 /* Line 1806 of yacc.c */
4795 (yyval
.assign_op
) = ASSIGN_OP_OR
;
4801 /* Line 1806 of yacc.c */
4804 (yyval
.assign_op
) = ASSIGN_OP_XOR
;
4810 /* Line 1806 of yacc.c */
4813 (yyval
.instr
) = (yyvsp
[(1) - (1)].instr
);
4819 /* Line 1806 of yacc.c */
4822 FIXME("Comma expression\n");
4828 /* Line 1806 of yacc.c */
4829 #line 4835 "hlsl.tab.c"
4832 /* User semantic actions sometimes alter yychar, and that requires
4833 that yytoken be updated with the new translation. We take the
4834 approach of translating immediately before every use of yytoken.
4835 One alternative is translating here after every semantic action,
4836 but that translation would be missed if the semantic action invokes
4837 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
4838 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
4839 incorrect destructor might then be invoked immediately. In the
4840 case of YYERROR or YYBACKUP, subsequent parser actions might lead
4841 to an incorrect destructor call or verbose syntax error message
4842 before the lookahead is translated. */
4843 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
4847 YY_STACK_PRINT (yyss
, yyssp
);
4852 /* Now `shift' the result of the reduction. Determine what state
4853 that goes to, based on the state we popped back to and the rule
4854 number reduced by. */
4858 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
4859 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
4860 yystate
= yytable
[yystate
];
4862 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
4867 /*------------------------------------.
4868 | yyerrlab -- here on detecting error |
4869 `------------------------------------*/
4871 /* Make sure we have latest lookahead translation. See comments at
4872 user semantic actions for why this is necessary. */
4873 yytoken
= yychar
== YYEMPTY
? YYEMPTY
: YYTRANSLATE (yychar
);
4875 /* If not already recovering from an error, report this error. */
4879 #if ! YYERROR_VERBOSE
4880 yyerror (YY_("syntax error"));
4882 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
4885 char const *yymsgp
= YY_("syntax error");
4886 int yysyntax_error_status
;
4887 yysyntax_error_status
= YYSYNTAX_ERROR
;
4888 if (yysyntax_error_status
== 0)
4890 else if (yysyntax_error_status
== 1)
4892 if (yymsg
!= yymsgbuf
)
4893 YYSTACK_FREE (yymsg
);
4894 yymsg
= (char *) YYSTACK_ALLOC (yymsg_alloc
);
4898 yymsg_alloc
= sizeof yymsgbuf
;
4899 yysyntax_error_status
= 2;
4903 yysyntax_error_status
= YYSYNTAX_ERROR
;
4908 if (yysyntax_error_status
== 2)
4909 goto yyexhaustedlab
;
4911 # undef YYSYNTAX_ERROR
4915 yyerror_range
[1] = yylloc
;
4917 if (yyerrstatus
== 3)
4919 /* If just tried and failed to reuse lookahead token after an
4920 error, discard it. */
4922 if (yychar
<= YYEOF
)
4924 /* Return failure if at end of input. */
4925 if (yychar
== YYEOF
)
4930 yydestruct ("Error: discarding",
4931 yytoken
, &yylval
, &yylloc
);
4936 /* Else will try to reuse lookahead token after shifting the error
4941 /*---------------------------------------------------.
4942 | yyerrorlab -- error raised explicitly by YYERROR. |
4943 `---------------------------------------------------*/
4946 /* Pacify compilers like GCC when the user code never invokes
4947 YYERROR and the label yyerrorlab therefore never appears in user
4949 if (/*CONSTCOND*/ 0)
4952 yyerror_range
[1] = yylsp
[1-yylen
];
4953 /* Do not reclaim the symbols of the rule which action triggered
4957 YY_STACK_PRINT (yyss
, yyssp
);
4962 /*-------------------------------------------------------------.
4963 | yyerrlab1 -- common code for both syntax error and YYERROR. |
4964 `-------------------------------------------------------------*/
4966 yyerrstatus
= 3; /* Each real token shifted decrements this. */
4970 yyn
= yypact
[yystate
];
4971 if (!yypact_value_is_default (yyn
))
4974 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
4982 /* Pop the current state because it cannot handle the error token. */
4986 yyerror_range
[1] = *yylsp
;
4987 yydestruct ("Error: popping",
4988 yystos
[yystate
], yyvsp
, yylsp
);
4991 YY_STACK_PRINT (yyss
, yyssp
);
4996 yyerror_range
[2] = yylloc
;
4997 /* Using YYLLOC is tempting, but would change the location of
4998 the lookahead. YYLOC is available though. */
4999 YYLLOC_DEFAULT (yyloc
, yyerror_range
, 2);
5002 /* Shift the error token. */
5003 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
5009 /*-------------------------------------.
5010 | yyacceptlab -- YYACCEPT comes here. |
5011 `-------------------------------------*/
5016 /*-----------------------------------.
5017 | yyabortlab -- YYABORT comes here. |
5018 `-----------------------------------*/
5023 #if !defined(yyoverflow) || YYERROR_VERBOSE
5024 /*-------------------------------------------------.
5025 | yyexhaustedlab -- memory exhaustion comes here. |
5026 `-------------------------------------------------*/
5028 yyerror (YY_("memory exhausted"));
5034 if (yychar
!= YYEMPTY
)
5036 /* Make sure we have latest lookahead translation. See comments at
5037 user semantic actions for why this is necessary. */
5038 yytoken
= YYTRANSLATE (yychar
);
5039 yydestruct ("Cleanup: discarding lookahead",
5040 yytoken
, &yylval
, &yylloc
);
5042 /* Do not reclaim the symbols of the rule which action triggered
5043 this YYABORT or YYACCEPT. */
5045 YY_STACK_PRINT (yyss
, yyssp
);
5046 while (yyssp
!= yyss
)
5048 yydestruct ("Cleanup: popping",
5049 yystos
[*yyssp
], yyvsp
, yylsp
);
5054 YYSTACK_FREE (yyss
);
5057 if (yymsg
!= yymsgbuf
)
5058 YYSTACK_FREE (yymsg
);
5060 /* Make sure YYID is used. */
5061 return YYID (yyresult
);
5066 /* Line 2067 of yacc.c */
5070 static void set_location(struct source_location
*loc
, const struct YYLTYPE
*l
)
5072 loc
->file
= hlsl_ctx
.source_file
;
5073 loc
->line
= l
->first_line
;
5074 loc
->col
= l
->first_column
;
5077 static DWORD
add_modifier(DWORD modifiers
, DWORD mod
, const struct YYLTYPE
*loc
)
5079 if (modifiers
& mod
)
5081 hlsl_report_message(hlsl_ctx
.source_file
, loc
->first_line
, loc
->first_column
, HLSL_LEVEL_ERROR
,
5082 "modifier '%s' already specified", debug_modifiers(mod
));
5085 if (mod
& (HLSL_MODIFIER_ROW_MAJOR
| HLSL_MODIFIER_COLUMN_MAJOR
)
5086 && modifiers
& (HLSL_MODIFIER_ROW_MAJOR
| HLSL_MODIFIER_COLUMN_MAJOR
))
5088 hlsl_report_message(hlsl_ctx
.source_file
, loc
->first_line
, loc
->first_column
, HLSL_LEVEL_ERROR
,
5089 "more than one matrix majority keyword");
5092 return modifiers
| mod
;
5095 static void dump_function_decl(struct wine_rb_entry
*entry
, void *context
)
5097 struct hlsl_ir_function_decl
*func
= WINE_RB_ENTRY_VALUE(entry
, struct hlsl_ir_function_decl
, entry
);
5099 debug_dump_ir_function_decl(func
);
5102 static void dump_function(struct wine_rb_entry
*entry
, void *context
)
5104 struct hlsl_ir_function
*func
= WINE_RB_ENTRY_VALUE(entry
, struct hlsl_ir_function
, entry
);
5105 wine_rb_for_each_entry(&func
->overloads
, dump_function_decl
, NULL
);
5108 struct bwriter_shader
*parse_hlsl(enum shader_type type
, DWORD major
, DWORD minor
,
5109 const char *entrypoint
, char **messages
)
5111 struct hlsl_scope
*scope
, *next_scope
;
5112 struct hlsl_type
*hlsl_type
, *next_type
;
5113 struct hlsl_ir_var
*var
, *next_var
;
5116 hlsl_ctx
.status
= PARSE_SUCCESS
;
5117 hlsl_ctx
.messages
.size
= hlsl_ctx
.messages
.capacity
= 0;
5118 hlsl_ctx
.line_no
= hlsl_ctx
.column
= 1;
5119 hlsl_ctx
.source_file
= d3dcompiler_strdup("");
5120 hlsl_ctx
.source_files
= d3dcompiler_alloc(sizeof(*hlsl_ctx
.source_files
));
5121 if (hlsl_ctx
.source_files
)
5122 hlsl_ctx
.source_files
[0] = hlsl_ctx
.source_file
;
5123 hlsl_ctx
.source_files_count
= 1;
5124 hlsl_ctx
.cur_scope
= NULL
;
5125 hlsl_ctx
.matrix_majority
= HLSL_COLUMN_MAJOR
;
5126 list_init(&hlsl_ctx
.scopes
);
5127 list_init(&hlsl_ctx
.types
);
5128 init_functions_tree(&hlsl_ctx
.functions
);
5130 push_scope(&hlsl_ctx
);
5131 hlsl_ctx
.globals
= hlsl_ctx
.cur_scope
;
5132 declare_predefined_types(hlsl_ctx
.globals
);
5136 if (TRACE_ON(hlsl_parser
))
5138 TRACE("IR dump.\n");
5139 wine_rb_for_each_entry(&hlsl_ctx
.functions
, dump_function
, NULL
);
5142 TRACE("Compilation status = %d\n", hlsl_ctx
.status
);
5145 if (hlsl_ctx
.messages
.size
)
5146 *messages
= hlsl_ctx
.messages
.string
;
5152 if (hlsl_ctx
.messages
.capacity
)
5153 d3dcompiler_free(hlsl_ctx
.messages
.string
);
5156 for (i
= 0; i
< hlsl_ctx
.source_files_count
; ++i
)
5157 d3dcompiler_free((void *)hlsl_ctx
.source_files
[i
]);
5158 d3dcompiler_free(hlsl_ctx
.source_files
);
5160 TRACE("Freeing functions IR.\n");
5161 wine_rb_destroy(&hlsl_ctx
.functions
, free_function_rb
, NULL
);
5163 TRACE("Freeing variables.\n");
5164 LIST_FOR_EACH_ENTRY_SAFE(scope
, next_scope
, &hlsl_ctx
.scopes
, struct hlsl_scope
, entry
)
5166 LIST_FOR_EACH_ENTRY_SAFE(var
, next_var
, &scope
->vars
, struct hlsl_ir_var
, scope_entry
)
5168 free_declaration(var
);
5170 wine_rb_destroy(&scope
->types
, NULL
, NULL
);
5171 d3dcompiler_free(scope
);
5174 TRACE("Freeing types.\n");
5175 LIST_FOR_EACH_ENTRY_SAFE(hlsl_type
, next_type
, &hlsl_ctx
.types
, struct hlsl_type
, entry
)
5177 free_hlsl_type(hlsl_type
);