Wrap all preprocessor code in the angle namespace.

BUG=836820
BUG=801364

Change-Id: I08b6a2f9f12b689e09df6efd916c313e71e8a051
Reviewed-on: https://chromium-review.googlesource.com/1028581
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
diff --git a/src/compiler/preprocessor/DiagnosticsBase.cpp b/src/compiler/preprocessor/DiagnosticsBase.cpp
index c89bc9f..691379f 100644
--- a/src/compiler/preprocessor/DiagnosticsBase.cpp
+++ b/src/compiler/preprocessor/DiagnosticsBase.cpp
@@ -8,6 +8,9 @@
 
 #include "common/debug.h"
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -141,3 +144,5 @@
 }
 
 }  // namespace pp
+
+}  // namespace angle
diff --git a/src/compiler/preprocessor/DiagnosticsBase.h b/src/compiler/preprocessor/DiagnosticsBase.h
index ea37614..8806d37 100644
--- a/src/compiler/preprocessor/DiagnosticsBase.h
+++ b/src/compiler/preprocessor/DiagnosticsBase.h
@@ -9,6 +9,9 @@
 
 #include <string>
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -87,4 +90,6 @@
 
 }  // namespace pp
 
+}  // namespace angle
+
 #endif  // COMPILER_PREPROCESSOR_DIAGNOSTICSBASE_H_
diff --git a/src/compiler/preprocessor/DirectiveHandlerBase.cpp b/src/compiler/preprocessor/DirectiveHandlerBase.cpp
index 049dae9..d723c2a 100644
--- a/src/compiler/preprocessor/DirectiveHandlerBase.cpp
+++ b/src/compiler/preprocessor/DirectiveHandlerBase.cpp
@@ -6,6 +6,9 @@
 
 #include "compiler/preprocessor/DirectiveHandlerBase.h"
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -14,3 +17,5 @@
 }
 
 }  // namespace pp
+
+}  // namespace angle
diff --git a/src/compiler/preprocessor/DirectiveHandlerBase.h b/src/compiler/preprocessor/DirectiveHandlerBase.h
index 6c81d01..858bc1d 100644
--- a/src/compiler/preprocessor/DirectiveHandlerBase.h
+++ b/src/compiler/preprocessor/DirectiveHandlerBase.h
@@ -9,6 +9,9 @@
 
 #include <string>
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -40,4 +43,6 @@
 
 }  // namespace pp
 
+}  // namespace angle
+
 #endif  // COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_
diff --git a/src/compiler/preprocessor/DirectiveParser.cpp b/src/compiler/preprocessor/DirectiveParser.cpp
index f6c5763..0731a41 100644
--- a/src/compiler/preprocessor/DirectiveParser.cpp
+++ b/src/compiler/preprocessor/DirectiveParser.cpp
@@ -18,6 +18,9 @@
 #include "compiler/preprocessor/Token.h"
 #include "compiler/preprocessor/Tokenizer.h"
 
+namespace angle
+{
+
 namespace
 {
 enum DirectiveType
@@ -998,3 +1001,5 @@
 }
 
 }  // namespace pp
+
+}  // namespace angle
diff --git a/src/compiler/preprocessor/DirectiveParser.h b/src/compiler/preprocessor/DirectiveParser.h
index 29c30a8..1fd6400 100644
--- a/src/compiler/preprocessor/DirectiveParser.h
+++ b/src/compiler/preprocessor/DirectiveParser.h
@@ -11,6 +11,9 @@
 #include "compiler/preprocessor/Macro.h"
 #include "compiler/preprocessor/SourceLocation.h"
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -80,4 +83,6 @@
 
 }  // namespace pp
 
+}  // namespace angle
+
 #endif  // COMPILER_PREPROCESSOR_DIRECTIVEPARSER_H_
diff --git a/src/compiler/preprocessor/ExpressionParser.cpp b/src/compiler/preprocessor/ExpressionParser.cpp
index ede3346..81ba922 100644
--- a/src/compiler/preprocessor/ExpressionParser.cpp
+++ b/src/compiler/preprocessor/ExpressionParser.cpp
@@ -117,13 +117,13 @@
 namespace {
 struct Context
 {
-    pp::Diagnostics* diagnostics;
-    pp::Lexer* lexer;
-    pp::Token* token;
+    angle::pp::Diagnostics *diagnostics;
+    angle::pp::Lexer *lexer;
+    angle::pp::Token *token;
     int* result;
     bool parsePresetToken;
 
-    pp::ExpressionParser::ErrorSettings errorSettings;
+    angle::pp::ExpressionParser::ErrorSettings errorSettings;
     bool *valid;
 
     void startIgnoreErrors() { ++ignoreErrors; }
@@ -1497,9 +1497,8 @@
                 std::ostringstream stream;
                 stream << (yyvsp[-2]) << " >> " << (yyvsp[0]);
                 std::string text = stream.str();
-                context->diagnostics->report(pp::Diagnostics::PP_UNDEFINED_SHIFT,
-                                             context->token->location,
-                                             text.c_str());
+                context->diagnostics->report(angle::pp::Diagnostics::PP_UNDEFINED_SHIFT,
+                                             context->token->location, text.c_str());
                 *(context->valid) = false;
             }
             (yyval) = static_cast<YYSTYPE>(0);
@@ -1527,9 +1526,8 @@
                 std::ostringstream stream;
                 stream << (yyvsp[-2]) << " << " << (yyvsp[0]);
                 std::string text = stream.str();
-                context->diagnostics->report(pp::Diagnostics::PP_UNDEFINED_SHIFT,
-                                             context->token->location,
-                                             text.c_str());
+                context->diagnostics->report(angle::pp::Diagnostics::PP_UNDEFINED_SHIFT,
+                                             context->token->location, text.c_str());
                 *(context->valid) = false;
             }
             (yyval) = static_cast<YYSTYPE>(0);
