+
+ cur = ctx->cur;
+ eat_opt_white( &cur );
+ if (*cur == ',') {
+ cur++;
+ eat_opt_white( &cur );
+
+ for (i = 0; i < TGSI_SEMANTIC_COUNT; i++) {
+ if (str_match_nocase_whole(&cur, tgsi_semantic_names[i])) {
+ uint index;
+
+ cur2 = cur;
+ eat_opt_white( &cur2 );
+ if (*cur2 == '[') {
+ cur2++;
+ eat_opt_white( &cur2 );
+ if (!parse_uint( &cur2, &index )) {
+ report_error( ctx, "Expected literal integer" );
+ return FALSE;
+ }
+ eat_opt_white( &cur2 );
+ if (*cur2 != ']') {
+ report_error( ctx, "Expected `]'" );
+ return FALSE;
+ }
+ cur2++;
+
+ decl.Semantic.Index = index;
+
+ cur = cur2;
+ }
+
+ decl.Declaration.Semantic = 1;
+ decl.Semantic.Name = i;
+
+ ctx->cur = cur;
+ break;
+ }
+ }
+ }
+ }
+ } else if (is_imm_array) {
+ unsigned i;
+ union tgsi_immediate_data *vals_itr;
+ /* we have our immediate data */
+ if (*cur != '{') {
+ report_error( ctx, "Immediate array without data" );
+ return FALSE;
+ }
+ ++cur;
+ ctx->cur = cur;
+
+ decl.ImmediateData.u =
+ MALLOC(sizeof(union tgsi_immediate_data) * 4 *
+ (decl.Range.Last + 1));
+ vals_itr = decl.ImmediateData.u;
+ for (i = 0; i <= decl.Range.Last; ++i) {
+ if (!parse_immediate_data(ctx, TGSI_IMM_FLOAT32, vals_itr)) {
+ FREE(decl.ImmediateData.u);
+ return FALSE;
+ }
+ vals_itr += 4;
+ eat_opt_white( &ctx->cur );
+ if (*ctx->cur != ',') {
+ if (i != decl.Range.Last) {
+ report_error( ctx, "Not enough data in immediate array!" );
+ FREE(decl.ImmediateData.u);
+ return FALSE;
+ }
+ } else
+ ++ctx->cur;