Preparation of hooking up the new preprocessor.
- Added custom Diagnostics class. Routed all info-log messages via this new class.
- Added custom DirectiveHandler class. Moved directive-handling code to this class and routed the old path.
- Deleted lexer_glue because it is not needed anymore. The new preprocessor is almost ready!
- Killed a bunch of dead code related to PragmaTable.
Review URL: https://codereview.appspot.com/6308074
git-svn-id: https://angleproject.googlecode.com/svn/trunk@1150 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/Diagnostics.cpp b/src/compiler/Diagnostics.cpp
new file mode 100644
index 0000000..5f93a03
--- /dev/null
+++ b/src/compiler/Diagnostics.cpp
@@ -0,0 +1,44 @@
+//
+// Copyright (c) 2012 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.
+//
+
+#include "compiler/Diagnostics.h"
+
+#include "compiler/InfoSink.h"
+#include "compiler/preprocessor/new/SourceLocation.h"
+
+TDiagnostics::TDiagnostics(TInfoSink& infoSink) : mInfoSink(infoSink)
+{
+}
+
+TDiagnostics::~TDiagnostics()
+{
+}
+
+void TDiagnostics::writeInfo(Severity severity,
+ const pp::SourceLocation& loc,
+ const std::string& reason,
+ const std::string& token,
+ const std::string& extra)
+{
+ TInfoSinkBase& sink = mInfoSink.info;
+ TPrefixType prefix = severity == ERROR ? EPrefixError : EPrefixWarning;
+
+ /* VC++ format: file(linenum) : error #: 'token' : extrainfo */
+ sink.prefix(prefix);
+ sink.location(EncodeSourceLoc(loc.file, loc.line));
+ sink << "'" << token << "' : " << reason << " " << extra << "\n";
+}
+
+void TDiagnostics::writeDebug(const std::string& str)
+{
+ mInfoSink.debug << str;
+}
+
+void TDiagnostics::print(ID id,
+ const pp::SourceLocation& loc,
+ const std::string& text)
+{
+}