@@ -1570,9 +1568,8 @@
                 std::ostringstream stream;
                 stream << (yyvsp[-2]) << " % " << (yyvsp[0]);
                 std::string text = stream.str();
-                context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
-                                             context->token->location,
-                                             text.c_str());
+                context->diagnostics->report(angle::pp::Diagnostics::PP_DIVISION_BY_ZERO,
+                                             context->token->location, text.c_str());
                 *(context->valid) = false;
             }
             (yyval) = static_cast<YYSTYPE>(0);
@@ -1601,9 +1598,8 @@
                 std::ostringstream stream;
                 stream << (yyvsp[-2]) << " / " << (yyvsp[0]);
                 std::string text = stream.str();
-                context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
-                                            context->token->location,
-                                            text.c_str());
+                context->diagnostics->report(angle::pp::Diagnostics::PP_DIVISION_BY_ZERO,
+                                             context->token->location, text.c_str());
                 *(context->valid) = false;
             }
             (yyval) = static_cast<YYSTYPE>(0);
@@ -1914,7 +1910,7 @@
 
 int yylex(YYSTYPE *lvalp, Context *context)
 {
-    pp::Token *token = context->token;
+    angle::pp::Token *token = context->token;
     if (!context->parsePresetToken)
     {
         context->lexer->lex(token);
@@ -1925,48 +1921,50 @@
 
     switch (token->type)
     {
-      case pp::Token::CONST_INT: {
-        unsigned int val = 0;
-        int testVal = 0;
-        if (!token->uValue(&val) || (!token->iValue(&testVal) &&
-                                     context->errorSettings.integerLiteralsMustFit32BitSignedRange))
+        case angle::pp::Token::CONST_INT:
         {
-            context->diagnostics->report(pp::Diagnostics::PP_INTEGER_OVERFLOW,
-                                         token->location, token->text);
-            *(context->valid) = false;
-        }
-        *lvalp = static_cast<YYSTYPE>(val);
-        type = TOK_CONST_INT;
-        break;
+            unsigned int val = 0;
+            int testVal      = 0;
+            if (!token->uValue(&val) ||
+                (!token->iValue(&testVal) &&
+                 context->errorSettings.integerLiteralsMustFit32BitSignedRange))
+            {
+                context->diagnostics->report(angle::pp::Diagnostics::PP_INTEGER_OVERFLOW,
+                                             token->location, token->text);
+                *(context->valid) = false;
+            }
+            *lvalp = static_cast<YYSTYPE>(val);
+            type   = TOK_CONST_INT;
+            break;
       }
-      case pp::Token::IDENTIFIER:
-        *lvalp = static_cast<YYSTYPE>(-1);
-        type = TOK_IDENTIFIER;
-        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 angle::pp::Token::IDENTIFIER:
+          *lvalp = static_cast<YYSTYPE>(-1);
+          type   = TOK_IDENTIFIER;
+          break;
+      case angle::pp::Token::OP_OR:
+          type = TOK_OP_OR;
+          break;
+      case angle::pp::Token::OP_AND:
+          type = TOK_OP_AND;
+          break;
+      case angle::pp::Token::OP_NE:
+          type = TOK_OP_NE;
+          break;
+      case angle::pp::Token::OP_EQ:
+          type = TOK_OP_EQ;
+          break;
+      case angle::pp::Token::OP_GE:
+          type = TOK_OP_GE;
+          break;
+      case angle::pp::Token::OP_LE:
+          type = TOK_OP_LE;
+          break;
+      case angle::pp::Token::OP_RIGHT:
+          type = TOK_OP_RIGHT;
+          break;
+      case angle::pp::Token::OP_LEFT:
+          type = TOK_OP_LEFT;
+          break;
       case '|':
       case '^':
       case '&':
@@ -1993,11 +1991,13 @@
 
 void yyerror(Context *context, const char *reason)
 {
-    context->diagnostics->report(pp::Diagnostics::PP_INVALID_EXPRESSION,
-                                 context->token->location,
-                                 reason);
+    context->diagnostics->report(angle::pp::Diagnostics::PP_INVALID_EXPRESSION,
+                                 context->token->location, reason);
 }
 
+namespace angle
+{
+
 namespace pp {
 
 ExpressionParser::ExpressionParser(Lexer *lexer, Diagnostics *diagnostics)
@@ -2042,3 +2042,5 @@
 }
 
 }  // namespace pp
+
+}  // namespace angle
diff --git a/src/compiler/preprocessor/ExpressionParser.h b/src/compiler/preprocessor/ExpressionParser.h
index 0f2901b..c5cd7f7 100644
--- a/src/compiler/preprocessor/ExpressionParser.h
+++ b/src/compiler/preprocessor/ExpressionParser.h
@@ -10,6 +10,9 @@
 #include "common/angleutils.h"
 #include "compiler/preprocessor/DiagnosticsBase.h"
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -40,4 +43,6 @@
 
 }  // namespace pp
 
+}  // namespace angle
+
 #endif  // COMPILER_PREPROCESSOR_EXPRESSIONPARSER_H_
