Mercurial > projects > dil
comparison trunk/src/dil/Parser.d @ 514:6ddff941862a
Added new error classes.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Fri, 14 Dec 2007 19:32:07 +0100 |
parents | aa73f669c298 |
children | 9ebc799c7dc5 |
comparison
equal
deleted
inserted
replaced
513:6160ab7b1816 | 514:6ddff941862a |
---|---|
25 { | 25 { |
26 Lexer lx; | 26 Lexer lx; |
27 Token* token; /// Current non-whitespace token. | 27 Token* token; /// Current non-whitespace token. |
28 Token* prevToken; /// Previous non-whitespace token. | 28 Token* prevToken; /// Previous non-whitespace token. |
29 | 29 |
30 Information[] errors; | 30 ParserError[] errors; |
31 | 31 |
32 ImportDeclaration[] imports; /// ImportDeclarations in the source text. | 32 ImportDeclaration[] imports; /// ImportDeclarations in the source text. |
33 | 33 |
34 LinkageType linkageType; | 34 LinkageType linkageType; |
35 Protection protection; | 35 Protection protection; |
4419 } | 4419 } |
4420 | 4420 |
4421 /// Reports an error that has no message ID yet. | 4421 /// Reports an error that has no message ID yet. |
4422 void error(Token* token, char[] formatMsg, ...) | 4422 void error(Token* token, char[] formatMsg, ...) |
4423 { | 4423 { |
4424 error_(token, MID.min, formatMsg, _arguments, _argptr); | 4424 error_(token, formatMsg, _arguments, _argptr); |
4425 } | 4425 } |
4426 | 4426 |
4427 void error(MID mid, ...) | 4427 void error(MID mid, ...) |
4428 { | 4428 { |
4429 error_(this.token, mid, GetMsg(mid), _arguments, _argptr); | 4429 error_(this.token, GetMsg(mid), _arguments, _argptr); |
4430 } | 4430 } |
4431 | 4431 |
4432 void error_(Token* token, MID mid, char[] formatMsg, TypeInfo[] _arguments, void* _argptr) | 4432 void error_(Token* token, char[] formatMsg, TypeInfo[] _arguments, void* _argptr) |
4433 { | 4433 { |
4434 if (trying) | 4434 if (trying) |
4435 { | 4435 { |
4436 ++errorCount; | 4436 ++errorCount; |
4437 return; | 4437 return; |
4438 } | 4438 } |
4439 auto location = token.getLocation(); | 4439 auto location = token.getLocation(); |
4440 auto msg = Format(_arguments, _argptr, formatMsg); | 4440 auto msg = Format(_arguments, _argptr, formatMsg); |
4441 errors ~= new Information(InfoType.Parser, mid, location, msg); | 4441 errors ~= new ParserError(location, msg); |
4442 } | 4442 } |
4443 | 4443 |
4444 /// Collection of error messages with no MID yet. | 4444 /// Collection of error messages with no MID yet. |
4445 private struct MSG | 4445 private struct MSG |
4446 { | 4446 { |