Home | History | Annotate | Download | only in compiler

Lines Matching full:context

29 #define YYLEX_PARAM context->scanner
34 %parse-param {TParseContext* context}
70 extern void yyerror(TParseContext* context, const char* reason);
73 if (context->shaderType != SH_FRAGMENT_SHADER && \
74 context->shaderType != SH_VERTEX_SHADER) { \
75 context->error(L, " supported in vertex/fragment shaders only ", S, "", ""); \
76 context->recover(); \
81 if (context->shaderType != SH_VERTEX_SHADER) { \
82 context->error(L, " supported in vertex shaders only ", S, "", ""); \
83 context->recover(); \
88 if (context->shaderType != SH_FRAGMENT_SHADER) { \
89 context->error(L, " supported in fragment shaders only ", S, "", ""); \
90 context->recover(); \
158 context->error($1.line, "undeclared identifier", $1.string->c_str(), "");
159 context->recover();
162 context->symbolTable.insert(*fakeVariable);
167 context->error($1.line, "variable expected", $1.string->c_str(), "");
168 context->recover();
179 $$ = context->intermediate.addConstantUnion(constArray, t, $1.line);
181 $$ = context->intermediate.addSymbol(variable->getUniqueId(),
197 context->error($1.line, " integer constant overflow", "", "");
198 context->recover();
202 $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), $1.line);
207 $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), $1.line);
212 $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $1.line);
226 context->error($2.line, " left of '[' is not of type array, matrix, or vector ", $1->getAsSymbolNode()->getSymbol().c_str(), "");
228 context->error($2.line, " left of '[' is not of type array, matrix, or vector ", "expression", "");
229 context->recover();
233 $$ = context->addConstArrayNode($3->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), $1, $2.line);
238 $$ = context->addConstVectorNode(fields, $1, $2.line);
240 $$ = context->addConstMatrixNode($3->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), $1, $2.line);
245 context->error($2.line, "", "[", "field selection out of range '%d'", $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
246 context->recover();
251 if (context->arraySetMaxSize($1->getAsSymbolNode(), $1->getTypePointer(), $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), true, $2.line))
252 context->recover();
254 if (context->arraySetMaxSize($1->getAsSymbolNode(), $1->getTypePointer(), 0, false, $2.line))
255 context->recover();
258 context->error($2.line, "", "[", "array index out of range '%d'", $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
259 context->recover();
262 $$ = context->intermediate.addIndex(EOpIndexDirect, $1, $3, $2.line);
266 context->error($2.line, "", "[", "array must be redeclared with a size before being indexed with a variable");
267 context->recover();
270 $$ = context->intermediate.addIndex(EOpIndexIndirect, $1, $3, $2.line);
276 $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), $2.line);
301 context->error($3.line, "cannot apply dot operator to an array", ".", "");
302 context->recover();
307 if (! context->parseVectorFields(*$3.string, $1->getNominalSize(), fields, $3.line)) {
310 context->recover();
314 $$ = context->addConstVectorNode(fields, $1, $3.line);
316 context->recover();
325 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), $3.line);
326 $$ = context->intermediate.addIndex(EOpIndexDirect, $1, index, $2.line);
330 TIntermTyped* index = context->intermediate.addSwizzle(fields, $3.line);
331 $$ = context->intermediate.addIndex(EOpVectorSwizzle, $1, index, $2.line);
337 if (! context->parseMatrixFields(*$3.string, $1->getNominalSize(), fields, $3.line)) {
342 context->recover();
346 context->error($2.line, " non-scalar fields not implemented yet", ".", "");
347 context->recover();
350 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), $3.line);
351 $$ = context->intermediate.addIndex(EOpIndexDirect, $1, index, $2.line);
356 TIntermTyped* index = context
357 $$ = context->intermediate.addIndex(EOpIndexDirect, $1, index, $2.line);
364 context->error($2.line, "structure has no fields", "Internal Error", "");
365 context->recover();
377 $$ = context->addConstStruct(*$3.string, $1, $2.line);
379 context->recover();
391 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, $3.line);
392 $$ = context->intermediate.addIndex(EOpIndexDirectStruct, $1, index, $2.line);
396 context->error($2.line, " no such field in structure", $3.string->c_str(), "");
397 context->recover();
402 context->error($2.line, " field selection requires structure, vector, or matrix on left hand side", $3.string->c_str(), "");
403 context->recover();
409 if (context->lValueErrorCheck($2.line, "++", $1))
410 context->recover();
411 $$ = context->intermediate.addUnaryMath(EOpPostIncrement, $1, $2.line, context->symbolTable);
413 context->unaryOpError($2.line, "++", $1->getCompleteString());
414 context->recover();
419 if (context->lValueErrorCheck($2.line, "--", $1))
420 context->recover();
421 $$ = context->intermediate.addUnaryMath(EOpPostDecrement, $1, $2.line, context->symbolTable);
423 context->unaryOpError($2.line, "--", $1->getCompleteString());
424 context->recover();
432 if (context->integerErrorCheck($1, "[]"))
433 context->recover();
451 if (context->constructorErrorCheck($1.line, $1.intermNode, *fnCall, op, &type)) {
457 $$ = context->addConstructor($1.intermNode, &type, op, fnCall, $1.line);
461 context->recover();
462 $$ = context->intermediate.setAggregateOperator(0, op, $1.line);
471 fnCandidate = context->findFunction($1.line, fnCall, &builtIn);
477 context->extensionErrorCheck($1.line, fnCandidate->getExtension())) {
478 context->recover();
489 $$ = context->intermediate.addUnaryMath(op, $1.intermNode, 0, context->symbolTable);
491 context->error($1.intermNode->getLine(), " wrong operand type", "Internal Error",
497 $$ = context->intermediate.setAggregateOperator($1.intermAggregate, op, $1.line);
502 $$ = context->intermediate.setAggregateOperator($1.intermAggregate, EOpFunctionCall, $1.line);
516 if (context->lValueErrorCheck($$->getLine(), "assign", $$->getAsAggregate()->getSequence()[i]->getAsTyped())) {
517 context->error($1.intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");
518 context->recover();
529 $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), $1.line);
530 context->recover();
542 context->error($3.line, "methods are not supported", "", "");
543 context->recover();
581 $$.intermNode = context->intermediate.growAggregate($1.intermNode, $3, $2.line);
600 context->error($1.line, "cannot construct this type", "array", "");
601 context->recover();
645 context->error($1.line, "cannot construct this type", getBasicString($1.type), "");
646 context->recover();
657 if (context->reservedErrorCheck($1.line, *$1.string))
658 context->recover();
664 if (context->reservedErrorCheck($1.line, *$1.string))
665 context->recover();
677 if (context->lValueErrorCheck($1.line, "++", $2))
678 context->recover();
679 $$ = context->intermediate.addUnaryMath(EOpPreIncrement, $2, $1.line, context->symbolTable);
681 context->unaryOpError($1.line, "++", $2->getCompleteString());
682 context->recover();
687 if (context->lValueErrorCheck($1.line, "--", $2))
688 context->recover();
689 $$ = context->intermediate.addUnaryMath(EOpPreDecrement, $2, $1.line, context->symbolTable);
691 context->unaryOpError($1.line, "--", $2->getCompleteString());
692 context->recover();
698 $$ = context->intermediate.addUnaryMath($1.op, $2, $1.line, context->symbolTable);
706 context->unaryOpError($1.line, errorOp, $2->getCompleteString());
707 context->recover();
727 $$ = context->intermediate.addBinaryMath(EOpMul, $1, $3, $2.line, context->symbolTable);
729 context->binaryOpError($2.line, "*", $1->getCompleteString(), $3->getCompleteString());
730 context->recover();
736 $$ = context->intermediate.addBinaryMath(EOpDiv, $1, $3, $2.line, context->symbolTable);
738 context->binaryOpError($2.line, "/", $1->getCompleteString(), $3->getCompleteString());
739 context->recover();
748 $$ = context->intermediate.addBinaryMath(EOpAdd, $1, $3, $2.line, context->symbolTable);
750 context->binaryOpError($2.line, "+", $1->getCompleteString(), $3->getCompleteString());
751 context->recover();
756 $$ = context->intermediate.addBinaryMath(EOpSub, $1, $3, $2.line, context->symbolTable);
758 context->binaryOpError($2.line, "-", $1->getCompleteString(), $3->getCompleteString());
759 context->recover();
772 $$ = context->intermediate.addBinaryMath(EOpLessThan, $1, $3, $2.line, context->symbolTable);
774 context->binaryOpError($2.line, "<", $1->getCompleteString(), $3->getCompleteString());
775 context->recover();
778 $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
782 $$ = context->intermediate.addBinaryMath(EOpGreaterThan, $1, $3, $2.line, context->symbolTable);
784 context->binaryOpError($2.line, ">", $1->getCompleteString(), $3->getCompleteString());
785 context->recover();
788 $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
792 $$ = context->intermediate.addBinaryMath(EOpLessThanEqual, $1, $3, $2.line, context->symbolTable);
794 context->binaryOpError($2.line, "<=", $1->getCompleteString(), $3->getCompleteString());
795 context->recover();
798 $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
802 $$ = context->intermediate.addBinaryMath(EOpGreaterThanEqual, $1, $3, $2.line, context->symbolTable);
804 context->binaryOpError($2.line, ">=", $1->getCompleteString(), $3->getCompleteString());
805 context->recover();
808 $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
816 $$ = context->intermediate.addBinaryMath(EOpEqual, $1, $3, $2.line, context->symbolTable);
818 context->binaryOpError($2.line, "==", $1->getCompleteString(), $3->getCompleteString());
819 context->recover();
822 $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
826 $$ = context->intermediate.addBinaryMath(EOpNotEqual, $1, $3, $2.line, context->symbolTable);
828 context->binaryOpError($2.line, "!=", $1->getCompleteString(), $3->getCompleteString());
829 context->recover();
832 $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
852 $$ = context->intermediate.addBinaryMath(EOpLogicalAnd, $1, $3, $2.line, context->symbolTable);
854 context->binaryOpError($2.line, "&&", $1->getCompleteString(), $3->getCompleteString());
855 context->recover();
858 $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
866 $$ = context->intermediate.addBinaryMath(EOpLogicalXor, $1, $3, $2.line, context->symbolTable);
868 context->binaryOpError($2.line, "^^", $1->getCompleteString(), $3->getCompleteString());
869 context->recover();
872 $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
880 $$ = context->intermediate.addBinaryMath(EOpLogicalOr, $1, $3, $2.line, context->symbolTable);
882 context->binaryOpError($2.line, "||", $1->getCompleteString(), $3->getCompleteString());
883 context->recover();
886 $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
894 if (context->boolErrorCheck($2.line, $1))
895 context->recover();
897 $$ = context->intermediate.addSelection($1, $3, $5, $2.line);
902 context->binaryOpError($2.line, ":", $3->getCompleteString(), $5->getCompleteString());
903 context->recover();
912 if (context->lValueErrorCheck($2.line, "assign", $1))
913 context->recover();
914 $$ = context->intermediate.addAssign($2.op, $1, $3, $2.line);
916 context->assignError($2.line, "assign", $1->getCompleteString(), $3->getCompleteString());
917 context->recover();
936 $$ = context->intermediate.addComma($1, $3, $2.line);
938 context->binaryOpError($2.line, ",", $1->getCompleteString(), $3->getCompleteString());
939 context->recover();
947 if (context->constErrorCheck($1))
948 context->recover();
968 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), $1.line), $1.line);
972 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, $1.line), $1.line);
985 context->symbolTable.setDefaultPrecision( $3.type, $2 );
1000 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find($1->getMangledName()));
1003 context->error($2.line, "overloaded functions must have the same return type", $1->getReturnType().getBasicString(), "");
1004 context->recover();
1008 context->error($2.line, "overloaded functions must have the same parameter qualifiers", $1->getParam(i).type->getQualifierString(), "");
1009 context->recover();
1022 context->symbolTable.insert(*$$.function);
1054 context->error($2.line, "cannot be an argument type except for '(void)'", "void", "");
1055 context->recover();
1068 context->error($2.line, "no qualifiers allowed for function return", getQualifierString($1.qualifier), "");
1069 context->recover();
1072 if (context->structQualifierErrorCheck($2.line, $1))
1073 context->recover();
1087 context->error($2.line, "illegal use of type 'void'", $2.string->c_str(), "");
1088 context->recover();
1090 if (context->reservedErrorCheck($2.line, *$2.string))
1091 context->recover();
1098 if (context->arrayTypeErrorCheck($3.line, $1))
1099 context->recover();
1101 if (context->reservedErrorCheck($2.line, *$2.string))
1102 context->recover();
1105 if (context->arraySizeErrorCheck($3.line, $4, size))
1106 context->recover();
1127 if (context->paramErrorCheck($3.line, $1.qualifier, $2, $$.param.type))
1128 context->recover();
1132 if (context->parameterSamplerErrorCheck($2.line, $1, *$2.param.type))
1133 context->recover();
1134 if (context->paramErrorCheck($2.line, EvqTemporary, $1, $$.param.type))
1135 context->recover();
1142 if (context->paramErrorCheck($3.line, $1.qualifier, $2, $$.param.type))
1143 context->recover();
1147 if (context->parameterSamplerErrorCheck($2.line, $1, *$2.param.type))
1148 context->recover();
1149 if (context->paramErrorCheck($2.line, EvqTemporary, $1, $$.param.type))
1150 context->recover();
1181 $$.type.precision = context->symbolTable.getDefaultPrecision($1.type.type);
1182 if (context->precisionErrorCheck($1.line, $$.type.precision, $1.type.type)) {
1183 context->recover();
1188 $$.intermAggregate = context->intermediate.growAggregate($1.intermNode, context->intermediate.addSymbol(0, *$3.string, TType($1.type), $3.line), $3.line);
1190 if (context->structQualifierErrorCheck($3.line, $$.type))
1191 context->recover();
1193 if (context->nonInitConstErrorCheck($3.line, *$3.string, $$.type))
1194 context->recover();
1196 if (context->nonInitErrorCheck($3.line, *$3.string, $$.type))
1197 context->recover();
1200 if (context->structQualifierErrorCheck($3.line, $1.type))
1201 context->recover();
1203 if (context->nonInitConstErrorCheck($3.line, *$3.string, $1.type))
1204 context->recover();
1208 if (context->arrayTypeErrorCheck($4.line, $1.type) || context->arrayQualifierErrorCheck($4.line, $1.type))
1209 context
1213 if (context->arrayErrorCheck($4.line, *$3.string, $1.type, variable))
1214 context->recover();
1218 if (context->structQualifierErrorCheck($3.line, $1.type))
1219 context->recover();
1221 if (context->nonInitConstErrorCheck($3.line, *$3.string, $1.type))
1222 context->recover();
1226 if (context->arrayTypeErrorCheck($4.line, $1.type) || context->arrayQualifierErrorCheck($4.line, $1.type))
1227 context->recover();
1230 if (context->arraySizeErrorCheck($4.line, $5, size))
1231 context->recover();
1234 if (context->arrayErrorCheck($4.line, *$3.string, $1.type, variable))
1235 context->recover();
1238 $$.intermAggregate = context->intermediate.growAggregate($1.intermNode, context->intermediate.addSymbol(0, *$3.string, type, $3.line), $3.line);
1242 if (context->structQualifierErrorCheck($3.line, $1.type))
1243 context->recover();
1248 if (!context->executeInitializer($3.line, *$3.string, $1.type, $5, intermNode)) {
1253 $$.intermAggregate = context->intermediate.growAggregate($1.intermNode, intermNode, $4.line);
1257 context->recover();
1266 $$.intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, "", TType($1), $1.line), $1.line);
1269 $$.intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, *$2.string, TType($1), $2.line), $2.line);
1271 if (context->structQualifierErrorCheck($2.line, $$.type))
1272 context->recover();
1274 if (context->nonInitConstErrorCheck($2.line, *$2.string, $$.type))
1275 context->recover();
1279 if (context->nonInitErrorCheck($2.line, *$2.string, $$.type))
1280 context->recover();
1283 $$.intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, *$2.string, TType($1), $2.line), $2.line);
1285 if (context->structQualifierErrorCheck($2.line, $1))
1286 context->recover();
1288 if (context->nonInitConstErrorCheck($2.line, *$2.string, $1))
1289 context->recover();
1293 if (context->arrayTypeErrorCheck($3.line, $1) || context->arrayQualifierErrorCheck($3.line, $1))
1294 context->recover();
1298 if (context->arrayErrorCheck($3.line, *$2.string, $1, variable))
1299 context->recover();
1305 if (context->arraySizeErrorCheck($2.line, $4, size))
1306 context->recover();
1308 $$.intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, *$2.string, type, $2.line), $2.line);
1310 if (context->structQualifierErrorCheck($2.line, $1))
1311 context->recover();
1313 if (context->nonInitConstErrorCheck($2.line, *$2.string, $1))
1314 context->recover();
1318 if (context->arrayTypeErrorCheck($3.line, $1) || context->arrayQualifierErrorCheck($3.line, $1))
1319 context->recover();
1322 if (context->arraySizeErrorCheck($3.line, $4, size))
1323 context->recover();
1327 if (context->arrayErrorCheck($3.line, *$2.string, $1, variable))
1328 context->recover();
1332 if (context->structQualifierErrorCheck($2.line, $1))
1333 context->recover();
1338 if (!context->executeInitializer($2.line, *$2.string, $1, $4, intermNode)) {
1343 $$.intermAggregate = context->intermediate.makeAggregate(intermNode, $3.line);
1347 context->recover();
1379 // if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "input"))
1380 // context->recover();
1385 // if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "output"))
1386 // context->recover();
1415 // if (context->reservedErrorCheck($2.line, *$2.string, context))
1416 // context->recover();
1418 // if (! context->symbolTable.insert(*$$.variable)) {
1419 // context->error($2.line, "redefinition", $$.variable->getName().c_str(), "");
1420 // context->recover();
1431 context->error($1.line, "not supported", "first-class array", "");
1432 context->recover();
1438 context->error($2.line, "not supported", "first-class array", "");
1439 context->recover();
1445 context->error($2.line, "cannot be bool or int", getQualifierString($1.qualifier), "");
1446 context->recover();
1450 context->error($2.line, "cannot be bool or int", getQualifierString($1.qualifier), "");
1451 context->recover();
1464 if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "attribute"))
1465 context->recover();
1469 if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "varying"))
1470 context->recover();
1471 if (context->shaderType == SH_VERTEX_SHADER)
1477 if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "invariant varying"))
1478 context->recover();
1479 if (context->shaderType == SH_VERTEX_SHADER)
1485 if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "uniform"))
1486 context->recover();
1520 if (context->arrayTypeErrorCheck($2.line, $1))
1521 context->recover();
1524 if (context->arraySizeErrorCheck($2.line, $3, size))
1525 context->recover();
1533 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1537 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1541 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1545 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1550 // TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1554 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1559 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1564 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1569 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1574 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1579 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1584 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1589 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1594 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1600 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1606 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1612 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1618 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1623 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1629 $$.qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1637 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
1645 if (context->reservedErrorCheck($2.line, *$2.string))
1646 context->recover();
1650 if (! context->symbolTable.insert(*userTypeDef)) {
1651 context->error($2.line, "redefinition", $2.string->c_str(), "struct");
1652 context->recover();
1673 context->error((*$2)[i].line, "duplicate field name in structure:", "struct", (*$2)[i].type->getFieldName().c_str());
1674 context->recover();
1686 if (context->voidErrorCheck($1.line, (*$2)[0].type->getFieldName(), $1)) {
1687 context->recover();
1700 if (context->arrayTypeErrorCheck($1.line, $1))
1701 context->recover();
1725 if (context->reservedErrorCheck($1.line, *$1.string))
1726 context->recover();
1733 if (context->reservedErrorCheck($1.line, *$1.string))
1734 context->recover();
1741 if (context->arraySizeErrorCheck($2.line, $3, size))
1742 context->recover();
1772 | LEFT_BRACE { context->symbolTable.push(); } statement_list { context->symbolTable.pop(); } RIGHT_BRACE {
1798 $$ = context->intermediate.makeAggregate($1, 0);
1801 $$ = context->intermediate.growAggregate($1, $2, 0);
1812 if (context->boolErrorCheck($1.line, $3))
1813 context->recover();
1814 $$ = context->intermediate.addSelection($3, $5, $1.line);
1835 if (context->boolErrorCheck($1->getLine(), $1))
1836 context->recover();
1840 if (context->structQualifierErrorCheck($2.line, $1))
1841 context->recover();
1842 if (context->boolErrorCheck($2.line, $1))
1843 context->recover();
1845 if (!context->executeInitializer($2.line, *$2.string, $1, $4, intermNode))
1848 context->recover();
1855 : WHILE LEFT_PAREN { context->symbolTable.push(); ++context->loopNestingLevel; } condition RIGHT_PAREN statement_no_new_scope {
1856 context->symbolTable.pop();
1857 $$ = context->intermediate.addLoop(ELoopWhile, 0, $4, 0, $6, $1.line);
1858 --context->loopNestingLevel;
1860 | DO { ++context->loopNestingLevel; } statement WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON {
1861 if (context->boolErrorCheck($8.line, $6))
1862 context->recover();
1864 $$ = context->intermediate.addLoop(ELoopDoWhile, 0, $6, 0, $3, $4.line);
1865 --context->loopNestingLevel;
1867 | FOR LEFT_PAREN { context->symbolTable.push(); ++context->loopNestingLevel; } for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope {
1868 context->symbolTable.pop();
1869 $$ = context->intermediate.addLoop(ELoopFor, $4, reinterpret_cast<TIntermTyped*>($5.node1), reinterpret_cast<TIntermTyped*>($5.node2), $7, $1.line);
1870 --context->loopNestingLevel;
1905 if (context->loopNestingLevel <= 0) {
1906 context->error($1.line, "continue statement only allowed in loops", "", "");
1907 context->recover();
1909 $$ = context->intermediate.addBranch(EOpContinue, $1.line);
1912 if (context->loopNestingLevel <= 0) {
1913 context->error($1.line, "break statement only allowed in loops", "", "");
1914 context->recover();
1916 $$ = context->intermediate.addBranch(EOpBreak, $1.line);
1919 $$ = context->intermediate.addBranch(EOpReturn, $1.line);
1920 if (context->currentFunctionType->getBasicType() != EbtVoid) {
1921 context->error($1.line, "non-void function must return a value", "return", "");
1922 context->recover();
1926 $$ = context->intermediate.addBranch(EOpReturn, $2, $1.line);
1927 context->functionReturnsValue = true;
1928 if (context->currentFunctionType->getBasicType() == EbtVoid) {
1929 context->error($1.line, "void function cannot return a value", "return", "");
1930 context->recover();
1931 } else if (*(context->currentFunctionType) != $2->getType()) {
1932 context->error($1.line, "function return is not matching type:", "return", "");
1933 context->recover();
1938 $$ = context->intermediate.addBranch(EOpKill, $1.line);
1947 context->treeRoot = $$;
1950 $$ = context->intermediate.growAggregate($1, $2, 0);
1951 context->treeRoot = $$;
1967 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
1977 context->error($1.line, "function already has a body", function->getName().c_str(), "");
1978 context->recover();
1987 context->error($1.line, "function cannot take any parameter(s)", function->getName().c_str(), "");
1988 context->recover();
1991 context->error($1.line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
1992 context->recover();
1999 context->symbolTable.push();
2004 context->currentFunctionType = &(prevDec->getReturnType());
2005 context->functionReturnsValue = false;
2023 if (! context->symbolTable.insert(*variable)) {
2024 context->error($1.line, "redefinition", variable->getName().c_str(), "");
2025 context->recover();
2032 paramNodes = context->intermediate.growAggregate(
2034 context->intermediate.addSymbol(variable->getUniqueId(),
2039 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, $1.line), $1.line);
2042 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, $1.line);
2044 context->loopNestingLevel = 0;
2049 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
2050 context->error($1.line, "function does not return a value:", "", $1.function->getName().c_str());
2051 context->recover();
2053 context->symbolTable.pop();
2054 $$ = context->intermediate.growAggregate($1.intermAggregate, $3, 0);
2055 context->intermediate.setAggregateOperator($$, EOpFunction, $1.line);
2061 $$->getAsAggregate()->setOptimize(context->contextPragma.optimize);
2062 $$->getAsAggregate()->setDebug(context->contextPragma.debug);
2063 $$->getAsAggregate()->addToPragmaTable(context->contextPragma.pragmaTable);
2069 int glslang_parse(TParseContext* context) {
2070 return yyparse(context);