diff --git a/src/compiler/preprocessor/ExpressionParser.y b/src/compiler/preprocessor/ExpressionParser.y
index 68d7cc3..6ddf912 100644
--- a/src/compiler/preprocessor/ExpressionParser.y
+++ b/src/compiler/preprocessor/ExpressionParser.y
@@ -59,13 +59,13 @@
 namespace {
 struct Context
 {
-    pp::Diagnostics* diagnostics;
-    pp::Lexer* lexer;
-    pp::Token* token;
+    angle::pp::Diagnostics *diagnostics;
+    angle::pp::Lexer *lexer;
+    angle::pp::Token *token;
     int* result;
     bool parsePresetToken;
 
-    pp::ExpressionParser::ErrorSettings errorSettings;
+    angle::pp::ExpressionParser::ErrorSettings errorSettings;
     bool *valid;
 
     void startIgnoreErrors() { ++ignoreErrors; }
@@ -201,7 +201,7 @@
                 std::ostringstream stream;
                 stream << $1 << " >> " << $3;
                 std::string text = stream.str();
-                context->diagnostics->report(pp::Diagnostics::PP_UNDEFINED_SHIFT,
+                context->diagnostics->report(angle::pp::Diagnostics::PP_UNDEFINED_SHIFT,
                                              context->token->location,
                                              text.c_str());
                 *(context->valid) = false;
@@ -226,7 +226,7 @@
                 std::ostringstream stream;
                 stream << $1 << " << " << $3;
                 std::string text = stream.str();
-                context->diagnostics->report(pp::Diagnostics::PP_UNDEFINED_SHIFT,
+                context->diagnostics->report(angle::pp::Diagnostics::PP_UNDEFINED_SHIFT,
                                              context->token->location,
                                              text.c_str());
                 *(context->valid) = false;
@@ -254,7 +254,7 @@
                 std::ostringstream stream;
                 stream << $1 << " % " << $3;
                 std::string text = stream.str();
-                context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
+                context->diagnostics->report(angle::pp::Diagnostics::PP_DIVISION_BY_ZERO,
                                              context->token->location,
                                              text.c_str());
                 *(context->valid) = false;
@@ -280,7 +280,7 @@
                 std::ostringstream stream;
                 stream << $1 << " / " << $3;
                 std::string text = stream.str();
-                context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
+                context->diagnostics->report(angle::pp::Diagnostics::PP_DIVISION_BY_ZERO,
                                             context->token->location,
                                             text.c_str());
                 *(context->valid) = false;
@@ -332,7 +332,7 @@
 
 int yylex(YYSTYPE *lvalp, Context *context)
 {
-    pp::Token *token = context->token;
+    angle::pp::Token *token = context->token;
     if (!context->parsePresetToken)
     {
         context->lexer->lex(token);
@@ -343,13 +343,13 @@
 
     switch (token->type)
     {
-      case pp::Token::CONST_INT: {
+      case angle::pp::Token::CONST_INT: {
         unsigned int val = 0;
         int testVal = 0;
         if (!token->uValue(&val) || (!token->iValue(&testVal) &&
                                      context->errorSettings.integerLiteralsMustFit32BitSignedRange))
         {
-            context->diagnostics->report(pp::Diagnostics::PP_INTEGER_OVERFLOW,
+            context->diagnostics->report(angle::pp::Diagnostics::PP_INTEGER_OVERFLOW,
                                          token->location, token->text);
             *(context->valid) = false;
         }
@@ -357,32 +357,32 @@
         type = TOK_CONST_INT;
         break;
       }
-      case pp::Token::IDENTIFIER:
+      case angle::pp::Token::IDENTIFIER:
         *lvalp = static_cast<YYSTYPE>(-1);
         type = TOK_IDENTIFIER;
         break;
-      case pp::Token::OP_OR:
+      case angle::pp::Token::OP_OR:
         type = TOK_OP_OR;
         break;
-      case pp::Token::OP_AND:
+      case angle::pp::Token::OP_AND:
         type = TOK_OP_AND;
         break;
-      case pp::Token::OP_NE:
+      case angle::pp::Token::OP_NE:
         type = TOK_OP_NE;
         break;
-      case pp::Token::OP_EQ:
+      case angle::pp::Token::OP_EQ:
         type = TOK_OP_EQ;
         break;
-      case pp::Token::OP_GE:
+      case angle::pp::Token::OP_GE:
         type = TOK_OP_GE;
         break;
-      case pp::Token::OP_LE:
+      case angle::pp::Token::OP_LE:
         type = TOK_OP_LE;
         break;
-      case pp::Token::OP_RIGHT:
+      case angle::pp::Token::OP_RIGHT:
         type = TOK_OP_RIGHT;
         break;
-      case pp::Token::OP_LEFT:
+      case angle::pp::Token::OP_LEFT:
         type = TOK_OP_LEFT;
         break;
       case '|':
@@ -411,11 +411,13 @@
 
 void yyerror(Context *context, const char *reason)
 {
-    context->diagnostics->report(pp::Diagnostics::PP_INVALID_EXPRESSION,
+    context->diagnostics->report(angle::pp::Diagnostics::PP_INVALID_EXPRESSION,
                                  context->token->location,
                                  reason);
 }
 
+namespace angle {
+
 namespace pp {
 
 ExpressionParser::ExpressionParser(Lexer *lexer, Diagnostics *diagnostics)
@@ -460,3 +462,5 @@
 }
 
 }  // namespace pp
+
+}  // namespace angle
diff --git a/src/compiler/preprocessor/Input.cpp b/src/compiler/preprocessor/Input.cpp
index 0f2327b..073d671 100644
--- a/src/compiler/preprocessor/Input.cpp
+++ b/src/compiler/preprocessor/Input.cpp
@@ -11,6 +11,9 @@
 
 #include "common/debug.h"
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -127,3 +130,5 @@
 }
 
 }  // namespace pp
+
+}  // namespace angle
diff --git a/src/compiler/preprocessor/Input.h b/src/compiler/preprocessor/Input.h
index 8c7c7ee..e2150f8 100644
--- a/src/compiler/preprocessor/Input.h
+++ b/src/compiler/preprocessor/Input.h
@@ -10,6 +10,9 @@
 #include <cstddef>
 #include <vector>
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -51,4 +54,6 @@
 
 }  // namespace pp
 
+}  // namespace angle
+
 #endif  // COMPILER_PREPROCESSOR_INPUT_H_
diff --git a/src/compiler/preprocessor/Lexer.cpp b/src/compiler/preprocessor/Lexer.cpp
index 89cb3cf..cf58be7 100644
--- a/src/compiler/preprocessor/Lexer.cpp
+++ b/src/compiler/preprocessor/Lexer.cpp
@@ -6,6 +6,9 @@
 
 #include "compiler/preprocessor/Lexer.h"
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -14,3 +17,5 @@
 }
 
 }  // namespace pp
+
+}  // namespace angle
diff --git a/src/compiler/preprocessor/Lexer.h b/src/compiler/preprocessor/Lexer.h
index 775bc0a..c267707 100644
--- a/src/compiler/preprocessor/Lexer.h
+++ b/src/compiler/preprocessor/Lexer.h
@@ -9,6 +9,9 @@
 
 #include "common/angleutils.h"
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -24,4 +27,6 @@
 
 }  // namespace pp
 
