Fix breaking the build with missing GetGlobalMaxTokenSize.
Because the preprocessor is used independently from the compiler,
we need a way to track max token size when we don't have access
to the parse context with the current spec.
BUG=angle:550
Change-Id: Idf5035ec2c001ee75f264151ab3c4e92f3cd44d7
Reviewed-on: https://chromium-review.googlesource.com/187140
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Reviewed-by: Nicolas Capens <nicolascapens@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/preprocessor/Tokenizer.cpp b/src/compiler/preprocessor/Tokenizer.cpp
index 45130b3..25aefa9 100644
--- a/src/compiler/preprocessor/Tokenizer.cpp
+++ b/src/compiler/preprocessor/Tokenizer.cpp
@@ -540,7 +540,6 @@
*/
#include "Tokenizer.h"
-#include "length_limits.h"
#include "DiagnosticsBase.h"
#include "Token.h"
@@ -2317,7 +2316,9 @@
namespace pp {
-Tokenizer::Tokenizer(Diagnostics* diagnostics) : mHandle(0)
+Tokenizer::Tokenizer(Diagnostics* diagnostics)
+ : mHandle(0),
+ mMaxTokenSize(256)
{
mContext.diagnostics = diagnostics;
}
@@ -2347,14 +2348,19 @@
ppset_lineno(line,mHandle);
}
+void Tokenizer::setMaxTokenSize(size_t maxTokenSize)
+{
+ mMaxTokenSize = maxTokenSize;
+}
+
void Tokenizer::lex(Token* token)
{
token->type = pplex(&token->text,&token->location,mHandle);
- if (token->text.size() > GetGlobalMaxTokenSize())
+ if (token->text.size() > mMaxTokenSize)
{
mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG,
token->location, token->text);
- token->text.erase(GetGlobalMaxTokenSize());
+ token->text.erase(mMaxTokenSize);
}
token->flags = 0;