Permalink
Browse files

diagnose delete unsupported in stage 0 and refactor a bit unsupported…

… messages
  • Loading branch information...
1 parent 7eeee58 commit e9bf0d635b1579264257b842ccc21d8f0ea34161 @NotFound committed Feb 3, 2011
Showing with 22 additions and 4 deletions.
  1. +9 −1 errors.cpp
  2. +7 −1 errors.h
  3. +6 −2 winxedst0.cpp
View
10 errors.cpp
@@ -1,5 +1,5 @@
// errors.cpp
-// Revision 8-nov-2009
+// Revision 3-feb-2011
#include "errors.h"
@@ -42,6 +42,14 @@ Unsupported::Unsupported(const std::string &msg, const Token &where) :
//**********************************************************************
+UnsupportedInStage::UnsupportedInStage(const std::string &msg,
+ const Token &where) :
+ CompileError("Unsupported in stage 0: " + msg, where)
+{
+}
+
+//**********************************************************************
+
SyntaxError::SyntaxError(const std::string &msg, const Token &where) :
CompileError("Syntax error: " + msg, where)
{
View
8 errors.h
@@ -2,7 +2,7 @@
#define INCLUDE_ERRORS_H
// errors.h
-// Revision 8-nov-2009
+// Revision 3-feb-2011
#include "token.h"
@@ -33,6 +33,12 @@ class Unsupported : public CompileError
Unsupported(const std::string &msg, const Token &where);
};
+class UnsupportedInStage : public CompileError
+{
+public:
+ UnsupportedInStage(const std::string &msg, const Token &where);
+};
+
class SyntaxError : public CompileError
{
public:
View
8 winxedst0.cpp
@@ -1,5 +1,5 @@
// winxedst0.cpp
-// Revision 2-feb-2011
+// Revision 3-feb-2011
// Winxed compiler stage 0.
@@ -4753,6 +4753,10 @@ Expr * parseExpr_4(BlockBase &block, Tokenizer &tk)
Expr *subexpr= parseExpr_4(block, tk);
return new OpPreDecExpr(block, t, subexpr);
}
+ else if (t.iskeyword("delete"))
+ {
+ throw UnsupportedInStage("operator delete", t);
+ }
else
{
tk.unget(t);
@@ -4993,7 +4997,7 @@ Expr * parseExpr_16(BlockBase &block, Tokenizer &tk)
subexpr= new OpSubToExpr(block, t, subexpr, subexpr2);
break;
default:
- throw CompileError("Unimplemented in stage 0", t);
+ throw UnsupportedInStage("operator " + t.str(), t);
}
}
tk.unget(t);

0 comments on commit e9bf0d6

Please sign in to comment.