Refactor location tracking.
R=kbr@chromium.org
Review URL: https://codereview.appspot.com/9078046
git-svn-id: https://angleproject.googlecode.com/svn/trunk@2202 736b8ea6-26fd-11df-bfd4-992fa37f6226
TRAC #23333
Authored-by: alokp@chromium.org
Signed-off-by: Shannon Woods
Signed-off-by Nicolas Capens
Merged-by: Jamie Madill
diff --git a/src/compiler/Common.h b/src/compiler/Common.h
index 27a5598..532486a 100644
--- a/src/compiler/Common.h
+++ b/src/compiler/Common.h
@@ -14,24 +14,12 @@
#include "compiler/PoolAlloc.h"
-// We need two pieces of information to report errors/warnings - string and
-// line number. We encode these into a single int so that it can be easily
-// incremented/decremented by lexer. The right SOURCE_LOC_LINE_SIZE bits store
-// line number while the rest store the string number. Since the shaders are
-// usually small, we should not run out of memory. SOURCE_LOC_LINE_SIZE
-// can be increased to alleviate this issue.
-typedef int TSourceLoc;
-const unsigned int SOURCE_LOC_LINE_SIZE = 16; // in bits.
-const unsigned int SOURCE_LOC_LINE_MASK = (1 << SOURCE_LOC_LINE_SIZE) - 1;
-
-inline TSourceLoc EncodeSourceLoc(int string, int line) {
- return (string << SOURCE_LOC_LINE_SIZE) | (line & SOURCE_LOC_LINE_MASK);
-}
-
-inline void DecodeSourceLoc(TSourceLoc loc, int* string, int* line) {
- if (string) *string = loc >> SOURCE_LOC_LINE_SIZE;
- if (line) *line = loc & SOURCE_LOC_LINE_MASK;
-}
+struct TSourceLoc {
+ int first_file;
+ int first_line;
+ int last_file;
+ int last_line;
+};
//
// Put POOL_ALLOCATOR_NEW_DELETE in base classes to make them use this scheme.
diff --git a/src/compiler/Compiler.cpp b/src/compiler/Compiler.cpp
index 7b3c646..d39d921 100644
--- a/src/compiler/Compiler.cpp
+++ b/src/compiler/Compiler.cpp
@@ -127,8 +127,10 @@
// We preserve symbols at the built-in level from compile-to-compile.
// Start pushing the user-defined symbols at global level.
symbolTable.push();
- if (!symbolTable.atGlobalLevel())
- infoSink.info.message(EPrefixInternalError, "Wrong symbol table level");
+ if (!symbolTable.atGlobalLevel()) {
+ infoSink.info.prefix(EPrefixInternalError);
+ infoSink.info << "Wrong symbol table level";
+ }
// Parse shader.
bool success =
@@ -180,7 +182,8 @@
if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS) {
success = enforcePackingRestrictions();
if (!success) {
- infoSink.info.message(EPrefixError, "too many uniforms");
+ infoSink.info.prefix(EPrefixError);
+ infoSink.info << "too many uniforms";
}
}
}
@@ -265,10 +268,12 @@
case DetectRecursion::kErrorNone:
return true;
case DetectRecursion::kErrorMissingMain:
- infoSink.info.message(EPrefixError, "Missing main()");
+ infoSink.info.prefix(EPrefixError);
+ infoSink.info << "Missing main()";
return false;
case DetectRecursion::kErrorRecursion:
- infoSink.info.message(EPrefixError, "Function recursion detected");
+ infoSink.info.prefix(EPrefixError);
+ infoSink.info << "Function recursion detected";
return false;
default:
UNREACHABLE();
diff --git a/src/compiler/Diagnostics.cpp b/src/compiler/Diagnostics.cpp
index 4632ad0..540c5d6 100644
--- a/src/compiler/Diagnostics.cpp
+++ b/src/compiler/Diagnostics.cpp
@@ -46,7 +46,7 @@
TInfoSinkBase& sink = mInfoSink.info;
/* VC++ format: file(linenum) : error #: 'token' : extrainfo */
sink.prefix(prefix);
- sink.location(EncodeSourceLoc(loc.file, loc.line));
+ sink.location(loc.file, loc.line);
sink << "'" << token << "' : " << reason << " " << extra << "\n";
}
diff --git a/src/compiler/InfoSink.cpp b/src/compiler/InfoSink.cpp
index ba32f78..d20a6c0 100644
--- a/src/compiler/InfoSink.cpp
+++ b/src/compiler/InfoSink.cpp
@@ -6,8 +6,8 @@
#include "compiler/InfoSink.h"
-void TInfoSinkBase::prefix(TPrefixType message) {
- switch(message) {
+void TInfoSinkBase::prefix(TPrefixType p) {
+ switch(p) {
case EPrefixNone:
break;
case EPrefixWarning:
@@ -31,29 +31,24 @@
}
}
-void TInfoSinkBase::location(TSourceLoc loc) {
- int string = 0, line = 0;
- DecodeSourceLoc(loc, &string, &line);
-
+void TInfoSinkBase::location(int file, int line) {
TPersistStringStream stream;
if (line)
- stream << string << ":" << line;
+ stream << file << ":" << line;
else
- stream << string << ":? ";
+ stream << file << ":? ";
stream << ": ";
sink.append(stream.str());
}
-void TInfoSinkBase::message(TPrefixType message, const char* s) {
- prefix(message);
- sink.append(s);
- sink.append("\n");
+void TInfoSinkBase::location(const TSourceLoc& loc) {
+ location(loc.first_file, loc.first_line);
}
-void TInfoSinkBase::message(TPrefixType message, const char* s, TSourceLoc loc) {
- prefix(message);
+void TInfoSinkBase::message(TPrefixType p, const TSourceLoc& loc, const char* m) {
+ prefix(p);
location(loc);
- sink.append(s);
+ sink.append(m);
sink.append("\n");
}
diff --git a/src/compiler/InfoSink.h b/src/compiler/InfoSink.h
index e2224e91..6888838 100644
--- a/src/compiler/InfoSink.h
+++ b/src/compiler/InfoSink.h
@@ -96,10 +96,10 @@
const TPersistString& str() const { return sink; }
const char* c_str() const { return sink.c_str(); }
- void prefix(TPrefixType message);
- void location(TSourceLoc loc);
- void message(TPrefixType message, const char* s);
- void message(TPrefixType message, const char* s, TSourceLoc loc);
+ void prefix(TPrefixType p);
+ void location(int file, int line);
+ void location(const TSourceLoc& loc);
+ void message(TPrefixType p, const TSourceLoc& loc, const char* m);
private:
TPersistString sink;
diff --git a/src/compiler/Intermediate.cpp b/src/compiler/Intermediate.cpp
index 7042657..537b14b 100644
--- a/src/compiler/Intermediate.cpp
+++ b/src/compiler/Intermediate.cpp
@@ -141,7 +141,7 @@
//
// Returns the added node.
//
-TIntermSymbol* TIntermediate::addSymbol(int id, const TString& name, const TType& type, TSourceLoc line)
+TIntermSymbol* TIntermediate::addSymbol(int id, const TString& name, const TType& type, const TSourceLoc& line)
{
TIntermSymbol* node = new TIntermSymbol(id, name, type);
node->setLine(line);
@@ -154,7 +154,7 @@
//
// Returns the added node.
//
-TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc line)
+TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc& line)
{
switch (op) {
case EOpEqual:
@@ -210,8 +210,6 @@
// one and promote it to the right type.
//
TIntermBinary* node = new TIntermBinary(op);
- if (line == 0)
- line = right->getLine();
node->setLine(line);
node->setLeft(left);
@@ -240,15 +238,13 @@
//
// Returns the added node.
//
-TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc line)
+TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc& line)
{
//
// Like adding binary math, except the conversion can only go
// from right to left.
//
TIntermBinary* node = new TIntermBinary(op);
- if (line == 0)
- line = left->getLine();
node->setLine(line);
TIntermTyped* child = addConversion(op, left->getType(), right);
@@ -270,11 +266,9 @@
// Returns the added node.
// The caller should set the type of the returned node.
//
-TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, TSourceLoc line)
+TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, const TSourceLoc& line)
{
TIntermBinary* node = new TIntermBinary(op);
- if (line == 0)
- line = index->getLine();
node->setLine(line);
node->setLeft(base);
node->setRight(index);
@@ -289,13 +283,13 @@
//
// Returns the added node.
//
-TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode, TSourceLoc line)
+TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode, const TSourceLoc& line)
{
TIntermUnary* node;
TIntermTyped* child = childNode->getAsTyped();
if (child == 0) {
- infoSink.info.message(EPrefixInternalError, "Bad type in AddUnaryMath", line);
+ infoSink.info.message(EPrefixInternalError, line, "Bad type in AddUnaryMath");
return 0;
}
@@ -360,8 +354,6 @@
// Make a new node for the operator.
//
node = new TIntermUnary(op);
- if (line == 0)
- line = child->getLine();
node->setLine(line);
node->setOperand(child);
@@ -388,7 +380,7 @@
// Returns an aggregate node, which could be the one passed in if
// it was already an aggregate but no operator was set.
//
-TIntermAggregate* TIntermediate::setAggregateOperator(TIntermNode* node, TOperator op, TSourceLoc line)
+TIntermAggregate* TIntermediate::setAggregateOperator(TIntermNode* node, TOperator op, const TSourceLoc& line)
{
TIntermAggregate* aggNode;
@@ -403,8 +395,6 @@
//
aggNode = new TIntermAggregate();
aggNode->getSequence().push_back(node);
- if (line == 0)
- line = node->getLine();
}
} else
aggNode = new TIntermAggregate();
@@ -413,8 +403,7 @@
// Set the operator.
//
aggNode->setOp(op);
- if (line != 0)
- aggNode->setLine(line);
+ aggNode->setLine(line);
return aggNode;
}
@@ -505,7 +494,7 @@
case EbtUInt: newOp = EOpConvFloatToUInt; break;
case EbtBool: newOp = EOpConvBoolToFloat; break;
default:
- infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());
+ infoSink.info.message(EPrefixInternalError, node->getLine(), "Bad promotion node");
return 0;
}
break;
@@ -515,7 +504,7 @@
case EbtUInt: newOp = EOpConvBoolToUInt; break;
case EbtFloat: newOp = EOpConvFloatToBool; break;
default:
- infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());
+ infoSink.info.message(EPrefixInternalError, node->getLine(), "Bad promotion node");
return 0;
}
break;
@@ -525,7 +514,7 @@
case EbtBool: newOp = EOpConvBoolToInt; break;
case EbtFloat: newOp = EOpConvFloatToInt; break;
default:
- infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());
+ infoSink.info.message(EPrefixInternalError, node->getLine(), "Bad promotion node");
return 0;
}
break;
@@ -535,12 +524,12 @@
case EbtBool: newOp = EOpConvBoolToUInt; break;
case EbtFloat: newOp = EOpConvFloatToUInt; break;
default:
- infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());
+ infoSink.info.message(EPrefixInternalError, node->getLine(), "Bad promotion node");
return 0;
}
break;
default:
- infoSink.info.message(EPrefixInternalError, "Bad promotion type", node->getLine());
+ infoSink.info.message(EPrefixInternalError, node->getLine(), "Bad promotion type");
return 0;
}
@@ -560,7 +549,7 @@
// Returns the resulting aggregate, unless 0 was passed in for
// both existing nodes.
//
-TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* right, TSourceLoc line)
+TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* right, const TSourceLoc& line)
{
if (left == 0 && right == 0)
return 0;
@@ -577,8 +566,7 @@
if (right)
aggNode->getSequence().push_back(right);
- if (line != 0)
- aggNode->setLine(line);
+ aggNode->setLine(line);
return aggNode;
}
@@ -588,7 +576,7 @@
//
// Returns an aggregate, unless 0 was passed in for the existing node.
//
-TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, TSourceLoc line)
+TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, const TSourceLoc& line)
{
if (node == 0)
return 0;
@@ -596,10 +584,7 @@
TIntermAggregate* aggNode = new TIntermAggregate;
aggNode->getSequence().push_back(node);
- if (line != 0)
- aggNode->setLine(line);
- else
- aggNode->setLine(node->getLine());
+ aggNode->setLine(line);
return aggNode;
}
@@ -611,7 +596,7 @@
//
// Returns the selection node created.
//
-TIntermNode* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nodePair, TSourceLoc line)
+TIntermNode* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nodePair, const TSourceLoc& line)
{
//
// For compile time constant selections, prune the code and
@@ -632,7 +617,7 @@
}
-TIntermTyped* TIntermediate::addComma(TIntermTyped* left, TIntermTyped* right, TSourceLoc line)
+TIntermTyped* TIntermediate::addComma(TIntermTyped* left, TIntermTyped* right, const TSourceLoc& line)
{
if (left->getType().getQualifier() == EvqConst && right->getType().getQualifier() == EvqConst) {
return right;
@@ -652,7 +637,7 @@
//
// Returns the selection node created, or 0 if one could not be.
//
-TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, TSourceLoc line)
+TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc& line)
{
//
// Get compatible types.
@@ -695,7 +680,7 @@
// Returns the constant union node created.
//
-TIntermConstantUnion* TIntermediate::addConstantUnion(ConstantUnion* unionArrayPointer, const TType& t, TSourceLoc line)
+TIntermConstantUnion* TIntermediate::addConstantUnion(ConstantUnion* unionArrayPointer, const TType& t, const TSourceLoc& line)
{
TIntermConstantUnion* node = new TIntermConstantUnion(unionArrayPointer, t);
node->setLine(line);
@@ -703,7 +688,7 @@
return node;
}
-TIntermTyped* TIntermediate::addSwizzle(TVectorFields& fields, TSourceLoc line)
+TIntermTyped* TIntermediate::addSwizzle(TVectorFields& fields, const TSourceLoc& line)
{
TIntermAggregate* node = new TIntermAggregate(EOpSequence);
@@ -726,7 +711,7 @@
//
// Create loop nodes.
//
-TIntermNode* TIntermediate::addLoop(TLoopType type, TIntermNode* init, TIntermTyped* cond, TIntermTyped* expr, TIntermNode* body, TSourceLoc line)
+TIntermNode* TIntermediate::addLoop(TLoopType type, TIntermNode* init, TIntermTyped* cond, TIntermTyped* expr, TIntermNode* body, const TSourceLoc& line)
{
TIntermNode* node = new TIntermLoop(type, init, cond, expr, body);
node->setLine(line);
@@ -737,12 +722,12 @@
//
// Add branches.
//
-TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TSourceLoc line)
+TIntermBranch* TIntermediate::addBranch(TOperator branchOp, const TSourceLoc& line)
{
return addBranch(branchOp, 0, line);
}
-TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TIntermTyped* expression, TSourceLoc line)
+TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TIntermTyped* expression, const TSourceLoc& line)
{
TIntermBranch* node = new TIntermBranch(branchOp, expression);
node->setLine(line);
@@ -922,7 +907,7 @@
// This function only handles scalars, vectors, and matrices.
if (left->isArray() || right->isArray())
{
- infoSink.info.message(EPrefixInternalError, "Invalid operation for arrays", getLine());
+ infoSink.info.message(EPrefixInternalError, getLine(), "Invalid operation for arrays");
return false;
}
@@ -1040,7 +1025,7 @@
}
else
{
- infoSink.info.message(EPrefixInternalError, "Missing elses", getLine());
+ infoSink.info.message(EPrefixInternalError, getLine(), "Missing elses");
return false;
}
@@ -1094,7 +1079,7 @@
}
else
{
- infoSink.info.message(EPrefixInternalError, "Missing elses", getLine());
+ infoSink.info.message(EPrefixInternalError, getLine(), "Missing elses");
return false;
}
@@ -1273,7 +1258,7 @@
{
if (getType().getBasicType() != EbtFloat || node->getBasicType() != EbtFloat)
{
- infoSink.info.message(EPrefixInternalError, "Constant Folding cannot be done for matrix multiply", getLine());
+ infoSink.info.message(EPrefixInternalError, getLine(), "Constant Folding cannot be done for matrix multiply");
return 0;
}
@@ -1313,7 +1298,7 @@
case EbtFloat:
if (rightUnionArray[i] == 0.0f)
{
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", getLine());
+ infoSink.info.message(EPrefixWarning, getLine(), "Divide by zero error during constant folding");
tempConstArray[i].setFConst(unionArray[i].getFConst() < 0 ? -FLT_MAX : FLT_MAX);
}
else
@@ -1325,7 +1310,7 @@
case EbtInt:
if (rightUnionArray[i] == 0)
{
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", getLine());
+ infoSink.info.message(EPrefixWarning, getLine(), "Divide by zero error during constant folding");
tempConstArray[i].setIConst(INT_MAX);
}
else
@@ -1337,7 +1322,7 @@
case EbtUInt:
if (rightUnionArray[i] == 0)
{
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", getLine());
+ infoSink.info.message(EPrefixWarning, getLine(), "Divide by zero error during constant folding");
tempConstArray[i].setUConst(UINT_MAX);
}
else
@@ -1347,7 +1332,7 @@
break;
default:
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"/\"", getLine());
+ infoSink.info.message(EPrefixInternalError, getLine(), "Constant folding cannot be done for \"/\"");
return 0;
}
}
@@ -1358,7 +1343,7 @@
{
if (node->getBasicType() != EbtFloat)
{
- infoSink.info.message(EPrefixInternalError, "Constant Folding cannot be done for matrix times vector", getLine());
+ infoSink.info.message(EPrefixInternalError, getLine(), "Constant Folding cannot be done for matrix times vector");
return 0;
}
@@ -1389,7 +1374,7 @@
{
if (getType().getBasicType() != EbtFloat)
{
- infoSink.info.message(EPrefixInternalError, "Constant Folding cannot be done for vector times matrix", getLine());
+ infoSink.info.message(EPrefixInternalError, getLine(), "Constant Folding cannot be done for vector times matrix");
return 0;
}
@@ -1552,7 +1537,7 @@
return tempNode;
default:
- infoSink.info.message(EPrefixInternalError, "Invalid operator for constant folding", getLine());
+ infoSink.info.message(EPrefixInternalError, getLine(), "Invalid operator for constant folding");
return 0;
}
tempNode = new TIntermConstantUnion(tempConstArray, returnType);
@@ -1578,7 +1563,7 @@
case EbtInt: tempConstArray[i].setIConst(-unionArray[i].getIConst()); break;
case EbtUInt: tempConstArray[i].setUConst(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getUConst()))); break;
default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
+ infoSink.info.message(EPrefixInternalError, getLine(), "Unary operation not folded into constant");
return 0;
}
break;
@@ -1588,7 +1573,7 @@
{
case EbtBool: tempConstArray[i].setBConst(!unionArray[i].getBConst()); break;
default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
+ infoSink.info.message(EPrefixInternalError, getLine(), "Unary operation not folded into constant");
return 0;
}
break;
@@ -1627,7 +1612,7 @@
leftUnionArray[i].setFConst(static_cast<float>(node->getFConst(i)));
break;
default:
- infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
+ infoSink.info.message(EPrefixInternalError, node->getLine(), "Cannot promote");
return 0;
}
break;
@@ -1646,7 +1631,7 @@
leftUnionArray[i].setIConst(static_cast<int>(node->getFConst(i)));
break;
default:
- infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
+ infoSink.info.message(EPrefixInternalError, node->getLine(), "Cannot promote");
return 0;
}
break;
@@ -1665,7 +1650,7 @@
leftUnionArray[i].setUConst(static_cast<unsigned int>(node->getFConst(i)));
break;
default:
- infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
+ infoSink.info.message(EPrefixInternalError, node->getLine(), "Cannot promote");
return 0;
}
break;
@@ -1684,13 +1669,13 @@
leftUnionArray[i].setBConst(node->getFConst(i) != 0.0f);
break;
default:
- infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
+ infoSink.info.message(EPrefixInternalError, node->getLine(), "Cannot promote");
return 0;
}
break;
default:
- infoSink.info.message(EPrefixInternalError, "Incorrect data type found", node->getLine());
+ infoSink.info.message(EPrefixInternalError, node->getLine(), "Incorrect data type found");
return 0;
}
diff --git a/src/compiler/OutputHLSL.cpp b/src/compiler/OutputHLSL.cpp
index 6352711..e4a8abc 100644
--- a/src/compiler/OutputHLSL.cpp
+++ b/src/compiler/OutputHLSL.cpp
@@ -1936,7 +1936,7 @@
{
if (mInsideFunction)
{
- outputLineDirective(node->getLine());
+ outputLineDirective(node->getLine().first_line);
out << "{\n";
mScopeDepth++;
@@ -1953,7 +1953,7 @@
for (TIntermSequence::iterator sit = node->getSequence().begin(); sit != node->getSequence().end(); sit++)
{
- outputLineDirective((*sit)->getLine());
+ outputLineDirective((*sit)->getLine().first_line);
traverseStatements(*sit);
@@ -1962,7 +1962,7 @@
if (mInsideFunction)
{
- outputLineDirective(node->getEndLine());
+ outputLineDirective(node->getLine().last_line);
out << "}\n";
mScopeDepth--;
@@ -2395,7 +2395,7 @@
out << ")\n";
- outputLineDirective(node->getLine());
+ outputLineDirective(node->getLine().first_line);
out << "{\n";
if (node->getTrueBlock())
@@ -2403,20 +2403,20 @@
traverseStatements(node->getTrueBlock());
}
- outputLineDirective(node->getLine());
+ outputLineDirective(node->getLine().first_line);
out << ";\n}\n";
if (node->getFalseBlock())
{
out << "else\n";
- outputLineDirective(node->getFalseBlock()->getLine());
+ outputLineDirective(node->getFalseBlock()->getLine().first_line);
out << "{\n";
- outputLineDirective(node->getFalseBlock()->getLine());
+ outputLineDirective(node->getFalseBlock()->getLine().first_line);
traverseStatements(node->getFalseBlock());
- outputLineDirective(node->getFalseBlock()->getLine());
+ outputLineDirective(node->getFalseBlock()->getLine().first_line);
out << ";\n}\n";
}
}
@@ -2452,7 +2452,7 @@
{
out << "{do\n";
- outputLineDirective(node->getLine());
+ outputLineDirective(node->getLine().first_line);
out << "{\n";
}
else
@@ -2480,7 +2480,7 @@
out << ")\n";
- outputLineDirective(node->getLine());
+ outputLineDirective(node->getLine().first_line);
out << "{\n";
}
@@ -2489,12 +2489,12 @@
traverseStatements(node->getBody());
}
- outputLineDirective(node->getLine());
+ outputLineDirective(node->getLine().first_line);
out << ";}\n";
if (node->getType() == ELoopDoWhile)
{
- outputLineDirective(node->getCondition()->getLine());
+ outputLineDirective(node->getCondition()->getLine().first_line);
out << "while(\n";
node->getCondition()->traverse(this);
@@ -2766,7 +2766,7 @@
out << increment;
out << ")\n";
- outputLineDirective(node->getLine());
+ outputLineDirective(node->getLine().first_line);
out << "{\n";
if (node->getBody())
@@ -2774,7 +2774,7 @@
node->getBody()->traverse(this);
}
- outputLineDirective(node->getLine());
+ outputLineDirective(node->getLine().first_line);
out << ";}\n";
if (!firstLoopFragment)
diff --git a/src/compiler/ParseHelper.cpp b/src/compiler/ParseHelper.cpp
index 63632a7..35bf68e 100644
--- a/src/compiler/ParseHelper.cpp
+++ b/src/compiler/ParseHelper.cpp
@@ -22,7 +22,7 @@
// Look at a '.' field selector string and change it into offsets
// for a vector.
//
-bool TParseContext::parseVectorFields(const TString& compString, int vecSize, TVectorFields& fields, int line)
+bool TParseContext::parseVectorFields(const TString& compString, int vecSize, TVectorFields& fields, const TSourceLoc& line)
{
fields.num = (int) compString.size();
if (fields.num > 4) {
@@ -115,7 +115,7 @@
// Look at a '.' field selector string and change it into offsets
// for a matrix.
//
-bool TParseContext::parseMatrixFields(const TString& compString, int matCols, int matRows, TMatrixFields& fields, int line)
+bool TParseContext::parseMatrixFields(const TString& compString, int matCols, int matRows, TMatrixFields& fields, const TSourceLoc& line)
{
fields.wholeRow = false;
fields.wholeCol = false;
@@ -175,22 +175,24 @@
//
// Used by flex/bison to output all syntax and parsing errors.
//
-void TParseContext::error(TSourceLoc loc,
+void TParseContext::error(const TSourceLoc& loc,
const char* reason, const char* token,
const char* extraInfo)
{
pp::SourceLocation srcLoc;
- DecodeSourceLoc(loc, &srcLoc.file, &srcLoc.line);
+ srcLoc.file = loc.first_file;
+ srcLoc.line = loc.first_line;
diagnostics.writeInfo(pp::Diagnostics::ERROR,
srcLoc, reason, token, extraInfo);
}
-void TParseContext::warning(TSourceLoc loc,
+void TParseContext::warning(const TSourceLoc& loc,
const char* reason, const char* token,
const char* extraInfo) {
pp::SourceLocation srcLoc;
- DecodeSourceLoc(loc, &srcLoc.file, &srcLoc.line);
+ srcLoc.file = loc.first_file;
+ srcLoc.line = loc.first_line;
diagnostics.writeInfo(pp::Diagnostics::WARNING,
srcLoc, reason, token, extraInfo);
}
@@ -203,7 +205,7 @@
//
// Same error message for all places assignments don't work.
//
-void TParseContext::assignError(int line, const char* op, TString left, TString right)
+void TParseContext::assignError(const TSourceLoc& line, const char* op, TString left, TString right)
{
std::stringstream extraInfoStream;
extraInfoStream << "cannot convert from '" << right << "' to '" << left << "'";
@@ -214,7 +216,7 @@
//
// Same error message for all places unary operations don't work.
//
-void TParseContext::unaryOpError(int line, const char* op, TString operand)
+void TParseContext::unaryOpError(const TSourceLoc& line, const char* op, TString operand)
{
std::stringstream extraInfoStream;
extraInfoStream << "no operation '" << op << "' exists that takes an operand of type " << operand
@@ -226,7 +228,7 @@
//
// Same error message for all binary operations don't work.
//
-void TParseContext::binaryOpError(int line, const char* op, TString left, TString right)
+void TParseContext::binaryOpError(const TSourceLoc& line, const char* op, TString left, TString right)
{
std::stringstream extraInfoStream;
extraInfoStream << "no operation '" << op << "' exists that takes a left-hand operand of type '" << left
@@ -235,7 +237,7 @@
error(line, " wrong operand types ", op, extraInfo.c_str());
}
-bool TParseContext::precisionErrorCheck(int line, TPrecision precision, TBasicType type){
+bool TParseContext::precisionErrorCheck(const TSourceLoc& line, TPrecision precision, TBasicType type){
if (!checksPrecisionErrors)
return false;
switch( type ){
@@ -263,7 +265,7 @@
//
// Returns true if the was an error.
//
-bool TParseContext::lValueErrorCheck(int line, const char* op, TIntermTyped* node)
+bool TParseContext::lValueErrorCheck(const TSourceLoc& line, const char* op, TIntermTyped* node)
{
TIntermSymbol* symNode = node->getAsSymbolNode();
TIntermBinary* binaryNode = node->getAsBinaryNode();
@@ -406,7 +408,7 @@
//
// Returns true if the was an error.
//
-bool TParseContext::globalErrorCheck(int line, bool global, const char* token)
+bool TParseContext::globalErrorCheck(const TSourceLoc& line, bool global, const char* token)
{
if (global)
return false;
@@ -425,7 +427,7 @@
//
// Returns true if there was an error.
//
-bool TParseContext::reservedErrorCheck(int line, const TString& identifier)
+bool TParseContext::reservedErrorCheck(const TSourceLoc& line, const TString& identifier)
{
static const char* reservedErrMsg = "reserved built-in name";
if (!symbolTable.atBuiltInLevel()) {
@@ -463,7 +465,7 @@
//
// Returns true if there was an error in construction.
//
-bool TParseContext::constructorErrorCheck(int line, TIntermNode* node, TFunction& function, TOperator op, TType* type)
+bool TParseContext::constructorErrorCheck(const TSourceLoc& line, TIntermNode* node, TFunction& function, TOperator op, TType* type)
{
*type = function.getReturnType();
@@ -565,7 +567,7 @@
//
// returns true in case of an error
//
-bool TParseContext::voidErrorCheck(int line, const TString& identifier, const TPublicType& pubType)
+bool TParseContext::voidErrorCheck(const TSourceLoc& line, const TString& identifier, const TPublicType& pubType)
{
if (pubType.type == EbtVoid) {
error(line, "illegal use of type 'void'", identifier.c_str());
@@ -579,7 +581,7 @@
//
// returns true in case of an error
//
-bool TParseContext::boolErrorCheck(int line, const TIntermTyped* type)
+bool TParseContext::boolErrorCheck(const TSourceLoc& line, const TIntermTyped* type)
{
if (type->getBasicType() != EbtBool || type->isArray() || type->isMatrix() || type->isVector()) {
error(line, "boolean expression expected", "");
@@ -593,7 +595,7 @@
//
// returns true in case of an error
//
-bool TParseContext::boolErrorCheck(int line, const TPublicType& pType)
+bool TParseContext::boolErrorCheck(const TSourceLoc& line, const TPublicType& pType)
{
if (pType.type != EbtBool || pType.isAggregate()) {
error(line, "boolean expression expected", "");
@@ -603,7 +605,7 @@
return false;
}
-bool TParseContext::samplerErrorCheck(int line, const TPublicType& pType, const char* reason)
+bool TParseContext::samplerErrorCheck(const TSourceLoc& line, const TPublicType& pType, const char* reason)
{
if (pType.type == EbtStruct) {
if (containsSampler(*pType.userDef)) {
@@ -622,7 +624,7 @@
return false;
}
-bool TParseContext::structQualifierErrorCheck(int line, const TPublicType& pType)
+bool TParseContext::structQualifierErrorCheck(const TSourceLoc& line, const TPublicType& pType)
{
switch (pType.qualifier)
{
@@ -644,7 +646,7 @@
return false;
}
-bool TParseContext::locationDeclaratorListCheck(int line, const TPublicType &pType)
+bool TParseContext::locationDeclaratorListCheck(const TSourceLoc& line, const TPublicType &pType)
{
if (pType.layoutQualifier.location != -1)
{
@@ -655,7 +657,7 @@
return false;
}
-bool TParseContext::parameterSamplerErrorCheck(int line, TQualifier qualifier, const TType& type)
+bool TParseContext::parameterSamplerErrorCheck(const TSourceLoc& line, TQualifier qualifier, const TType& type)
{
if ((qualifier == EvqOut || qualifier == EvqInOut) &&
type.getBasicType() != EbtStruct && IsSampler(type.getBasicType())) {
@@ -687,7 +689,7 @@
//
// Returns true if there was an error.
//
-bool TParseContext::arraySizeErrorCheck(int line, TIntermTyped* expr, int& size)
+bool TParseContext::arraySizeErrorCheck(const TSourceLoc& line, TIntermTyped* expr, int& size)
{
TIntermConstantUnion* constant = expr->getAsConstantUnion();
@@ -729,7 +731,7 @@
//
// Returns true if there is an error.
//
-bool TParseContext::arrayQualifierErrorCheck(int line, TPublicType type)
+bool TParseContext::arrayQualifierErrorCheck(const TSourceLoc& line, TPublicType type)
{
if ((type.qualifier == EvqAttribute) || (type.qualifier == EvqVertexInput) || (type.qualifier == EvqConst)) {
error(line, "cannot declare arrays of this qualifier", TType(type).getCompleteString().c_str());
@@ -744,7 +746,7 @@
//
// Returns true if there is an error.
//
-bool TParseContext::arrayTypeErrorCheck(int line, TPublicType type)
+bool TParseContext::arrayTypeErrorCheck(const TSourceLoc& line, TPublicType type)
{
//
// Can the type be an array?
@@ -765,7 +767,7 @@
//
// Returns true if there was an error.
//
-bool TParseContext::arrayErrorCheck(int line, const TString& identifier, const TPublicType &type, TVariable*& variable)
+bool TParseContext::arrayErrorCheck(const TSourceLoc& line, const TString& identifier, const TPublicType &type, TVariable*& variable)
{
//
// Don't check for reserved word use until after we know it's not in the symbol table,
@@ -830,7 +832,7 @@
return false;
}
-bool TParseContext::arraySetMaxSize(TIntermSymbol *node, TType* type, int size, bool updateFlag, TSourceLoc line)
+bool TParseContext::arraySetMaxSize(TIntermSymbol *node, TType* type, int size, bool updateFlag, const TSourceLoc& line)
{
bool builtIn = false;
TSymbol* symbol = symbolTable.find(node->getSymbol(), 0, &builtIn);
@@ -879,7 +881,7 @@
//
// Returns true if there was an error.
//
-bool TParseContext::nonInitConstErrorCheck(int line, const TString& identifier, TPublicType& type, bool array)
+bool TParseContext::nonInitConstErrorCheck(const TSourceLoc& line, const TString& identifier, TPublicType& type, bool array)
{
if (type.qualifier == EvqConst)
{
@@ -911,7 +913,7 @@
//
// Returns true if there was an error.
//
-bool TParseContext::nonInitErrorCheck(int line, const TString& identifier, const TPublicType& type, TVariable*& variable)
+bool TParseContext::nonInitErrorCheck(const TSourceLoc& line, const TString& identifier, const TPublicType& type, TVariable*& variable)
{
if (reservedErrorCheck(line, identifier))
recover();
@@ -931,7 +933,7 @@
return false;
}
-bool TParseContext::paramErrorCheck(int line, TQualifier qualifier, TQualifier paramQualifier, TType* type)
+bool TParseContext::paramErrorCheck(const TSourceLoc& line, TQualifier qualifier, TQualifier paramQualifier, TType* type)
{
if (qualifier != EvqConst && qualifier != EvqTemporary) {
error(line, "qualifier not allowed on function parameter", getQualifierString(qualifier));
@@ -950,7 +952,7 @@
return false;
}
-bool TParseContext::extensionErrorCheck(int line, const TString& extension)
+bool TParseContext::extensionErrorCheck(const TSourceLoc& line, const TString& extension)
{
const TExtensionBehavior& extBehavior = extensionBehavior();
TExtensionBehavior::const_iterator iter = extBehavior.find(extension.c_str());
@@ -971,7 +973,7 @@
return false;
}
-bool TParseContext::singleDeclarationErrorCheck(TPublicType &publicType, TSourceLoc identifierLocation, const TString &identifier)
+bool TParseContext::singleDeclarationErrorCheck(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier)
{
if (structQualifierErrorCheck(identifierLocation, publicType))
return true;
@@ -999,7 +1001,7 @@
return false;
}
-bool TParseContext::layoutLocationErrorCheck(TSourceLoc location, const TLayoutQualifier &layoutQualifier)
+bool TParseContext::layoutLocationErrorCheck(const TSourceLoc& location, const TLayoutQualifier &layoutQualifier)
{
if (layoutQualifier.location != -1)
{
@@ -1017,6 +1019,22 @@
return (iter != extbehavior.end());
}
+void TParseContext::handleExtensionDirective(const TSourceLoc& loc, const char* extName, const char* behavior)
+{
+ pp::SourceLocation srcLoc;
+ srcLoc.file = loc.first_file;
+ srcLoc.line = loc.first_line;
+ directiveHandler.handleExtension(srcLoc, extName, behavior);
+}
+
+void TParseContext::handlePragmaDirective(const TSourceLoc& loc, const char* name, const char* value)
+{
+ pp::SourceLocation srcLoc;
+ srcLoc.file = loc.first_file;
+ srcLoc.line = loc.first_line;
+ directiveHandler.handlePragma(srcLoc, name, value);
+}
+
/////////////////////////////////////////////////////////////////////////////////
//
// Non-Errors.
@@ -1028,7 +1046,7 @@
//
// Return the function symbol if found, otherwise 0.
//
-const TFunction* TParseContext::findFunction(int line, TFunction* call, int shaderVersion, bool *builtIn)
+const TFunction* TParseContext::findFunction(const TSourceLoc& line, TFunction* call, int shaderVersion, bool *builtIn)
{
// First find by unmangled name to check whether the function name has been
// hidden by a variable name or struct typename.
@@ -1054,7 +1072,7 @@
// Initializers show up in several places in the grammar. Have one set of
// code to handle them here.
//
-bool TParseContext::executeInitializer(TSourceLoc line, const TString& identifier, TPublicType& pType,
+bool TParseContext::executeInitializer(const TSourceLoc& line, const TString& identifier, TPublicType& pType,
TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable)
{
TType type = TType(pType);
@@ -1211,7 +1229,7 @@
return returnType;
}
-TIntermAggregate* TParseContext::parseSingleDeclaration(TPublicType &publicType, TSourceLoc identifierLocation, const TString &identifier)
+TIntermAggregate* TParseContext::parseSingleDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier)
{
TIntermSymbol* symbol = intermediate.addSymbol(0, identifier, TType(publicType), identifierLocation);
TIntermAggregate* aggregate = intermediate.makeAggregate(symbol, identifierLocation);
@@ -1239,7 +1257,7 @@
return aggregate;
}
-TIntermAggregate* TParseContext::parseSingleArrayDeclaration(TPublicType &publicType, TSourceLoc identifierLocation, const TString &identifier, TSourceLoc indexLocation, TIntermTyped *indexExpression)
+TIntermAggregate* TParseContext::parseSingleArrayDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& indexLocation, TIntermTyped *indexExpression)
{
if (singleDeclarationErrorCheck(publicType, identifierLocation, identifier))
recover();
@@ -1280,7 +1298,7 @@
return aggregate;
}
-TIntermAggregate* TParseContext::parseSingleInitDeclaration(TPublicType &publicType, TSourceLoc identifierLocation, const TString &identifier, TSourceLoc initLocation, TIntermTyped *initializer)
+TIntermAggregate* TParseContext::parseSingleInitDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& initLocation, TIntermTyped *initializer)
{
if (singleDeclarationErrorCheck(publicType, identifierLocation, identifier))
recover();
@@ -1300,7 +1318,7 @@
}
}
-TIntermAggregate* TParseContext::parseDeclarator(TPublicType &publicType, TIntermAggregate *aggregateDeclaration, TSymbol *identifierSymbol, TSourceLoc identifierLocation, const TString &identifier)
+TIntermAggregate* TParseContext::parseDeclarator(TPublicType &publicType, TIntermAggregate *aggregateDeclaration, TSymbol *identifierSymbol, const TSourceLoc& identifierLocation, const TString &identifier)
{
if (publicType.type == EbtInvariant && !identifierSymbol)
{
@@ -1329,7 +1347,7 @@
return intermAggregate;
}
-TIntermAggregate* TParseContext::parseArrayDeclarator(TPublicType &publicType, TSourceLoc identifierLocation, const TString &identifier, TSourceLoc arrayLocation, TIntermNode *declaratorList, TIntermTyped *indexExpression)
+TIntermAggregate* TParseContext::parseArrayDeclarator(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& arrayLocation, TIntermNode *declaratorList, TIntermTyped *indexExpression)
{
if (structQualifierErrorCheck(identifierLocation, publicType))
recover();
@@ -1371,7 +1389,7 @@
return NULL;
}
-TIntermAggregate* TParseContext::parseInitDeclarator(TPublicType &publicType, TIntermAggregate *declaratorList, TSourceLoc identifierLocation, const TString &identifier, TSourceLoc initLocation, TIntermTyped *initializer)
+TIntermAggregate* TParseContext::parseInitDeclarator(TPublicType &publicType, TIntermAggregate *declaratorList, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& initLocation, TIntermTyped *initializer)
{
if (structQualifierErrorCheck(identifierLocation, publicType))
recover();
@@ -1523,7 +1541,7 @@
//
// Returns 0 for an error or the constructed node (aggregate or typed) for no error.
//
-TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType* type, TOperator op, TFunction* fnCall, TSourceLoc line)
+TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType* type, TOperator op, TFunction* fnCall, const TSourceLoc& line)
{
if (node == 0)
return 0;
@@ -1631,7 +1649,7 @@
//
// Returns 0 for an error or the constructed node.
//
-TIntermTyped* TParseContext::constructBuiltIn(const TType* type, TOperator op, TIntermNode* node, TSourceLoc line, bool subset)
+TIntermTyped* TParseContext::constructBuiltIn(const TType* type, TOperator op, TIntermNode* node, const TSourceLoc& line, bool subset)
{
TIntermTyped* newNode;
TOperator basicOp;
@@ -1700,7 +1718,7 @@
//
// Returns 0 for an error or the input node itself if the expected and the given parameter types match.
//
-TIntermTyped* TParseContext::constructStruct(TIntermNode* node, TType* type, int paramCount, TSourceLoc line, bool subset)
+TIntermTyped* TParseContext::constructStruct(TIntermNode* node, TType* type, int paramCount, const TSourceLoc& line, bool subset)
{
if (*type == node->getAsTyped()->getType()) {
if (subset)
@@ -1727,7 +1745,7 @@
// node or it could be the intermediate tree representation of accessing fields in a constant structure or column of
// a constant matrix.
//
-TIntermTyped* TParseContext::addConstVectorNode(TVectorFields& fields, TIntermTyped* node, TSourceLoc line)
+TIntermTyped* TParseContext::addConstVectorNode(TVectorFields& fields, TIntermTyped* node, const TSourceLoc& line)
{
TIntermTyped* typedNode;
TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
@@ -1771,7 +1789,7 @@
// to the function could either be a symbol node (m[0] where m is a constant matrix)that represents a
// constant matrix or it could be the tree representation of the constant matrix (s.m1[0] where s is a constant structure)
//
-TIntermTyped* TParseContext::addConstMatrixNode(int index, TIntermTyped* node, TSourceLoc line)
+TIntermTyped* TParseContext::addConstMatrixNode(int index, TIntermTyped* node, const TSourceLoc& line)
{
TIntermTyped* typedNode;
TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
@@ -1806,7 +1824,7 @@
// to the function could either be a symbol node (a[0] where a is a constant array)that represents a
// constant array or it could be the tree representation of the constant array (s.a1[0] where s is a constant structure)
//
-TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, TSourceLoc line)
+TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, const TSourceLoc& line)
{
TIntermTyped* typedNode;
TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
@@ -1843,7 +1861,7 @@
// If there is an embedded/nested struct, it appropriately calls addConstStructNested or addConstStructFromAggr
// function and returns the parse-tree with the values of the embedded/nested struct.
//
-TIntermTyped* TParseContext::addConstStruct(const TString &identifier, TIntermTyped *node, TSourceLoc line)
+TIntermTyped* TParseContext::addConstStruct(const TString &identifier, TIntermTyped *node, const TSourceLoc& line)
{
const TTypeList* fields = node->getType().getStruct();
TIntermTyped *typedNode;
@@ -1876,8 +1894,8 @@
//
// Interface/uniform blocks
//
-TIntermAggregate* TParseContext::addInterfaceBlock(const TPublicType& typeQualifier, TSourceLoc nameLine, const TString& blockName, TTypeList* typeList,
- const TString& instanceName, TSourceLoc instanceLine, TIntermTyped* arrayIndex, TSourceLoc arrayIndexLine)
+TIntermAggregate* TParseContext::addInterfaceBlock(const TPublicType& typeQualifier, const TSourceLoc& nameLine, const TString& blockName, TTypeList* typeList,
+ const TString& instanceName, const TSourceLoc& instanceLine, TIntermTyped* arrayIndex, const TSourceLoc& arrayIndexLine)
{
if (reservedErrorCheck(nameLine, blockName))
recover();
@@ -2011,7 +2029,7 @@
return aggregate;
}
-bool TParseContext::enterStructDeclaration(int line, const TString& identifier)
+bool TParseContext::enterStructDeclaration(const TSourceLoc& line, const TString& identifier)
{
++structNestingLevel;
@@ -2037,7 +2055,7 @@
} // namespace
-bool TParseContext::structNestingErrorCheck(TSourceLoc line, const TType& fieldType)
+bool TParseContext::structNestingErrorCheck(const TSourceLoc& line, const TType& fieldType)
{
if (!isWebGLBasedSpec(shaderSpec)) {
return false;
@@ -2064,7 +2082,7 @@
//
// Parse an array index expression
//
-TIntermTyped* TParseContext::addIndexExpression(TIntermTyped *baseExpression, TSourceLoc location, TIntermTyped *indexExpression)
+TIntermTyped* TParseContext::addIndexExpression(TIntermTyped *baseExpression, const TSourceLoc& location, TIntermTyped *indexExpression)
{
TIntermTyped *indexedExpression = NULL;
@@ -2215,7 +2233,7 @@
return indexedExpression;
}
-TIntermTyped* TParseContext::addFieldSelectionExpression(TIntermTyped *baseExpression, TSourceLoc dotLocation, const TString &fieldString, TSourceLoc fieldLocation)
+TIntermTyped* TParseContext::addFieldSelectionExpression(TIntermTyped *baseExpression, const TSourceLoc& dotLocation, const TString &fieldString, const TSourceLoc& fieldLocation)
{
TIntermTyped *indexedExpression = NULL;
@@ -2398,7 +2416,7 @@
return indexedExpression;
}
-TLayoutQualifier TParseContext::parseLayoutQualifier(const TString &qualifierType, TSourceLoc qualifierTypeLine)
+TLayoutQualifier TParseContext::parseLayoutQualifier(const TString &qualifierType, const TSourceLoc& qualifierTypeLine)
{
TLayoutQualifier qualifier;
@@ -2440,7 +2458,7 @@
return qualifier;
}
-TLayoutQualifier TParseContext::parseLayoutQualifier(const TString &qualifierType, TSourceLoc qualifierTypeLine, const TString &intValueString, int intValue, TSourceLoc intValueLine)
+TLayoutQualifier TParseContext::parseLayoutQualifier(const TString &qualifierType, const TSourceLoc& qualifierTypeLine, const TString &intValueString, int intValue, const TSourceLoc& intValueLine)
{
TLayoutQualifier qualifier;
@@ -2528,7 +2546,7 @@
return typeList;
}
-TPublicType TParseContext::addStructure(TSourceLoc structLine, TSourceLoc nameLine, const TString &structName, TTypeList* typeList)
+TPublicType TParseContext::addStructure(const TSourceLoc& structLine, const TSourceLoc& nameLine, const TString &structName, TTypeList* typeList)
{
TType* structure = new TType(typeList, structName);
diff --git a/src/compiler/ParseHelper.h b/src/compiler/ParseHelper.h
index 6ac41ad..2807773 100644
--- a/src/compiler/ParseHelper.h
+++ b/src/compiler/ParseHelper.h
@@ -70,93 +70,95 @@
int getShaderVersion() const { return shaderVersion; }
int numErrors() const { return diagnostics.numErrors(); }
TInfoSink& infoSink() { return diagnostics.infoSink(); }
- void error(TSourceLoc loc, const char *reason, const char* token,
+ void error(const TSourceLoc& loc, const char *reason, const char* token,
const char* extraInfo="");
- void warning(TSourceLoc loc, const char* reason, const char* token,
+ void warning(const TSourceLoc& loc, const char* reason, const char* token,
const char* extraInfo="");
void trace(const char* str);
void recover();
- bool parseVectorFields(const TString&, int vecSize, TVectorFields&, int line);
- bool parseMatrixFields(const TString&, int matCols, int matRows, TMatrixFields&, int line);
+ bool parseVectorFields(const TString&, int vecSize, TVectorFields&, const TSourceLoc& line);
+ bool parseMatrixFields(const TString&, int matCols, int matRows, TMatrixFields&, const TSourceLoc& line);
- bool reservedErrorCheck(int line, const TString& identifier);
- void assignError(int line, const char* op, TString left, TString right);
- void unaryOpError(int line, const char* op, TString operand);
- void binaryOpError(int line, const char* op, TString left, TString right);
- bool precisionErrorCheck(int line, TPrecision precision, TBasicType type);
- bool lValueErrorCheck(int line, const char* op, TIntermTyped*);
+ bool reservedErrorCheck(const TSourceLoc& line, const TString& identifier);
+ void assignError(const TSourceLoc& line, const char* op, TString left, TString right);
+ void unaryOpError(const TSourceLoc& line, const char* op, TString operand);
+ void binaryOpError(const TSourceLoc& line, const char* op, TString left, TString right);
+ bool precisionErrorCheck(const TSourceLoc& line, TPrecision precision, TBasicType type);
+ bool lValueErrorCheck(const TSourceLoc& line, const char* op, TIntermTyped*);
bool constErrorCheck(TIntermTyped* node);
bool integerErrorCheck(TIntermTyped* node, const char* token);
- bool globalErrorCheck(int line, bool global, const char* token);
- bool constructorErrorCheck(int line, TIntermNode*, TFunction&, TOperator, TType*);
- bool arraySizeErrorCheck(int line, TIntermTyped* expr, int& size);
- bool arrayQualifierErrorCheck(int line, TPublicType type);
- bool arrayTypeErrorCheck(int line, TPublicType type);
- bool arrayErrorCheck(int line, const TString& identifier, const TPublicType &type, TVariable*& variable);
- bool voidErrorCheck(int, const TString&, const TPublicType&);
- bool boolErrorCheck(int, const TIntermTyped*);
- bool boolErrorCheck(int, const TPublicType&);
- bool samplerErrorCheck(int line, const TPublicType& pType, const char* reason);
- bool structQualifierErrorCheck(int line, const TPublicType& pType);
- bool locationDeclaratorListCheck(int line, const TPublicType &pType);
- bool parameterSamplerErrorCheck(int line, TQualifier qualifier, const TType& type);
- bool nonInitConstErrorCheck(int line, const TString& identifier, TPublicType& type, bool array);
- bool nonInitErrorCheck(int line, const TString& identifier, const TPublicType& type, TVariable*& variable);
- bool paramErrorCheck(int line, TQualifier qualifier, TQualifier paramQualifier, TType* type);
- bool extensionErrorCheck(int line, const TString&);
- bool singleDeclarationErrorCheck(TPublicType &publicType, TSourceLoc identifierLocation, const TString &identifier);
- bool layoutLocationErrorCheck(TSourceLoc location, const TLayoutQualifier &layoutQualifier);
+ bool globalErrorCheck(const TSourceLoc& line, bool global, const char* token);
+ bool constructorErrorCheck(const TSourceLoc& line, TIntermNode*, TFunction&, TOperator, TType*);
+ bool arraySizeErrorCheck(const TSourceLoc& line, TIntermTyped* expr, int& size);
+ bool arrayQualifierErrorCheck(const TSourceLoc& line, TPublicType type);
+ bool arrayTypeErrorCheck(const TSourceLoc& line, TPublicType type);
+ bool arrayErrorCheck(const TSourceLoc& line, const TString& identifier, const TPublicType &type, TVariable*& variable);
+ bool voidErrorCheck(const TSourceLoc&, const TString&, const TPublicType&);
+ bool boolErrorCheck(const TSourceLoc&, const TIntermTyped*);
+ bool boolErrorCheck(const TSourceLoc&, const TPublicType&);
+ bool samplerErrorCheck(const TSourceLoc& line, const TPublicType& pType, const char* reason);
+ bool structQualifierErrorCheck(const TSourceLoc& line, const TPublicType& pType);
+ bool locationDeclaratorListCheck(const TSourceLoc& line, const TPublicType &pType);
+ bool parameterSamplerErrorCheck(const TSourceLoc& line, TQualifier qualifier, const TType& type);
+ bool nonInitConstErrorCheck(const TSourceLoc& line, const TString& identifier, TPublicType& type, bool array);
+ bool nonInitErrorCheck(const TSourceLoc& line, const TString& identifier, const TPublicType& type, TVariable*& variable);
+ bool paramErrorCheck(const TSourceLoc& line, TQualifier qualifier, TQualifier paramQualifier, TType* type);
+ bool extensionErrorCheck(const TSourceLoc& line, const TString&);
+ bool singleDeclarationErrorCheck(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier);
+ bool layoutLocationErrorCheck(const TSourceLoc& location, const TLayoutQualifier &layoutQualifier);
const TPragma& pragma() const { return directiveHandler.pragma(); }
const TExtensionBehavior& extensionBehavior() const { return directiveHandler.extensionBehavior(); }
bool supportsExtension(const char* extension);
+ void handleExtensionDirective(const TSourceLoc& loc, const char* extName, const char* behavior);
+ void handlePragmaDirective(const TSourceLoc& loc, const char* name, const char* value);
bool containsSampler(TType& type);
bool areAllChildConst(TIntermAggregate* aggrNode);
- const TFunction* findFunction(int line, TFunction* pfnCall, int shaderVersion, bool *builtIn = 0);
- bool executeInitializer(TSourceLoc line, const TString& identifier, TPublicType& pType,
+ const TFunction* findFunction(const TSourceLoc& line, TFunction* pfnCall, int shaderVersion, bool *builtIn = 0);
+ bool executeInitializer(const TSourceLoc& line, const TString& identifier, TPublicType& pType,
TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable = 0);
- bool arraySetMaxSize(TIntermSymbol*, TType*, int, bool, TSourceLoc);
+ bool arraySetMaxSize(TIntermSymbol*, TType*, int, bool, const TSourceLoc&);
TPublicType addFullySpecifiedType(TQualifier qualifier, const TPublicType& typeSpecifier);
TPublicType addFullySpecifiedType(TQualifier qualifier, TLayoutQualifier layoutQualifier, const TPublicType& typeSpecifier);
- TIntermAggregate* parseSingleDeclaration(TPublicType &publicType, TSourceLoc identifierLocation, const TString &identifier);
- TIntermAggregate* parseSingleArrayDeclaration(TPublicType &publicType, TSourceLoc identifierLocation, const TString &identifier, TSourceLoc indexLocation, TIntermTyped *indexExpression);
- TIntermAggregate* parseSingleInitDeclaration(TPublicType &publicType, TSourceLoc identifierLocation, const TString &identifier, TSourceLoc initLocation, TIntermTyped *initializer);
- TIntermAggregate* parseDeclarator(TPublicType &publicType, TIntermAggregate *aggregateDeclaration, TSymbol *identifierSymbol, TSourceLoc identifierLocation, const TString &identifier);
- TIntermAggregate* parseArrayDeclarator(TPublicType &publicType, TSourceLoc identifierLocation, const TString &identifier, TSourceLoc arrayLocation, TIntermNode *declaratorList, TIntermTyped *indexExpression);
- TIntermAggregate* parseInitDeclarator(TPublicType &publicType, TIntermAggregate *declaratorList, TSourceLoc identifierLocation, const TString &identifier, TSourceLoc initLocation, TIntermTyped *initializer);
+ TIntermAggregate* parseSingleDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier);
+ TIntermAggregate* parseSingleArrayDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& indexLocation, TIntermTyped *indexExpression);
+ TIntermAggregate* parseSingleInitDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& initLocation, TIntermTyped *initializer);
+ TIntermAggregate* parseDeclarator(TPublicType &publicType, TIntermAggregate *aggregateDeclaration, TSymbol *identifierSymbol, const TSourceLoc& identifierLocation, const TString &identifier);
+ TIntermAggregate* parseArrayDeclarator(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& arrayLocation, TIntermNode *declaratorList, TIntermTyped *indexExpression);
+ TIntermAggregate* parseInitDeclarator(TPublicType &publicType, TIntermAggregate *declaratorList, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& initLocation, TIntermTyped *initializer);
void parseGlobalLayoutQualifier(const TPublicType &typeQualifier);
TFunction *addConstructorFunc(TPublicType publicType);
- TIntermTyped* addConstructor(TIntermNode*, const TType*, TOperator, TFunction*, TSourceLoc);
+ TIntermTyped* addConstructor(TIntermNode*, const TType*, TOperator, TFunction*, const TSourceLoc&);
TIntermTyped* foldConstConstructor(TIntermAggregate* aggrNode, const TType& type);
- TIntermTyped* constructStruct(TIntermNode*, TType*, int, TSourceLoc, bool subset);
- TIntermTyped* constructBuiltIn(const TType*, TOperator, TIntermNode*, TSourceLoc, bool subset);
- TIntermTyped* addConstVectorNode(TVectorFields&, TIntermTyped*, TSourceLoc);
- TIntermTyped* addConstMatrixNode(int , TIntermTyped*, TSourceLoc);
- TIntermTyped* addConstArrayNode(int index, TIntermTyped* node, TSourceLoc line);
- TIntermTyped* addConstStruct(const TString &identifier, TIntermTyped *node, TSourceLoc line);
- TIntermTyped* addIndexExpression(TIntermTyped *baseExpression, TSourceLoc location, TIntermTyped *indexExpression);
- TIntermTyped* addFieldSelectionExpression(TIntermTyped *baseExpression, TSourceLoc dotLocation, const TString &fieldString, TSourceLoc fieldLocation);
+ TIntermTyped* constructStruct(TIntermNode*, TType*, int, const TSourceLoc&, bool subset);
+ TIntermTyped* constructBuiltIn(const TType*, TOperator, TIntermNode*, const TSourceLoc&, bool subset);
+ TIntermTyped* addConstVectorNode(TVectorFields&, TIntermTyped*, const TSourceLoc&);
+ TIntermTyped* addConstMatrixNode(int , TIntermTyped*, const TSourceLoc&);
+ TIntermTyped* addConstArrayNode(int index, TIntermTyped* node, const TSourceLoc& line);
+ TIntermTyped* addConstStruct(const TString &identifier, TIntermTyped *node, const TSourceLoc& line);
+ TIntermTyped* addIndexExpression(TIntermTyped *baseExpression, const TSourceLoc& location, TIntermTyped *indexExpression);
+ TIntermTyped* addFieldSelectionExpression(TIntermTyped *baseExpression, const TSourceLoc& dotLocation, const TString &fieldString, const TSourceLoc& fieldLocation);
TTypeList *addStructDeclaratorList(const TPublicType& typeSpecifier, TTypeList *typeList);
- TPublicType addStructure(TSourceLoc structLine, TSourceLoc nameLine, const TString &structName, TTypeList* typeList);
+ TPublicType addStructure(const TSourceLoc& structLine, const TSourceLoc& nameLine, const TString &structName, TTypeList* typeList);
- TIntermAggregate* addInterfaceBlock(const TPublicType& typeQualifier, TSourceLoc nameLine, const TString& blockName, TTypeList* typeList,
- const TString& instanceName, TSourceLoc instanceLine, TIntermTyped* arrayIndex, TSourceLoc arrayIndexLine);
+ TIntermAggregate* addInterfaceBlock(const TPublicType& typeQualifier, const TSourceLoc& nameLine, const TString& blockName, TTypeList* typeList,
+ const TString& instanceName, const TSourceLoc& instanceLine, TIntermTyped* arrayIndex, const TSourceLoc& arrayIndexLine);
- TLayoutQualifier parseLayoutQualifier(const TString &qualifierType, TSourceLoc qualifierTypeLine);
- TLayoutQualifier parseLayoutQualifier(const TString &qualifierType, TSourceLoc qualifierTypeLine, const TString &intValueString, int intValue, TSourceLoc intValueLine);
+ TLayoutQualifier parseLayoutQualifier(const TString &qualifierType, const TSourceLoc& qualifierTypeLine);
+ TLayoutQualifier parseLayoutQualifier(const TString &qualifierType, const TSourceLoc& qualifierTypeLine, const TString &intValueString, int intValue, const TSourceLoc& intValueLine);
TLayoutQualifier joinLayoutQualifiers(TLayoutQualifier leftQualifier, TLayoutQualifier rightQualifier);
// Performs an error check for embedded struct declarations.
// Returns true if an error was raised due to the declaration of
// this struct.
- bool enterStructDeclaration(TSourceLoc line, const TString& identifier);
+ bool enterStructDeclaration(const TSourceLoc& line, const TString& identifier);
void exitStructDeclaration();
- bool structNestingErrorCheck(TSourceLoc line, const TType& fieldType);
+ bool structNestingErrorCheck(const TSourceLoc& line, const TType& fieldType);
};
int PaParseStrings(size_t count, const char* const string[], const int length[],
diff --git a/src/compiler/Types.h b/src/compiler/Types.h
index 4d3daf5..6a39e24 100644
--- a/src/compiler/Types.h
+++ b/src/compiler/Types.h
@@ -19,7 +19,7 @@
//
struct TTypeLine {
TType* type;
- int line;
+ TSourceLoc line;
};
typedef TVector<TTypeLine> TTypeList;
@@ -288,9 +288,9 @@
bool array;
int arraySize;
TType* userDef;
- int line;
+ TSourceLoc line;
- void setBasic(TBasicType bt, TQualifier q, int ln = 0)
+ void setBasic(TBasicType bt, TQualifier q, const TSourceLoc& ln)
{
type = bt;
layoutQualifier = TLayoutQualifier::create();
diff --git a/src/compiler/glslang.l b/src/compiler/glslang.l
index f5a19a7..d485e74 100644
--- a/src/compiler/glslang.l
+++ b/src/compiler/glslang.l
@@ -47,7 +47,10 @@
#pragma warning(disable : 4102)
#endif
-#define YY_USER_ACTION yylval->lex.line = yylineno;
+#define YY_USER_ACTION \
+ yylloc->first_file = yylloc->last_file = yycolumn; \
+ yylloc->first_line = yylloc->last_line = yylineno;
+
#define YY_INPUT(buf, result, max_size) \
result = string_input(buf, max_size, yyscanner);
@@ -62,7 +65,7 @@
%}
%option noyywrap nounput never-interactive
-%option yylineno reentrant bison-bridge
+%option yylineno reentrant bison-bridge bison-locations
%option extra-type="TParseContext*"
D [0-9]
@@ -377,7 +380,8 @@
yy_size_t len = token.type == pp::Token::LAST ? 0 : token.text.size();
if (len < max_size)
memcpy(buf, token.text.c_str(), len);
- yyset_lineno(EncodeSourceLoc(token.location.file, token.location.line), yyscanner);
+ yyset_column(token.location.file, yyscanner);
+ yyset_lineno(token.location.line, yyscanner);
if (len >= max_size)
YY_FATAL_ERROR("Input buffer overflow");
@@ -404,7 +408,7 @@
int reserved_word(yyscan_t yyscanner) {
struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
- yyextra->error(yylineno, "Illegal use of reserved word", yytext, "");
+ yyextra->error(*yylloc, "Illegal use of reserved word", yytext, "");
yyextra->recover();
return 0;
}
@@ -457,7 +461,7 @@
if (context->shaderVersion < 300)
{
- context->error(yylineno, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext, "");
+ context->error(*yylloc, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext, "");
context->recover();
return 0;
}
@@ -473,7 +477,7 @@
if (context->shaderVersion < 300)
{
- context->error(yylineno, "Floating-point suffix unsupported prior to GLSL ES 3.00", yytext);
+ context->error(*yylloc, "Floating-point suffix unsupported prior to GLSL ES 3.00", yytext);
context->recover();
return 0;
}
@@ -481,13 +485,6 @@
return(FLOATCONSTANT);
}
-void yyerror(TParseContext* context, const char* reason) {
- struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
-
- context->error(yylineno, reason, yytext);
- context->recover();
-}
-
int glslang_initialize(TParseContext* context) {
yyscan_t scanner = NULL;
if (yylex_init_extra(context, &scanner))
@@ -510,7 +507,8 @@
int glslang_scan(size_t count, const char* const string[], const int length[],
TParseContext* context) {
yyrestart(NULL, context->scanner);
- yyset_lineno(EncodeSourceLoc(0, 1), context->scanner);
+ yyset_column(0, context->scanner);
+ yyset_lineno(1, context->scanner);
// Initialize preprocessor.
if (!context->preprocessor.init(count, string, length))
diff --git a/src/compiler/glslang.y b/src/compiler/glslang.y
index 951a79c..5d85ab5 100644
--- a/src/compiler/glslang.y
+++ b/src/compiler/glslang.y
@@ -39,7 +39,6 @@
#include "GLSLANG/ShaderLang.h"
#define YYENABLE_NLS 0
-#define YYLTYPE_IS_TRIVIAL 1
#define YYLEX_PARAM context->scanner
@@ -47,10 +46,15 @@
%expect 1 /* One shift reduce conflict because of if | else */
%pure-parser
%parse-param {TParseContext* context}
+%locations
+
+%code requires {
+#define YYLTYPE TSourceLoc
+#define YYLTYPE_IS_DECLARED 1
+}
%union {
struct {
- TSourceLoc line;
union {
TString *string;
float f;
@@ -61,7 +65,6 @@
TSymbol* symbol;
} lex;
struct {
- TSourceLoc line;
TOperator op;
union {
TIntermNode* intermNode;
@@ -83,8 +86,24 @@
}
%{
-extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
-extern void yyerror(TParseContext* context, const char* reason);
+extern int yylex(YYSTYPE* yylval_param, YYLTYPE* yylloc, void* yyscanner);
+extern void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason);
+
+#define YYLLOC_DEFAULT(Current, Rhs, N) \
+ do { \
+ if (YYID(N)) { \
+ (Current).first_file = YYRHSLOC(Rhs, 1).first_file; \
+ (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
+ (Current).last_file = YYRHSLOC(Rhs, N).last_file; \
+ (Current).last_line = YYRHSLOC(Rhs, N).last_line; \
+ } \
+ else { \
+ (Current).first_file = YYRHSLOC(Rhs, 0).last_file; \
+ (Current).first_line = YYRHSLOC(Rhs, 0).last_line; \
+ (Current).last_file = YYRHSLOC(Rhs, 0).last_file; \
+ (Current).last_line = YYRHSLOC(Rhs, 0).last_line; \
+ } \
+ } while (0)
#define FRAG_VERT_ONLY(S, L) { \
if (context->shaderType != SH_FRAGMENT_SHADER && \
@@ -200,7 +219,7 @@
const TSymbol* symbol = $1.symbol;
const TVariable* variable;
if (symbol == 0) {
- context->error($1.line, "undeclared identifier", $1.string->c_str());
+ context->error(@1, "undeclared identifier", $1.string->c_str());
context->recover();
TType type(EbtFloat, EbpUndefined);
TVariable* fakeVariable = new TVariable($1.string, type);
@@ -209,7 +228,7 @@
} else {
// This identifier can only be a variable type symbol
if (! symbol->isVariable()) {
- context->error($1.line, "variable expected", $1.string->c_str());
+ context->error(@1, "variable expected", $1.string->c_str());
context->recover();
}
variable = static_cast<const TVariable*>(symbol);
@@ -221,11 +240,11 @@
if (variable->getType().getQualifier() == EvqConst ) {
ConstantUnion* constArray = variable->getConstPointer();
TType t(variable->getType());
- $$ = context->intermediate.addConstantUnion(constArray, t, $1.line);
+ $$ = context->intermediate.addConstantUnion(constArray, t, @1);
} else
$$ = context->intermediate.addSymbol(variable->getUniqueId(),
variable->getName(),
- variable->getType(), $1.line);
+ variable->getType(), @1);
}
;
@@ -236,22 +255,22 @@
| INTCONSTANT {
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setIConst($1.i);
- $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), $1.line);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), @1);
}
| UINTCONSTANT {
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setUConst($1.u);
- $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConst), $1.line);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConst), @1);
}
| FLOATCONSTANT {
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setFConst($1.f);
- $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), $1.line);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), @1);
}
| BOOLCONSTANT {
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst($1.b);
- $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $1.line);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @1);
}
| LEFT_PAREN expression RIGHT_PAREN {
$$ = $2;
@@ -263,30 +282,30 @@
$$ = $1;
}
| postfix_expression LEFT_BRACKET integer_expression RIGHT_BRACKET {
- $$ = context->addIndexExpression($1, $2.line, $3);
+ $$ = context->addIndexExpression($1, @2, $3);
}
| function_call {
$$ = $1;
}
| postfix_expression DOT identifier {
- $$ = context->addFieldSelectionExpression($1, $2.line, *$3.string, $3.line);
+ $$ = context->addFieldSelectionExpression($1, @2, *$3.string, @3);
}
| postfix_expression INC_OP {
- if (context->lValueErrorCheck($2.line, "++", $1))
+ if (context->lValueErrorCheck(@2, "++", $1))
context->recover();
- $$ = context->intermediate.addUnaryMath(EOpPostIncrement, $1, $2.line);
+ $$ = context->intermediate.addUnaryMath(EOpPostIncrement, $1, @2);
if ($$ == 0) {
- context->unaryOpError($2.line, "++", $1->getCompleteString());
+ context->unaryOpError(@2, "++", $1->getCompleteString());
context->recover();
$$ = $1;
}
}
| postfix_expression DEC_OP {
- if (context->lValueErrorCheck($2.line, "--", $1))
+ if (context->lValueErrorCheck(@2, "--", $1))
context->recover();
- $$ = context->intermediate.addUnaryMath(EOpPostDecrement, $1, $2.line);
+ $$ = context->intermediate.addUnaryMath(EOpPostDecrement, $1, @2);
if ($$ == 0) {
- context->unaryOpError($2.line, "--", $1->getCompleteString());
+ context->unaryOpError(@2, "--", $1->getCompleteString());
context->recover();
$$ = $1;
}
@@ -314,18 +333,18 @@
// Their parameters will be verified algorithmically.
//
TType type(EbtVoid, EbpUndefined); // use this to get the type back
- if (context->constructorErrorCheck($1.line, $1.intermNode, *fnCall, op, &type)) {
+ if (context->constructorErrorCheck(@1, $1.intermNode, *fnCall, op, &type)) {
$$ = 0;
} else {
//
// It's a constructor, of type 'type'.
//
- $$ = context->addConstructor($1.intermNode, &type, op, fnCall, $1.line);
+ $$ = context->addConstructor($1.intermNode, &type, op, fnCall, @1);
}
if ($$ == 0) {
context->recover();
- $$ = context->intermediate.setAggregateOperator(0, op, $1.line);
+ $$ = context->intermediate.setAggregateOperator(0, op, @1);
}
$$->setType(type);
} else {
@@ -334,13 +353,13 @@
//
const TFunction* fnCandidate;
bool builtIn;
- fnCandidate = context->findFunction($1.line, fnCall, context->shaderVersion, &builtIn);
+ fnCandidate = context->findFunction(@1, fnCall, context->shaderVersion, &builtIn);
if (fnCandidate) {
//
// A declared function.
//
if (builtIn && !fnCandidate->getExtension().empty() &&
- context->extensionErrorCheck($1.line, fnCandidate->getExtension())) {
+ context->extensionErrorCheck(@1, fnCandidate->getExtension())) {
context->recover();
}
op = fnCandidate->getBuiltInOp();
@@ -352,7 +371,7 @@
//
// Treat it like a built-in unary operator.
//
- $$ = context->intermediate.addUnaryMath(op, $1.intermNode, 0);
+ $$ = context->intermediate.addUnaryMath(op, $1.intermNode, @1);
if ($$ == 0) {
std::stringstream extraInfoStream;
extraInfoStream << "built in unary operator function. Type: " << static_cast<TIntermTyped*>($1.intermNode)->getCompleteString();
@@ -361,12 +380,12 @@
YYERROR;
}
} else {
- $$ = context->intermediate.setAggregateOperator($1.intermAggregate, op, $1.line);
+ $$ = context->intermediate.setAggregateOperator($1.intermAggregate, op, @1);
}
} else {
// This is a real function call
- $$ = context->intermediate.setAggregateOperator($1.intermAggregate, EOpFunctionCall, $1.line);
+ $$ = context->intermediate.setAggregateOperator($1.intermAggregate, EOpFunctionCall, @1);
$$->setType(fnCandidate->getReturnType());
// this is how we know whether the given function is a builtIn function or a user defined function
@@ -393,7 +412,7 @@
// Put on a dummy node for error recovery
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setFConst(0.0f);
- $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), $1.line);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), @1);
context->recover();
}
}
@@ -406,7 +425,7 @@
$$ = $1;
}
| postfix_expression DOT function_call_generic {
- context->error($3.line, "methods are not supported", "");
+ context->error(@3, "methods are not supported", "");
context->recover();
$$ = $3;
}
@@ -415,11 +434,9 @@
function_call_generic
: function_call_header_with_parameters RIGHT_PAREN {
$$ = $1;
- $$.line = $2.line;
}
| function_call_header_no_parameters RIGHT_PAREN {
$$ = $1;
- $$.line = $2.line;
}
;
@@ -445,7 +462,7 @@
TParameter param = { 0, new TType($3->getType()) };
$1.function->addParameter(param);
$$.function = $1.function;
- $$.intermNode = context->intermediate.growAggregate($1.intermNode, $3, $2.line);
+ $$.intermNode = context->intermediate.growAggregate($1.intermNode, $3, @2);
}
;
@@ -462,7 +479,7 @@
$$ = context->addConstructorFunc($1);
}
| IDENTIFIER {
- if (context->reservedErrorCheck($1.line, *$1.string))
+ if (context->reservedErrorCheck(@1, *$1.string))
context->recover();
TType type(EbtVoid, EbpUndefined);
TFunction *function = new TFunction($1.string, type);
@@ -475,28 +492,28 @@
$$ = $1;
}
| INC_OP unary_expression {
- if (context->lValueErrorCheck($1.line, "++", $2))
+ if (context->lValueErrorCheck(@1, "++", $2))
context->recover();
- $$ = context->intermediate.addUnaryMath(EOpPreIncrement, $2, $1.line);
+ $$ = context->intermediate.addUnaryMath(EOpPreIncrement, $2, @1);
if ($$ == 0) {
- context->unaryOpError($1.line, "++", $2->getCompleteString());
+ context->unaryOpError(@1, "++", $2->getCompleteString());
context->recover();
$$ = $2;
}
}
| DEC_OP unary_expression {
- if (context->lValueErrorCheck($1.line, "--", $2))
+ if (context->lValueErrorCheck(@1, "--", $2))
context->recover();
- $$ = context->intermediate.addUnaryMath(EOpPreDecrement, $2, $1.line);
+ $$ = context->intermediate.addUnaryMath(EOpPreDecrement, $2, @1);
if ($$ == 0) {
- context->unaryOpError($1.line, "--", $2->getCompleteString());
+ context->unaryOpError(@1, "--", $2->getCompleteString());
context->recover();
$$ = $2;
}
}
| unary_operator unary_expression {
if ($1.op != EOpNull) {
- $$ = context->intermediate.addUnaryMath($1.op, $2, $1.line);
+ $$ = context->intermediate.addUnaryMath($1.op, $2, @1);
if ($$ == 0) {
const char* errorOp = "";
switch($1.op) {
@@ -504,7 +521,7 @@
case EOpLogicalNot: errorOp = "!"; break;
default: break;
}
- context->unaryOpError($1.line, errorOp, $2->getCompleteString());
+ context->unaryOpError(@1, errorOp, $2->getCompleteString());
context->recover();
$$ = $2;
}
@@ -515,28 +532,28 @@
// Grammar Note: No traditional style type casts.
unary_operator
- : PLUS { $$.line = $1.line; $$.op = EOpNull; }
- | DASH { $$.line = $1.line; $$.op = EOpNegative; }
- | BANG { $$.line = $1.line; $$.op = EOpLogicalNot; }
+ : PLUS { $$.op = EOpNull; }
+ | DASH { $$.op = EOpNegative; }
+ | BANG { $$.op = EOpLogicalNot; }
;
// Grammar Note: No '*' or '&' unary ops. Pointers are not supported.
multiplicative_expression
: unary_expression { $$ = $1; }
| multiplicative_expression STAR unary_expression {
- FRAG_VERT_ONLY("*", $2.line);
- $$ = context->intermediate.addBinaryMath(EOpMul, $1, $3, $2.line);
+ FRAG_VERT_ONLY("*", @2);
+ $$ = context->intermediate.addBinaryMath(EOpMul, $1, $3, @2);
if ($$ == 0) {
- context->binaryOpError($2.line, "*", $1->getCompleteString(), $3->getCompleteString());
+ context->binaryOpError(@2, "*", $1->getCompleteString(), $3->getCompleteString());
context->recover();
$$ = $1;
}
}
| multiplicative_expression SLASH unary_expression {
- FRAG_VERT_ONLY("/", $2.line);
- $$ = context->intermediate.addBinaryMath(EOpDiv, $1, $3, $2.line);
+ FRAG_VERT_ONLY("/", @2);
+ $$ = context->intermediate.addBinaryMath(EOpDiv, $1, $3, @2);
if ($$ == 0) {
- context->binaryOpError($2.line, "/", $1->getCompleteString(), $3->getCompleteString());
+ context->binaryOpError(@2, "/", $1->getCompleteString(), $3->getCompleteString());
context->recover();
$$ = $1;
}
@@ -546,17 +563,17 @@
additive_expression
: multiplicative_expression { $$ = $1; }
| additive_expression PLUS multiplicative_expression {
- $$ = context->intermediate.addBinaryMath(EOpAdd, $1, $3, $2.line);
+ $$ = context->intermediate.addBinaryMath(EOpAdd, $1, $3, @2);
if ($$ == 0) {
- context->binaryOpError($2.line, "+", $1->getCompleteString(), $3->getCompleteString());
+ context->binaryOpError(@2, "+", $1->getCompleteString(), $3->getCompleteString());
context->recover();
$$ = $1;
}
}
| additive_expression DASH multiplicative_expression {
- $$ = context->intermediate.addBinaryMath(EOpSub, $1, $3, $2.line);
+ $$ = context->intermediate.addBinaryMath(EOpSub, $1, $3, @2);
if ($$ == 0) {
- context->binaryOpError($2.line, "-", $1->getCompleteString(), $3->getCompleteString());
+ context->binaryOpError(@2, "-", $1->getCompleteString(), $3->getCompleteString());
context->recover();
$$ = $1;
}
@@ -570,43 +587,43 @@
relational_expression
: shift_expression { $$ = $1; }
| relational_expression LEFT_ANGLE shift_expression {
- $$ = context->intermediate.addBinaryMath(EOpLessThan, $1, $3, $2.line);
+ $$ = context->intermediate.addBinaryMath(EOpLessThan, $1, $3, @2);
if ($$ == 0) {
- context->binaryOpError($2.line, "<", $1->getCompleteString(), $3->getCompleteString());
+ context->binaryOpError(@2, "<", $1->getCompleteString(), $3->getCompleteString());
context->recover();
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
- $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @2);
}
}
| relational_expression RIGHT_ANGLE shift_expression {
- $$ = context->intermediate.addBinaryMath(EOpGreaterThan, $1, $3, $2.line);
+ $$ = context->intermediate.addBinaryMath(EOpGreaterThan, $1, $3, @2);
if ($$ == 0) {
- context->binaryOpError($2.line, ">", $1->getCompleteString(), $3->getCompleteString());
+ context->binaryOpError(@2, ">", $1->getCompleteString(), $3->getCompleteString());
context->recover();
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
- $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @2);
}
}
| relational_expression LE_OP shift_expression {
- $$ = context->intermediate.addBinaryMath(EOpLessThanEqual, $1, $3, $2.line);
+ $$ = context->intermediate.addBinaryMath(EOpLessThanEqual, $1, $3, @2);
if ($$ == 0) {
- context->binaryOpError($2.line, "<=", $1->getCompleteString(), $3->getCompleteString());
+ context->binaryOpError(@2, "<=", $1->getCompleteString(), $3->getCompleteString());
context->recover();
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
- $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @2);
}
}
| relational_expression GE_OP shift_expression {
- $$ = context->intermediate.addBinaryMath(EOpGreaterThanEqual, $1, $3, $2.line);
+ $$ = context->intermediate.addBinaryMath(EOpGreaterThanEqual, $1, $3, @2);
if ($$ == 0) {
- context->binaryOpError($2.line, ">=", $1->getCompleteString(), $3->getCompleteString());
+ context->binaryOpError(@2, ">=", $1->getCompleteString(), $3->getCompleteString());
context->recover();
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
- $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @2);
}
}
;
@@ -614,23 +631,23 @@
equality_expression
: relational_expression { $$ = $1; }
| equality_expression EQ_OP relational_expression {
- $$ = context->intermediate.addBinaryMath(EOpEqual, $1, $3, $2.line);
+ $$ = context->intermediate.addBinaryMath(EOpEqual, $1, $3, @2);
if ($$ == 0) {
- context->binaryOpError($2.line, "==", $1->getCompleteString(), $3->getCompleteString());
+ context->binaryOpError(@2, "==", $1->getCompleteString(), $3->getCompleteString());
context->recover();
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
- $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @2);
}
}
| equality_expression NE_OP relational_expression {
- $$ = context->intermediate.addBinaryMath(EOpNotEqual, $1, $3, $2.line);
+ $$ = context->intermediate.addBinaryMath(EOpNotEqual, $1, $3, @2);
if ($$ == 0) {
- context->binaryOpError($2.line, "!=", $1->getCompleteString(), $3->getCompleteString());
+ context->binaryOpError(@2, "!=", $1->getCompleteString(), $3->getCompleteString());
context->recover();
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
- $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @2);
}
}
;
@@ -650,13 +667,13 @@
logical_and_expression
: inclusive_or_expression { $$ = $1; }
| logical_and_expression AND_OP inclusive_or_expression {
- $$ = context->intermediate.addBinaryMath(EOpLogicalAnd, $1, $3, $2.line);
+ $$ = context->intermediate.addBinaryMath(EOpLogicalAnd, $1, $3, @2);
if ($$ == 0) {
- context->binaryOpError($2.line, "&&", $1->getCompleteString(), $3->getCompleteString());
+ context->binaryOpError(@2, "&&", $1->getCompleteString(), $3->getCompleteString());
context->recover();
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
- $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @2);
}
}
;
@@ -664,13 +681,13 @@
logical_xor_expression
: logical_and_expression { $$ = $1; }
| logical_xor_expression XOR_OP logical_and_expression {
- $$ = context->intermediate.addBinaryMath(EOpLogicalXor, $1, $3, $2.line);
+ $$ = context->intermediate.addBinaryMath(EOpLogicalXor, $1, $3, @2);
if ($$ == 0) {
- context->binaryOpError($2.line, "^^", $1->getCompleteString(), $3->getCompleteString());
+ context->binaryOpError(@2, "^^", $1->getCompleteString(), $3->getCompleteString());
context->recover();
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
- $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @2);
}
}
;
@@ -678,13 +695,13 @@
logical_or_expression
: logical_xor_expression { $$ = $1; }
| logical_or_expression OR_OP logical_xor_expression {
- $$ = context->intermediate.addBinaryMath(EOpLogicalOr, $1, $3, $2.line);
+ $$ = context->intermediate.addBinaryMath(EOpLogicalOr, $1, $3, @2);
if ($$ == 0) {
- context->binaryOpError($2.line, "||", $1->getCompleteString(), $3->getCompleteString());
+ context->binaryOpError(@2, "||", $1->getCompleteString(), $3->getCompleteString());
context->recover();
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
- $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @2);
}
}
;
@@ -692,15 +709,15 @@
conditional_expression
: logical_or_expression { $$ = $1; }
| logical_or_expression QUESTION expression COLON assignment_expression {
- if (context->boolErrorCheck($2.line, $1))
+ if (context->boolErrorCheck(@2, $1))
context->recover();
- $$ = context->intermediate.addSelection($1, $3, $5, $2.line);
+ $$ = context->intermediate.addSelection($1, $3, $5, @2);
if ($3->getType() != $5->getType())
$$ = 0;
if ($$ == 0) {
- context->binaryOpError($2.line, ":", $3->getCompleteString(), $5->getCompleteString());
+ context->binaryOpError(@2, ":", $3->getCompleteString(), $5->getCompleteString());
context->recover();
$$ = $5;
}
@@ -710,11 +727,11 @@
assignment_expression
: conditional_expression { $$ = $1; }
| unary_expression assignment_operator assignment_expression {
- if (context->lValueErrorCheck($2.line, "assign", $1))
+ if (context->lValueErrorCheck(@2, "assign", $1))
context->recover();
- $$ = context->intermediate.addAssign($2.op, $1, $3, $2.line);
+ $$ = context->intermediate.addAssign($2.op, $1, $3, @2);
if ($$ == 0) {
- context->assignError($2.line, "assign", $1->getCompleteString(), $3->getCompleteString());
+ context->assignError(@2, "assign", $1->getCompleteString(), $3->getCompleteString());
context->recover();
$$ = $1;
}
@@ -722,11 +739,11 @@
;
assignment_operator
- : EQUAL { $$.line = $1.line; $$.op = EOpAssign; }
- | MUL_ASSIGN { FRAG_VERT_ONLY("*=", $1.line); $$.line = $1.line; $$.op = EOpMulAssign; }
- | DIV_ASSIGN { FRAG_VERT_ONLY("/=", $1.line); $$.line = $1.line; $$.op = EOpDivAssign; }
- | ADD_ASSIGN { $$.line = $1.line; $$.op = EOpAddAssign; }
- | SUB_ASSIGN { $$.line = $1.line; $$.op = EOpSubAssign; }
+ : EQUAL { $$.op = EOpAssign; }
+ | MUL_ASSIGN { FRAG_VERT_ONLY("*=", @1); $$.op = EOpMulAssign; }
+ | DIV_ASSIGN { FRAG_VERT_ONLY("/=", @1); $$.op = EOpDivAssign; }
+ | ADD_ASSIGN { $$.op = EOpAddAssign; }
+ | SUB_ASSIGN { $$.op = EOpSubAssign; }
;
expression
@@ -734,9 +751,9 @@
$$ = $1;
}
| expression COMMA assignment_expression {
- $$ = context->intermediate.addComma($1, $3, $2.line);
+ $$ = context->intermediate.addComma($1, $3, @2);
if ($$ == 0) {
- context->binaryOpError($2.line, ",", $1->getCompleteString(), $3->getCompleteString());
+ context->binaryOpError(@2, ",", $1->getCompleteString(), $3->getCompleteString());
context->recover();
$$ = $3;
}
@@ -753,7 +770,7 @@
enter_struct
: IDENTIFIER LEFT_BRACE {
- if (context->enterStructDeclaration($1.line, *$1.string))
+ if (context->enterStructDeclaration(@1, *$1.string))
context->recover();
$$ = $1;
}
@@ -774,11 +791,11 @@
{
TVariable variable(param.name, *param.type);
- prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable.getUniqueId(), variable.getName(), variable.getType(), $1.line), $1.line);
+ prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable.getUniqueId(), variable.getName(), variable.getType(), @1), @1);
}
else
{
- prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, $1.line), $1.line);
+ prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, @1), @1);
}
}
@@ -794,26 +811,26 @@
}
| PRECISION precision_qualifier type_specifier_no_prec SEMICOLON {
if (($2 == EbpHigh) && (context->shaderType == SH_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) {
- context->error($1.line, "precision is not supported in fragment shader", "highp");
+ context->error(@1, "precision is not supported in fragment shader", "highp");
context->recover();
}
if (!context->symbolTable.setDefaultPrecision( $3, $2 )) {
- context->error($1.line, "illegal type argument for default precision qualifier", getBasicString($3.type));
+ context->error(@1, "illegal type argument for default precision qualifier", getBasicString($3.type));
context->recover();
}
$$ = 0;
}
| type_qualifier enter_struct struct_declaration_list RIGHT_BRACE SEMICOLON {
- ES3_ONLY(getQualifierString($1.qualifier), $1.line, "interface blocks");
- $$ = context->addInterfaceBlock($1, $2.line, *$2.string, $3, "", 0, NULL, 0);
+ ES3_ONLY(getQualifierString($1.qualifier), @1, "interface blocks");
+ $$ = context->addInterfaceBlock($1, @2, *$2.string, $3, "", @$, NULL, @$);
}
| type_qualifier enter_struct struct_declaration_list RIGHT_BRACE IDENTIFIER SEMICOLON {
- ES3_ONLY(getQualifierString($1.qualifier), $1.line, "interface blocks");
- $$ = context->addInterfaceBlock($1, $2.line, *$2.string, $3, *$5.string, $5.line, NULL, 0);
+ ES3_ONLY(getQualifierString($1.qualifier), @1, "interface blocks");
+ $$ = context->addInterfaceBlock($1, @2, *$2.string, $3, *$5.string, @5, NULL, @$);
}
| type_qualifier enter_struct struct_declaration_list RIGHT_BRACE IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET SEMICOLON {
- ES3_ONLY(getQualifierString($1.qualifier), $1.line, "interface blocks");
- $$ = context->addInterfaceBlock($1, $2.line, *$2.string, $3, *$5.string, $5.line, $7, $6.line);
+ ES3_ONLY(getQualifierString($1.qualifier), @1, "interface blocks");
+ $$ = context->addInterfaceBlock($1, @2, *$2.string, $3, *$5.string, @5, $7, @6);
}
| type_qualifier SEMICOLON {
context->parseGlobalLayoutQualifier($1);
@@ -834,12 +851,12 @@
TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find($1->getMangledName(), context->shaderVersion));
if (prevDec) {
if (prevDec->getReturnType() != $1->getReturnType()) {
- context->error($2.line, "overloaded functions must have the same return type", $1->getReturnType().getBasicString());
+ context->error(@2, "overloaded functions must have the same return type", $1->getReturnType().getBasicString());
context->recover();
}
for (size_t i = 0; i < prevDec->getParamCount(); ++i) {
if (prevDec->getParam(i).type->getQualifier() != $1->getParam(i).type->getQualifier()) {
- context->error($2.line, "overloaded functions must have the same parameter qualifiers", $1->getParam(i).type->getQualifierString());
+ context->error(@2, "overloaded functions must have the same parameter qualifiers", $1->getParam(i).type->getQualifierString());
context->recover();
}
}
@@ -851,7 +868,6 @@
// being redeclared. So, pass back up this declaration, not the one in the symbol table.
//
$$.function = $1;
- $$.line = $2.line;
// We're at the inner scope level of the function's arguments and body statement.
// Add the function prototype to the surrounding scope instead.
@@ -887,7 +903,7 @@
//
// This parameter > first is void
//
- context->error($2.line, "cannot be an argument type except for '(void)'", "void");
+ context->error(@2, "cannot be an argument type except for '(void)'", "void");
context->recover();
delete $3.param.type;
} else {
@@ -901,11 +917,11 @@
function_header
: fully_specified_type IDENTIFIER LEFT_PAREN {
if ($1.qualifier != EvqGlobal && $1.qualifier != EvqTemporary) {
- context->error($2.line, "no qualifiers allowed for function return", getQualifierString($1.qualifier));
+ context->error(@2, "no qualifiers allowed for function return", getQualifierString($1.qualifier));
context->recover();
}
// make sure a sampler is not involved as well...
- if (context->structQualifierErrorCheck($2.line, $1))
+ if (context->structQualifierErrorCheck(@2, $1))
context->recover();
// Add the function as a prototype after parsing it (we do not support recursion)
@@ -922,31 +938,29 @@
// Type + name
: type_specifier identifier {
if ($1.type == EbtVoid) {
- context->error($2.line, "illegal use of type 'void'", $2.string->c_str());
+ context->error(@2, "illegal use of type 'void'", $2.string->c_str());
context->recover();
}
- if (context->reservedErrorCheck($2.line, *$2.string))
+ if (context->reservedErrorCheck(@2, *$2.string))
context->recover();
TParameter param = {$2.string, new TType($1)};
- $$.line = $2.line;
$$.param = param;
}
| type_specifier identifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
// Check that we can make an array out of this type
- if (context->arrayTypeErrorCheck($3.line, $1))
+ if (context->arrayTypeErrorCheck(@3, $1))
context->recover();
- if (context->reservedErrorCheck($2.line, *$2.string))
+ if (context->reservedErrorCheck(@2, *$2.string))
context->recover();
int size;
- if (context->arraySizeErrorCheck($3.line, $4, size))
+ if (context->arraySizeErrorCheck(@3, $4, size))
context->recover();
$1.setArray(true, size);
TType* type = new TType($1);
TParameter param = { $2.string, type };
- $$.line = $2.line;
$$.param = param;
}
;
@@ -962,14 +976,14 @@
//
: parameter_type_qualifier parameter_qualifier parameter_declarator {
$$ = $3;
- if (context->paramErrorCheck($3.line, $1, $2, $$.param.type))
+ if (context->paramErrorCheck(@3, $1, $2, $$.param.type))
context->recover();
}
| parameter_qualifier parameter_declarator {
$$ = $2;
- if (context->parameterSamplerErrorCheck($2.line, $1, *$2.param.type))
+ if (context->parameterSamplerErrorCheck(@2, $1, *$2.param.type))
context->recover();
- if (context->paramErrorCheck($2.line, EvqTemporary, $1, $$.param.type))
+ if (context->paramErrorCheck(@2, EvqTemporary, $1, $$.param.type))
context->recover();
}
//
@@ -977,14 +991,14 @@
//
| parameter_type_qualifier parameter_qualifier parameter_type_specifier {
$$ = $3;
- if (context->paramErrorCheck($3.line, $1, $2, $$.param.type))
+ if (context->paramErrorCheck(@3, $1, $2, $$.param.type))
context->recover();
}
| parameter_qualifier parameter_type_specifier {
$$ = $2;
- if (context->parameterSamplerErrorCheck($2.line, $1, *$2.param.type))
+ if (context->parameterSamplerErrorCheck(@2, $1, *$2.param.type))
context->recover();
- if (context->paramErrorCheck($2.line, EvqTemporary, $1, $$.param.type))
+ if (context->paramErrorCheck(@2, EvqTemporary, $1, $$.param.type))
context->recover();
}
;
@@ -1017,62 +1031,62 @@
}
| init_declarator_list COMMA identifier {
$$ = $1;
- $$.intermAggregate = context->parseDeclarator($$.type, $1.intermAggregate, $3.symbol, $3.line, *$3.string);
+ $$.intermAggregate = context->parseDeclarator($$.type, $1.intermAggregate, $3.symbol, @3, *$3.string);
}
| init_declarator_list COMMA identifier LEFT_BRACKET RIGHT_BRACKET {
$$ = $1;
- context->parseArrayDeclarator($$.type, $3.line, *$3.string, $4.line, NULL, NULL);
+ context->parseArrayDeclarator($$.type, @3, *$3.string, @4, NULL, NULL);
}
| init_declarator_list COMMA identifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
$$ = $1;
- $$.intermAggregate = context->parseArrayDeclarator($$.type, $3.line, *$3.string, $4.line, $1.intermNode, $5);
+ $$.intermAggregate = context->parseArrayDeclarator($$.type, @3, *$3.string, @4, $1.intermNode, $5);
}
| init_declarator_list COMMA identifier EQUAL initializer {
$$ = $1;
- $$.intermAggregate = context->parseInitDeclarator($$.type, $1.intermAggregate, $3.line, *$3.string, $4.line, $5);
+ $$.intermAggregate = context->parseInitDeclarator($$.type, $1.intermAggregate, @3, *$3.string, @4, $5);
}
;
single_declaration
: fully_specified_type {
$$.type = $1;
- $$.intermAggregate = context->parseSingleDeclaration($$.type, $1.line, "");
+ $$.intermAggregate = context->parseSingleDeclaration($$.type, @1, "");
}
| fully_specified_type identifier {
$$.type = $1;
- $$.intermAggregate = context->parseSingleDeclaration($$.type, $2.line, *$2.string);
+ $$.intermAggregate = context->parseSingleDeclaration($$.type, @2, *$2.string);
}
| fully_specified_type identifier LEFT_BRACKET RIGHT_BRACKET {
- context->error($2.line, "unsized array declarations not supported", $2.string->c_str());
+ context->error(@2, "unsized array declarations not supported", $2.string->c_str());
context->recover();
$$.type = $1;
- $$.intermAggregate = context->parseSingleDeclaration($$.type, $2.line, *$2.string);
+ $$.intermAggregate = context->parseSingleDeclaration($$.type, @2, *$2.string);
}
| fully_specified_type identifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
$$.type = $1;
- $$.intermAggregate = context->parseSingleArrayDeclaration($$.type, $2.line, *$2.string, $3.line, $4);
+ $$.intermAggregate = context->parseSingleArrayDeclaration($$.type, @2, *$2.string, @3, $4);
}
| fully_specified_type identifier EQUAL initializer {
$$.type = $1;
- $$.intermAggregate = context->parseSingleInitDeclaration($$.type, $2.line, *$2.string, $3.line, $4);
+ $$.intermAggregate = context->parseSingleInitDeclaration($$.type, @2, *$2.string, @3, $4);
}
| INVARIANT IDENTIFIER {
- VERTEX_ONLY("invariant declaration", $1.line);
- if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "invariant varying"))
+ VERTEX_ONLY("invariant declaration", @1);
+ if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "invariant varying"))
context->recover();
- $$.type.setBasic(EbtInvariant, EvqInvariantVaryingOut, $2.line);
+ $$.type.setBasic(EbtInvariant, EvqInvariantVaryingOut, @2);
if (!$2.symbol)
{
- context->error($2.line, "undeclared identifier declared as invariant", $2.string->c_str());
+ context->error(@2, "undeclared identifier declared as invariant", $2.string->c_str());
context->recover();
$$.intermAggregate = 0;
}
else
{
- TIntermSymbol *symbol = context->intermediate.addSymbol(0, *$2.string, TType($$.type), $2.line);
- $$.intermAggregate = context->intermediate.makeAggregate(symbol, $2.line);
+ TIntermSymbol *symbol = context->intermediate.addSymbol(0, *$2.string, TType($$.type), @2);
+ $$.intermAggregate = context->intermediate.makeAggregate(symbol, @2);
}
}
@@ -1098,15 +1112,15 @@
//
//input_or_output
// : INPUT {
-// if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "input"))
+// if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "input"))
// context->recover();
-// UNPACK_ONLY("input", $1.line);
+// UNPACK_ONLY("input", @1);
// $$.qualifier = EvqInput;
// }
// | OUTPUT {
-// if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "output"))
+// if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "output"))
// context->recover();
-// PACK_ONLY("output", $1.line);
+// PACK_ONLY("output", @1);
// $$.qualifier = EvqOutput;
// }
// ;
@@ -1134,11 +1148,11 @@
//
//buffer_declaration
// : type_specifier IDENTIFIER COLON constant_expression SEMICOLON {
-// if (context->reservedErrorCheck($2.line, *$2.string, context))
+// if (context->reservedErrorCheck(@2, *$2.string, context))
// context->recover();
// $$.variable = new TVariable($2.string, $1);
// if (! context->symbolTable.declare(*$$.variable)) {
-// context->error($2.line, "redefinition", $$.variable->getName().c_str());
+// context->error(@2, "redefinition", $$.variable->getName().c_str());
// context->recover();
// // don't have to delete $$.variable, the pool pop will take care of it
// }
@@ -1150,7 +1164,7 @@
$$ = $1;
if ($1.array) {
- context->error($1.line, "not supported", "first-class array");
+ context->error(@1, "not supported", "first-class array");
context->recover();
$1.setArray(false);
}
@@ -1163,11 +1177,9 @@
interpolation_qualifier
: SMOOTH {
$$.qualifier = EvqSmooth;
- $$.line = $1.line;
}
| FLAT {
$$.qualifier = EvqFlat;
- $$.line = $1.line;
}
;
@@ -1179,82 +1191,82 @@
type_qualifier
: ATTRIBUTE {
- VERTEX_ONLY("attribute", $1.line);
- ES2_ONLY("attribute", $1.line);
- if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "attribute"))
+ VERTEX_ONLY("attribute", @1);
+ ES2_ONLY("attribute", @1);
+ if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "attribute"))
context->recover();
- $$.setBasic(EbtVoid, EvqAttribute, $1.line);
+ $$.setBasic(EbtVoid, EvqAttribute, @1);
}
| VARYING {
- ES2_ONLY("varying", $1.line);
- if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "varying"))
+ ES2_ONLY("varying", @1);
+ if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "varying"))
context->recover();
if (context->shaderType == SH_VERTEX_SHADER)
- $$.setBasic(EbtVoid, EvqVaryingOut, $1.line);
+ $$.setBasic(EbtVoid, EvqVaryingOut, @1);
else
- $$.setBasic(EbtVoid, EvqVaryingIn, $1.line);
+ $$.setBasic(EbtVoid, EvqVaryingIn, @1);
}
| INVARIANT VARYING {
- ES2_ONLY("varying", $1.line);
- if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "invariant varying"))
+ ES2_ONLY("varying", @1);
+ if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "invariant varying"))
context->recover();
if (context->shaderType == SH_VERTEX_SHADER)
- $$.setBasic(EbtVoid, EvqInvariantVaryingOut, $1.line);
+ $$.setBasic(EbtVoid, EvqInvariantVaryingOut, @1);
else
- $$.setBasic(EbtVoid, EvqInvariantVaryingIn, $1.line);
+ $$.setBasic(EbtVoid, EvqInvariantVaryingIn, @1);
}
| storage_qualifier {
- $$.setBasic(EbtVoid, $1.qualifier, $1.line);
+ $$.setBasic(EbtVoid, $1.qualifier, @1);
}
| interpolation_qualifier storage_qualifier {
if ($2.qualifier == EvqSmoothIn) {
if ($1.qualifier == EvqSmooth)
- $$.setBasic(EbtVoid, EvqSmoothIn, $2.line);
+ $$.setBasic(EbtVoid, EvqSmoothIn, @2);
else if ($1.qualifier == EvqFlat)
- $$.setBasic(EbtVoid, EvqFlatIn, $2.line);
+ $$.setBasic(EbtVoid, EvqFlatIn, @2);
else UNREACHABLE();
}
else if ($2.qualifier == EvqCentroidIn) {
if ($1.qualifier == EvqSmooth)
- $$.setBasic(EbtVoid, EvqCentroidIn, $2.line);
+ $$.setBasic(EbtVoid, EvqCentroidIn, @2);
else if ($1.qualifier == EvqFlat)
- $$.setBasic(EbtVoid, EvqFlatIn, $2.line);
+ $$.setBasic(EbtVoid, EvqFlatIn, @2);
else UNREACHABLE();
}
else if ($2.qualifier == EvqSmoothOut) {
if ($1.qualifier == EvqSmooth)
- $$.setBasic(EbtVoid, EvqSmoothOut, $2.line);
+ $$.setBasic(EbtVoid, EvqSmoothOut, @2);
else if ($1.qualifier == EvqFlat)
- $$.setBasic(EbtVoid, EvqFlatOut, $2.line);
+ $$.setBasic(EbtVoid, EvqFlatOut, @2);
else UNREACHABLE();
}
else if ($2.qualifier == EvqCentroidOut) {
if ($1.qualifier == EvqSmooth)
- $$.setBasic(EbtVoid, EvqCentroidOut, $2.line);
+ $$.setBasic(EbtVoid, EvqCentroidOut, @2);
else if ($1.qualifier == EvqFlat)
- $$.setBasic(EbtVoid, EvqFlatOut, $2.line);
+ $$.setBasic(EbtVoid, EvqFlatOut, @2);
else UNREACHABLE();
}
else {
- context->error($1.line, "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getInterpolationString($1.qualifier));
+ context->error(@1, "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getInterpolationString($1.qualifier));
context->recover();
- $$.setBasic(EbtVoid, $2.qualifier, $2.line);
+ $$.setBasic(EbtVoid, $2.qualifier, @2);
}
}
| interpolation_qualifier {
- context->error($1.line, "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getInterpolationString($1.qualifier));
+ context->error(@1, "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getInterpolationString($1.qualifier));
context->recover();
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtVoid, qual, $1.line);
+ $$.setBasic(EbtVoid, qual, @1);
}
| layout_qualifier {
$$.qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.layoutQualifier = $1;
}
| layout_qualifier storage_qualifier {
- $$.setBasic(EbtVoid, $2.qualifier, $2.line);
+ $$.setBasic(EbtVoid, $2.qualifier, @2);
$$.layoutQualifier = $1;
}
;
@@ -1262,43 +1274,37 @@
storage_qualifier
: CONST_QUAL {
$$.qualifier = EvqConst;
- $$.line = $1.line;
}
| IN_QUAL {
- ES3_ONLY("in", $1.line, "storage qualifier");
+ ES3_ONLY("in", @1, "storage qualifier");
$$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqSmoothIn : EvqVertexInput;
- $$.line = $1.line;
}
| OUT_QUAL {
- ES3_ONLY("out", $1.line, "storage qualifier");
+ ES3_ONLY("out", @1, "storage qualifier");
$$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOutput : EvqSmoothOut;
- $$.line = $1.line;
}
| CENTROID IN_QUAL {
- ES3_ONLY("centroid in", $1.line, "storage qualifier");
+ ES3_ONLY("centroid in", @1, "storage qualifier");
if (context->shaderType == SH_VERTEX_SHADER)
{
- context->error($1.line, "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader");
+ context->error(@1, "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader");
context->recover();
}
$$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexInput;
- $$.line = $1.line;
}
| CENTROID OUT_QUAL {
- ES3_ONLY("centroid out", $1.line, "storage qualifier");
+ ES3_ONLY("centroid out", @1, "storage qualifier");
if (context->shaderType == SH_FRAGMENT_SHADER)
{
- context->error($1.line, "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader");
+ context->error(@1, "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader");
context->recover();
}
$$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOutput : EvqCentroidOut;
- $$.line = $1.line;
}
| UNIFORM {
- if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "uniform"))
+ if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "uniform"))
context->recover();
$$.qualifier = EvqUniform;
- $$.line = $1.line;
}
;
@@ -1308,7 +1314,7 @@
if ($$.precision == EbpUndefined) {
$$.precision = context->symbolTable.getDefaultPrecision($1.type);
- if (context->precisionErrorCheck($1.line, $$.precision, $1.type)) {
+ if (context->precisionErrorCheck(@1, $$.precision, $1.type)) {
context->recover();
}
}
@@ -1333,7 +1339,7 @@
layout_qualifier
: LAYOUT LEFT_PAREN layout_qualifier_id_list RIGHT_PAREN {
- ES3_ONLY("layout", $1.line, "qualifier");
+ ES3_ONLY("layout", @1, "qualifier");
$$ = $3;
}
;
@@ -1349,13 +1355,13 @@
layout_qualifier_id
: IDENTIFIER {
- $$ = context->parseLayoutQualifier(*$1.string, $1.line);
+ $$ = context->parseLayoutQualifier(*$1.string, @1);
}
| IDENTIFIER EQUAL INTCONSTANT {
- $$ = context->parseLayoutQualifier(*$1.string, $1.line, *$3.string, $3.i, $3.line);
+ $$ = context->parseLayoutQualifier(*$1.string, @1, *$3.string, $3.i, @3);
}
| IDENTIFIER EQUAL UINTCONSTANT {
- $$ = context->parseLayoutQualifier(*$1.string, $1.line, *$3.string, $3.i, $3.line);
+ $$ = context->parseLayoutQualifier(*$1.string, @1, *$3.string, $3.i, @3);
}
;
@@ -1366,11 +1372,11 @@
| type_specifier_nonarray LEFT_BRACKET constant_expression RIGHT_BRACKET {
$$ = $1;
- if (context->arrayTypeErrorCheck($2.line, $1))
+ if (context->arrayTypeErrorCheck(@2, $1))
context->recover();
else {
int size;
- if (context->arraySizeErrorCheck($2.line, $3, size))
+ if (context->arraySizeErrorCheck(@2, $3, size))
context->recover();
$$.setArray(true, size);
}
@@ -1380,202 +1386,202 @@
type_specifier_nonarray
: VOID_TYPE {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtVoid, qual, $1.line);
+ $$.setBasic(EbtVoid, qual, @1);
}
| FLOAT_TYPE {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, $1.line);
+ $$.setBasic(EbtFloat, qual, @1);
}
| INT_TYPE {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtInt, qual, $1.line);
+ $$.setBasic(EbtInt, qual, @1);
}
| UINT_TYPE {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtUInt, qual, $1.line);
+ $$.setBasic(EbtUInt, qual, @1);
}
| BOOL_TYPE {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtBool, qual, $1.line);
+ $$.setBasic(EbtBool, qual, @1);
}
| VEC2 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, $1.line);
+ $$.setBasic(EbtFloat, qual, @1);
$$.setAggregate(2);
}
| VEC3 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, $1.line);
+ $$.setBasic(EbtFloat, qual, @1);
$$.setAggregate(3);
}
| VEC4 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, $1.line);
+ $$.setBasic(EbtFloat, qual, @1);
$$.setAggregate(4);
}
| BVEC2 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtBool, qual, $1.line);
+ $$.setBasic(EbtBool, qual, @1);
$$.setAggregate(2);
}
| BVEC3 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtBool, qual, $1.line);
+ $$.setBasic(EbtBool, qual, @1);
$$.setAggregate(3);
}
| BVEC4 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtBool, qual, $1.line);
+ $$.setBasic(EbtBool, qual, @1);
$$.setAggregate(4);
}
| IVEC2 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtInt, qual, $1.line);
+ $$.setBasic(EbtInt, qual, @1);
$$.setAggregate(2);
}
| IVEC3 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtInt, qual, $1.line);
+ $$.setBasic(EbtInt, qual, @1);
$$.setAggregate(3);
}
| IVEC4 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtInt, qual, $1.line);
+ $$.setBasic(EbtInt, qual, @1);
$$.setAggregate(4);
}
| UVEC2 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtUInt, qual, $1.line);
+ $$.setBasic(EbtUInt, qual, @1);
$$.setAggregate(2);
}
| UVEC3 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtUInt, qual, $1.line);
+ $$.setBasic(EbtUInt, qual, @1);
$$.setAggregate(3);
}
| UVEC4 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtUInt, qual, $1.line);
+ $$.setBasic(EbtUInt, qual, @1);
$$.setAggregate(4);
}
| MATRIX2 {
- FRAG_VERT_ONLY("mat2", $1.line);
+ FRAG_VERT_ONLY("mat2", @1);
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, $1.line);
+ $$.setBasic(EbtFloat, qual, @1);
$$.setMatrix(2, 2);
}
| MATRIX3 {
- FRAG_VERT_ONLY("mat3", $1.line);
+ FRAG_VERT_ONLY("mat3", @1);
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, $1.line);
+ $$.setBasic(EbtFloat, qual, @1);
$$.setMatrix(3, 3);
}
| MATRIX4 {
- FRAG_VERT_ONLY("mat4", $1.line);
+ FRAG_VERT_ONLY("mat4", @1);
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, $1.line);
+ $$.setBasic(EbtFloat, qual, @1);
$$.setMatrix(4, 4);
}
| MATRIX2x3 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, $1.line);
+ $$.setBasic(EbtFloat, qual, @1);
$$.setMatrix(2, 3);
}
| MATRIX3x2 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, $1.line);
+ $$.setBasic(EbtFloat, qual, @1);
$$.setMatrix(3, 2);
}
| MATRIX2x4 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, $1.line);
+ $$.setBasic(EbtFloat, qual, @1);
$$.setMatrix(2, 4);
}
| MATRIX4x2 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, $1.line);
+ $$.setBasic(EbtFloat, qual, @1);
$$.setMatrix(4, 2);
}
| MATRIX3x4 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, $1.line);
+ $$.setBasic(EbtFloat, qual, @1);
$$.setMatrix(3, 4);
}
| MATRIX4x3 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, $1.line);
+ $$.setBasic(EbtFloat, qual, @1);
$$.setMatrix(4, 3);
}
| SAMPLER2D {
- FRAG_VERT_ONLY("sampler2D", $1.line);
+ FRAG_VERT_ONLY("sampler2D", @1);
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtSampler2D, qual, $1.line);
+ $$.setBasic(EbtSampler2D, qual, @1);
}
| SAMPLER3D {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtSampler3D, qual, $1.line);
+ $$.setBasic(EbtSampler3D, qual, @1);
}
| SAMPLERCUBE {
- FRAG_VERT_ONLY("samplerCube", $1.line);
+ FRAG_VERT_ONLY("samplerCube", @1);
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtSamplerCube, qual, $1.line);
+ $$.setBasic(EbtSamplerCube, qual, @1);
}
| SAMPLER2DARRAY {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtSampler2DArray, qual, $1.line);
+ $$.setBasic(EbtSampler2DArray, qual, @1);
}
| ISAMPLER2D {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtISampler2D, qual, $1.line);
+ $$.setBasic(EbtISampler2D, qual, @1);
}
| ISAMPLER3D {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtISampler3D, qual, $1.line);
+ $$.setBasic(EbtISampler3D, qual, @1);
}
| ISAMPLERCUBE {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtISamplerCube, qual, $1.line);
+ $$.setBasic(EbtISamplerCube, qual, @1);
}
| ISAMPLER2DARRAY {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtISampler2DArray, qual, $1.line);
+ $$.setBasic(EbtISampler2DArray, qual, @1);
}
| USAMPLER2D {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtUSampler2D, qual, $1.line);
+ $$.setBasic(EbtUSampler2D, qual, @1);
}
| USAMPLER3D {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtUSampler3D, qual, $1.line);
+ $$.setBasic(EbtUSampler3D, qual, @1);
}
| USAMPLERCUBE {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtUSamplerCube, qual, $1.line);
+ $$.setBasic(EbtUSamplerCube, qual, @1);
}
| USAMPLER2DARRAY {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtUSampler2DArray, qual, $1.line);
+ $$.setBasic(EbtUSampler2DArray, qual, @1);
}
| SAMPLER_EXTERNAL_OES {
if (!context->supportsExtension("GL_OES_EGL_image_external")) {
- context->error($1.line, "unsupported type", "samplerExternalOES");
+ context->error(@1, "unsupported type", "samplerExternalOES");
context->recover();
}
- FRAG_VERT_ONLY("samplerExternalOES", $1.line);
+ FRAG_VERT_ONLY("samplerExternalOES", @1);
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtSamplerExternalOES, qual, $1.line);
+ $$.setBasic(EbtSamplerExternalOES, qual, @1);
}
| SAMPLER2DRECT {
if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
- context->error($1.line, "unsupported type", "sampler2DRect");
+ context->error(@1, "unsupported type", "sampler2DRect");
context->recover();
}
- FRAG_VERT_ONLY("sampler2DRect", $1.line);
+ FRAG_VERT_ONLY("sampler2DRect", @1);
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtSampler2DRect, qual, $1.line);
+ $$.setBasic(EbtSampler2DRect, qual, @1);
}
| struct_specifier {
- FRAG_VERT_ONLY("struct", $1.line);
+ FRAG_VERT_ONLY("struct", @1);
$$ = $1;
$$.qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
}
@@ -1586,17 +1592,17 @@
//
TType& structure = static_cast<TVariable*>($1.symbol)->getType();
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtStruct, qual, $1.line);
+ $$.setBasic(EbtStruct, qual, @1);
$$.userDef = &structure;
}
;
struct_specifier
- : STRUCT identifier LEFT_BRACE { if (context->enterStructDeclaration($2.line, *$2.string)) context->recover(); } struct_declaration_list RIGHT_BRACE {
- $$ = context->addStructure($1.line, $2.line, *$2.string, $5);
+ : STRUCT identifier LEFT_BRACE { if (context->enterStructDeclaration(@2, *$2.string)) context->recover(); } struct_declaration_list RIGHT_BRACE {
+ $$ = context->addStructure(@1, @2, *$2.string, $5);
}
- | STRUCT LEFT_BRACE { if (context->enterStructDeclaration($2.line, *$2.string)) context->recover(); } struct_declaration_list RIGHT_BRACE {
- $$ = context->addStructure($1.line, 0, "", $4);
+ | STRUCT LEFT_BRACE { if (context->enterStructDeclaration(@2, *$2.string)) context->recover(); } struct_declaration_list RIGHT_BRACE {
+ $$ = context->addStructure(@1, @$, "", $4);
}
;
@@ -1642,23 +1648,21 @@
struct_declarator
: identifier {
- if (context->reservedErrorCheck($1.line, *$1.string))
+ if (context->reservedErrorCheck(@1, *$1.string))
context->recover();
$$.type = new TType(EbtVoid, EbpUndefined);
- $$.line = $1.line;
$$.type->setFieldName(*$1.string);
}
| identifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
- if (context->reservedErrorCheck($1.line, *$1.string))
+ if (context->reservedErrorCheck(@1, *$1.string))
context->recover();
$$.type = new TType(EbtVoid, EbpUndefined);
- $$.line = $1.line;
$$.type->setFieldName(*$1.string);
int size;
- if (context->arraySizeErrorCheck($2.line, $3, size))
+ if (context->arraySizeErrorCheck(@2, $3, size))
context->recover();
$$.type->setArraySize(size);
}
@@ -1692,7 +1696,7 @@
| LEFT_BRACE { context->symbolTable.push(); } statement_list { context->symbolTable.pop(); } RIGHT_BRACE {
if ($3 != 0) {
$3->setOp(EOpSequence);
- $3->setEndLine($5.line);
+ $3->setLine(@$);
}
$$ = $3;
}
@@ -1716,7 +1720,7 @@
| LEFT_BRACE statement_list RIGHT_BRACE {
if ($2) {
$2->setOp(EOpSequence);
- $2->setEndLine($3.line);
+ $2->setLine(@$);
}
$$ = $2;
}
@@ -1724,10 +1728,10 @@
statement_list
: statement {
- $$ = context->intermediate.makeAggregate($1, 0);
+ $$ = context->intermediate.makeAggregate($1, @$);
}
| statement_list statement {
- $$ = context->intermediate.growAggregate($1, $2, 0);
+ $$ = context->intermediate.growAggregate($1, $2, @$);
}
;
@@ -1738,9 +1742,9 @@
selection_statement
: IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement {
- if (context->boolErrorCheck($1.line, $3))
+ if (context->boolErrorCheck(@1, $3))
context->recover();
- $$ = context->intermediate.addSelection($3, $5, $1.line);
+ $$ = context->intermediate.addSelection($3, $5, @1);
}
;
@@ -1766,12 +1770,12 @@
}
| fully_specified_type identifier EQUAL initializer {
TIntermNode* intermNode;
- if (context->structQualifierErrorCheck($2.line, $1))
+ if (context->structQualifierErrorCheck(@2, $1))
context->recover();
- if (context->boolErrorCheck($2.line, $1))
+ if (context->boolErrorCheck(@2, $1))
context->recover();
- if (!context->executeInitializer($2.line, *$2.string, $1, $4, intermNode))
+ if (!context->executeInitializer(@2, *$2.string, $1, $4, intermNode))
$$ = $4;
else {
context->recover();
@@ -1783,19 +1787,19 @@
iteration_statement
: WHILE LEFT_PAREN { context->symbolTable.push(); ++context->loopNestingLevel; } condition RIGHT_PAREN statement_no_new_scope {
context->symbolTable.pop();
- $$ = context->intermediate.addLoop(ELoopWhile, 0, $4, 0, $6, $1.line);
+ $$ = context->intermediate.addLoop(ELoopWhile, 0, $4, 0, $6, @1);
--context->loopNestingLevel;
}
| DO { ++context->loopNestingLevel; } statement_with_scope WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON {
- if (context->boolErrorCheck($8.line, $6))
+ if (context->boolErrorCheck(@8, $6))
context->recover();
- $$ = context->intermediate.addLoop(ELoopDoWhile, 0, $6, 0, $3, $4.line);
+ $$ = context->intermediate.addLoop(ELoopDoWhile, 0, $6, 0, $3, @4);
--context->loopNestingLevel;
}
| FOR LEFT_PAREN { context->symbolTable.push(); ++context->loopNestingLevel; } for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope {
context->symbolTable.pop();
- $$ = context->intermediate.addLoop(ELoopFor, $4, reinterpret_cast<TIntermTyped*>($5.node1), reinterpret_cast<TIntermTyped*>($5.node2), $7, $1.line);
+ $$ = context->intermediate.addLoop(ELoopFor, $4, reinterpret_cast<TIntermTyped*>($5.node1), reinterpret_cast<TIntermTyped*>($5.node2), $7, @1);
--context->loopNestingLevel;
}
;
@@ -1832,39 +1836,39 @@
jump_statement
: CONTINUE SEMICOLON {
if (context->loopNestingLevel <= 0) {
- context->error($1.line, "continue statement only allowed in loops", "");
+ context->error(@1, "continue statement only allowed in loops", "");
context->recover();
}
- $$ = context->intermediate.addBranch(EOpContinue, $1.line);
+ $$ = context->intermediate.addBranch(EOpContinue, @1);
}
| BREAK SEMICOLON {
if (context->loopNestingLevel <= 0) {
- context->error($1.line, "break statement only allowed in loops", "");
+ context->error(@1, "break statement only allowed in loops", "");
context->recover();
}
- $$ = context->intermediate.addBranch(EOpBreak, $1.line);
+ $$ = context->intermediate.addBranch(EOpBreak, @1);
}
| RETURN SEMICOLON {
- $$ = context->intermediate.addBranch(EOpReturn, $1.line);
+ $$ = context->intermediate.addBranch(EOpReturn, @1);
if (context->currentFunctionType->getBasicType() != EbtVoid) {
- context->error($1.line, "non-void function must return a value", "return");
+ context->error(@1, "non-void function must return a value", "return");
context->recover();
}
}
| RETURN expression SEMICOLON {
- $$ = context->intermediate.addBranch(EOpReturn, $2, $1.line);
+ $$ = context->intermediate.addBranch(EOpReturn, $2, @1);
context->functionReturnsValue = true;
if (context->currentFunctionType->getBasicType() == EbtVoid) {
- context->error($1.line, "void function cannot return a value", "return");
+ context->error(@1, "void function cannot return a value", "return");
context->recover();
} else if (*(context->currentFunctionType) != $2->getType()) {
- context->error($1.line, "function return is not matching type:", "return");
+ context->error(@1, "function return is not matching type:", "return");
context->recover();
}
}
| DISCARD SEMICOLON {
- FRAG_ONLY("discard", $1.line);
- $$ = context->intermediate.addBranch(EOpKill, $1.line);
+ FRAG_ONLY("discard", @1);
+ $$ = context->intermediate.addBranch(EOpKill, @1);
}
;
@@ -1876,7 +1880,7 @@
context->treeRoot = $$;
}
| translation_unit external_declaration {
- $$ = context->intermediate.growAggregate($1, $2, 0);
+ $$ = context->intermediate.growAggregate($1, $2, @$);
context->treeRoot = $$;
}
;
@@ -1898,7 +1902,7 @@
if (builtIn)
{
- context->error($1.line, "built-in functions cannot be redefined", function->getName().c_str());
+ context->error(@1, "built-in functions cannot be redefined", function->getName().c_str());
context->recover();
}
@@ -1912,7 +1916,7 @@
//
// Then this function already has a body.
//
- context->error($1.line, "function already has a body", function->getName().c_str());
+ context->error(@1, "function already has a body", function->getName().c_str());
context->recover();
}
prevDec->setDefined();
@@ -1922,11 +1926,11 @@
//
if (function->getName() == "main") {
if (function->getParamCount() > 0) {
- context->error($1.line, "function cannot take any parameter(s)", function->getName().c_str());
+ context->error(@1, "function cannot take any parameter(s)", function->getName().c_str());
context->recover();
}
if (function->getReturnType().getBasicType() != EbtVoid) {
- context->error($1.line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
+ context->error(@1, "", function->getReturnType().getBasicString(), "main function cannot return a value");
context->recover();
}
}
@@ -1954,7 +1958,7 @@
// Insert the parameters with name in the symbol table.
//
if (! context->symbolTable.declare(*variable)) {
- context->error($1.line, "redefinition", variable->getName().c_str());
+ context->error(@1, "redefinition", variable->getName().c_str());
context->recover();
delete variable;
}
@@ -1966,13 +1970,13 @@
paramNodes,
context->intermediate.addSymbol(variable->getUniqueId(),
variable->getName(),
- variable->getType(), $1.line),
- $1.line);
+ variable->getType(), @1),
+ @1);
} else {
- paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, $1.line), $1.line);
+ paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, @1), @1);
}
}
- context->intermediate.setAggregateOperator(paramNodes, EOpParameters, $1.line);
+ context->intermediate.setAggregateOperator(paramNodes, EOpParameters, @1);
$1.intermAggregate = paramNodes;
context->loopNestingLevel = 0;
}
@@ -1980,12 +1984,12 @@
//?? Check that all paths return a value if return type != void ?
// May be best done as post process phase on intermediate code
if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
- context->error($1.line, "function does not return a value:", "", $1.function->getName().c_str());
+ context->error(@1, "function does not return a value:", "", $1.function->getName().c_str());
context->recover();
}
- $$ = context->intermediate.growAggregate($1.intermAggregate, $3, 0);
- context->intermediate.setAggregateOperator($$, EOpFunction, $1.line);
+ $$ = context->intermediate.growAggregate($1.intermAggregate, $3, @$);
+ context->intermediate.setAggregateOperator($$, EOpFunction, @1);
$$->getAsAggregate()->setName($1.function->getMangledName().c_str());
$$->getAsAggregate()->setType($1.function->getReturnType());
@@ -1994,15 +1998,17 @@
$$->getAsAggregate()->setOptimize(context->pragma().optimize);
$$->getAsAggregate()->setDebug(context->pragma().debug);
- if ($3 && $3->getAsAggregate())
- $$->getAsAggregate()->setEndLine($3->getAsAggregate()->getEndLine());
-
context->symbolTable.pop();
}
;
%%
+void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason) {
+ context->error(*yylloc, reason, "");
+ context->recover();
+}
+
int glslang_parse(TParseContext* context) {
return yyparse(context);
}
diff --git a/src/compiler/glslang_lex.cpp b/src/compiler/glslang_lex.cpp
index 45e17f5..6579db0 100644
--- a/src/compiler/glslang_lex.cpp
+++ b/src/compiler/glslang_lex.cpp
@@ -994,7 +994,10 @@
#pragma warning(disable : 4102)
#endif
-#define YY_USER_ACTION yylval->lex.line = yylineno;
+#define YY_USER_ACTION \
+ yylloc->first_file = yylloc->last_file = yycolumn; \
+ yylloc->first_line = yylloc->last_line = yylineno;
+
#define YY_INPUT(buf, result, max_size) \
result = string_input(buf, max_size, yyscanner);
@@ -1045,6 +1048,8 @@
YYSTYPE * yylval_r;
+ YYLTYPE * yylloc_r;
+
}; /* end struct yyguts_t */
static int yy_init_globals (yyscan_t yyscanner );
@@ -1053,6 +1058,8 @@
* from bison output in section 1.*/
# define yylval yyg->yylval_r
+ # define yylloc yyg->yylloc_r
+
int yylex_init (yyscan_t* scanner);
int yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
@@ -1090,6 +1097,10 @@
void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
+ YYLTYPE *yyget_lloc (yyscan_t yyscanner );
+
+ void yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
+
/* Macros after this point can all be overridden by user definitions in
* section 1.
*/
@@ -1196,10 +1207,10 @@
#define YY_DECL_IS_OURS 1
extern int yylex \
- (YYSTYPE * yylval_param ,yyscan_t yyscanner);
+ (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
#define YY_DECL int yylex \
- (YYSTYPE * yylval_param , yyscan_t yyscanner)
+ (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
#endif /* !YY_DECL */
/* Code executed at the beginning of each rule, after yytext and yyleng
@@ -1230,6 +1241,8 @@
yylval = yylval_param;
+ yylloc = yylloc_param;
+
if ( !yyg->yy_init )
{
yyg->yy_init = 1;
@@ -2952,6 +2965,18 @@
yylval = yylval_param;
}
+YYLTYPE *yyget_lloc (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yylloc;
+}
+
+void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ yylloc = yylloc_param;
+}
+
/* User-visible API */
/* yylex_init is special because it creates the scanner itself, so it is
@@ -3133,7 +3158,8 @@
yy_size_t len = token.type == pp::Token::LAST ? 0 : token.text.size();
if (len < max_size)
memcpy(buf, token.text.c_str(), len);
- yyset_lineno(EncodeSourceLoc(token.location.file, token.location.line),yyscanner);
+ yyset_column(token.location.file,yyscanner);
+ yyset_lineno(token.location.line,yyscanner);
if (len >= max_size)
YY_FATAL_ERROR("Input buffer overflow");
@@ -3160,7 +3186,7 @@
int reserved_word(yyscan_t yyscanner) {
struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
- yyextra->error(yylineno, "Illegal use of reserved word", yytext, "");
+ yyextra->error(*yylloc, "Illegal use of reserved word", yytext, "");
yyextra->recover();
return 0;
}
@@ -3213,7 +3239,7 @@
if (context->shaderVersion < 300)
{
- context->error(yylineno, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext, "");
+ context->error(*yylloc, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext, "");
context->recover();
return 0;
}
@@ -3229,7 +3255,7 @@
if (context->shaderVersion < 300)
{
- context->error(yylineno, "Floating-point suffix unsupported prior to GLSL ES 3.00", yytext);
+ context->error(*yylloc, "Floating-point suffix unsupported prior to GLSL ES 3.00", yytext);
context->recover();
return 0;
}
@@ -3237,13 +3263,6 @@
return(FLOATCONSTANT);
}
-void yyerror(TParseContext* context, const char* reason) {
- struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
-
- context->error(yylineno, reason, yytext);
- context->recover();
-}
-
int glslang_initialize(TParseContext* context) {
yyscan_t scanner = NULL;
if (yylex_init_extra(context,&scanner))
@@ -3266,7 +3285,8 @@
int glslang_scan(size_t count, const char* const string[], const int length[],
TParseContext* context) {
yyrestart(NULL,context->scanner);
- yyset_lineno(EncodeSourceLoc(0, 1),context->scanner);
+ yyset_column(0,context->scanner);
+ yyset_lineno(1,context->scanner);
// Initialize preprocessor.
if (!context->preprocessor.init(count, string, length))
diff --git a/src/compiler/glslang_tab.cpp b/src/compiler/glslang_tab.cpp
index 8d26db2..bb6738f 100644
--- a/src/compiler/glslang_tab.cpp
+++ b/src/compiler/glslang_tab.cpp
@@ -89,7 +89,6 @@
#include "GLSLANG/ShaderLang.h"
#define YYENABLE_NLS 0
-#define YYLTYPE_IS_TRIVIAL 1
#define YYLEX_PARAM context->scanner
@@ -123,6 +122,14 @@
#if YYDEBUG
extern int yydebug;
#endif
+/* "%code requires" blocks. */
+
+
+#define YYLTYPE TSourceLoc
+#define YYLTYPE_IS_DECLARED 1
+
+
+
/* Tokens. */
#ifndef YYTOKENTYPE
@@ -263,7 +270,6 @@
struct {
- TSourceLoc line;
union {
TString *string;
float f;
@@ -274,7 +280,6 @@
TSymbol* symbol;
} lex;
struct {
- TSourceLoc line;
TOperator op;
union {
TIntermNode* intermNode;
@@ -302,6 +307,19 @@
# define YYSTYPE_IS_DECLARED 1
#endif
+#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
+typedef struct YYLTYPE
+{
+ int first_line;
+ int first_column;
+ int last_line;
+ int last_column;
+} YYLTYPE;
+# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
+# define YYLTYPE_IS_DECLARED 1
+# define YYLTYPE_IS_TRIVIAL 1
+#endif
+
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
@@ -322,8 +340,24 @@
/* Copy the second part of user declarations. */
-extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
-extern void yyerror(TParseContext* context, const char* reason);
+extern int yylex(YYSTYPE* yylval_param, YYLTYPE* yylloc, void* yyscanner);
+extern void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason);
+
+#define YYLLOC_DEFAULT(Current, Rhs, N) \
+ do { \
+ if (YYID(N)) { \
+ (Current).first_file = YYRHSLOC(Rhs, 1).first_file; \
+ (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
+ (Current).last_file = YYRHSLOC(Rhs, N).last_file; \
+ (Current).last_line = YYRHSLOC(Rhs, N).last_line; \
+ } \
+ else { \
+ (Current).first_file = YYRHSLOC(Rhs, 0).last_file; \
+ (Current).first_line = YYRHSLOC(Rhs, 0).last_line; \
+ (Current).last_file = YYRHSLOC(Rhs, 0).last_file; \
+ (Current).last_line = YYRHSLOC(Rhs, 0).last_line; \
+ } \
+ } while (0)
#define FRAG_VERT_ONLY(S, L) { \
if (context->shaderType != SH_FRAGMENT_SHADER && \
@@ -520,13 +554,15 @@
#if (! defined yyoverflow \
&& (! defined __cplusplus \
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+ || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
+ && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
{
yytype_int16 yyss_alloc;
YYSTYPE yyvs_alloc;
+ YYLTYPE yyls_alloc;
};
/* The size of the maximum gap between one aligned stack and the next. */
@@ -535,8 +571,8 @@
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
- + YYSTACK_GAP_MAXIMUM)
+ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ + 2 * YYSTACK_GAP_MAXIMUM)
# define YYCOPY_NEEDED 1
@@ -753,31 +789,31 @@
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 194, 194, 195, 198, 233, 236, 241, 246, 251,
- 256, 262, 265, 268, 271, 274, 284, 297, 305, 405,
- 408, 416, 420, 427, 431, 438, 444, 453, 461, 464,
- 474, 477, 487, 497, 518, 519, 520, 525, 526, 535,
- 547, 548, 556, 567, 571, 572, 582, 592, 602, 615,
- 616, 626, 639, 643, 647, 651, 652, 665, 666, 679,
- 680, 693, 694, 711, 712, 725, 726, 727, 728, 729,
- 733, 736, 747, 755, 763, 790, 795, 806, 810, 814,
- 818, 825, 863, 866, 873, 881, 902, 923, 934, 963,
- 968, 978, 983, 993, 996, 999, 1002, 1008, 1015, 1018,
- 1022, 1026, 1030, 1037, 1041, 1045, 1052, 1056, 1060, 1149,
- 1158, 1164, 1168, 1175, 1181, 1188, 1197, 1206, 1209, 1245,
- 1252, 1256, 1263, 1267, 1272, 1277, 1287, 1297, 1306, 1316,
- 1323, 1326, 1329, 1335, 1342, 1345, 1351, 1354, 1357, 1363,
- 1366, 1381, 1385, 1389, 1393, 1397, 1401, 1406, 1411, 1416,
- 1421, 1426, 1431, 1436, 1441, 1446, 1451, 1456, 1461, 1467,
- 1473, 1479, 1484, 1489, 1494, 1499, 1504, 1509, 1514, 1518,
- 1523, 1527, 1531, 1535, 1539, 1543, 1547, 1551, 1555, 1559,
- 1568, 1577, 1582, 1595, 1595, 1598, 1598, 1604, 1607, 1622,
- 1625, 1634, 1638, 1644, 1652, 1668, 1672, 1676, 1677, 1683,
- 1684, 1685, 1686, 1687, 1691, 1692, 1692, 1692, 1702, 1703,
- 1707, 1707, 1708, 1708, 1713, 1716, 1726, 1729, 1735, 1736,
- 1740, 1748, 1752, 1762, 1767, 1784, 1784, 1789, 1789, 1796,
- 1796, 1804, 1807, 1813, 1816, 1822, 1826, 1833, 1840, 1847,
- 1854, 1865, 1874, 1878, 1885, 1888, 1894, 1894
+ 0, 213, 213, 214, 217, 252, 255, 260, 265, 270,
+ 275, 281, 284, 287, 290, 293, 303, 316, 324, 424,
+ 427, 435, 438, 444, 448, 455, 461, 470, 478, 481,
+ 491, 494, 504, 514, 535, 536, 537, 542, 543, 552,
+ 564, 565, 573, 584, 588, 589, 599, 609, 619, 632,
+ 633, 643, 656, 660, 664, 668, 669, 682, 683, 696,
+ 697, 710, 711, 728, 729, 742, 743, 744, 745, 746,
+ 750, 753, 764, 772, 780, 807, 812, 823, 827, 831,
+ 835, 842, 879, 882, 889, 897, 918, 939, 949, 977,
+ 982, 992, 997, 1007, 1010, 1013, 1016, 1022, 1029, 1032,
+ 1036, 1040, 1044, 1051, 1055, 1059, 1066, 1070, 1074, 1163,
+ 1172, 1178, 1181, 1187, 1193, 1200, 1209, 1218, 1221, 1257,
+ 1264, 1268, 1275, 1278, 1282, 1286, 1295, 1304, 1312, 1322,
+ 1329, 1332, 1335, 1341, 1348, 1351, 1357, 1360, 1363, 1369,
+ 1372, 1387, 1391, 1395, 1399, 1403, 1407, 1412, 1417, 1422,
+ 1427, 1432, 1437, 1442, 1447, 1452, 1457, 1462, 1467, 1473,
+ 1479, 1485, 1490, 1495, 1500, 1505, 1510, 1515, 1520, 1524,
+ 1529, 1533, 1537, 1541, 1545, 1549, 1553, 1557, 1561, 1565,
+ 1574, 1583, 1588, 1601, 1601, 1604, 1604, 1610, 1613, 1628,
+ 1631, 1640, 1644, 1650, 1657, 1672, 1676, 1680, 1681, 1687,
+ 1688, 1689, 1690, 1691, 1695, 1696, 1696, 1696, 1706, 1707,
+ 1711, 1711, 1712, 1712, 1717, 1720, 1730, 1733, 1739, 1740,
+ 1744, 1752, 1756, 1766, 1771, 1788, 1788, 1793, 1793, 1800,
+ 1800, 1808, 1811, 1817, 1820, 1826, 1830, 1837, 1844, 1851,
+ 1858, 1869, 1878, 1882, 1889, 1892, 1898, 1898
};
#endif
@@ -1608,7 +1644,7 @@
} \
else \
{ \
- yyerror (context, YY_("syntax error: cannot back up")); \
+ yyerror (&yylloc, context, YY_("syntax error: cannot back up")); \
YYERROR; \
} \
while (YYID (0))
@@ -1618,17 +1654,90 @@
#define YYERRCODE 256
-/* This macro is provided for backward compatibility. */
+/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+ If N is 0, then set CURRENT to the empty location which ends
+ the previous symbol: RHS[0] (always defined). */
+
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+ do \
+ if (YYID (N)) \
+ { \
+ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
+ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
+ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
+ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
+ } \
+ else \
+ { \
+ (Current).first_line = (Current).last_line = \
+ YYRHSLOC (Rhs, 0).last_line; \
+ (Current).first_column = (Current).last_column = \
+ YYRHSLOC (Rhs, 0).last_column; \
+ } \
+ while (YYID (0))
+#endif
+
+#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+
+
+/* YY_LOCATION_PRINT -- Print the location on the stream.
+ This macro was not mandated originally: define only if we know
+ we won't break user code: when these are the locations we know. */
+
#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+
+/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
+
+__attribute__((__unused__))
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static unsigned
+yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
+#else
+static unsigned
+yy_location_print_ (yyo, yylocp)
+ FILE *yyo;
+ YYLTYPE const * const yylocp;
+#endif
+{
+ unsigned res = 0;
+ int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
+ if (0 <= yylocp->first_line)
+ {
+ res += fprintf (yyo, "%d", yylocp->first_line);
+ if (0 <= yylocp->first_column)
+ res += fprintf (yyo, ".%d", yylocp->first_column);
+ }
+ if (0 <= yylocp->last_line)
+ {
+ if (yylocp->first_line < yylocp->last_line)
+ {
+ res += fprintf (yyo, "-%d", yylocp->last_line);
+ if (0 <= end_col)
+ res += fprintf (yyo, ".%d", end_col);
+ }
+ else if (0 <= end_col && yylocp->first_column < end_col)
+ res += fprintf (yyo, "-%d", end_col);
+ }
+ return res;
+ }
+
+# define YY_LOCATION_PRINT(File, Loc) \
+ yy_location_print_ (File, &(Loc))
+
+# else
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+# endif
#endif
/* YYLEX -- calling `yylex' with the right arguments. */
#ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, YYLEX_PARAM)
+# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
#else
-# define YYLEX yylex (&yylval)
+# define YYLEX yylex (&yylval, &yylloc)
#endif
/* Enable debugging if requested. */
@@ -1651,7 +1760,7 @@
{ \
YYFPRINTF (stderr, "%s ", Title); \
yy_symbol_print (stderr, \
- Type, Value, context); \
+ Type, Value, Location, context); \
YYFPRINTF (stderr, "\n"); \
} \
} while (YYID (0))
@@ -1665,13 +1774,14 @@
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, TParseContext* context)
#else
static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
+yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, context)
FILE *yyoutput;
int yytype;
YYSTYPE const * const yyvaluep;
+ YYLTYPE const * const yylocationp;
TParseContext* context;
#endif
{
@@ -1679,6 +1789,7 @@
YYUSE (yyo);
if (!yyvaluep)
return;
+ YYUSE (yylocationp);
YYUSE (context);
# ifdef YYPRINT
if (yytype < YYNTOKENS)
@@ -1701,13 +1812,14 @@
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, TParseContext* context)
#else
static void
-yy_symbol_print (yyoutput, yytype, yyvaluep, context)
+yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, context)
FILE *yyoutput;
int yytype;
YYSTYPE const * const yyvaluep;
+ YYLTYPE const * const yylocationp;
TParseContext* context;
#endif
{
@@ -1716,7 +1828,9 @@
else
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
- yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
+ YY_LOCATION_PRINT (yyoutput, *yylocationp);
+ YYFPRINTF (yyoutput, ": ");
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, context);
YYFPRINTF (yyoutput, ")");
}
@@ -1759,11 +1873,12 @@
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
-yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
+yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, TParseContext* context)
#else
static void
-yy_reduce_print (yyvsp, yyrule, context)
+yy_reduce_print (yyvsp, yylsp, yyrule, context)
YYSTYPE *yyvsp;
+ YYLTYPE *yylsp;
int yyrule;
TParseContext* context;
#endif
@@ -1779,7 +1894,7 @@
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
&(yyvsp[(yyi + 1) - (yynrhs)])
- , context);
+ , &(yylsp[(yyi + 1) - (yynrhs)]) , context);
YYFPRINTF (stderr, "\n");
}
}
@@ -1787,7 +1902,7 @@
# define YY_REDUCE_PRINT(Rule) \
do { \
if (yydebug) \
- yy_reduce_print (yyvsp, Rule, context); \
+ yy_reduce_print (yyvsp, yylsp, Rule, context); \
} while (YYID (0))
/* Nonzero means print parse trace. It is left uninitialized so that
@@ -2067,17 +2182,19 @@
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, TParseContext* context)
#else
static void
-yydestruct (yymsg, yytype, yyvaluep, context)
+yydestruct (yymsg, yytype, yyvaluep, yylocationp, context)
const char *yymsg;
int yytype;
YYSTYPE *yyvaluep;
+ YYLTYPE *yylocationp;
TParseContext* context;
#endif
{
YYUSE (yyvaluep);
+ YYUSE (yylocationp);
YYUSE (context);
if (!yymsg)
@@ -2139,6 +2256,11 @@
static YYSTYPE yyval_default;
# define YY_INITIAL_VALUE(Value) = Value
#endif
+static YYLTYPE yyloc_default
+# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+ = { 1, 1, 1, 1 }
+# endif
+;
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
@@ -2150,6 +2272,10 @@
/* The semantic value of the lookahead symbol. */
YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
+/* Location data for the lookahead symbol. */
+YYLTYPE yylloc = yyloc_default;
+
+
/* Number of syntax errors so far. */
int yynerrs;
@@ -2160,6 +2286,7 @@
/* The stacks and their tools:
`yyss': related to states.
`yyvs': related to semantic values.
+ `yyls': related to locations.
Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
@@ -2174,6 +2301,14 @@
YYSTYPE *yyvs;
YYSTYPE *yyvsp;
+ /* The location stack. */
+ YYLTYPE yylsa[YYINITDEPTH];
+ YYLTYPE *yyls;
+ YYLTYPE *yylsp;
+
+ /* The locations where the error started and ended. */
+ YYLTYPE yyerror_range[3];
+
YYSIZE_T yystacksize;
int yyn;
@@ -2183,6 +2318,7 @@
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
+ YYLTYPE yyloc;
#if YYERROR_VERBOSE
/* Buffer for error messages, and its allocated size. */
@@ -2191,7 +2327,7 @@
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif
-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
/* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */
@@ -2199,6 +2335,7 @@
yyssp = yyss = yyssa;
yyvsp = yyvs = yyvsa;
+ yylsp = yyls = yylsa;
yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n"));
@@ -2207,6 +2344,7 @@
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
+ yylsp[0] = yylloc;
goto yysetstate;
/*------------------------------------------------------------.
@@ -2232,6 +2370,7 @@
memory. */
YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss;
+ YYLTYPE *yyls1 = yyls;
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
@@ -2240,8 +2379,10 @@
yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
+ &yyls1, yysize * sizeof (*yylsp),
&yystacksize);
+ yyls = yyls1;
yyss = yyss1;
yyvs = yyvs1;
}
@@ -2264,6 +2405,7 @@
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+ YYSTACK_RELOCATE (yyls_alloc, yyls);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
@@ -2273,6 +2415,7 @@
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
+ yylsp = yyls + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
@@ -2350,7 +2493,7 @@
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
-
+ *++yylsp = yylloc;
goto yynewstate;
@@ -2381,7 +2524,8 @@
GCC warning that YYVAL may be used uninitialized. */
yyval = yyvsp[1-yylen];
-
+ /* Default location. */
+ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
@@ -2392,7 +2536,7 @@
const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
const TVariable* variable;
if (symbol == 0) {
- context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str());
+ context->error((yylsp[(1) - (1)]), "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str());
context->recover();
TType type(EbtFloat, EbpUndefined);
TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
@@ -2401,7 +2545,7 @@
} else {
// This identifier can only be a variable type symbol
if (! symbol->isVariable()) {
- context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str());
+ context->error((yylsp[(1) - (1)]), "variable expected", (yyvsp[(1) - (1)].lex).string->c_str());
context->recover();
}
variable = static_cast<const TVariable*>(symbol);
@@ -2413,11 +2557,11 @@
if (variable->getType().getQualifier() == EvqConst ) {
ConstantUnion* constArray = variable->getConstPointer();
TType t(variable->getType());
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yylsp[(1) - (1)]));
} else
(yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
variable->getName(),
- variable->getType(), (yyvsp[(1) - (1)].lex).line);
+ variable->getType(), (yylsp[(1) - (1)]));
}
break;
@@ -2433,7 +2577,7 @@
{
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
}
break;
@@ -2442,7 +2586,7 @@
{
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setUConst((yyvsp[(1) - (1)].lex).u);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
}
break;
@@ -2451,7 +2595,7 @@
{
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
}
break;
@@ -2460,7 +2604,7 @@
{
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
}
break;
@@ -2481,7 +2625,7 @@
case 12:
{
- (yyval.interm.intermTypedNode) = context->addIndexExpression((yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode));
+ (yyval.interm.intermTypedNode) = context->addIndexExpression((yyvsp[(1) - (4)].interm.intermTypedNode), (yylsp[(2) - (4)]), (yyvsp[(3) - (4)].interm.intermTypedNode));
}
break;
@@ -2495,18 +2639,18 @@
case 14:
{
- (yyval.interm.intermTypedNode) = context->addFieldSelectionExpression((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyvsp[(3) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->addFieldSelectionExpression((yyvsp[(1) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yylsp[(3) - (3)]));
}
break;
case 15:
{
- if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
+ if (context->lValueErrorCheck((yylsp[(2) - (2)]), "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
context->recover();
- (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yylsp[(2) - (2)]));
if ((yyval.interm.intermTypedNode) == 0) {
- context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
+ context->unaryOpError((yylsp[(2) - (2)]), "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
context->recover();
(yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
}
@@ -2516,11 +2660,11 @@
case 16:
{
- if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
+ if (context->lValueErrorCheck((yylsp[(2) - (2)]), "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
context->recover();
- (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yylsp[(2) - (2)]));
if ((yyval.interm.intermTypedNode) == 0) {
- context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
+ context->unaryOpError((yylsp[(2) - (2)]), "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
context->recover();
(yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
}
@@ -2550,18 +2694,18 @@
// Their parameters will be verified algorithmically.
//
TType type(EbtVoid, EbpUndefined); // use this to get the type back
- if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
+ if (context->constructorErrorCheck((yylsp[(1) - (1)]), (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
(yyval.interm.intermTypedNode) = 0;
} else {
//
// It's a constructor, of type 'type'.
//
- (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
+ (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yylsp[(1) - (1)]));
}
if ((yyval.interm.intermTypedNode) == 0) {
context->recover();
- (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yylsp[(1) - (1)]));
}
(yyval.interm.intermTypedNode)->setType(type);
} else {
@@ -2570,13 +2714,13 @@
//
const TFunction* fnCandidate;
bool builtIn;
- fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, context->shaderVersion, &builtIn);
+ fnCandidate = context->findFunction((yylsp[(1) - (1)]), fnCall, context->shaderVersion, &builtIn);
if (fnCandidate) {
//
// A declared function.
//
if (builtIn && !fnCandidate->getExtension().empty() &&
- context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
+ context->extensionErrorCheck((yylsp[(1) - (1)]), fnCandidate->getExtension())) {
context->recover();
}
op = fnCandidate->getBuiltInOp();
@@ -2588,7 +2732,7 @@
//
// Treat it like a built-in unary operator.
//
- (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0);
+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, (yylsp[(1) - (1)]));
if ((yyval.interm.intermTypedNode) == 0) {
std::stringstream extraInfoStream;
extraInfoStream << "built in unary operator function. Type: " << static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString();
@@ -2597,12 +2741,12 @@
YYERROR;
}
} else {
- (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yylsp[(1) - (1)]));
}
} else {
// This is a real function call
- (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yylsp[(1) - (1)]));
(yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
// this is how we know whether the given function is a builtIn function or a user defined function
@@ -2629,7 +2773,7 @@
// Put on a dummy node for error recovery
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setFConst(0.0f);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
context->recover();
}
}
@@ -2647,7 +2791,7 @@
case 20:
{
- context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "");
+ context->error((yylsp[(3) - (3)]), "methods are not supported", "");
context->recover();
(yyval.interm) = (yyvsp[(3) - (3)].interm);
}
@@ -2657,7 +2801,6 @@
{
(yyval.interm) = (yyvsp[(1) - (2)].interm);
- (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
}
break;
@@ -2665,7 +2808,6 @@
{
(yyval.interm) = (yyvsp[(1) - (2)].interm);
- (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
}
break;
@@ -2701,7 +2843,7 @@
TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
(yyvsp[(1) - (3)].interm).function->addParameter(param);
(yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
- (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
}
break;
@@ -2722,7 +2864,7 @@
case 29:
{
- if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
+ if (context->reservedErrorCheck((yylsp[(1) - (1)]), *(yyvsp[(1) - (1)].lex).string))
context->recover();
TType type(EbtVoid, EbpUndefined);
TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
@@ -2740,11 +2882,11 @@
case 31:
{
- if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
+ if (context->lValueErrorCheck((yylsp[(1) - (2)]), "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
context->recover();
- (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]));
if ((yyval.interm.intermTypedNode) == 0) {
- context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
+ context->unaryOpError((yylsp[(1) - (2)]), "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
context->recover();
(yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
}
@@ -2754,11 +2896,11 @@
case 32:
{
- if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
+ if (context->lValueErrorCheck((yylsp[(1) - (2)]), "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
context->recover();
- (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]));
if ((yyval.interm.intermTypedNode) == 0) {
- context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
+ context->unaryOpError((yylsp[(1) - (2)]), "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
context->recover();
(yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
}
@@ -2769,7 +2911,7 @@
{
if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
- (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]));
if ((yyval.interm.intermTypedNode) == 0) {
const char* errorOp = "";
switch((yyvsp[(1) - (2)].interm).op) {
@@ -2777,7 +2919,7 @@
case EOpLogicalNot: errorOp = "!"; break;
default: break;
}
- context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
+ context->unaryOpError((yylsp[(1) - (2)]), errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
context->recover();
(yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
}
@@ -2788,17 +2930,17 @@
case 34:
- { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; }
+ { (yyval.interm).op = EOpNull; }
break;
case 35:
- { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; }
+ { (yyval.interm).op = EOpNegative; }
break;
case 36:
- { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; }
+ { (yyval.interm).op = EOpLogicalNot; }
break;
case 37:
@@ -2809,10 +2951,10 @@
case 38:
{
- FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
+ FRAG_VERT_ONLY("*", (yylsp[(2) - (3)]));
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
- context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->binaryOpError((yylsp[(2) - (3)]), "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
(yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
}
@@ -2822,10 +2964,10 @@
case 39:
{
- FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
+ FRAG_VERT_ONLY("/", (yylsp[(2) - (3)]));
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
- context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->binaryOpError((yylsp[(2) - (3)]), "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
(yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
}
@@ -2840,9 +2982,9 @@
case 41:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
- context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->binaryOpError((yylsp[(2) - (3)]), "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
(yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
}
@@ -2852,9 +2994,9 @@
case 42:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
- context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->binaryOpError((yylsp[(2) - (3)]), "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
(yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
}
@@ -2874,13 +3016,13 @@
case 45:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
- context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->binaryOpError((yylsp[(2) - (3)]), "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
}
}
break;
@@ -2888,13 +3030,13 @@
case 46:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
- context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->binaryOpError((yylsp[(2) - (3)]), ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
}
}
break;
@@ -2902,13 +3044,13 @@
case 47:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
- context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->binaryOpError((yylsp[(2) - (3)]), "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
}
}
break;
@@ -2916,13 +3058,13 @@
case 48:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
- context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->binaryOpError((yylsp[(2) - (3)]), ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
}
}
break;
@@ -2935,13 +3077,13 @@
case 50:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
- context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->binaryOpError((yylsp[(2) - (3)]), "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
}
}
break;
@@ -2949,13 +3091,13 @@
case 51:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
- context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->binaryOpError((yylsp[(2) - (3)]), "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
}
}
break;
@@ -2983,13 +3125,13 @@
case 56:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
- context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->binaryOpError((yylsp[(2) - (3)]), "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
}
}
break;
@@ -3002,13 +3144,13 @@
case 58:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
- context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->binaryOpError((yylsp[(2) - (3)]), "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
}
}
break;
@@ -3021,13 +3163,13 @@
case 60:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
- context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->binaryOpError((yylsp[(2) - (3)]), "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
}
}
break;
@@ -3040,15 +3182,15 @@
case 62:
{
- if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
+ if (context->boolErrorCheck((yylsp[(2) - (5)]), (yyvsp[(1) - (5)].interm.intermTypedNode)))
context->recover();
- (yyval.interm.intermTypedNode) = context->intermediate.addSelection((yyvsp[(1) - (5)].interm.intermTypedNode), (yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.intermTypedNode), (yyvsp[(2) - (5)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addSelection((yyvsp[(1) - (5)].interm.intermTypedNode), (yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.intermTypedNode), (yylsp[(2) - (5)]));
if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
(yyval.interm.intermTypedNode) = 0;
if ((yyval.interm.intermTypedNode) == 0) {
- context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
+ context->binaryOpError((yylsp[(2) - (5)]), ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
context->recover();
(yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
}
@@ -3063,11 +3205,11 @@
case 64:
{
- if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
+ if (context->lValueErrorCheck((yylsp[(2) - (3)]), "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
context->recover();
- (yyval.interm.intermTypedNode) = context->intermediate.addAssign((yyvsp[(2) - (3)].interm).op, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].interm).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addAssign((yyvsp[(2) - (3)].interm).op, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
- context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->assignError((yylsp[(2) - (3)]), "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
(yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
}
@@ -3076,27 +3218,27 @@
case 65:
- { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; }
+ { (yyval.interm).op = EOpAssign; }
break;
case 66:
- { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; }
+ { FRAG_VERT_ONLY("*=", (yylsp[(1) - (1)])); (yyval.interm).op = EOpMulAssign; }
break;
case 67:
- { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; }
+ { FRAG_VERT_ONLY("/=", (yylsp[(1) - (1)])); (yyval.interm).op = EOpDivAssign; }
break;
case 68:
- { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; }
+ { (yyval.interm).op = EOpAddAssign; }
break;
case 69:
- { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; }
+ { (yyval.interm).op = EOpSubAssign; }
break;
case 70:
@@ -3109,9 +3251,9 @@
case 71:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
- context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->binaryOpError((yylsp[(2) - (3)]), ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
(yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
}
@@ -3130,7 +3272,7 @@
case 73:
{
- if (context->enterStructDeclaration((yyvsp[(1) - (2)].lex).line, *(yyvsp[(1) - (2)].lex).string))
+ if (context->enterStructDeclaration((yylsp[(1) - (2)]), *(yyvsp[(1) - (2)].lex).string))
context->recover();
(yyval.lex) = (yyvsp[(1) - (2)].lex);
}
@@ -3152,11 +3294,11 @@
{
TVariable variable(param.name, *param.type);
- prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable.getUniqueId(), variable.getName(), variable.getType(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
+ prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable.getUniqueId(), variable.getName(), variable.getType(), (yylsp[(1) - (2)])), (yylsp[(1) - (2)]));
}
else
{
- prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
+ prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yylsp[(1) - (2)])), (yylsp[(1) - (2)]));
}
}
@@ -3180,11 +3322,11 @@
{
if (((yyvsp[(2) - (4)].interm.precision) == EbpHigh) && (context->shaderType == SH_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) {
- context->error((yyvsp[(1) - (4)].lex).line, "precision is not supported in fragment shader", "highp");
+ context->error((yylsp[(1) - (4)]), "precision is not supported in fragment shader", "highp");
context->recover();
}
if (!context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type), (yyvsp[(2) - (4)].interm.precision) )) {
- context->error((yyvsp[(1) - (4)].lex).line, "illegal type argument for default precision qualifier", getBasicString((yyvsp[(3) - (4)].interm.type).type));
+ context->error((yylsp[(1) - (4)]), "illegal type argument for default precision qualifier", getBasicString((yyvsp[(3) - (4)].interm.type).type));
context->recover();
}
(yyval.interm.intermNode) = 0;
@@ -3194,24 +3336,24 @@
case 77:
{
- ES3_ONLY(getQualifierString((yyvsp[(1) - (5)].interm.type).qualifier), (yyvsp[(1) - (5)].interm.type).line, "interface blocks");
- (yyval.interm.intermNode) = context->addInterfaceBlock((yyvsp[(1) - (5)].interm.type), (yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(3) - (5)].interm.typeList), "", 0, NULL, 0);
+ ES3_ONLY(getQualifierString((yyvsp[(1) - (5)].interm.type).qualifier), (yylsp[(1) - (5)]), "interface blocks");
+ (yyval.interm.intermNode) = context->addInterfaceBlock((yyvsp[(1) - (5)].interm.type), (yylsp[(2) - (5)]), *(yyvsp[(2) - (5)].lex).string, (yyvsp[(3) - (5)].interm.typeList), "", (yyloc), NULL, (yyloc));
}
break;
case 78:
{
- ES3_ONLY(getQualifierString((yyvsp[(1) - (6)].interm.type).qualifier), (yyvsp[(1) - (6)].interm.type).line, "interface blocks");
- (yyval.interm.intermNode) = context->addInterfaceBlock((yyvsp[(1) - (6)].interm.type), (yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string, (yyvsp[(3) - (6)].interm.typeList), *(yyvsp[(5) - (6)].lex).string, (yyvsp[(5) - (6)].lex).line, NULL, 0);
+ ES3_ONLY(getQualifierString((yyvsp[(1) - (6)].interm.type).qualifier), (yylsp[(1) - (6)]), "interface blocks");
+ (yyval.interm.intermNode) = context->addInterfaceBlock((yyvsp[(1) - (6)].interm.type), (yylsp[(2) - (6)]), *(yyvsp[(2) - (6)].lex).string, (yyvsp[(3) - (6)].interm.typeList), *(yyvsp[(5) - (6)].lex).string, (yylsp[(5) - (6)]), NULL, (yyloc));
}
break;
case 79:
{
- ES3_ONLY(getQualifierString((yyvsp[(1) - (9)].interm.type).qualifier), (yyvsp[(1) - (9)].interm.type).line, "interface blocks");
- (yyval.interm.intermNode) = context->addInterfaceBlock((yyvsp[(1) - (9)].interm.type), (yyvsp[(2) - (9)].lex).line, *(yyvsp[(2) - (9)].lex).string, (yyvsp[(3) - (9)].interm.typeList), *(yyvsp[(5) - (9)].lex).string, (yyvsp[(5) - (9)].lex).line, (yyvsp[(7) - (9)].interm.intermTypedNode), (yyvsp[(6) - (9)].lex).line);
+ ES3_ONLY(getQualifierString((yyvsp[(1) - (9)].interm.type).qualifier), (yylsp[(1) - (9)]), "interface blocks");
+ (yyval.interm.intermNode) = context->addInterfaceBlock((yyvsp[(1) - (9)].interm.type), (yylsp[(2) - (9)]), *(yyvsp[(2) - (9)].lex).string, (yyvsp[(3) - (9)].interm.typeList), *(yyvsp[(5) - (9)].lex).string, (yylsp[(5) - (9)]), (yyvsp[(7) - (9)].interm.intermTypedNode), (yylsp[(6) - (9)]));
}
break;
@@ -3237,12 +3379,12 @@
TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName(), context->shaderVersion));
if (prevDec) {
if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
- context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString());
+ context->error((yylsp[(2) - (2)]), "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString());
context->recover();
}
for (size_t i = 0; i < prevDec->getParamCount(); ++i) {
if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
- context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString());
+ context->error((yylsp[(2) - (2)]), "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString());
context->recover();
}
}
@@ -3254,7 +3396,6 @@
// being redeclared. So, pass back up this declaration, not the one in the symbol table.
//
(yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
- (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
// We're at the inner scope level of the function's arguments and body statement.
// Add the function prototype to the surrounding scope instead.
@@ -3299,7 +3440,7 @@
//
// This parameter > first is void
//
- context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void");
+ context->error((yylsp[(2) - (3)]), "cannot be an argument type except for '(void)'", "void");
context->recover();
delete (yyvsp[(3) - (3)].interm).param.type;
} else {
@@ -3314,11 +3455,11 @@
{
if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
- context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier));
+ context->error((yylsp[(2) - (3)]), "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier));
context->recover();
}
// make sure a sampler is not involved as well...
- if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
+ if (context->structQualifierErrorCheck((yylsp[(2) - (3)]), (yyvsp[(1) - (3)].interm.type)))
context->recover();
// Add the function as a prototype after parsing it (we do not support recursion)
@@ -3335,13 +3476,12 @@
{
if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
- context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str());
+ context->error((yylsp[(2) - (2)]), "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str());
context->recover();
}
- if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
+ if (context->reservedErrorCheck((yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string))
context->recover();
TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
- (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
(yyval.interm).param = param;
}
break;
@@ -3350,20 +3490,19 @@
{
// Check that we can make an array out of this type
- if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
+ if (context->arrayTypeErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm.type)))
context->recover();
- if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
+ if (context->reservedErrorCheck((yylsp[(2) - (5)]), *(yyvsp[(2) - (5)].lex).string))
context->recover();
int size;
- if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
+ if (context->arraySizeErrorCheck((yylsp[(3) - (5)]), (yyvsp[(4) - (5)].interm.intermTypedNode), size))
context->recover();
(yyvsp[(1) - (5)].interm.type).setArray(true, size);
TType* type = new TType((yyvsp[(1) - (5)].interm.type));
TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
- (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
(yyval.interm).param = param;
}
break;
@@ -3372,7 +3511,7 @@
{
(yyval.interm) = (yyvsp[(3) - (3)].interm);
- if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.qualifier), (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
+ if (context->paramErrorCheck((yylsp[(3) - (3)]), (yyvsp[(1) - (3)].interm.qualifier), (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
context->recover();
}
break;
@@ -3381,9 +3520,9 @@
{
(yyval.interm) = (yyvsp[(2) - (2)].interm);
- if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
+ if (context->parameterSamplerErrorCheck((yylsp[(2) - (2)]), (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
context->recover();
- if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
+ if (context->paramErrorCheck((yylsp[(2) - (2)]), EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
context->recover();
}
break;
@@ -3392,7 +3531,7 @@
{
(yyval.interm) = (yyvsp[(3) - (3)].interm);
- if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.qualifier), (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
+ if (context->paramErrorCheck((yylsp[(3) - (3)]), (yyvsp[(1) - (3)].interm.qualifier), (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
context->recover();
}
break;
@@ -3401,9 +3540,9 @@
{
(yyval.interm) = (yyvsp[(2) - (2)].interm);
- if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
+ if (context->parameterSamplerErrorCheck((yylsp[(2) - (2)]), (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
context->recover();
- if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
+ if (context->paramErrorCheck((yylsp[(2) - (2)]), EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
context->recover();
}
break;
@@ -3455,7 +3594,7 @@
{
(yyval.interm) = (yyvsp[(1) - (3)].interm);
- (yyval.interm).intermAggregate = context->parseDeclarator((yyval.interm).type, (yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].lex).symbol, (yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string);
+ (yyval.interm).intermAggregate = context->parseDeclarator((yyval.interm).type, (yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].lex).symbol, (yylsp[(3) - (3)]), *(yyvsp[(3) - (3)].lex).string);
}
break;
@@ -3463,7 +3602,7 @@
{
(yyval.interm) = (yyvsp[(1) - (5)].interm);
- context->parseArrayDeclarator((yyval.interm).type, (yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(4) - (5)].lex).line, NULL, NULL);
+ context->parseArrayDeclarator((yyval.interm).type, (yylsp[(3) - (5)]), *(yyvsp[(3) - (5)].lex).string, (yylsp[(4) - (5)]), NULL, NULL);
}
break;
@@ -3471,7 +3610,7 @@
{
(yyval.interm) = (yyvsp[(1) - (6)].interm);
- (yyval.interm).intermAggregate = context->parseArrayDeclarator((yyval.interm).type, (yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(4) - (6)].lex).line, (yyvsp[(1) - (6)].interm).intermNode, (yyvsp[(5) - (6)].interm.intermTypedNode));
+ (yyval.interm).intermAggregate = context->parseArrayDeclarator((yyval.interm).type, (yylsp[(3) - (6)]), *(yyvsp[(3) - (6)].lex).string, (yylsp[(4) - (6)]), (yyvsp[(1) - (6)].interm).intermNode, (yyvsp[(5) - (6)].interm.intermTypedNode));
}
break;
@@ -3479,7 +3618,7 @@
{
(yyval.interm) = (yyvsp[(1) - (5)].interm);
- (yyval.interm).intermAggregate = context->parseInitDeclarator((yyval.interm).type, (yyvsp[(1) - (5)].interm).intermAggregate, (yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(4) - (5)].lex).line, (yyvsp[(5) - (5)].interm.intermTypedNode));
+ (yyval.interm).intermAggregate = context->parseInitDeclarator((yyval.interm).type, (yyvsp[(1) - (5)].interm).intermAggregate, (yylsp[(3) - (5)]), *(yyvsp[(3) - (5)].lex).string, (yylsp[(4) - (5)]), (yyvsp[(5) - (5)].interm.intermTypedNode));
}
break;
@@ -3487,7 +3626,7 @@
{
(yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
- (yyval.interm).intermAggregate = context->parseSingleDeclaration((yyval.interm).type, (yyvsp[(1) - (1)].interm.type).line, "");
+ (yyval.interm).intermAggregate = context->parseSingleDeclaration((yyval.interm).type, (yylsp[(1) - (1)]), "");
}
break;
@@ -3495,18 +3634,18 @@
{
(yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
- (yyval.interm).intermAggregate = context->parseSingleDeclaration((yyval.interm).type, (yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string);
+ (yyval.interm).intermAggregate = context->parseSingleDeclaration((yyval.interm).type, (yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string);
}
break;
case 105:
{
- context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str());
+ context->error((yylsp[(2) - (4)]), "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str());
context->recover();
(yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
- (yyval.interm).intermAggregate = context->parseSingleDeclaration((yyval.interm).type, (yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string);
+ (yyval.interm).intermAggregate = context->parseSingleDeclaration((yyval.interm).type, (yylsp[(2) - (4)]), *(yyvsp[(2) - (4)].lex).string);
}
break;
@@ -3514,7 +3653,7 @@
{
(yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
- (yyval.interm).intermAggregate = context->parseSingleArrayDeclaration((yyval.interm).type, (yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode));
+ (yyval.interm).intermAggregate = context->parseSingleArrayDeclaration((yyval.interm).type, (yylsp[(2) - (5)]), *(yyvsp[(2) - (5)].lex).string, (yylsp[(3) - (5)]), (yyvsp[(4) - (5)].interm.intermTypedNode));
}
break;
@@ -3522,28 +3661,28 @@
{
(yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
- (yyval.interm).intermAggregate = context->parseSingleInitDeclaration((yyval.interm).type, (yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(3) - (4)].lex).line, (yyvsp[(4) - (4)].interm.intermTypedNode));
+ (yyval.interm).intermAggregate = context->parseSingleInitDeclaration((yyval.interm).type, (yylsp[(2) - (4)]), *(yyvsp[(2) - (4)].lex).string, (yylsp[(3) - (4)]), (yyvsp[(4) - (4)].interm.intermTypedNode));
}
break;
case 108:
{
- VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
- if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
+ VERTEX_ONLY("invariant declaration", (yylsp[(1) - (2)]));
+ if (context->globalErrorCheck((yylsp[(1) - (2)]), context->symbolTable.atGlobalLevel(), "invariant varying"))
context->recover();
- (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yyvsp[(2) - (2)].lex).line);
+ (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yylsp[(2) - (2)]));
if (!(yyvsp[(2) - (2)].lex).symbol)
{
- context->error((yyvsp[(2) - (2)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(2) - (2)].lex).string->c_str());
+ context->error((yylsp[(2) - (2)]), "undeclared identifier declared as invariant", (yyvsp[(2) - (2)].lex).string->c_str());
context->recover();
(yyval.interm).intermAggregate = 0;
}
else
{
- TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yyvsp[(2) - (2)].lex).line);
- (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
+ TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yylsp[(2) - (2)]));
+ (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yylsp[(2) - (2)]));
}
}
break;
@@ -3554,7 +3693,7 @@
(yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
if ((yyvsp[(1) - (1)].interm.type).array) {
- context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array");
+ context->error((yylsp[(1) - (1)]), "not supported", "first-class array");
context->recover();
(yyvsp[(1) - (1)].interm.type).setArray(false);
}
@@ -3572,7 +3711,6 @@
{
(yyval.interm.type).qualifier = EvqSmooth;
- (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
}
break;
@@ -3580,7 +3718,6 @@
{
(yyval.interm.type).qualifier = EvqFlat;
- (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
}
break;
@@ -3594,44 +3731,44 @@
case 114:
{
- VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
- ES2_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
- if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
+ VERTEX_ONLY("attribute", (yylsp[(1) - (1)]));
+ ES2_ONLY("attribute", (yylsp[(1) - (1)]));
+ if (context->globalErrorCheck((yylsp[(1) - (1)]), context->symbolTable.atGlobalLevel(), "attribute"))
context->recover();
- (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yylsp[(1) - (1)]));
}
break;
case 115:
{
- ES2_ONLY("varying", (yyvsp[(1) - (1)].lex).line);
- if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
+ ES2_ONLY("varying", (yylsp[(1) - (1)]));
+ if (context->globalErrorCheck((yylsp[(1) - (1)]), context->symbolTable.atGlobalLevel(), "varying"))
context->recover();
if (context->shaderType == SH_VERTEX_SHADER)
- (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yylsp[(1) - (1)]));
else
- (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yylsp[(1) - (1)]));
}
break;
case 116:
{
- ES2_ONLY("varying", (yyvsp[(1) - (2)].lex).line);
- if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
+ ES2_ONLY("varying", (yylsp[(1) - (2)]));
+ if (context->globalErrorCheck((yylsp[(1) - (2)]), context->symbolTable.atGlobalLevel(), "invariant varying"))
context->recover();
if (context->shaderType == SH_VERTEX_SHADER)
- (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
+ (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yylsp[(1) - (2)]));
else
- (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
+ (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yylsp[(1) - (2)]));
}
break;
case 117:
{
- (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(1) - (1)].interm.type).qualifier, (yyvsp[(1) - (1)].interm.type).line);
+ (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(1) - (1)].interm.type).qualifier, (yylsp[(1) - (1)]));
}
break;
@@ -3640,37 +3777,37 @@
{
if ((yyvsp[(2) - (2)].interm.type).qualifier == EvqSmoothIn) {
if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqSmooth)
- (yyval.interm.type).setBasic(EbtVoid, EvqSmoothIn, (yyvsp[(2) - (2)].interm.type).line);
+ (yyval.interm.type).setBasic(EbtVoid, EvqSmoothIn, (yylsp[(2) - (2)]));
else if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqFlat)
- (yyval.interm.type).setBasic(EbtVoid, EvqFlatIn, (yyvsp[(2) - (2)].interm.type).line);
+ (yyval.interm.type).setBasic(EbtVoid, EvqFlatIn, (yylsp[(2) - (2)]));
else UNREACHABLE();
}
else if ((yyvsp[(2) - (2)].interm.type).qualifier == EvqCentroidIn) {
if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqSmooth)
- (yyval.interm.type).setBasic(EbtVoid, EvqCentroidIn, (yyvsp[(2) - (2)].interm.type).line);
+ (yyval.interm.type).setBasic(EbtVoid, EvqCentroidIn, (yylsp[(2) - (2)]));
else if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqFlat)
- (yyval.interm.type).setBasic(EbtVoid, EvqFlatIn, (yyvsp[(2) - (2)].interm.type).line);
+ (yyval.interm.type).setBasic(EbtVoid, EvqFlatIn, (yylsp[(2) - (2)]));
else UNREACHABLE();
}
else if ((yyvsp[(2) - (2)].interm.type).qualifier == EvqSmoothOut) {
if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqSmooth)
- (yyval.interm.type).setBasic(EbtVoid, EvqSmoothOut, (yyvsp[(2) - (2)].interm.type).line);
+ (yyval.interm.type).setBasic(EbtVoid, EvqSmoothOut, (yylsp[(2) - (2)]));
else if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqFlat)
- (yyval.interm.type).setBasic(EbtVoid, EvqFlatOut, (yyvsp[(2) - (2)].interm.type).line);
+ (yyval.interm.type).setBasic(EbtVoid, EvqFlatOut, (yylsp[(2) - (2)]));
else UNREACHABLE();
}
else if ((yyvsp[(2) - (2)].interm.type).qualifier == EvqCentroidOut) {
if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqSmooth)
- (yyval.interm.type).setBasic(EbtVoid, EvqCentroidOut, (yyvsp[(2) - (2)].interm.type).line);
+ (yyval.interm.type).setBasic(EbtVoid, EvqCentroidOut, (yylsp[(2) - (2)]));
else if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqFlat)
- (yyval.interm.type).setBasic(EbtVoid, EvqFlatOut, (yyvsp[(2) - (2)].interm.type).line);
+ (yyval.interm.type).setBasic(EbtVoid, EvqFlatOut, (yylsp[(2) - (2)]));
else UNREACHABLE();
}
else {
- context->error((yyvsp[(1) - (2)].interm.type).line, "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getInterpolationString((yyvsp[(1) - (2)].interm.type).qualifier));
+ context->error((yylsp[(1) - (2)]), "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getInterpolationString((yyvsp[(1) - (2)].interm.type).qualifier));
context->recover();
- (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(2) - (2)].interm.type).qualifier, (yyvsp[(2) - (2)].interm.type).line);
+ (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(2) - (2)].interm.type).qualifier, (yylsp[(2) - (2)]));
}
}
break;
@@ -3678,11 +3815,11 @@
case 119:
{
- context->error((yyvsp[(1) - (1)].interm.type).line, "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getInterpolationString((yyvsp[(1) - (1)].interm.type).qualifier));
+ context->error((yylsp[(1) - (1)]), "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getInterpolationString((yyvsp[(1) - (1)].interm.type).qualifier));
context->recover();
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].interm.type).line);
+ (yyval.interm.type).setBasic(EbtVoid, qual, (yylsp[(1) - (1)]));
}
break;
@@ -3697,7 +3834,7 @@
case 121:
{
- (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(2) - (2)].interm.type).qualifier, (yyvsp[(2) - (2)].interm.type).line);
+ (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(2) - (2)].interm.type).qualifier, (yylsp[(2) - (2)]));
(yyval.interm.type).layoutQualifier = (yyvsp[(1) - (2)].interm.layoutQualifier);
}
break;
@@ -3706,63 +3843,57 @@
{
(yyval.interm.type).qualifier = EvqConst;
- (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
}
break;
case 123:
{
- ES3_ONLY("in", (yyvsp[(1) - (1)].lex).line, "storage qualifier");
+ ES3_ONLY("in", (yylsp[(1) - (1)]), "storage qualifier");
(yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqSmoothIn : EvqVertexInput;
- (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
}
break;
case 124:
{
- ES3_ONLY("out", (yyvsp[(1) - (1)].lex).line, "storage qualifier");
+ ES3_ONLY("out", (yylsp[(1) - (1)]), "storage qualifier");
(yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOutput : EvqSmoothOut;
- (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
}
break;
case 125:
{
- ES3_ONLY("centroid in", (yyvsp[(1) - (2)].lex).line, "storage qualifier");
+ ES3_ONLY("centroid in", (yylsp[(1) - (2)]), "storage qualifier");
if (context->shaderType == SH_VERTEX_SHADER)
{
- context->error((yyvsp[(1) - (2)].lex).line, "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader");
+ context->error((yylsp[(1) - (2)]), "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader");
context->recover();
}
(yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexInput;
- (yyval.interm.type).line = (yyvsp[(1) - (2)].lex).line;
}
break;
case 126:
{
- ES3_ONLY("centroid out", (yyvsp[(1) - (2)].lex).line, "storage qualifier");
+ ES3_ONLY("centroid out", (yylsp[(1) - (2)]), "storage qualifier");
if (context->shaderType == SH_FRAGMENT_SHADER)
{
- context->error((yyvsp[(1) - (2)].lex).line, "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader");
+ context->error((yylsp[(1) - (2)]), "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader");
context->recover();
}
(yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOutput : EvqCentroidOut;
- (yyval.interm.type).line = (yyvsp[(1) - (2)].lex).line;
}
break;
case 127:
{
- if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
+ if (context->globalErrorCheck((yylsp[(1) - (1)]), context->symbolTable.atGlobalLevel(), "uniform"))
context->recover();
(yyval.interm.type).qualifier = EvqUniform;
- (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
}
break;
@@ -3773,7 +3904,7 @@
if ((yyval.interm.type).precision == EbpUndefined) {
(yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
- if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
+ if (context->precisionErrorCheck((yylsp[(1) - (1)]), (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
context->recover();
}
}
@@ -3812,7 +3943,7 @@
case 133:
{
- ES3_ONLY("layout", (yyvsp[(1) - (4)].lex).line, "qualifier");
+ ES3_ONLY("layout", (yylsp[(1) - (4)]), "qualifier");
(yyval.interm.layoutQualifier) = (yyvsp[(3) - (4)].interm.layoutQualifier);
}
break;
@@ -3834,21 +3965,21 @@
case 136:
{
- (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (1)].lex).string, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (1)].lex).string, (yylsp[(1) - (1)]));
}
break;
case 137:
{
- (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (3)].lex).string, (yyvsp[(1) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyvsp[(3) - (3)].lex).i, (yyvsp[(3) - (3)].lex).line);
+ (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (3)].lex).string, (yylsp[(1) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yyvsp[(3) - (3)].lex).i, (yylsp[(3) - (3)]));
}
break;
case 138:
{
- (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (3)].lex).string, (yyvsp[(1) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyvsp[(3) - (3)].lex).i, (yyvsp[(3) - (3)].lex).line);
+ (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (3)].lex).string, (yylsp[(1) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yyvsp[(3) - (3)].lex).i, (yylsp[(3) - (3)]));
}
break;
@@ -3864,11 +3995,11 @@
{
(yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
- if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
+ if (context->arrayTypeErrorCheck((yylsp[(2) - (4)]), (yyvsp[(1) - (4)].interm.type)))
context->recover();
else {
int size;
- if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
+ if (context->arraySizeErrorCheck((yylsp[(2) - (4)]), (yyvsp[(3) - (4)].interm.intermTypedNode), size))
context->recover();
(yyval.interm.type).setArray(true, size);
}
@@ -3879,7 +4010,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtVoid, qual, (yylsp[(1) - (1)]));
}
break;
@@ -3887,7 +4018,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
}
break;
@@ -3895,7 +4026,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[(1) - (1)]));
}
break;
@@ -3903,7 +4034,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[(1) - (1)]));
}
break;
@@ -3911,7 +4042,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[(1) - (1)]));
}
break;
@@ -3919,7 +4050,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setAggregate(2);
}
break;
@@ -3928,7 +4059,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setAggregate(3);
}
break;
@@ -3937,7 +4068,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setAggregate(4);
}
break;
@@ -3946,7 +4077,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setAggregate(2);
}
break;
@@ -3955,7 +4086,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setAggregate(3);
}
break;
@@ -3964,7 +4095,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setAggregate(4);
}
break;
@@ -3973,7 +4104,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setAggregate(2);
}
break;
@@ -3982,7 +4113,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setAggregate(3);
}
break;
@@ -3991,7 +4122,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setAggregate(4);
}
break;
@@ -4000,7 +4131,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setAggregate(2);
}
break;
@@ -4009,7 +4140,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setAggregate(3);
}
break;
@@ -4018,7 +4149,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setAggregate(4);
}
break;
@@ -4026,9 +4157,9 @@
case 158:
{
- FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
+ FRAG_VERT_ONLY("mat2", (yylsp[(1) - (1)]));
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setMatrix(2, 2);
}
break;
@@ -4036,9 +4167,9 @@
case 159:
{
- FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
+ FRAG_VERT_ONLY("mat3", (yylsp[(1) - (1)]));
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setMatrix(3, 3);
}
break;
@@ -4046,9 +4177,9 @@
case 160:
{
- FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
+ FRAG_VERT_ONLY("mat4", (yylsp[(1) - (1)]));
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setMatrix(4, 4);
}
break;
@@ -4057,7 +4188,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setMatrix(2, 3);
}
break;
@@ -4066,7 +4197,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setMatrix(3, 2);
}
break;
@@ -4075,7 +4206,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setMatrix(2, 4);
}
break;
@@ -4084,7 +4215,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setMatrix(4, 2);
}
break;
@@ -4093,7 +4224,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setMatrix(3, 4);
}
break;
@@ -4102,7 +4233,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setMatrix(4, 3);
}
break;
@@ -4110,9 +4241,9 @@
case 167:
{
- FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
+ FRAG_VERT_ONLY("sampler2D", (yylsp[(1) - (1)]));
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtSampler2D, qual, (yylsp[(1) - (1)]));
}
break;
@@ -4120,16 +4251,16 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtSampler3D, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtSampler3D, qual, (yylsp[(1) - (1)]));
}
break;
case 169:
{
- FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
+ FRAG_VERT_ONLY("samplerCube", (yylsp[(1) - (1)]));
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yylsp[(1) - (1)]));
}
break;
@@ -4137,7 +4268,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtSampler2DArray, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtSampler2DArray, qual, (yylsp[(1) - (1)]));
}
break;
@@ -4145,7 +4276,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtISampler2D, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtISampler2D, qual, (yylsp[(1) - (1)]));
}
break;
@@ -4153,7 +4284,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtISampler3D, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtISampler3D, qual, (yylsp[(1) - (1)]));
}
break;
@@ -4161,7 +4292,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtISamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtISamplerCube, qual, (yylsp[(1) - (1)]));
}
break;
@@ -4169,7 +4300,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtISampler2DArray, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtISampler2DArray, qual, (yylsp[(1) - (1)]));
}
break;
@@ -4177,7 +4308,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtUSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtUSampler2D, qual, (yylsp[(1) - (1)]));
}
break;
@@ -4185,7 +4316,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtUSampler3D, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtUSampler3D, qual, (yylsp[(1) - (1)]));
}
break;
@@ -4193,7 +4324,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtUSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtUSamplerCube, qual, (yylsp[(1) - (1)]));
}
break;
@@ -4201,7 +4332,7 @@
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtUSampler2DArray, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtUSampler2DArray, qual, (yylsp[(1) - (1)]));
}
break;
@@ -4209,12 +4340,12 @@
{
if (!context->supportsExtension("GL_OES_EGL_image_external")) {
- context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES");
+ context->error((yylsp[(1) - (1)]), "unsupported type", "samplerExternalOES");
context->recover();
}
- FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
+ FRAG_VERT_ONLY("samplerExternalOES", (yylsp[(1) - (1)]));
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yylsp[(1) - (1)]));
}
break;
@@ -4222,19 +4353,19 @@
{
if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
- context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "sampler2DRect");
+ context->error((yylsp[(1) - (1)]), "unsupported type", "sampler2DRect");
context->recover();
}
- FRAG_VERT_ONLY("sampler2DRect", (yyvsp[(1) - (1)].lex).line);
+ FRAG_VERT_ONLY("sampler2DRect", (yylsp[(1) - (1)]));
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yylsp[(1) - (1)]));
}
break;
case 181:
{
- FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
+ FRAG_VERT_ONLY("struct", (yylsp[(1) - (1)]));
(yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
(yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
}
@@ -4249,32 +4380,32 @@
//
TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setBasic(EbtStruct, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).userDef = &structure;
}
break;
case 183:
- { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
+ { if (context->enterStructDeclaration((yylsp[(2) - (3)]), *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
break;
case 184:
{
- (yyval.interm.type) = context->addStructure((yyvsp[(1) - (6)].lex).line, (yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string, (yyvsp[(5) - (6)].interm.typeList));
+ (yyval.interm.type) = context->addStructure((yylsp[(1) - (6)]), (yylsp[(2) - (6)]), *(yyvsp[(2) - (6)].lex).string, (yyvsp[(5) - (6)].interm.typeList));
}
break;
case 185:
- { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
+ { if (context->enterStructDeclaration((yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
break;
case 186:
{
- (yyval.interm.type) = context->addStructure((yyvsp[(1) - (5)].lex).line, 0, "", (yyvsp[(4) - (5)].interm.typeList));
+ (yyval.interm.type) = context->addStructure((yylsp[(1) - (5)]), (yyloc), "", (yyvsp[(4) - (5)].interm.typeList));
}
break;
@@ -4336,11 +4467,10 @@
case 193:
{
- if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
+ if (context->reservedErrorCheck((yylsp[(1) - (1)]), *(yyvsp[(1) - (1)].lex).string))
context->recover();
(yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
- (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
(yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
}
break;
@@ -4348,15 +4478,14 @@
case 194:
{
- if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
+ if (context->reservedErrorCheck((yylsp[(1) - (4)]), *(yyvsp[(1) - (4)].lex).string))
context->recover();
(yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
- (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
(yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
int size;
- if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
+ if (context->arraySizeErrorCheck((yylsp[(2) - (4)]), (yyvsp[(3) - (4)].interm.intermTypedNode), size))
context->recover();
(yyval.interm.typeLine).type->setArraySize(size);
}
@@ -4427,7 +4556,7 @@
{
if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
(yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
- (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
+ (yyvsp[(3) - (5)].interm.intermAggregate)->setLine((yyloc));
}
(yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
}
@@ -4475,7 +4604,7 @@
{
if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
(yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
- (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
+ (yyvsp[(2) - (3)].interm.intermAggregate)->setLine((yyloc));
}
(yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
}
@@ -4484,14 +4613,14 @@
case 216:
{
- (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
+ (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), (yyloc));
}
break;
case 217:
{
- (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0);
+ (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), (yyloc));
}
break;
@@ -4508,9 +4637,9 @@
case 220:
{
- if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
+ if (context->boolErrorCheck((yylsp[(1) - (5)]), (yyvsp[(3) - (5)].interm.intermTypedNode)))
context->recover();
- (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line);
+ (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yylsp[(1) - (5)]));
}
break;
@@ -4543,12 +4672,12 @@
{
TIntermNode* intermNode;
- if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
+ if (context->structQualifierErrorCheck((yylsp[(2) - (4)]), (yyvsp[(1) - (4)].interm.type)))
context->recover();
- if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
+ if (context->boolErrorCheck((yylsp[(2) - (4)]), (yyvsp[(1) - (4)].interm.type)))
context->recover();
- if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
+ if (!context->executeInitializer((yylsp[(2) - (4)]), *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
(yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
else {
context->recover();
@@ -4566,7 +4695,7 @@
{
context->symbolTable.pop();
- (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[(4) - (6)].interm.intermTypedNode), 0, (yyvsp[(6) - (6)].interm.intermNode), (yyvsp[(1) - (6)].lex).line);
+ (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[(4) - (6)].interm.intermTypedNode), 0, (yyvsp[(6) - (6)].interm.intermNode), (yylsp[(1) - (6)]));
--context->loopNestingLevel;
}
break;
@@ -4579,10 +4708,10 @@
case 228:
{
- if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
+ if (context->boolErrorCheck((yylsp[(8) - (8)]), (yyvsp[(6) - (8)].interm.intermTypedNode)))
context->recover();
- (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[(6) - (8)].interm.intermTypedNode), 0, (yyvsp[(3) - (8)].interm.intermNode), (yyvsp[(4) - (8)].lex).line);
+ (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[(6) - (8)].interm.intermTypedNode), 0, (yyvsp[(3) - (8)].interm.intermNode), (yylsp[(4) - (8)]));
--context->loopNestingLevel;
}
break;
@@ -4596,7 +4725,7 @@
{
context->symbolTable.pop();
- (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopFor, (yyvsp[(4) - (7)].interm.intermNode), reinterpret_cast<TIntermTyped*>((yyvsp[(5) - (7)].interm.nodePair).node1), reinterpret_cast<TIntermTyped*>((yyvsp[(5) - (7)].interm.nodePair).node2), (yyvsp[(7) - (7)].interm.intermNode), (yyvsp[(1) - (7)].lex).line);
+ (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopFor, (yyvsp[(4) - (7)].interm.intermNode), reinterpret_cast<TIntermTyped*>((yyvsp[(5) - (7)].interm.nodePair).node1), reinterpret_cast<TIntermTyped*>((yyvsp[(5) - (7)].interm.nodePair).node2), (yyvsp[(7) - (7)].interm.intermNode), (yylsp[(1) - (7)]));
--context->loopNestingLevel;
}
break;
@@ -4649,10 +4778,10 @@
{
if (context->loopNestingLevel <= 0) {
- context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "");
+ context->error((yylsp[(1) - (2)]), "continue statement only allowed in loops", "");
context->recover();
}
- (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
+ (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yylsp[(1) - (2)]));
}
break;
@@ -4660,19 +4789,19 @@
{
if (context->loopNestingLevel <= 0) {
- context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "");
+ context->error((yylsp[(1) - (2)]), "break statement only allowed in loops", "");
context->recover();
}
- (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
+ (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yylsp[(1) - (2)]));
}
break;
case 239:
{
- (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
+ (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yylsp[(1) - (2)]));
if (context->currentFunctionType->getBasicType() != EbtVoid) {
- context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return");
+ context->error((yylsp[(1) - (2)]), "non-void function must return a value", "return");
context->recover();
}
}
@@ -4681,13 +4810,13 @@
case 240:
{
- (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
+ (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yylsp[(1) - (3)]));
context->functionReturnsValue = true;
if (context->currentFunctionType->getBasicType() == EbtVoid) {
- context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return");
+ context->error((yylsp[(1) - (3)]), "void function cannot return a value", "return");
context->recover();
} else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
- context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return");
+ context->error((yylsp[(1) - (3)]), "function return is not matching type:", "return");
context->recover();
}
}
@@ -4696,8 +4825,8 @@
case 241:
{
- FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
- (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
+ FRAG_ONLY("discard", (yylsp[(1) - (2)]));
+ (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yylsp[(1) - (2)]));
}
break;
@@ -4712,7 +4841,7 @@
case 243:
{
- (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
+ (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), (yyloc));
context->treeRoot = (yyval.interm.intermNode);
}
break;
@@ -4740,7 +4869,7 @@
if (builtIn)
{
- context->error((yyvsp[(1) - (1)].interm).line, "built-in functions cannot be redefined", function->getName().c_str());
+ context->error((yylsp[(1) - (1)]), "built-in functions cannot be redefined", function->getName().c_str());
context->recover();
}
@@ -4754,7 +4883,7 @@
//
// Then this function already has a body.
//
- context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str());
+ context->error((yylsp[(1) - (1)]), "function already has a body", function->getName().c_str());
context->recover();
}
prevDec->setDefined();
@@ -4764,11 +4893,11 @@
//
if (function->getName() == "main") {
if (function->getParamCount() > 0) {
- context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str());
+ context->error((yylsp[(1) - (1)]), "function cannot take any parameter(s)", function->getName().c_str());
context->recover();
}
if (function->getReturnType().getBasicType() != EbtVoid) {
- context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
+ context->error((yylsp[(1) - (1)]), "", function->getReturnType().getBasicString(), "main function cannot return a value");
context->recover();
}
}
@@ -4796,7 +4925,7 @@
// Insert the parameters with name in the symbol table.
//
if (! context->symbolTable.declare(*variable)) {
- context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str());
+ context->error((yylsp[(1) - (1)]), "redefinition", variable->getName().c_str());
context->recover();
delete variable;
}
@@ -4808,13 +4937,13 @@
paramNodes,
context->intermediate.addSymbol(variable->getUniqueId(),
variable->getName(),
- variable->getType(), (yyvsp[(1) - (1)].interm).line),
- (yyvsp[(1) - (1)].interm).line);
+ variable->getType(), (yylsp[(1) - (1)])),
+ (yylsp[(1) - (1)]));
} else {
- paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
+ paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yylsp[(1) - (1)])), (yylsp[(1) - (1)]));
}
}
- context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
+ context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yylsp[(1) - (1)]));
(yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
context->loopNestingLevel = 0;
}
@@ -4826,12 +4955,12 @@
//?? Check that all paths return a value if return type != void ?
// May be best done as post process phase on intermediate code
if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
- context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
+ context->error((yylsp[(1) - (3)]), "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
context->recover();
}
- (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
- context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
+ (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), (yyloc));
+ context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yylsp[(1) - (3)]));
(yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
(yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
@@ -4840,9 +4969,6 @@
(yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->pragma().optimize);
(yyval.interm.intermNode)->getAsAggregate()->setDebug(context->pragma().debug);
- if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
- (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
-
context->symbolTable.pop();
}
break;
@@ -4869,6 +4995,7 @@
YY_STACK_PRINT (yyss, yyssp);
*++yyvsp = yyval;
+ *++yylsp = yyloc;
/* Now `shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
@@ -4898,7 +5025,7 @@
{
++yynerrs;
#if ! YYERROR_VERBOSE
- yyerror (context, YY_("syntax error"));
+ yyerror (&yylloc, context, YY_("syntax error"));
#else
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
yyssp, yytoken)
@@ -4925,7 +5052,7 @@
yymsgp = yymsg;
}
}
- yyerror (context, yymsgp);
+ yyerror (&yylloc, context, yymsgp);
if (yysyntax_error_status == 2)
goto yyexhaustedlab;
}
@@ -4933,7 +5060,7 @@
#endif
}
-
+ yyerror_range[1] = yylloc;
if (yyerrstatus == 3)
{
@@ -4949,7 +5076,7 @@
else
{
yydestruct ("Error: discarding",
- yytoken, &yylval, context);
+ yytoken, &yylval, &yylloc, context);
yychar = YYEMPTY;
}
}
@@ -4970,6 +5097,7 @@
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
+ yyerror_range[1] = yylsp[1-yylen];
/* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */
YYPOPSTACK (yylen);
@@ -5003,9 +5131,9 @@
if (yyssp == yyss)
YYABORT;
-
+ yyerror_range[1] = *yylsp;
yydestruct ("Error: popping",
- yystos[yystate], yyvsp, context);
+ yystos[yystate], yyvsp, yylsp, context);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
@@ -5015,6 +5143,11 @@
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
+ yyerror_range[2] = yylloc;
+ /* Using YYLLOC is tempting, but would change the location of
+ the lookahead. YYLOC is available though. */
+ YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
+ *++yylsp = yyloc;
/* Shift the error token. */
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
@@ -5042,7 +5175,7 @@
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
yyexhaustedlab:
- yyerror (context, YY_("memory exhausted"));
+ yyerror (&yylloc, context, YY_("memory exhausted"));
yyresult = 2;
/* Fall through. */
#endif
@@ -5054,7 +5187,7 @@
user semantic actions for why this is necessary. */
yytoken = YYTRANSLATE (yychar);
yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval, context);
+ yytoken, &yylval, &yylloc, context);
}
/* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */
@@ -5063,7 +5196,7 @@
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp, context);
+ yystos[*yyssp], yyvsp, yylsp, context);
YYPOPSTACK (1);
}
#ifndef yyoverflow
@@ -5082,6 +5215,11 @@
+void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason) {
+ context->error(*yylloc, reason, "");
+ context->recover();
+}
+
int glslang_parse(TParseContext* context) {
return yyparse(context);
}
diff --git a/src/compiler/glslang_tab.h b/src/compiler/glslang_tab.h
index 9598c6d..f785722 100644
--- a/src/compiler/glslang_tab.h
+++ b/src/compiler/glslang_tab.h
@@ -39,6 +39,14 @@
#if YYDEBUG
extern int yydebug;
#endif
+/* "%code requires" blocks. */
+
+
+#define YYLTYPE TSourceLoc
+#define YYLTYPE_IS_DECLARED 1
+
+
+
/* Tokens. */
#ifndef YYTOKENTYPE
@@ -179,7 +187,6 @@
struct {
- TSourceLoc line;
union {
TString *string;
float f;
@@ -190,7 +197,6 @@
TSymbol* symbol;
} lex;
struct {
- TSourceLoc line;
TOperator op;
union {
TIntermNode* intermNode;
@@ -218,6 +224,19 @@
# define YYSTYPE_IS_DECLARED 1
#endif
+#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
+typedef struct YYLTYPE
+{
+ int first_line;
+ int first_column;
+ int last_line;
+ int last_column;
+} YYLTYPE;
+# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
+# define YYLTYPE_IS_DECLARED 1
+# define YYLTYPE_IS_TRIVIAL 1
+#endif
+
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
diff --git a/src/compiler/intermOut.cpp b/src/compiler/intermOut.cpp
index e5c09db..c3abfa4 100644
--- a/src/compiler/intermOut.cpp
+++ b/src/compiler/intermOut.cpp
@@ -196,7 +196,9 @@
case EOpAny: out << "any"; break;
case EOpAll: out << "all"; break;
- default: out.message(EPrefixError, "Bad unary op");
+ default:
+ out.prefix(EPrefixError);
+ out << "Bad unary op";
}
out << " (" << node->getCompleteString() << ")";
@@ -211,7 +213,8 @@
TInfoSinkBase& out = sink;
if (node->getOp() == EOpNull) {
- out.message(EPrefixError, "node is still EOpNull!");
+ out.prefix(EPrefixError);
+ out << "node is still EOpNull!";
return true;
}
@@ -274,7 +277,9 @@
case EOpDeclaration: out << "Declaration: "; break;
- default: out.message(EPrefixError, "Bad aggregation op");
+ default:
+ out.prefix(EPrefixError);
+ out << "Bad aggregation op";
}
if (node->getOp() != EOpSequence && node->getOp() != EOpParameters)
@@ -349,7 +354,7 @@
out << " (const uint)\n";
break;
default:
- out.message(EPrefixInternalError, "Unknown constant", node->getLine());
+ out.message(EPrefixInternalError, node->getLine(), "Unknown constant");
break;
}
}
diff --git a/src/compiler/intermediate.h b/src/compiler/intermediate.h
index d5d6a19..a8a0e31 100644
--- a/src/compiler/intermediate.h
+++ b/src/compiler/intermediate.h
@@ -217,10 +217,16 @@
public:
POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
- TIntermNode() : line(0) {}
+ TIntermNode() {
+ // TODO: Move this to TSourceLoc constructor
+ // after getting rid of TPublicType.
+ line.first_file = line.last_file = 0;
+ line.first_line = line.last_line = 0;
+ }
+ virtual ~TIntermNode() { }
- TSourceLoc getLine() const { return line; }
- void setLine(TSourceLoc l) { line = l; }
+ const TSourceLoc& getLine() const { return line; }
+ void setLine(const TSourceLoc& l) { line = l; }
virtual void traverse(TIntermTraverser*) = 0;
virtual TIntermTyped* getAsTyped() { return 0; }
@@ -231,7 +237,6 @@
virtual TIntermSelection* getAsSelectionNode() { return 0; }
virtual TIntermSymbol* getAsSymbolNode() { return 0; }
virtual TIntermLoop* getAsLoopNode() { return 0; }
- virtual ~TIntermNode() { }
protected:
TSourceLoc line;
@@ -470,7 +475,7 @@
//
class TIntermAggregate : public TIntermOperator {
public:
- TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), endLine(0), useEmulatedFunction(false) { }
+ TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), useEmulatedFunction(false) { }
TIntermAggregate(TOperator o) : TIntermOperator(o), useEmulatedFunction(false) { }
~TIntermAggregate() { }
@@ -490,9 +495,6 @@
void setDebug(bool d) { debug = d; }
bool getDebug() { return debug; }
- void setEndLine(TSourceLoc line) { endLine = line; }
- TSourceLoc getEndLine() const { return endLine; }
-
void setUseEmulatedFunction() { useEmulatedFunction = true; }
bool getUseEmulatedFunction() { return useEmulatedFunction; }
@@ -505,7 +507,6 @@
bool optimize;
bool debug;
- TSourceLoc endLine;
// If set to true, replace the built-in function call with an emulated one
// to work around driver bugs.
diff --git a/src/compiler/localintermediate.h b/src/compiler/localintermediate.h
index 0e5ed0a..db35250 100644
--- a/src/compiler/localintermediate.h
+++ b/src/compiler/localintermediate.h
@@ -24,34 +24,33 @@
POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
TIntermediate(TInfoSink& i) : infoSink(i) { }
- TIntermSymbol* addSymbol(int Id, const TString&, const TType&, TSourceLoc);
+ TIntermSymbol* addSymbol(int Id, const TString&, const TType&, const TSourceLoc&);
TIntermTyped* addConversion(TOperator, const TType&, TIntermTyped*);
- TIntermTyped* addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc);
- TIntermTyped* addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc);
- TIntermTyped* addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, TSourceLoc);
- TIntermTyped* addUnaryMath(TOperator op, TIntermNode* child, TSourceLoc);
- TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right, TSourceLoc);
- TIntermAggregate* makeAggregate(TIntermNode* node, TSourceLoc);
- TIntermAggregate* setAggregateOperator(TIntermNode*, TOperator, TSourceLoc);
- TIntermNode* addSelection(TIntermTyped* cond, TIntermNodePair code, TSourceLoc);
- TIntermTyped* addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, TSourceLoc);
- TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, TSourceLoc);
- TIntermConstantUnion* addConstantUnion(ConstantUnion*, const TType&, TSourceLoc);
+ TIntermTyped* addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&);
+ TIntermTyped* addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&);
+ TIntermTyped* addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, const TSourceLoc&);
+ TIntermTyped* addUnaryMath(TOperator op, TIntermNode* child, const TSourceLoc&);
+ TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right, const TSourceLoc&);
+ TIntermAggregate* makeAggregate(TIntermNode* node, const TSourceLoc&);
+ TIntermAggregate* setAggregateOperator(TIntermNode*, TOperator, const TSourceLoc&);
+ TIntermNode* addSelection(TIntermTyped* cond, TIntermNodePair code, const TSourceLoc&);
+ TIntermTyped* addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc&);
+ TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, const TSourceLoc&);
+ TIntermConstantUnion* addConstantUnion(ConstantUnion*, const TType&, const TSourceLoc&);
TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) ;
- bool parseConstTree(TSourceLoc, TIntermNode*, ConstantUnion*, TOperator, TType, bool singleConstantParam = false);
- TIntermNode* addLoop(TLoopType, TIntermNode*, TIntermTyped*, TIntermTyped*, TIntermNode*, TSourceLoc);
- TIntermBranch* addBranch(TOperator, TSourceLoc);
- TIntermBranch* addBranch(TOperator, TIntermTyped*, TSourceLoc);
- TIntermTyped* addSwizzle(TVectorFields&, TSourceLoc);
+ bool parseConstTree(const TSourceLoc&, TIntermNode*, ConstantUnion*, TOperator, TType, bool singleConstantParam = false);
+ TIntermNode* addLoop(TLoopType, TIntermNode*, TIntermTyped*, TIntermTyped*, TIntermNode*, const TSourceLoc&);
+ TIntermBranch* addBranch(TOperator, const TSourceLoc&);
+ TIntermBranch* addBranch(TOperator, TIntermTyped*, const TSourceLoc&);
+ TIntermTyped* addSwizzle(TVectorFields&, const TSourceLoc&);
bool postProcess(TIntermNode*);
void remove(TIntermNode*);
void outputTree(TIntermNode*);
-
-protected:
- TInfoSink& infoSink;
private:
void operator=(TIntermediate&); // prevent assignments
+
+ TInfoSink& infoSink;
};
#endif // _LOCAL_INTERMEDIATE_INCLUDED_
diff --git a/src/compiler/parseConst.cpp b/src/compiler/parseConst.cpp
index 09f6e2b..fd2af0e 100644
--- a/src/compiler/parseConst.cpp
+++ b/src/compiler/parseConst.cpp
@@ -61,7 +61,7 @@
void TConstTraverser::visitSymbol(TIntermSymbol* node)
{
- infoSink.info.message(EPrefixInternalError, "Symbol Node found in constant constructor", node->getLine());
+ infoSink.info.message(EPrefixInternalError, node->getLine(), "Symbol Node found in constant constructor");
return;
}
@@ -74,12 +74,12 @@
TString buf;
buf.append("'constructor' : assigning non-constant to ");
buf.append(type.getCompleteString());
- infoSink.info.message(EPrefixError, buf.c_str(), node->getLine());
+ infoSink.info.message(EPrefixError, node->getLine(), buf.c_str());
error = true;
return false;
}
- infoSink.info.message(EPrefixInternalError, "Binary Node found in constant constructor", node->getLine());
+ infoSink.info.message(EPrefixInternalError, node->getLine(), "Binary Node found in constant constructor");
return false;
}
@@ -89,7 +89,7 @@
TString buf;
buf.append("'constructor' : assigning non-constant to ");
buf.append(type.getCompleteString());
- infoSink.info.message(EPrefixError, buf.c_str(), node->getLine());
+ infoSink.info.message(EPrefixError, node->getLine(), buf.c_str());
error = true;
return false;
}
@@ -100,7 +100,7 @@
TString buf;
buf.append("'constructor' : assigning non-constant to ");
buf.append(type.getCompleteString());
- infoSink.info.message(EPrefixError, buf.c_str(), node->getLine());
+ infoSink.info.message(EPrefixError, node->getLine(), buf.c_str());
error = true;
return false;
}
@@ -146,7 +146,7 @@
bool TConstTraverser::visitSelection(Visit visit, TIntermSelection* node)
{
- infoSink.info.message(EPrefixInternalError, "Selection Node found in constant constructor", node->getLine());
+ infoSink.info.message(EPrefixInternalError, node->getLine(), "Selection Node found in constant constructor");
error = true;
return false;
}
@@ -219,14 +219,14 @@
bool TConstTraverser::visitLoop(Visit visit, TIntermLoop* node)
{
- infoSink.info.message(EPrefixInternalError, "Loop Node found in constant constructor", node->getLine());
+ infoSink.info.message(EPrefixInternalError, node->getLine(), "Loop Node found in constant constructor");
error = true;
return false;
}
bool TConstTraverser::visitBranch(Visit visit, TIntermBranch* node)
{
- infoSink.info.message(EPrefixInternalError, "Branch Node found in constant constructor", node->getLine());
+ infoSink.info.message(EPrefixInternalError, node->getLine(), "Branch Node found in constant constructor");
error = true;
return false;
}
@@ -236,7 +236,7 @@
// Individual functions can be initialized to 0 to skip processing of that
// type of node. It's children will still be processed.
//
-bool TIntermediate::parseConstTree(TSourceLoc line, TIntermNode* root, ConstantUnion* unionArray, TOperator constructorType, TType t, bool singleConstantParam)
+bool TIntermediate::parseConstTree(const TSourceLoc& line, TIntermNode* root, ConstantUnion* unionArray, TOperator constructorType, TType t, bool singleConstantParam)
{
if (root == 0)
return false;
diff --git a/src/compiler/timing/RestrictVertexShaderTiming.cpp b/src/compiler/timing/RestrictVertexShaderTiming.cpp
index 524c6cf..57c01eb 100644
--- a/src/compiler/timing/RestrictVertexShaderTiming.cpp
+++ b/src/compiler/timing/RestrictVertexShaderTiming.cpp
@@ -10,8 +10,8 @@
{
if (IsSampler(node->getBasicType())) {
++mNumErrors;
- mSink.prefix(EPrefixError);
- mSink.location(node->getLine());
- mSink << "Samplers are not permitted in vertex shaders.\n";
+ mSink.message(EPrefixError,
+ node->getLine(),
+ "Samplers are not permitted in vertex shaders.\n");
}
}