zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DiagnosticsBase.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 #include "DiagnosticsBase.h"
8 
9 #include <cassert>
10 
11 namespace pp
12 {
13 
15 {
16 }
17 
19  const SourceLocation& loc,
20  const std::string& text)
21 {
22  // TODO(alokp): Keep a count of errors and warnings.
23  print(id, loc, text);
24 }
25 
27 {
28  if ((id > ERROR_BEGIN) && (id < ERROR_END))
29  return ERROR;
30 
31  if ((id > WARNING_BEGIN) && (id < WARNING_END))
32  return WARNING;
33 
34  assert(false);
35  return ERROR;
36 }
37 
39 {
40  switch (id)
41  {
42  // Errors begin.
43  case INTERNAL_ERROR:
44  return "internal error";
45  case OUT_OF_MEMORY:
46  return "out of memory";
47  case INVALID_CHARACTER:
48  return "invalid character";
49  case INVALID_NUMBER:
50  return "invalid number";
51  case INTEGER_OVERFLOW:
52  return "integer overflow";
53  case FLOAT_OVERFLOW:
54  return "float overflow";
55  case TOKEN_TOO_LONG:
56  return "token too long";
57  case INVALID_EXPRESSION:
58  return "invalid expression";
59  case DIVISION_BY_ZERO:
60  return "division by zero";
61  case EOF_IN_COMMENT:
62  return "unexpected end of file found in comment";
63  case UNEXPECTED_TOKEN:
64  return "unexpected token";
66  return "invalid directive name";
68  return "macro name is reserved";
69  case MACRO_REDEFINED:
70  return "macro redefined";
72  return "predefined macro redefined";
74  return "predefined macro undefined";
76  return "unterminated macro invocation";
77  case MACRO_TOO_FEW_ARGS:
78  return "Not enough arguments for macro";
80  return "Too many arguments for macro";
82  return "unexpected #endif found without a matching #if";
84  return "unexpected #else found without a matching #if";
86  return "unexpected #else found after another #else";
88  return "unexpected #elif found without a matching #if";
90  return "unexpected #elif found after #else";
92  return "unexpected end of file found in conditional block";
94  return "invalid extension name";
96  return "invalid extension behavior";
98  return "invalid extension directive";
100  return "invalid version number";
102  return "invalid version directive";
104  return "#version directive must occur before anything else, "
105  "except for comments and white space";
106  case INVALID_LINE_NUMBER:
107  return "invalid line number";
108  case INVALID_FILE_NUMBER:
109  return "invalid file number";
111  return "invalid line directive";
112  // Errors end.
113  // Warnings begin.
114  case EOF_IN_DIRECTIVE:
115  return "unexpected end of file found in directive";
117  return "unexpected token after conditional expression";
118  case UNRECOGNIZED_PRAGMA:
119  return "unrecognized pragma";
120  // Warnings end.
121  default:
122  assert(false);
123  return "";
124  }
125 }
126 
127 } // namespace pp
virtual ~Diagnostics()
png_sPLT_entryp pp
Definition: pngrutil.c:1375
#define assert(x)
Definition: SDL_malloc.c:1234
void report(ID id, const SourceLocation &loc, const std::string &text)
virtual void print(ID id, const SourceLocation &loc, const std::string &text)=0
GLsizei const GLcharARB ** string
Definition: glew.h:5638
std::string message(ID id)
Severity severity(ID id)