+}  // namespace angle
+
 #endif  // COMPILER_PREPROCESSOR_LEXER_H_
diff --git a/src/compiler/preprocessor/Macro.cpp b/src/compiler/preprocessor/Macro.cpp
index 52e2312..deb24ab 100644
--- a/src/compiler/preprocessor/Macro.cpp
+++ b/src/compiler/preprocessor/Macro.cpp
@@ -9,6 +9,9 @@
 #include "common/angleutils.h"
 #include "compiler/preprocessor/Token.h"
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -42,3 +45,5 @@
 }
 
 }  // namespace pp
+
+}  // namespace angle
diff --git a/src/compiler/preprocessor/Macro.h b/src/compiler/preprocessor/Macro.h
index c42e172..d7880f4 100644
--- a/src/compiler/preprocessor/Macro.h
+++ b/src/compiler/preprocessor/Macro.h
@@ -12,6 +12,9 @@
 #include <string>
 #include <vector>
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -47,4 +50,6 @@
 
 }  // namespace pp
 
+}  // namespace angle
+
 #endif  // COMPILER_PREPROCESSOR_MACRO_H_
diff --git a/src/compiler/preprocessor/MacroExpander.cpp b/src/compiler/preprocessor/MacroExpander.cpp
index d88d3a6..e4b1968 100644
--- a/src/compiler/preprocessor/MacroExpander.cpp
+++ b/src/compiler/preprocessor/MacroExpander.cpp
@@ -12,6 +12,9 @@
 #include "compiler/preprocessor/DiagnosticsBase.h"
 #include "compiler/preprocessor/Token.h"
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -479,3 +482,5 @@
 }
 
 }  // namespace pp
+
+}  // namespace angle
diff --git a/src/compiler/preprocessor/MacroExpander.h b/src/compiler/preprocessor/MacroExpander.h
index fae7676..e5cde5f 100644
--- a/src/compiler/preprocessor/MacroExpander.h
+++ b/src/compiler/preprocessor/MacroExpander.h
@@ -13,6 +13,9 @@
 #include "compiler/preprocessor/Lexer.h"
 #include "compiler/preprocessor/Macro.h"
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -80,4 +83,6 @@
 
 }  // namespace pp
 
+}  // namespace angle
+
 #endif  // COMPILER_PREPROCESSOR_MACROEXPANDER_H_
