update and skip accepts check in lexers
We think we're getting away with this because our
tokens never go from legal to illegal to legal again,
right?
Change-Id: Iaaef797f7c4b487ba7b1d0e018846bd13086b34c
Reviewed-on: https://skia-review.googlesource.com/138275
Auto-Submit: Mike Klein <mtklein@chromium.org>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/SkSLLayoutLexer.cpp b/src/sksl/SkSLLayoutLexer.cpp
index 5a4e23f..58af170 100644
--- a/src/sksl/SkSLLayoutLexer.cpp
+++ b/src/sksl/SkSLLayoutLexer.cpp
@@ -542,7 +542,8 @@
if (!state) {
break;
}
- if (accepts[state]) {
+ // We seem to be getting away without doing this check.
+ /*if (accepts[state] != -1)*/ {
lastAccept = (LayoutToken::Kind)accepts[state];
lastAcceptEnd = offset;
}
@@ -551,4 +552,4 @@
return LayoutToken(lastAccept, startOffset, lastAcceptEnd - startOffset);
}
-} // namespace
+} // namespace SkSL
diff --git a/src/sksl/SkSLLayoutLexer.h b/src/sksl/SkSLLayoutLexer.h
index fa337ed..e95f20e 100644
--- a/src/sksl/SkSLLayoutLexer.h
+++ b/src/sksl/SkSLLayoutLexer.h
@@ -123,5 +123,5 @@
int fOffset;
};
-} // namespace
+} // namespace SkSL
#endif
diff --git a/src/sksl/SkSLLexer.cpp b/src/sksl/SkSLLexer.cpp
index 44ebdca..5bb970a 100644
--- a/src/sksl/SkSLLexer.cpp
+++ b/src/sksl/SkSLLexer.cpp
@@ -957,7 +957,8 @@
if (!state) {
break;
}
- if (accepts[state]) {
+ // We seem to be getting away without doing this check.
+ /*if (accepts[state] != -1)*/ {
lastAccept = (Token::Kind)accepts[state];
lastAcceptEnd = offset;
}
@@ -966,4 +967,4 @@
return Token(lastAccept, startOffset, lastAcceptEnd - startOffset);
}
-} // namespace
+} // namespace SkSL
diff --git a/src/sksl/SkSLLexer.h b/src/sksl/SkSLLexer.h
index 18f70a1..2700287 100644
--- a/src/sksl/SkSLLexer.h
+++ b/src/sksl/SkSLLexer.h
@@ -238,5 +238,5 @@
int fOffset;
};
-} // namespace
+} // namespace SkSL
#endif
diff --git a/src/sksl/lex/Main.cpp b/src/sksl/lex/Main.cpp
index 68c97f0..9a30b8b 100644
--- a/src/sksl/lex/Main.cpp
+++ b/src/sksl/lex/Main.cpp
@@ -149,7 +149,8 @@
out << " if (!state) {\n";
out << " break;\n";
out << " }\n";
- out << " if (accepts[state]) {\n";
+ out << " // We seem to be getting away without doing this check.\n";
+ out << " /*if (accepts[state] != -1)*/ {\n";
out << " lastAccept = (" << token << "::Kind) accepts[state];\n";
out << " lastAcceptEnd = offset;\n";
out << " }\n";