Reland "Renamed SkSL "offset" to "line""
This reverts commit cc91452f0a65f261283615db9ed3d37b1c3acd15.
Change-Id: I7eff0ddeebef4ce298893f9b3ba410b09647e9a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453138
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/sksl/SkSLDSLParser.cpp b/src/sksl/SkSLDSLParser.cpp
index 8b283e9..6ae114f 100644
--- a/src/sksl/SkSLDSLParser.cpp
+++ b/src/sksl/SkSLDSLParser.cpp
@@ -196,16 +196,16 @@
return this->position(t.fLine);
}
-PositionInfo DSLParser::position(int offset) {
- return PositionInfo("<unknown>", offset);
+PositionInfo DSLParser::position(int line) {
+ return PositionInfo("<unknown>", line);
}
void DSLParser::error(Token token, String msg) {
this->error(token.fLine, msg);
}
-void DSLParser::error(int offset, String msg) {
- GetErrorReporter().error(msg.c_str(), this->position(offset));
+void DSLParser::error(int line, String msg) {
+ GetErrorReporter().error(msg.c_str(), this->position(line));
}
/* declaration* END_OF_FILE */
@@ -413,12 +413,12 @@
}
}
-bool DSLParser::parseArrayDimensions(int offset, DSLType* type) {
+bool DSLParser::parseArrayDimensions(int line, DSLType* type) {
while (this->checkNext(Token::Kind::TK_LBRACKET)) {
if (this->checkNext(Token::Kind::TK_RBRACKET)) {
- this->error(offset, "expected array dimension");
+ this->error(line, "expected array dimension");
} else {
- *type = Array(*type, this->arraySize(), this->position(offset));
+ *type = Array(*type, this->arraySize(), this->position(line));
if (!this->expect(Token::Kind::TK_RBRACKET, "']'")) {
return false;
}
@@ -427,7 +427,7 @@
return true;
}
-bool DSLParser::parseInitializer(int offset, DSLExpression* initializer) {
+bool DSLParser::parseInitializer(int line, DSLExpression* initializer) {
if (this->checkNext(Token::Kind::TK_EQ)) {
DSLExpression value = this->assignmentExpression();
if (!value.hasValue()) {
@@ -1583,17 +1583,17 @@
}
}
-DSLExpression DSLParser::swizzle(int offset, DSLExpression base,
+DSLExpression DSLParser::swizzle(int line, DSLExpression base,
skstd::string_view swizzleMask) {
SkASSERT(swizzleMask.length() > 0);
if (!base.type().isVector() && !base.type().isScalar()) {
- return base.field(swizzleMask, this->position(offset));
+ return base.field(swizzleMask, this->position(line));
}
int length = swizzleMask.length();
SkSL::SwizzleComponent::Type components[4];
for (int i = 0; i < length; ++i) {
if (i >= 4) {
- this->error(offset, "too many components in swizzle mask");
+ this->error(line, "too many components in swizzle mask");
return DSLExpression::Poison();
}
switch (swizzleMask[i]) {
@@ -1616,7 +1616,7 @@
case 'q': components[i] = SwizzleComponent::Q; break;
case 'B': components[i] = SwizzleComponent::UB; break;
default:
- this->error(offset,
+ this->error(line,
String::printf("invalid swizzle component '%c'", swizzleMask[i]).c_str());
return DSLExpression::Poison();
}
@@ -1631,8 +1631,8 @@
}
}
-dsl::DSLExpression DSLParser::call(int offset, dsl::DSLExpression base, ExpressionArray args) {
- return DSLExpression(base(std::move(args), this->position(offset)), this->position(offset));
+dsl::DSLExpression DSLParser::call(int line, dsl::DSLExpression base, ExpressionArray args) {
+ return DSLExpression(base(std::move(args), this->position(line)), this->position(line));
}
/* LBRACKET expression? RBRACKET | DOT IDENTIFIER | LPAREN arguments RPAREN |