diff --git a/src/compiler/preprocessor/Preprocessor.cpp b/src/compiler/preprocessor/Preprocessor.cpp
index 349c7b0..494a8db 100644
--- a/src/compiler/preprocessor/Preprocessor.cpp
+++ b/src/compiler/preprocessor/Preprocessor.cpp
@@ -14,6 +14,9 @@
 #include "compiler/preprocessor/Token.h"
 #include "compiler/preprocessor/Tokenizer.h"
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -105,3 +108,5 @@
 }
 
 }  // namespace pp
+
+}  // namespace angle
diff --git a/src/compiler/preprocessor/Preprocessor.h b/src/compiler/preprocessor/Preprocessor.h
index 2fe504f..4551c40 100644
--- a/src/compiler/preprocessor/Preprocessor.h
+++ b/src/compiler/preprocessor/Preprocessor.h
@@ -11,6 +11,9 @@
 
 #include "common/angleutils.h"
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -57,4 +60,6 @@
 
 }  // namespace pp
 
+}  // namespace angle
+
 #endif  // COMPILER_PREPROCESSOR_PREPROCESSOR_H_
diff --git a/src/compiler/preprocessor/SourceLocation.h b/src/compiler/preprocessor/SourceLocation.h
index 51908a3..61d1af0 100644
--- a/src/compiler/preprocessor/SourceLocation.h
+++ b/src/compiler/preprocessor/SourceLocation.h
@@ -7,6 +7,9 @@
 #ifndef COMPILER_PREPROCESSOR_SOURCELOCATION_H_
 #define COMPILER_PREPROCESSOR_SOURCELOCATION_H_
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -36,4 +39,6 @@
 
 }  // namespace pp
 
+}  // namespace angle
+
 #endif  // COMPILER_PREPROCESSOR_SOURCELOCATION_H_
diff --git a/src/compiler/preprocessor/Token.cpp b/src/compiler/preprocessor/Token.cpp
index ce0ce94..a59d394 100644
--- a/src/compiler/preprocessor/Token.cpp
+++ b/src/compiler/preprocessor/Token.cpp
@@ -9,6 +9,9 @@
 #include "common/debug.h"
 #include "compiler/preprocessor/numeric_lex.h"
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -78,3 +81,5 @@
 }
 
 }  // namespace pp
+
+}  // namespace angle
diff --git a/src/compiler/preprocessor/Token.h b/src/compiler/preprocessor/Token.h
index 26732ab..88b9433 100644
--- a/src/compiler/preprocessor/Token.h
+++ b/src/compiler/preprocessor/Token.h
@@ -12,6 +12,9 @@
 
 #include "compiler/preprocessor/SourceLocation.h"
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -104,6 +107,8 @@
 
 std::ostream &operator<<(std::ostream &out, const Token &token);
 
-}  // namepsace pp
+}  // namespace pp
+
+}  // namespace angle
 
 #endif  // COMPILER_PREPROCESSOR_TOKEN_H_
diff --git a/src/compiler/preprocessor/Tokenizer.cpp b/src/compiler/preprocessor/Tokenizer.cpp
index 2760a56..ac71633 100644
--- a/src/compiler/preprocessor/Tokenizer.cpp
+++ b/src/compiler/preprocessor/Tokenizer.cpp
@@ -924,7 +924,7 @@
 #endif
 
 typedef std::string YYSTYPE;
-typedef pp::SourceLocation YYLTYPE;
+typedef angle::pp::SourceLocation YYLTYPE;
 
 // Use the unused yycolumn variable to track file (string) number.
 #define yyfileno yycolumn
@@ -941,18 +941,19 @@
 #define YY_USER_ACTION                                              \
     do                                                              \
     {                                                               \
-        pp::Input* input = &yyextra->input;                         \
-        pp::Input::Location* scanLoc = &yyextra->scanLoc;           \
+        angle::pp::Input *input             = &yyextra->input;      \
+        angle::pp::Input::Location *scanLoc = &yyextra->scanLoc;    \
         while ((scanLoc->sIndex < input->count()) &&                \
                (scanLoc->cIndex >= input->length(scanLoc->sIndex))) \
         {                                                           \
             scanLoc->cIndex -= input->length(scanLoc->sIndex++);    \
-            ++yyfileno; yylineno = 1;                               \
+            ++yyfileno;                                             \
+            yylineno = 1;                                           \
         }                                                           \
         yylloc->file = yyfileno;                                    \
         yylloc->line = yylineno;                                    \
         scanLoc->cIndex += yyleng;                                  \
-    } while(0);
+    } while (0);
 
 #define YY_INPUT(buf, result, maxSize) \
     result = yyextra->input.read(buf, maxSize, &yylineno);
@@ -964,15 +965,7 @@
 #define INITIAL 0
 #define COMMENT 1
 
-
-
-
-
-
-#define YY_EXTRA_TYPE pp::Tokenizer::Context*
-
-
-
+#define YY_EXTRA_TYPE angle::pp::Tokenizer::Context *
 
 /* Holds the entire state of the reentrant scanner. */
 struct yyguts_t
@@ -1436,7 +1429,7 @@
     if (yylineno == INT_MAX)
     {
         *yylval = "Integer overflow on line number";
-        return pp::Token::GOT_ERROR;
+        return angle::pp::Token::GOT_ERROR;
     }
     ++yylineno;
 }
