Differences From Artifact [f9cdaf211a0e9fb0]:
- File
polemy/lex.d
- 2010-11-20 09:20:03 - part of checkin [515502e8d1] on branch trunk - table get, init, ask expressions addded (user: kinaba) [annotate]
To Artifact [514757ca55e253b4]:
- File
polemy/lex.d
- 2010-11-20 12:57:15 - part of checkin [3f6f41b558] on branch trunk - ast - table conversion (NOT AT ALL TESTED) (user: kinaba) [annotate]
10 10 import std.ctype : isspace, isalnum;
11 11
12 12 /*mixin*/
13 13 template ExceptionWithPosition()
14 14 {
15 15 const LexPosition pos;
16 16 this( const LexPosition pos, string msg, string file=null, size_t line=0, Throwable next=null )
17 - { super(sprintf!"[%s] %s"(pos, msg), file, line, next); this.pos = pos; }
17 + {
18 + if(pos is null)
19 + super(sprintf!"[??] %s"(msg), file, line, next);
20 + else
21 + super(sprintf!"[%s] %s"(pos, msg), file, line, next);
22 + this.pos = pos;
23 + }
18 24 }
19 25
20 26 /// Thrown when encountered an EOF in the middle of a lexical token
21 27
22 28 class UnexpectedEOF : Exception
23 29 {
24 30 mixin ExceptionWithPosition;