summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/compiler/preprocessor
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/compiler/preprocessor')
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp80
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h6
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DirectiveHandlerBase.h18
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp171
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.h62
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.h8
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y85
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Input.cpp4
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Input.h29
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Lexer.h2
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Macro.cpp2
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Macro.h9
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp64
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.h60
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp35
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.h19
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/SourceLocation.h18
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Token.cpp10
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Token.h35
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.h16
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l34
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/length_limits.h21
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/numeric_lex.h8
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/pp_utils.h4
24 files changed, 438 insertions, 362 deletions
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp b/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp
index a7ce862bcb..cf60bc2349 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp
@@ -16,8 +16,8 @@ Diagnostics::~Diagnostics()
}
void Diagnostics::report(ID id,
- const SourceLocation& loc,
- const std::string& text)
+ const SourceLocation &loc,
+ const std::string &text)
{
// TODO(alokp): Keep a count of errors and warnings.
print(id, loc, text);
@@ -41,86 +41,86 @@ std::string Diagnostics::message(ID id)
{
// Errors begin.
case PP_INTERNAL_ERROR:
- return "internal error";
+ return "internal error";
case PP_OUT_OF_MEMORY:
- return "out of memory";
+ return "out of memory";
case PP_INVALID_CHARACTER:
- return "invalid character";
+ return "invalid character";
case PP_INVALID_NUMBER:
- return "invalid number";
+ return "invalid number";
case PP_INTEGER_OVERFLOW:
- return "integer overflow";
+ return "integer overflow";
case PP_FLOAT_OVERFLOW:
- return "float overflow";
+ return "float overflow";
case PP_TOKEN_TOO_LONG:
- return "token too long";
+ return "token too long";
case PP_INVALID_EXPRESSION:
- return "invalid expression";
+ return "invalid expression";
case PP_DIVISION_BY_ZERO:
- return "division by zero";
+ return "division by zero";
case PP_EOF_IN_COMMENT:
- return "unexpected end of file found in comment";
+ return "unexpected end of file found in comment";
case PP_UNEXPECTED_TOKEN:
- return "unexpected token";
+ return "unexpected token";
case PP_DIRECTIVE_INVALID_NAME:
- return "invalid directive name";
+ return "invalid directive name";
case PP_MACRO_NAME_RESERVED:
- return "macro name is reserved";
+ return "macro name is reserved";
case PP_MACRO_REDEFINED:
- return "macro redefined";
+ return "macro redefined";
case PP_MACRO_PREDEFINED_REDEFINED:
- return "predefined macro redefined";
+ return "predefined macro redefined";
case PP_MACRO_PREDEFINED_UNDEFINED:
- return "predefined macro undefined";
+ return "predefined macro undefined";
case PP_MACRO_UNTERMINATED_INVOCATION:
- return "unterminated macro invocation";
+ return "unterminated macro invocation";
case PP_MACRO_TOO_FEW_ARGS:
- return "Not enough arguments for macro";
+ return "Not enough arguments for macro";
case PP_MACRO_TOO_MANY_ARGS:
- return "Too many arguments for macro";
+ return "Too many arguments for macro";
case PP_CONDITIONAL_ENDIF_WITHOUT_IF:
- return "unexpected #endif found without a matching #if";
+ return "unexpected #endif found without a matching #if";
case PP_CONDITIONAL_ELSE_WITHOUT_IF:
- return "unexpected #else found without a matching #if";
+ return "unexpected #else found without a matching #if";
case PP_CONDITIONAL_ELSE_AFTER_ELSE:
- return "unexpected #else found after another #else";
+ return "unexpected #else found after another #else";
case PP_CONDITIONAL_ELIF_WITHOUT_IF:
- return "unexpected #elif found without a matching #if";
+ return "unexpected #elif found without a matching #if";
case PP_CONDITIONAL_ELIF_AFTER_ELSE:
- return "unexpected #elif found after #else";
+ return "unexpected #elif found after #else";
case PP_CONDITIONAL_UNTERMINATED:
- return "unexpected end of file found in conditional block";
+ return "unexpected end of file found in conditional block";
case PP_INVALID_EXTENSION_NAME:
- return "invalid extension name";
+ return "invalid extension name";
case PP_INVALID_EXTENSION_BEHAVIOR:
- return "invalid extension behavior";
+ return "invalid extension behavior";
case PP_INVALID_EXTENSION_DIRECTIVE:
- return "invalid extension directive";
+ return "invalid extension directive";
case PP_INVALID_VERSION_NUMBER:
- return "invalid version number";
+ return "invalid version number";
case PP_INVALID_VERSION_DIRECTIVE:
- return "invalid version directive";
+ return "invalid version directive";
case PP_VERSION_NOT_FIRST_STATEMENT:
return "#version directive must occur before anything else, "
"except for comments and white space";
case PP_INVALID_LINE_NUMBER:
- return "invalid line number";
+ return "invalid line number";
case PP_INVALID_FILE_NUMBER:
- return "invalid file number";
+ return "invalid file number";
case PP_INVALID_LINE_DIRECTIVE:
- return "invalid line directive";
+ return "invalid line directive";
// Errors end.
// Warnings begin.
case PP_EOF_IN_DIRECTIVE:
- return "unexpected end of file found in directive";
+ return "unexpected end of file found in directive";
case PP_CONDITIONAL_UNEXPECTED_TOKEN:
- return "unexpected token after conditional expression";
+ return "unexpected token after conditional expression";
case PP_UNRECOGNIZED_PRAGMA:
- return "unrecognized pragma";
+ return "unrecognized pragma";
// Warnings end.
default:
- assert(false);
- return "";
+ assert(false);
+ return "";
}
}
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h b/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h
index 2c8c539137..a7587ed657 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h
@@ -72,15 +72,15 @@ class Diagnostics
virtual ~Diagnostics();
- void report(ID id, const SourceLocation& loc, const std::string& text);
+ void report(ID id, const SourceLocation &loc, const std::string &text);
protected:
Severity severity(ID id);
std::string message(ID id);
virtual void print(ID id,
- const SourceLocation& loc,
- const std::string& text) = 0;
+ const SourceLocation &loc,
+ const std::string &text) = 0;
};
} // namespace pp
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/DirectiveHandlerBase.h b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveHandlerBase.h
index 2aaeec2818..040b25c6a2 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/DirectiveHandlerBase.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveHandlerBase.h
@@ -23,19 +23,19 @@ class DirectiveHandler
public:
virtual ~DirectiveHandler();
- virtual void handleError(const SourceLocation& loc,
- const std::string& msg) = 0;
+ virtual void handleError(const SourceLocation &loc,
+ const std::string &msg) = 0;
// Handle pragma of form: #pragma name[(value)]
- virtual void handlePragma(const SourceLocation& loc,
- const std::string& name,
- const std::string& value) = 0;
+ virtual void handlePragma(const SourceLocation &loc,
+ const std::string &name,
+ const std::string &value) = 0;
- virtual void handleExtension(const SourceLocation& loc,
- const std::string& name,
- const std::string& behavior) = 0;
+ virtual void handleExtension(const SourceLocation &loc,
+ const std::string &name,
+ const std::string &behavior) = 0;
- virtual void handleVersion(const SourceLocation& loc,
+ virtual void handleVersion(const SourceLocation &loc,
int version) = 0;
};
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp
index ebec79804d..6434d5cb5c 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2011-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -35,9 +35,8 @@ enum DirectiveType
DIRECTIVE_VERSION,
DIRECTIVE_LINE
};
-} // namespace
-static DirectiveType getDirective(const pp::Token* token)
+DirectiveType getDirective(const pp::Token *token)
{
static const std::string kDirectiveDefine("define");
static const std::string kDirectiveUndef("undef");
@@ -58,35 +57,35 @@ static DirectiveType getDirective(const pp::Token* token)
if (token->text == kDirectiveDefine)
return DIRECTIVE_DEFINE;
- else if (token->text == kDirectiveUndef)
+ if (token->text == kDirectiveUndef)
return DIRECTIVE_UNDEF;
- else if (token->text == kDirectiveIf)
+ if (token->text == kDirectiveIf)
return DIRECTIVE_IF;
- else if (token->text == kDirectiveIfdef)
+ if (token->text == kDirectiveIfdef)
return DIRECTIVE_IFDEF;
- else if (token->text == kDirectiveIfndef)
+ if (token->text == kDirectiveIfndef)
return DIRECTIVE_IFNDEF;
- else if (token->text == kDirectiveElse)
+ if (token->text == kDirectiveElse)
return DIRECTIVE_ELSE;
- else if (token->text == kDirectiveElif)
+ if (token->text == kDirectiveElif)
return DIRECTIVE_ELIF;
- else if (token->text == kDirectiveEndif)
+ if (token->text == kDirectiveEndif)
return DIRECTIVE_ENDIF;
- else if (token->text == kDirectiveError)
+ if (token->text == kDirectiveError)
return DIRECTIVE_ERROR;
- else if (token->text == kDirectivePragma)
+ if (token->text == kDirectivePragma)
return DIRECTIVE_PRAGMA;
- else if (token->text == kDirectiveExtension)
+ if (token->text == kDirectiveExtension)
return DIRECTIVE_EXTENSION;
- else if (token->text == kDirectiveVersion)
+ if (token->text == kDirectiveVersion)
return DIRECTIVE_VERSION;
- else if (token->text == kDirectiveLine)
+ if (token->text == kDirectiveLine)
return DIRECTIVE_LINE;
return DIRECTIVE_NONE;
}
-static bool isConditionalDirective(DirectiveType directive)
+bool isConditionalDirective(DirectiveType directive)
{
switch (directive)
{
@@ -103,12 +102,12 @@ static bool isConditionalDirective(DirectiveType directive)
}
// Returns true if the token represents End Of Directive.
-static bool isEOD(const pp::Token* token)
+bool isEOD(const pp::Token *token)
{
return (token->type == '\n') || (token->type == pp::Token::LAST);
}
-static void skipUntilEOD(pp::Lexer* lexer, pp::Token* token)
+void skipUntilEOD(pp::Lexer *lexer, pp::Token *token)
{
while(!isEOD(token))
{
@@ -116,7 +115,7 @@ static void skipUntilEOD(pp::Lexer* lexer, pp::Token* token)
}
}
-static bool isMacroNameReserved(const std::string& name)
+bool isMacroNameReserved(const std::string &name)
{
// Names prefixed with "GL_" are reserved.
if (name.substr(0, 3) == "GL_")
@@ -129,30 +128,32 @@ static bool isMacroNameReserved(const std::string& name)
return false;
}
-static bool isMacroPredefined(const std::string& name,
- const pp::MacroSet& macroSet)
+bool isMacroPredefined(const std::string &name,
+ const pp::MacroSet &macroSet)
{
pp::MacroSet::const_iterator iter = macroSet.find(name);
return iter != macroSet.end() ? iter->second.predefined : false;
}
+} // namespace anonymous
+
namespace pp
{
class DefinedParser : public Lexer
{
public:
- DefinedParser(Lexer* lexer,
- const MacroSet* macroSet,
- Diagnostics* diagnostics) :
- mLexer(lexer),
- mMacroSet(macroSet),
- mDiagnostics(diagnostics)
+ DefinedParser(Lexer *lexer,
+ const MacroSet *macroSet,
+ Diagnostics *diagnostics)
+ : mLexer(lexer),
+ mMacroSet(macroSet),
+ mDiagnostics(diagnostics)
{
}
protected:
- virtual void lex(Token* token)
+ virtual void lex(Token *token)
{
static const std::string kDefined("defined");
@@ -199,24 +200,24 @@ class DefinedParser : public Lexer
}
private:
- Lexer* mLexer;
- const MacroSet* mMacroSet;
- Diagnostics* mDiagnostics;
+ Lexer *mLexer;
+ const MacroSet *mMacroSet;
+ Diagnostics *mDiagnostics;
};
-DirectiveParser::DirectiveParser(Tokenizer* tokenizer,
- MacroSet* macroSet,
- Diagnostics* diagnostics,
- DirectiveHandler* directiveHandler) :
- mPastFirstStatement(false),
- mTokenizer(tokenizer),
- mMacroSet(macroSet),
- mDiagnostics(diagnostics),
- mDirectiveHandler(directiveHandler)
+DirectiveParser::DirectiveParser(Tokenizer *tokenizer,
+ MacroSet *macroSet,
+ Diagnostics *diagnostics,
+ DirectiveHandler *directiveHandler)
+ : mPastFirstStatement(false),
+ mTokenizer(tokenizer),
+ mMacroSet(macroSet),
+ mDiagnostics(diagnostics),
+ mDirectiveHandler(directiveHandler)
{
}
-void DirectiveParser::lex(Token* token)
+void DirectiveParser::lex(Token *token)
{
do
{
@@ -232,19 +233,20 @@ void DirectiveParser::lex(Token* token)
{
if (!mConditionalStack.empty())
{
- const ConditionalBlock& block = mConditionalStack.back();
+ const ConditionalBlock &block = mConditionalStack.back();
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNTERMINATED,
block.location, block.type);
}
break;
}
- } while (skipping() || (token->type == '\n'));
+ }
+ while (skipping() || (token->type == '\n'));
mPastFirstStatement = true;
}
-void DirectiveParser::parseDirective(Token* token)
+void DirectiveParser::parseDirective(Token *token)
{
assert(token->type == Token::PP_HASH);
@@ -324,7 +326,7 @@ void DirectiveParser::parseDirective(Token* token)
}
}
-void DirectiveParser::parseDefine(Token* token)
+void DirectiveParser::parseDefine(Token *token)
{
assert(getDirective(token) == DIRECTIVE_DEFINE);
@@ -357,14 +359,16 @@ void DirectiveParser::parseDefine(Token* token)
{
// Function-like macro. Collect arguments.
macro.type = Macro::kTypeFunc;
- do {
+ do
+ {
mTokenizer->lex(token);
if (token->type != Token::IDENTIFIER)
break;
macro.parameters.push_back(token->text);
mTokenizer->lex(token); // Get ','.
- } while (token->type == ',');
+ }
+ while (token->type == ',');
if (token->type != ')')
{
@@ -404,7 +408,7 @@ void DirectiveParser::parseDefine(Token* token)
mMacroSet->insert(std::make_pair(macro.name, macro));
}
-void DirectiveParser::parseUndef(Token* token)
+void DirectiveParser::parseUndef(Token *token)
{
assert(getDirective(token) == DIRECTIVE_UNDEF);
@@ -433,25 +437,25 @@ void DirectiveParser::parseUndef(Token* token)
mTokenizer->lex(token);
}
-void DirectiveParser::parseIf(Token* token)
+void DirectiveParser::parseIf(Token *token)
{
assert(getDirective(token) == DIRECTIVE_IF);
parseConditionalIf(token);
}
-void DirectiveParser::parseIfdef(Token* token)
+void DirectiveParser::parseIfdef(Token *token)
{
assert(getDirective(token) == DIRECTIVE_IFDEF);
parseConditionalIf(token);
}
-void DirectiveParser::parseIfndef(Token* token)
+void DirectiveParser::parseIfndef(Token *token)
{
assert(getDirective(token) == DIRECTIVE_IFNDEF);
parseConditionalIf(token);
}
-void DirectiveParser::parseElse(Token* token)
+void DirectiveParser::parseElse(Token *token)
{
assert(getDirective(token) == DIRECTIVE_ELSE);
@@ -463,7 +467,7 @@ void DirectiveParser::parseElse(Token* token)
return;
}
- ConditionalBlock& block = mConditionalStack.back();
+ ConditionalBlock &block = mConditionalStack.back();
if (block.skipBlock)
{
// No diagnostics. Just skip the whole line.
@@ -492,7 +496,7 @@ void DirectiveParser::parseElse(Token* token)
}
}
-void DirectiveParser::parseElif(Token* token)
+void DirectiveParser::parseElif(Token *token)
{
assert(getDirective(token) == DIRECTIVE_ELIF);
@@ -504,7 +508,7 @@ void DirectiveParser::parseElif(Token* token)
return;
}
- ConditionalBlock& block = mConditionalStack.back();
+ ConditionalBlock &block = mConditionalStack.back();
if (block.skipBlock)
{
// No diagnostics. Just skip the whole line.
@@ -532,7 +536,7 @@ void DirectiveParser::parseElif(Token* token)
block.foundValidGroup = expression != 0;
}
-void DirectiveParser::parseEndif(Token* token)
+void DirectiveParser::parseEndif(Token *token)
{
assert(getDirective(token) == DIRECTIVE_ENDIF);
@@ -556,7 +560,7 @@ void DirectiveParser::parseEndif(Token* token)
}
}
-void DirectiveParser::parseError(Token* token)
+void DirectiveParser::parseError(Token *token)
{
assert(getDirective(token) == DIRECTIVE_ERROR);
@@ -571,7 +575,7 @@ void DirectiveParser::parseError(Token* token)
}
// Parses pragma of form: #pragma name[(value)].
-void DirectiveParser::parsePragma(Token* token)
+void DirectiveParser::parsePragma(Token *token)
{
assert(getDirective(token) == DIRECTIVE_PRAGMA);
@@ -627,7 +631,7 @@ void DirectiveParser::parsePragma(Token* token)
}
}
-void DirectiveParser::parseExtension(Token* token)
+void DirectiveParser::parseExtension(Token *token)
{
assert(getDirective(token) == DIRECTIVE_EXTENSION);
@@ -694,7 +698,7 @@ void DirectiveParser::parseExtension(Token* token)
mDirectiveHandler->handleExtension(token->location, name, behavior);
}
-void DirectiveParser::parseVersion(Token* token)
+void DirectiveParser::parseVersion(Token *token)
{
assert(getDirective(token) == DIRECTIVE_VERSION);
@@ -708,7 +712,9 @@ void DirectiveParser::parseVersion(Token* token)
enum State
{
- VERSION_NUMBER
+ VERSION_NUMBER,
+ VERSION_PROFILE,
+ VERSION_ENDLINE
};
bool valid = true;
@@ -716,12 +722,12 @@ void DirectiveParser::parseVersion(Token* token)
int state = VERSION_NUMBER;
mTokenizer->lex(token);
- while ((token->type != '\n') && (token->type != Token::LAST))
+ while (valid && (token->type != '\n') && (token->type != Token::LAST))
{
- switch (state++)
+ switch (state)
{
case VERSION_NUMBER:
- if (valid && (token->type != Token::CONST_INT))
+ if (token->type != Token::CONST_INT)
{
mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_NUMBER,
token->location, token->text);
@@ -733,29 +739,44 @@ void DirectiveParser::parseVersion(Token* token)
token->location, token->text);
valid = false;
}
- break;
- default:
if (valid)
{
- mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
+ state = (version < 300) ? VERSION_ENDLINE : VERSION_PROFILE;
+ }
+ break;
+ case VERSION_PROFILE:
+ if (token->type != Token::IDENTIFIER || token->text != "es")
+ {
+ mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_DIRECTIVE,
token->location, token->text);
valid = false;
}
+ state = VERSION_ENDLINE;
+ break;
+ default:
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
+ token->location, token->text);
+ valid = false;
break;
}
+
mTokenizer->lex(token);
}
- if (valid && (state != VERSION_NUMBER + 1))
+
+ if (valid && (state != VERSION_ENDLINE))
{
mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_DIRECTIVE,
token->location, token->text);
valid = false;
}
+
if (valid)
+ {
mDirectiveHandler->handleVersion(token->location, version);
+ }
}
-void DirectiveParser::parseLine(Token* token)
+void DirectiveParser::parseLine(Token *token)
{
assert(getDirective(token) == DIRECTIVE_LINE);
@@ -824,19 +845,21 @@ void DirectiveParser::parseLine(Token* token)
if (valid)
{
mTokenizer->setLineNumber(line);
- if (state == FILE_NUMBER + 1) mTokenizer->setFileNumber(file);
+ if (state == FILE_NUMBER + 1)
+ mTokenizer->setFileNumber(file);
}
}
bool DirectiveParser::skipping() const
{
- if (mConditionalStack.empty()) return false;
+ if (mConditionalStack.empty())
+ return false;
const ConditionalBlock& block = mConditionalStack.back();
return block.skipBlock || block.skipGroup;
}
-void DirectiveParser::parseConditionalIf(Token* token)
+void DirectiveParser::parseConditionalIf(Token *token)
{
ConditionalBlock block;
block.type = token->text;
@@ -877,7 +900,7 @@ void DirectiveParser::parseConditionalIf(Token* token)
mConditionalStack.push_back(block);
}
-int DirectiveParser::parseExpressionIf(Token* token)
+int DirectiveParser::parseExpressionIf(Token *token)
{
assert((getDirective(token) == DIRECTIVE_IF) ||
(getDirective(token) == DIRECTIVE_ELIF));
@@ -901,7 +924,7 @@ int DirectiveParser::parseExpressionIf(Token* token)
return expression;
}
-int DirectiveParser::parseExpressionIfdef(Token* token)
+int DirectiveParser::parseExpressionIfdef(Token *token)
{
assert((getDirective(token) == DIRECTIVE_IFDEF) ||
(getDirective(token) == DIRECTIVE_IFNDEF));
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.h b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.h
index 8a7f0072ba..335091781c 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.h
@@ -22,35 +22,35 @@ class Tokenizer;
class DirectiveParser : public Lexer
{
public:
- DirectiveParser(Tokenizer* tokenizer,
- MacroSet* macroSet,
- Diagnostics* diagnostics,
- DirectiveHandler* directiveHandler);
+ DirectiveParser(Tokenizer *tokenizer,
+ MacroSet *macroSet,
+ Diagnostics *diagnostics,
+ DirectiveHandler *directiveHandler);
- virtual void lex(Token* token);
+ virtual void lex(Token *token);
private:
PP_DISALLOW_COPY_AND_ASSIGN(DirectiveParser);
- void parseDirective(Token* token);
- void parseDefine(Token* token);
- void parseUndef(Token* token);
- void parseIf(Token* token);
- void parseIfdef(Token* token);
- void parseIfndef(Token* token);
- void parseElse(Token* token);
- void parseElif(Token* token);
- void parseEndif(Token* token);
- void parseError(Token* token);
- void parsePragma(Token* token);
- void parseExtension(Token* token);
- void parseVersion(Token* token);
- void parseLine(Token* token);
+ void parseDirective(Token *token);
+ void parseDefine(Token *token);
+ void parseUndef(Token *token);
+ void parseIf(Token *token);
+ void parseIfdef(Token *token);
+ void parseIfndef(Token *token);
+ void parseElse(Token *token);
+ void parseElif(Token *token);
+ void parseEndif(Token *token);
+ void parseError(Token *token);
+ void parsePragma(Token *token);
+ void parseExtension(Token *token);
+ void parseVersion(Token *token);
+ void parseLine(Token *token);
bool skipping() const;
- void parseConditionalIf(Token* token);
- int parseExpressionIf(Token* token);
- int parseExpressionIfdef(Token* token);
+ void parseConditionalIf(Token *token);
+ int parseExpressionIf(Token *token);
+ int parseExpressionIfdef(Token *token);
struct ConditionalBlock
{
@@ -61,20 +61,20 @@ class DirectiveParser : public Lexer
bool foundValidGroup;
bool foundElseGroup;
- ConditionalBlock() :
- skipBlock(false),
- skipGroup(false),
- foundValidGroup(false),
- foundElseGroup(false)
+ ConditionalBlock()
+ : skipBlock(false),
+ skipGroup(false),
+ foundValidGroup(false),
+ foundElseGroup(false)
{
}
};
bool mPastFirstStatement;
std::vector<ConditionalBlock> mConditionalStack;
- Tokenizer* mTokenizer;
- MacroSet* mMacroSet;
- Diagnostics* mDiagnostics;
- DirectiveHandler* mDirectiveHandler;
+ Tokenizer *mTokenizer;
+ MacroSet *mMacroSet;
+ Diagnostics *mDiagnostics;
+ DirectiveHandler *mDirectiveHandler;
};
} // namespace pp
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.h b/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.h
index 092d059413..f040cb01fa 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.h
@@ -19,15 +19,15 @@ struct Token;
class ExpressionParser
{
public:
- ExpressionParser(Lexer* lexer, Diagnostics* diagnostics);
+ ExpressionParser(Lexer *lexer, Diagnostics *diagnostics);
- bool parse(Token* token, int* result);
+ bool parse(Token *token, int *result);
private:
PP_DISALLOW_COPY_AND_ASSIGN(ExpressionParser);
- Lexer* mLexer;
- Diagnostics* mDiagnostics;
+ Lexer *mLexer;
+ Diagnostics *mDiagnostics;
};
} // namespace pp
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y b/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y
index 9fa0f0bf80..662a31b650 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y
+++ b/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y
@@ -195,15 +195,14 @@ expression
%%
-int yylex(YYSTYPE* lvalp, Context* context)
+int yylex(YYSTYPE *lvalp, Context *context)
{
int type = 0;
- pp::Token* token = context->token;
+ pp::Token *token = context->token;
switch (token->type)
{
- case pp::Token::CONST_INT:
- {
+ case pp::Token::CONST_INT: {
unsigned int val = 0;
if (!token->uValue(&val))
{
@@ -214,39 +213,59 @@ int yylex(YYSTYPE* lvalp, Context* context)
type = TOK_CONST_INT;
break;
}
- case pp::Token::OP_OR: type = TOK_OP_OR; break;
- case pp::Token::OP_AND: type = TOK_OP_AND; break;
- case pp::Token::OP_NE: type = TOK_OP_NE; break;
- case pp::Token::OP_EQ: type = TOK_OP_EQ; break;
- case pp::Token::OP_GE: type = TOK_OP_GE; break;
- case pp::Token::OP_LE: type = TOK_OP_LE; break;
- case pp::Token::OP_RIGHT: type = TOK_OP_RIGHT; break;
- case pp::Token::OP_LEFT: type = TOK_OP_LEFT; break;
- case '|': type = '|'; break;
- case '^': type = '^'; break;
- case '&': type = '&'; break;
- case '>': type = '>'; break;
- case '<': type = '<'; break;
- case '-': type = '-'; break;
- case '+': type = '+'; break;
- case '%': type = '%'; break;
- case '/': type = '/'; break;
- case '*': type = '*'; break;
- case '!': type = '!'; break;
- case '~': type = '~'; break;
- case '(': type = '('; break;
- case ')': type = ')'; break;
+ case pp::Token::OP_OR:
+ type = TOK_OP_OR;
+ break;
+ case pp::Token::OP_AND:
+ type = TOK_OP_AND;
+ break;
+ case pp::Token::OP_NE:
+ type = TOK_OP_NE;
+ break;
+ case pp::Token::OP_EQ:
+ type = TOK_OP_EQ;
+ break;
+ case pp::Token::OP_GE:
+ type = TOK_OP_GE;
+ break;
+ case pp::Token::OP_LE:
+ type = TOK_OP_LE;
+ break;
+ case pp::Token::OP_RIGHT:
+ type = TOK_OP_RIGHT;
+ break;
+ case pp::Token::OP_LEFT:
+ type = TOK_OP_LEFT;
+ break;
+ case '|':
+ case '^':
+ case '&':
+ case '>':
+ case '<':
+ case '-':
+ case '+':
+ case '%':
+ case '/':
+ case '*':
+ case '!':
+ case '~':
+ case '(':
+ case ')':
+ type = token->type;
+ break;
- default: break;
+ default:
+ break;
}
// Advance to the next token if the current one is valid.
- if (type != 0) context->lexer->lex(token);
+ if (type != 0)
+ context->lexer->lex(token);
return type;
}
-void yyerror(Context* context, const char* reason)
+void yyerror(Context *context, const char *reason)
{
context->diagnostics->report(pp::Diagnostics::PP_INVALID_EXPRESSION,
context->token->location,
@@ -255,13 +274,13 @@ void yyerror(Context* context, const char* reason)
namespace pp {
-ExpressionParser::ExpressionParser(Lexer* lexer, Diagnostics* diagnostics) :
- mLexer(lexer),
- mDiagnostics(diagnostics)
+ExpressionParser::ExpressionParser(Lexer *lexer, Diagnostics *diagnostics)
+ : mLexer(lexer),
+ mDiagnostics(diagnostics)
{
}
-bool ExpressionParser::parse(Token* token, int* result)
+bool ExpressionParser::parse(Token *token, int *result)
{
Context context;
context.diagnostics = mDiagnostics;
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Input.cpp b/src/3rdparty/angle/src/compiler/preprocessor/Input.cpp
index b4d970a97d..f9910a6cc3 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/Input.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Input.cpp
@@ -17,7 +17,7 @@ Input::Input() : mCount(0), mString(0)
{
}
-Input::Input(size_t count, const char* const string[], const int length[]) :
+Input::Input(size_t count, const char *const string[], const int length[]) :
mCount(count),
mString(string)
{
@@ -29,7 +29,7 @@ Input::Input(size_t count, const char* const string[], const int length[]) :
}
}
-size_t Input::read(char* buf, size_t maxSize)
+size_t Input::read(char *buf, size_t maxSize)
{
size_t nRead = 0;
while ((nRead < maxSize) && (mReadLoc.sIndex < mCount))
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Input.h b/src/3rdparty/angle/src/compiler/preprocessor/Input.h
index 14b7597cb4..2ac4f0c170 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/Input.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Input.h
@@ -18,27 +18,40 @@ class Input
{
public:
Input();
- Input(size_t count, const char* const string[], const int length[]);
+ Input(size_t count, const char *const string[], const int length[]);
- size_t count() const { return mCount; }
- const char* string(size_t index) const { return mString[index]; }
- size_t length(size_t index) const { return mLength[index]; }
+ size_t count() const
+ {
+ return mCount;
+ }
+ const char *string(size_t index) const
+ {
+ return mString[index];
+ }
+ size_t length(size_t index) const
+ {
+ return mLength[index];
+ }
- size_t read(char* buf, size_t maxSize);
+ size_t read(char *buf, size_t maxSize);
struct Location
{
size_t sIndex; // String index;
size_t cIndex; // Char index.
- Location() : sIndex(0), cIndex(0) { }
+ Location()
+ : sIndex(0),
+ cIndex(0)
+ {
+ }
};
- const Location& readLoc() const { return mReadLoc; }
+ const Location &readLoc() const { return mReadLoc; }
private:
// Input.
size_t mCount;
- const char* const* mString;
+ const char * const *mString;
std::vector<size_t> mLength;
Location mReadLoc;
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Lexer.h b/src/3rdparty/angle/src/compiler/preprocessor/Lexer.h
index eb85cea873..d42d3db7e0 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/Lexer.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Lexer.h
@@ -17,7 +17,7 @@ class Lexer
public:
virtual ~Lexer();
- virtual void lex(Token* token) = 0;
+ virtual void lex(Token *token) = 0;
};
} // namespace pp
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Macro.cpp b/src/3rdparty/angle/src/compiler/preprocessor/Macro.cpp
index b2e3088e32..13cb14e3dc 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/Macro.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Macro.cpp
@@ -11,7 +11,7 @@
namespace pp
{
-bool Macro::equals(const Macro& other) const
+bool Macro::equals(const Macro &other) const
{
return (type == other.type) &&
(name == other.name) &&
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Macro.h b/src/3rdparty/angle/src/compiler/preprocessor/Macro.h
index 7ec0149116..b77e7bc15c 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/Macro.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Macro.h
@@ -26,8 +26,13 @@ struct Macro
typedef std::vector<std::string> Parameters;
typedef std::vector<Token> Replacements;
- Macro() : predefined(false), disabled(false), type(kTypeObj) { }
- bool equals(const Macro& other) const;
+ Macro()
+ : predefined(false),
+ disabled(false),
+ type(kTypeObj)
+ {
+ }
+ bool equals(const Macro &other) const;
bool predefined;
mutable bool disabled;
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp b/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp
index b789260af9..d7e0c83465 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp
@@ -20,13 +20,13 @@ class TokenLexer : public Lexer
public:
typedef std::vector<Token> TokenVector;
- TokenLexer(TokenVector* tokens)
+ TokenLexer(TokenVector *tokens)
{
tokens->swap(mTokens);
mIter = mTokens.begin();
}
- virtual void lex(Token* token)
+ virtual void lex(Token *token)
{
if (mIter == mTokens.end())
{
@@ -46,12 +46,12 @@ class TokenLexer : public Lexer
TokenVector::const_iterator mIter;
};
-MacroExpander::MacroExpander(Lexer* lexer,
- MacroSet* macroSet,
- Diagnostics* diagnostics) :
- mLexer(lexer),
- mMacroSet(macroSet),
- mDiagnostics(diagnostics)
+MacroExpander::MacroExpander(Lexer *lexer,
+ MacroSet *macroSet,
+ Diagnostics *diagnostics)
+ : mLexer(lexer),
+ mMacroSet(macroSet),
+ mDiagnostics(diagnostics)
{
}
@@ -63,7 +63,7 @@ MacroExpander::~MacroExpander()
}
}
-void MacroExpander::lex(Token* token)
+void MacroExpander::lex(Token *token)
{
while (true)
{
@@ -97,7 +97,7 @@ void MacroExpander::lex(Token* token)
}
}
-void MacroExpander::getToken(Token* token)
+void MacroExpander::getToken(Token *token)
{
if (mReserveToken.get())
{
@@ -122,11 +122,11 @@ void MacroExpander::getToken(Token* token)
}
}
-void MacroExpander::ungetToken(const Token& token)
+void MacroExpander::ungetToken(const Token &token)
{
if (!mContextStack.empty())
{
- MacroContext* context = mContextStack.back();
+ MacroContext *context = mContextStack.back();
context->unget();
assert(context->replacements[context->index] == token);
}
@@ -148,7 +148,7 @@ bool MacroExpander::isNextTokenLeftParen()
return lparen;
}
-bool MacroExpander::pushMacro(const Macro& macro, const Token& identifier)
+bool MacroExpander::pushMacro(const Macro &macro, const Token &identifier)
{
assert(!macro.disabled);
assert(!identifier.expansionDisabled());
@@ -162,7 +162,7 @@ bool MacroExpander::pushMacro(const Macro& macro, const Token& identifier)
// Macro is disabled for expansion until it is popped off the stack.
macro.disabled = true;
- MacroContext* context = new MacroContext;
+ MacroContext *context = new MacroContext;
context->macro = &macro;
context->replacements.swap(replacements);
mContextStack.push_back(context);
@@ -173,7 +173,7 @@ void MacroExpander::popMacro()
{
assert(!mContextStack.empty());
- MacroContext* context = mContextStack.back();
+ MacroContext *context = mContextStack.back();
mContextStack.pop_back();
assert(context->empty());
@@ -182,9 +182,9 @@ void MacroExpander::popMacro()
delete context;
}
-bool MacroExpander::expandMacro(const Macro& macro,
- const Token& identifier,
- std::vector<Token>* replacements)
+bool MacroExpander::expandMacro(const Macro &macro,
+ const Token &identifier,
+ std::vector<Token> *replacements)
{
replacements->clear();
if (macro.type == Macro::kTypeObj)
@@ -239,9 +239,9 @@ bool MacroExpander::expandMacro(const Macro& macro,
return true;
}
-bool MacroExpander::collectMacroArgs(const Macro& macro,
- const Token& identifier,
- std::vector<MacroArg>* args)
+bool MacroExpander::collectMacroArgs(const Macro &macro,
+ const Token &identifier,
+ std::vector<MacroArg> *args)
{
Token token;
getToken(&token);
@@ -276,7 +276,8 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
// The individual arguments are separated by comma tokens, but
// the comma tokens between matching inner parentheses do not
// seperate arguments.
- if (openParens == 1) args->push_back(MacroArg());
+ if (openParens == 1)
+ args->push_back(MacroArg());
isArg = openParens != 1;
break;
default:
@@ -285,14 +286,15 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
}
if (isArg)
{
- MacroArg& arg = args->back();
+ MacroArg &arg = args->back();
// Initial whitespace is not part of the argument.
- if (arg.empty()) token.setHasLeadingSpace(false);
+ if (arg.empty())
+ token.setHasLeadingSpace(false);
arg.push_back(token);
}
}
- const Macro::Parameters& params = macro.parameters;
+ const Macro::Parameters &params = macro.parameters;
// If there is only one empty argument, it is equivalent to no argument.
if (params.empty() && (args->size() == 1) && args->front().empty())
{
@@ -313,7 +315,7 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
// inserted into the macro body.
for (std::size_t i = 0; i < args->size(); ++i)
{
- MacroArg& arg = args->at(i);
+ MacroArg &arg = args->at(i);
TokenLexer lexer(&arg);
MacroExpander expander(&lexer, mMacroSet, mDiagnostics);
@@ -328,13 +330,13 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
return true;
}
-void MacroExpander::replaceMacroParams(const Macro& macro,
- const std::vector<MacroArg>& args,
- std::vector<Token>* replacements)
+void MacroExpander::replaceMacroParams(const Macro &macro,
+ const std::vector<MacroArg> &args,
+ std::vector<Token> *replacements)
{
for (std::size_t i = 0; i < macro.replacements.size(); ++i)
{
- const Token& repl = macro.replacements[i];
+ const Token &repl = macro.replacements[i];
if (repl.type != Token::IDENTIFIER)
{
replacements->push_back(repl);
@@ -353,7 +355,7 @@ void MacroExpander::replaceMacroParams(const Macro& macro,
}
std::size_t iArg = std::distance(macro.parameters.begin(), iter);
- const MacroArg& arg = args[iArg];
+ const MacroArg &arg = args[iArg];
if (arg.empty())
{
continue;
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.h b/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.h
index 21b67571f1..d4fd091786 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.h
@@ -23,51 +23,65 @@ class Diagnostics;
class MacroExpander : public Lexer
{
public:
- MacroExpander(Lexer* lexer, MacroSet* macroSet, Diagnostics* diagnostics);
+ MacroExpander(Lexer *lexer, MacroSet *macroSet, Diagnostics *diagnostics);
virtual ~MacroExpander();
- virtual void lex(Token* token);
+ virtual void lex(Token *token);
private:
PP_DISALLOW_COPY_AND_ASSIGN(MacroExpander);
- void getToken(Token* token);
- void ungetToken(const Token& token);
+ void getToken(Token *token);
+ void ungetToken(const Token &token);
bool isNextTokenLeftParen();
- bool pushMacro(const Macro& macro, const Token& identifier);
+ bool pushMacro(const Macro &macro, const Token &identifier);
void popMacro();
- bool expandMacro(const Macro& macro,
- const Token& identifier,
- std::vector<Token>* replacements);
+ bool expandMacro(const Macro &macro,
+ const Token &identifier,
+ std::vector<Token> *replacements);
typedef std::vector<Token> MacroArg;
- bool collectMacroArgs(const Macro& macro,
- const Token& identifier,
- std::vector<MacroArg>* args);
- void replaceMacroParams(const Macro& macro,
- const std::vector<MacroArg>& args,
- std::vector<Token>* replacements);
+ bool collectMacroArgs(const Macro &macro,
+ const Token &identifier,
+ std::vector<MacroArg> *args);
+ void replaceMacroParams(const Macro &macro,
+ const std::vector<MacroArg> &args,
+ std::vector<Token> *replacements);
struct MacroContext
{
- const Macro* macro;
+ const Macro *macro;
std::size_t index;
std::vector<Token> replacements;
- MacroContext() : macro(0), index(0) { }
- bool empty() const { return index == replacements.size(); }
- const Token& get() { return replacements[index++]; }
- void unget() { assert(index > 0); --index; }
+ MacroContext()
+ : macro(0),
+ index(0)
+ {
+ }
+ bool empty() const
+ {
+ return index == replacements.size();
+ }
+ const Token &get()
+ {
+ return replacements[index++];
+ }
+ void unget()
+ {
+ assert(index > 0);
+ --index;
+ }
};
- Lexer* mLexer;
- MacroSet* mMacroSet;
- Diagnostics* mDiagnostics;
+ Lexer *mLexer;
+ MacroSet *mMacroSet;
+ Diagnostics *mDiagnostics;
std::auto_ptr<Token> mReserveToken;
- std::vector<MacroContext*> mContextStack;
+ std::vector<MacroContext *> mContextStack;
};
} // namespace pp
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp b/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp
index 580ffba459..3522fa1abb 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp
@@ -21,24 +21,24 @@ namespace pp
struct PreprocessorImpl
{
- Diagnostics* diagnostics;
+ Diagnostics *diagnostics;
MacroSet macroSet;
Tokenizer tokenizer;
DirectiveParser directiveParser;
MacroExpander macroExpander;
- PreprocessorImpl(Diagnostics* diag,
- DirectiveHandler* directiveHandler) :
- diagnostics(diag),
- tokenizer(diag),
- directiveParser(&tokenizer, &macroSet, diag, directiveHandler),
- macroExpander(&directiveParser, &macroSet, diag)
+ PreprocessorImpl(Diagnostics *diag,
+ DirectiveHandler *directiveHandler)
+ : diagnostics(diag),
+ tokenizer(diag),
+ directiveParser(&tokenizer, &macroSet, diag, directiveHandler),
+ macroExpander(&directiveParser, &macroSet, diag)
{
}
};
-Preprocessor::Preprocessor(Diagnostics* diagnostics,
- DirectiveHandler* directiveHandler)
+Preprocessor::Preprocessor(Diagnostics *diagnostics,
+ DirectiveHandler *directiveHandler)
{
mImpl = new PreprocessorImpl(diagnostics, directiveHandler);
}
@@ -49,7 +49,7 @@ Preprocessor::~Preprocessor()
}
bool Preprocessor::init(size_t count,
- const char* const string[],
+ const char * const string[],
const int length[])
{
static const int kGLSLVersion = 100;
@@ -63,7 +63,7 @@ bool Preprocessor::init(size_t count,
return mImpl->tokenizer.init(count, string, length);
}
-void Preprocessor::predefineMacro(const char* name, int value)
+void Preprocessor::predefineMacro(const char *name, int value)
{
std::ostringstream stream;
stream << value;
@@ -81,12 +81,7 @@ void Preprocessor::predefineMacro(const char* name, int value)
mImpl->macroSet[name] = macro;
}
-void Preprocessor::setMaxTokenLength(size_t maxLength)
-{
- mImpl->tokenizer.setMaxTokenLength(maxLength);
-}
-
-void Preprocessor::lex(Token* token)
+void Preprocessor::lex(Token *token)
{
bool validToken = false;
while (!validToken)
@@ -115,5 +110,9 @@ void Preprocessor::lex(Token* token)
}
}
-} // namespace pp
+void Preprocessor::setMaxTokenSize(size_t maxTokenSize)
+{
+ mImpl->tokenizer.setMaxTokenSize(maxTokenSize);
+}
+} // namespace pp
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.h b/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.h
index 9a90d79a1a..0a55f1c9c1 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.h
@@ -22,7 +22,7 @@ struct Token;
class Preprocessor
{
public:
- Preprocessor(Diagnostics* diagnostics, DirectiveHandler* directiveHandler);
+ Preprocessor(Diagnostics *diagnostics, DirectiveHandler *directiveHandler);
~Preprocessor();
// count: specifies the number of elements in the string and length arrays.
@@ -34,22 +34,19 @@ class Preprocessor
// Each element in the length array may contain the length of the
// corresponding string or a value less than 0 to indicate that the string
// is null terminated.
- bool init(size_t count, const char* const string[], const int length[]);
+ bool init(size_t count, const char * const string[], const int length[]);
// Adds a pre-defined macro.
- void predefineMacro(const char* name, int value);
- // Sets maximum allowed token length.
- // If token length exceeds this limit,
- // the token text will be truncated to the given maximum length, and
- // TOKEN_TOO_LONG diagnostic will be generated.
- // The maximum length defaults to 256.
- void setMaxTokenLength(size_t maxLength);
+ void predefineMacro(const char *name, int value);
- void lex(Token* token);
+ void lex(Token *token);
+
+ // Set maximum preprocessor token size
+ void setMaxTokenSize(size_t maxTokenSize);
private:
PP_DISALLOW_COPY_AND_ASSIGN(Preprocessor);
- PreprocessorImpl* mImpl;
+ PreprocessorImpl *mImpl;
};
} // namespace pp
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/SourceLocation.h b/src/3rdparty/angle/src/compiler/preprocessor/SourceLocation.h
index 6982613ac7..d4c1a5e178 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/SourceLocation.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/SourceLocation.h
@@ -12,10 +12,18 @@ namespace pp
struct SourceLocation
{
- SourceLocation() : file(0), line(0) { }
- SourceLocation(int f, int l) : file(f), line(l) { }
+ SourceLocation()
+ : file(0),
+ line(0)
+ {
+ }
+ SourceLocation(int f, int l)
+ : file(f),
+ line(l)
+ {
+ }
- bool equals(const SourceLocation& other) const
+ bool equals(const SourceLocation &other) const
{
return (file == other.file) && (line == other.line);
}
@@ -24,12 +32,12 @@ struct SourceLocation
int line;
};
-inline bool operator==(const SourceLocation& lhs, const SourceLocation& rhs)
+inline bool operator==(const SourceLocation &lhs, const SourceLocation &rhs)
{
return lhs.equals(rhs);
}
-inline bool operator!=(const SourceLocation& lhs, const SourceLocation& rhs)
+inline bool operator!=(const SourceLocation &lhs, const SourceLocation &rhs)
{
return !lhs.equals(rhs);
}
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Token.cpp b/src/3rdparty/angle/src/compiler/preprocessor/Token.cpp
index 67f50aa32c..d102654747 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/Token.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Token.cpp
@@ -21,7 +21,7 @@ void Token::reset()
text.clear();
}
-bool Token::equals(const Token& other) const
+bool Token::equals(const Token &other) const
{
return (type == other.type) &&
(flags == other.flags) &&
@@ -53,25 +53,25 @@ void Token::setExpansionDisabled(bool disable)
flags &= ~EXPANSION_DISABLED;
}
-bool Token::iValue(int* value) const
+bool Token::iValue(int *value) const
{
assert(type == CONST_INT);
return numeric_lex_int(text, value);
}
-bool Token::uValue(unsigned int* value) const
+bool Token::uValue(unsigned int *value) const
{
assert(type == CONST_INT);
return numeric_lex_int(text, value);
}
-bool Token::fValue(float* value) const
+bool Token::fValue(float *value) const
{
assert(type == CONST_FLOAT);
return numeric_lex_float(text, value);
}
-std::ostream& operator<<(std::ostream& out, const Token& token)
+std::ostream &operator<<(std::ostream &out, const Token &token)
{
if (token.hasLeadingSpace())
out << " ";
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Token.h b/src/3rdparty/angle/src/compiler/preprocessor/Token.h
index 8b553aecb6..8832e279c7 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/Token.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Token.h
@@ -62,27 +62,40 @@ struct Token
EXPANSION_DISABLED = 1 << 2
};
- Token() : type(0), flags(0) { }
+ Token()
+ : type(0),
+ flags(0)
+ {
+ }
void reset();
- bool equals(const Token& other) const;
+ bool equals(const Token &other) const;
// Returns true if this is the first token on line.
// It disregards any leading whitespace.
- bool atStartOfLine() const { return (flags & AT_START_OF_LINE) != 0; }
+ bool atStartOfLine() const
+ {
+ return (flags & AT_START_OF_LINE) != 0;
+ }
void setAtStartOfLine(bool start);
- bool hasLeadingSpace() const { return (flags & HAS_LEADING_SPACE) != 0; }
+ bool hasLeadingSpace() const
+ {
+ return (flags & HAS_LEADING_SPACE) != 0;
+ }
void setHasLeadingSpace(bool space);
- bool expansionDisabled() const { return (flags & EXPANSION_DISABLED) != 0; }
+ bool expansionDisabled() const
+ {
+ return (flags & EXPANSION_DISABLED) != 0;
+ }
void setExpansionDisabled(bool disable);
// Converts text into numeric value for CONST_INT and CONST_FLOAT token.
// Returns false if the parsed value cannot fit into an int or float.
- bool iValue(int* value) const;
- bool uValue(unsigned int* value) const;
- bool fValue(float* value) const;
+ bool iValue(int *value) const;
+ bool uValue(unsigned int *value) const;
+ bool fValue(float *value) const;
int type;
unsigned int flags;
@@ -90,17 +103,17 @@ struct Token
std::string text;
};
-inline bool operator==(const Token& lhs, const Token& rhs)
+inline bool operator==(const Token &lhs, const Token &rhs)
{
return lhs.equals(rhs);
}
-inline bool operator!=(const Token& lhs, const Token& rhs)
+inline bool operator!=(const Token &lhs, const Token &rhs)
{
return !lhs.equals(rhs);
}
-extern std::ostream& operator<<(std::ostream& out, const Token& token);
+extern std::ostream &operator<<(std::ostream &out, const Token &token);
} // namepsace pp
#endif // COMPILER_PREPROCESSOR_TOKEN_H_
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.h b/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.h
index 9d131f865a..07ad93da05 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -21,7 +21,7 @@ class Tokenizer : public Lexer
public:
struct Context
{
- Diagnostics* diagnostics;
+ Diagnostics *diagnostics;
Input input;
// The location where yytext points to. Token location should track
@@ -33,25 +33,25 @@ class Tokenizer : public Lexer
bool lineStart;
};
- Tokenizer(Diagnostics* diagnostics);
+ Tokenizer(Diagnostics *diagnostics);
~Tokenizer();
- bool init(size_t count, const char* const string[], const int length[]);
+ bool init(size_t count, const char * const string[], const int length[]);
- void setMaxTokenLength(size_t maxLength) { mMaxTokenLength = maxLength; }
void setFileNumber(int file);
void setLineNumber(int line);
+ void setMaxTokenSize(size_t maxTokenSize);
- virtual void lex(Token* token);
+ virtual void lex(Token *token);
private:
PP_DISALLOW_COPY_AND_ASSIGN(Tokenizer);
bool initScanner();
void destroyScanner();
- void* mHandle; // Scanner handle.
+ void *mHandle; // Scanner handle.
Context mContext; // Scanner extra.
- size_t mMaxTokenLength;
+ size_t mMaxTokenSize; // Maximum token size
};
} // namespace pp
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l b/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l
index f1380b26b7..2a77b905a4 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l
@@ -1,6 +1,6 @@
/*
//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -14,7 +14,7 @@ IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
%top{
//
-// Copyright (c) 2011-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2011-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -78,9 +78,9 @@ NEWLINE \n|\r|\r\n
IDENTIFIER [_a-zA-Z][_a-zA-Z0-9]*
PUNCTUATOR [][<>(){}.+-/*%^|&~=!:;,?]
-DECIMAL_CONSTANT [1-9][0-9]*
-OCTAL_CONSTANT 0[0-7]*
-HEXADECIMAL_CONSTANT 0[xX][0-9a-fA-F]+
+DECIMAL_CONSTANT [1-9][0-9]*[uU]?
+OCTAL_CONSTANT 0[0-7]*[uU]?
+HEXADECIMAL_CONSTANT 0[xX][0-9a-fA-F]+[uU]?
DIGIT [0-9]
EXPONENT_PART [eE][+-]?{DIGIT}+
@@ -114,12 +114,12 @@ FRACTIONAL_CONSTANT ({DIGIT}*"."{DIGIT}+)|({DIGIT}+".")
return pp::Token::IDENTIFIER;
}
-{DECIMAL_CONSTANT}|{OCTAL_CONSTANT}|{HEXADECIMAL_CONSTANT} {
+({DECIMAL_CONSTANT}[uU]?)|({OCTAL_CONSTANT}[uU]?)|({HEXADECIMAL_CONSTANT}[uU]?) {
yylval->assign(yytext, yyleng);
return pp::Token::CONST_INT;
}
-({DIGIT}+{EXPONENT_PART})|({FRACTIONAL_CONSTANT}{EXPONENT_PART}?) {
+({DIGIT}+{EXPONENT_PART}[fF]?)|({FRACTIONAL_CONSTANT}{EXPONENT_PART}?[fF]?) {
yylval->assign(yytext, yyleng);
return pp::Token::CONST_FLOAT;
}
@@ -267,9 +267,7 @@ FRACTIONAL_CONSTANT ({DIGIT}*"."{DIGIT}+)|({DIGIT}+".")
namespace pp {
-Tokenizer::Tokenizer(Diagnostics* diagnostics)
- : mHandle(0),
- mMaxTokenLength(256)
+Tokenizer::Tokenizer(Diagnostics *diagnostics) : mHandle(0)
{
mContext.diagnostics = diagnostics;
}
@@ -279,9 +277,10 @@ Tokenizer::~Tokenizer()
destroyScanner();
}
-bool Tokenizer::init(size_t count, const char* const string[], const int length[])
+bool Tokenizer::init(size_t count, const char * const string[], const int length[])
{
- if ((count > 0) && (string == 0)) return false;
+ if ((count > 0) && (string == 0))
+ return false;
mContext.input = Input(count, string, length);
return initScanner();
@@ -299,14 +298,19 @@ void Tokenizer::setLineNumber(int line)
yyset_lineno(line, mHandle);
}
-void Tokenizer::lex(Token* token)
+void Tokenizer::setMaxTokenSize(size_t maxTokenSize)
+{
+ mMaxTokenSize = maxTokenSize;
+}
+
+void Tokenizer::lex(Token *token)
{
token->type = yylex(&token->text, &token->location, mHandle);
- if (token->text.size() > mMaxTokenLength)
+ if (token->text.size() > mMaxTokenSize)
{
mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG,
token->location, token->text);
- token->text.erase(mMaxTokenLength);
+ token->text.erase(mMaxTokenSize);
}
token->flags = 0;
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/length_limits.h b/src/3rdparty/angle/src/compiler/preprocessor/length_limits.h
deleted file mode 100644
index 4f1f71319f..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/length_limits.h
+++ /dev/null
@@ -1,21 +0,0 @@
-//
-// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-//
-// length_limits.h
-//
-
-#if !defined(__LENGTH_LIMITS_H)
-#define __LENGTH_LIMITS_H 1
-
-// These constants are factored out from the rest of the headers to
-// make it easier to reference them from the compiler sources.
-
-// These lengths do not include the NULL terminator.
-#define MAX_SYMBOL_NAME_LEN 256
-#define MAX_STRING_LEN 511
-
-#endif // !(defined(__LENGTH_LIMITS_H)
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/numeric_lex.h b/src/3rdparty/angle/src/compiler/preprocessor/numeric_lex.h
index b04125d230..8a24540696 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/numeric_lex.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/numeric_lex.h
@@ -13,7 +13,7 @@
namespace pp {
-inline std::ios::fmtflags numeric_base_int(const std::string& str)
+inline std::ios::fmtflags numeric_base_int(const std::string &str)
{
if ((str.size() >= 2) &&
(str[0] == '0') &&
@@ -21,7 +21,7 @@ inline std::ios::fmtflags numeric_base_int(const std::string& str)
{
return std::ios::hex;
}
- else if ((str.size() >= 1) && (str[0] == '0'))
+ if ((str.size() >= 1) && (str[0] == '0'))
{
return std::ios::oct;
}
@@ -34,7 +34,7 @@ inline std::ios::fmtflags numeric_base_int(const std::string& str)
// in which case false is returned.
template<typename IntType>
-bool numeric_lex_int(const std::string& str, IntType* value)
+bool numeric_lex_int(const std::string &str, IntType *value)
{
std::istringstream stream(str);
// This should not be necessary, but MSVS has a buggy implementation.
@@ -46,7 +46,7 @@ bool numeric_lex_int(const std::string& str, IntType* value)
}
template<typename FloatType>
-bool numeric_lex_float(const std::string& str, FloatType* value)
+bool numeric_lex_float(const std::string &str, FloatType *value)
{
std::istringstream stream(str);
// Force "C" locale so that decimal character is always '.', and
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/pp_utils.h b/src/3rdparty/angle/src/compiler/preprocessor/pp_utils.h
index 17164ea8b0..9fba9385c5 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/pp_utils.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/pp_utils.h
@@ -12,7 +12,7 @@
// A macro to disallow the copy constructor and operator= functions
// This must be used in the private: declarations for a class.
#define PP_DISALLOW_COPY_AND_ASSIGN(TypeName) \
- TypeName(const TypeName&); \
- void operator=(const TypeName&)
+ TypeName(const TypeName &); \
+ void operator=(const TypeName &)
#endif // COMPILER_PREPROCESSOR_PPUTILS_H_