@@ -1453,28 +1446,28 @@
 {
     // # is only valid at start of line for preprocessor directives.
     yylval->assign(1, yytext[0]);
-    return yyextra->lineStart ? pp::Token::PP_HASH : pp::Token::PP_OTHER;
+    return yyextra->lineStart ? angle::pp::Token::PP_HASH : angle::pp::Token::PP_OTHER;
 }
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::IDENTIFIER;
+    return angle::pp::Token::IDENTIFIER;
 }
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::CONST_INT;
+    return angle::pp::Token::CONST_INT;
 }
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::CONST_FLOAT;
+    return angle::pp::Token::CONST_FLOAT;
 }
 	YY_BREAK
 /* Anything that starts with a {DIGIT} or .{DIGIT} must be a number. */
@@ -1483,154 +1476,154 @@
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::PP_NUMBER;
+    return angle::pp::Token::PP_NUMBER;
 }
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_INC;
+    return angle::pp::Token::OP_INC;
 }
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_DEC;
+    return angle::pp::Token::OP_DEC;
 }
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_LEFT;
+    return angle::pp::Token::OP_LEFT;
 }
 	YY_BREAK
 case 15:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_RIGHT;
+    return angle::pp::Token::OP_RIGHT;
 }
 	YY_BREAK
 case 16:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_LE;
+    return angle::pp::Token::OP_LE;
 }
 	YY_BREAK
 case 17:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_GE;
+    return angle::pp::Token::OP_GE;
 }
 	YY_BREAK
 case 18:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_EQ;
+    return angle::pp::Token::OP_EQ;
 }
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_NE;
+    return angle::pp::Token::OP_NE;
 }
 	YY_BREAK
 case 20:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_AND;
+    return angle::pp::Token::OP_AND;
 }
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_XOR;
+    return angle::pp::Token::OP_XOR;
 }
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_OR;
+    return angle::pp::Token::OP_OR;
 }
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_ADD_ASSIGN;
+    return angle::pp::Token::OP_ADD_ASSIGN;
 }
 	YY_BREAK
 case 24:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_SUB_ASSIGN;
+    return angle::pp::Token::OP_SUB_ASSIGN;
 }
 	YY_BREAK
 case 25:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_MUL_ASSIGN;
+    return angle::pp::Token::OP_MUL_ASSIGN;
 }
 	YY_BREAK
 case 26:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_DIV_ASSIGN;
+    return angle::pp::Token::OP_DIV_ASSIGN;
 }
 	YY_BREAK
 case 27:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_MOD_ASSIGN;
+    return angle::pp::Token::OP_MOD_ASSIGN;
 }
 	YY_BREAK
 case 28:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_LEFT_ASSIGN;
+    return angle::pp::Token::OP_LEFT_ASSIGN;
 }
 	YY_BREAK
 case 29:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_RIGHT_ASSIGN;
+    return angle::pp::Token::OP_RIGHT_ASSIGN;
 }
 	YY_BREAK
 case 30:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_AND_ASSIGN;
+    return angle::pp::Token::OP_AND_ASSIGN;
 }
 	YY_BREAK
 case 31:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_XOR_ASSIGN;
+    return angle::pp::Token::OP_XOR_ASSIGN;
 }
 	YY_BREAK
 case 32:
 YY_RULE_SETUP
 {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_OR_ASSIGN;
+    return angle::pp::Token::OP_OR_ASSIGN;
 }
 	YY_BREAK
 case 33:
@@ -1651,7 +1644,7 @@
     if (yylineno == INT_MAX)
     {
         *yylval = "Integer overflow on line number";
-        return pp::Token::GOT_ERROR;
+        return angle::pp::Token::GOT_ERROR;
     }
     ++yylineno;
     yylval->assign(1, '\n');
@@ -1662,7 +1655,7 @@
 YY_RULE_SETUP
 {
     yylval->assign(1, yytext[0]);
-    return pp::Token::PP_OTHER;
+    return angle::pp::Token::PP_OTHER;
 }
 	YY_BREAK
 case YY_STATE_EOF(INITIAL):
@@ -1670,8 +1663,8 @@
 {
     // YY_USER_ACTION is not invoked for handling EOF.
     // Set the location for EOF token manually.
-    pp::Input* input = &yyextra->input;
-    pp::Input::Location* scanLoc = &yyextra->scanLoc;
+    angle::pp::Input *input             = &yyextra->input;
+    angle::pp::Input::Location *scanLoc = &yyextra->scanLoc;
     yy_size_t sIndexMax = input->count() ? input->count() - 1 : 0;
     if (scanLoc->sIndex != sIndexMax)
     {
@@ -1688,14 +1681,14 @@
     // Line number overflows fake EOFs to exit early, check for this case.
     if (yylineno == INT_MAX)
     {
-        yyextra->diagnostics->report(pp::Diagnostics::PP_TOKENIZER_ERROR,
-                                     pp::SourceLocation(yyfileno, yylineno),
+        yyextra->diagnostics->report(angle::pp::Diagnostics::PP_TOKENIZER_ERROR,
+                                     angle::pp::SourceLocation(yyfileno, yylineno),
                                      "Integer overflow on line number");
     }
     else if (YY_START == COMMENT)
     {
-        yyextra->diagnostics->report(pp::Diagnostics::PP_EOF_IN_COMMENT,
-                                     pp::SourceLocation(yyfileno, yylineno),
+        yyextra->diagnostics->report(angle::pp::Diagnostics::PP_EOF_IN_COMMENT,
+                                     angle::pp::SourceLocation(yyfileno, yylineno),
                                      "EOF while in a comment");
     }
     yyterminate();
@@ -2976,12 +2969,8 @@
 
 #define YYTABLES_NAME "yytables"
 
-
-
-
-
-
-
+namespace angle
+{
 
 namespace pp {
 
@@ -3071,4 +3060,4 @@
 
 }  // namespace pp
 
-
+}  // namespace angle
diff --git a/src/compiler/preprocessor/Tokenizer.h b/src/compiler/preprocessor/Tokenizer.h
index af4fd7c..4609179 100644
--- a/src/compiler/preprocessor/Tokenizer.h
+++ b/src/compiler/preprocessor/Tokenizer.h
@@ -11,6 +11,9 @@
 #include "compiler/preprocessor/Input.h"
 #include "compiler/preprocessor/Lexer.h"
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -55,4 +58,6 @@
 
 }  // namespace pp
 
+}  // namespace angle
+
 #endif  // COMPILER_PREPROCESSOR_TOKENIZER_H_
diff --git a/src/compiler/preprocessor/Tokenizer.l b/src/compiler/preprocessor/Tokenizer.l
index 2395384..3df7367 100644
--- a/src/compiler/preprocessor/Tokenizer.l
+++ b/src/compiler/preprocessor/Tokenizer.l
@@ -51,7 +51,7 @@
 #endif
 
 typedef std::string YYSTYPE;
-typedef pp::SourceLocation YYLTYPE;
+typedef angle::pp::SourceLocation YYLTYPE;
 
 // Use the unused yycolumn variable to track file (string) number.
 #define yyfileno yycolumn
@@ -68,8 +68,8 @@
 #define YY_USER_ACTION                                              \
     do                                                              \
     {                                                               \
-        pp::Input* input = &yyextra->input;                         \
-        pp::Input::Location* scanLoc = &yyextra->scanLoc;           \
+        angle::pp::Input* input = &yyextra->input;                  \
+        angle::pp::Input::Location* scanLoc = &yyextra->scanLoc;    \
         while ((scanLoc->sIndex < input->count()) &&                \
                (scanLoc->cIndex >= input->length(scanLoc->sIndex))) \
         {                                                           \
@@ -89,7 +89,7 @@
 %option noyywrap nounput never-interactive
 %option reentrant bison-bridge bison-locations
 %option prefix="pp"
-%option extra-type="pp::Tokenizer::Context*"
+%option extra-type="angle::pp::Tokenizer::Context*"
 %x COMMENT
 
 NEWLINE     \n|\r|\r\n
@@ -119,7 +119,7 @@
     if (yylineno == INT_MAX)
     {
         *yylval = "Integer overflow on line number";
-        return pp::Token::GOT_ERROR;
+        return angle::pp::Token::GOT_ERROR;
     }
     ++yylineno;
 }
@@ -131,114 +131,114 @@
 # {
     // # is only valid at start of line for preprocessor directives.
     yylval->assign(1, yytext[0]);
-    return yyextra->lineStart ? pp::Token::PP_HASH : pp::Token::PP_OTHER;
+    return yyextra->lineStart ? angle::pp::Token::PP_HASH : angle::pp::Token::PP_OTHER;
 }
 
 {IDENTIFIER} {
     yylval->assign(yytext, yyleng);
-    return pp::Token::IDENTIFIER;
+    return angle::pp::Token::IDENTIFIER;
 }
 
 ({DECIMAL_CONSTANT}[uU]?)|({OCTAL_CONSTANT}[uU]?)|({HEXADECIMAL_CONSTANT}[uU]?) {
     yylval->assign(yytext, yyleng);
-    return pp::Token::CONST_INT;
+    return angle::pp::Token::CONST_INT;
 }
 
 ({DIGIT}+{EXPONENT_PART}[fF]?)|({FRACTIONAL_CONSTANT}{EXPONENT_PART}?[fF]?) {
     yylval->assign(yytext, yyleng);
-    return pp::Token::CONST_FLOAT;
+    return angle::pp::Token::CONST_FLOAT;
 }
 
     /* Anything that starts with a {DIGIT} or .{DIGIT} must be a number. */
     /* Rule to catch all invalid integers and floats. */
 ({DIGIT}+[_a-zA-Z0-9.]*)|("."{DIGIT}+[_a-zA-Z0-9.]*) {
     yylval->assign(yytext, yyleng);
-    return pp::Token::PP_NUMBER;
+    return angle::pp::Token::PP_NUMBER;
 }
 
 "++" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_INC;
+    return angle::pp::Token::OP_INC;
 }
 "--" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_DEC;
+    return angle::pp::Token::OP_DEC;
 }
 "<<" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_LEFT;
+    return angle::pp::Token::OP_LEFT;
 }
 ">>" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_RIGHT;
+    return angle::pp::Token::OP_RIGHT;
 }
 "<=" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_LE;
+    return angle::pp::Token::OP_LE;
 }
 ">=" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_GE;
+    return angle::pp::Token::OP_GE;
 }
 "==" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_EQ;
+    return angle::pp::Token::OP_EQ;
 }
 "!=" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_NE;
+    return angle::pp::Token::OP_NE;
 }
 "&&" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_AND;
+    return angle::pp::Token::OP_AND;
 }
 "^^" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_XOR;
+    return angle::pp::Token::OP_XOR;
 }
 "||" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_OR;
+    return angle::pp::Token::OP_OR;
 }
 "+=" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_ADD_ASSIGN;
+    return angle::pp::Token::OP_ADD_ASSIGN;
 }
 "-=" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_SUB_ASSIGN;
+    return angle::pp::Token::OP_SUB_ASSIGN;
 }
 "*=" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_MUL_ASSIGN;
+    return angle::pp::Token::OP_MUL_ASSIGN;
 }
 "/=" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_DIV_ASSIGN;
+    return angle::pp::Token::OP_DIV_ASSIGN;
 }
 "%=" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_MOD_ASSIGN;
+    return angle::pp::Token::OP_MOD_ASSIGN;
 }
 "<<=" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_LEFT_ASSIGN;
+    return angle::pp::Token::OP_LEFT_ASSIGN;
 }
 ">>=" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_RIGHT_ASSIGN;
+    return angle::pp::Token::OP_RIGHT_ASSIGN;
 }
 "&=" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_AND_ASSIGN;
+    return angle::pp::Token::OP_AND_ASSIGN;
 }
 "^=" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_XOR_ASSIGN;
+    return angle::pp::Token::OP_XOR_ASSIGN;
 }
 "|=" {
     yylval->assign(yytext, yyleng);
-    return pp::Token::OP_OR_ASSIGN;
+    return angle::pp::Token::OP_OR_ASSIGN;
 }
 
 {PUNCTUATOR} {
@@ -252,7 +252,7 @@
     if (yylineno == INT_MAX)
     {
         *yylval = "Integer overflow on line number";
-        return pp::Token::GOT_ERROR;
+        return angle::pp::Token::GOT_ERROR;
     }
     ++yylineno;
     yylval->assign(1, '\n');
@@ -261,14 +261,14 @@
 
 . {
     yylval->assign(1, yytext[0]);
-    return pp::Token::PP_OTHER;
+    return angle::pp::Token::PP_OTHER;
 }
 
 <*><<EOF>> {
     // YY_USER_ACTION is not invoked for handling EOF.
     // Set the location for EOF token manually.
-    pp::Input* input = &yyextra->input;
-    pp::Input::Location* scanLoc = &yyextra->scanLoc;
+    angle::pp::Input* input = &yyextra->input;
+    angle::pp::Input::Location* scanLoc = &yyextra->scanLoc;
     yy_size_t sIndexMax = input->count() ? input->count() - 1 : 0;
     if (scanLoc->sIndex != sIndexMax)
     {
@@ -284,14 +284,14 @@
 
     // Line number overflows fake EOFs to exit early, check for this case.
     if (yylineno == INT_MAX) {
-        yyextra->diagnostics->report(pp::Diagnostics::PP_TOKENIZER_ERROR,
-                pp::SourceLocation(yyfileno, yylineno),
+        yyextra->diagnostics->report(angle::pp::Diagnostics::PP_TOKENIZER_ERROR,
+                angle::pp::SourceLocation(yyfileno, yylineno),
                 "Integer overflow on line number");
     }
     else if (YY_START == COMMENT)
     {
-        yyextra->diagnostics->report(pp::Diagnostics::PP_EOF_IN_COMMENT,
-                                     pp::SourceLocation(yyfileno, yylineno),
+        yyextra->diagnostics->report(angle::pp::Diagnostics::PP_EOF_IN_COMMENT,
+                                     angle::pp::SourceLocation(yyfileno, yylineno),
                                      "EOF while in a comment");
     }
     yyterminate();
@@ -299,6 +299,8 @@
 
 %%
 
+namespace angle {
+
 namespace pp {
 
 Tokenizer::Tokenizer(Diagnostics *diagnostics) : mHandle(nullptr), mMaxTokenSize(256)
@@ -387,3 +389,5 @@
 
 }  // namespace pp
 
+} // namespace angle
+
diff --git a/src/compiler/preprocessor/numeric_lex.h b/src/compiler/preprocessor/numeric_lex.h
index 3be926d..124eafd 100644
--- a/src/compiler/preprocessor/numeric_lex.h
+++ b/src/compiler/preprocessor/numeric_lex.h
@@ -12,6 +12,9 @@
 #include <cmath>
 #include <sstream>
 
+namespace angle
+{
+
 namespace pp
 {
 
@@ -54,6 +57,8 @@
     return errno != ERANGE && std::isfinite(*value);
 }
 
-}  // namespace pp.
+}  // namespace pp
+
+}  // namespace angle
 
 #endif  // COMPILER_PREPROCESSOR_NUMERICLEX_H_