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 import std.ctype : isspace, isalnum; 10 import std.ctype : isspace, isalnum;
11 11
12 /*mixin*/ 12 /*mixin*/
13 template ExceptionWithPosition() 13 template ExceptionWithPosition()
14 { 14 {
15 const LexPosition pos; 15 const LexPosition pos;
16 this( const LexPosition pos, string msg, string file=null, size_t line=0 16 this( const LexPosition pos, string msg, string file=null, size_t line=0
> 17 {
> 18 if(pos is null)
> 19 super(sprintf!"[??] %s"(msg), file, line, next);
> 20 else
17 { super(sprintf!"[%s] %s"(pos, msg), file, line, next); this.pos | 21 super(sprintf!"[%s] %s"(pos, msg), file, line, next);
> 22 this.pos = pos;
> 23 }
18 } 24 }
19 25
20 /// Thrown when encountered an EOF in the middle of a lexical token 26 /// Thrown when encountered an EOF in the middle of a lexical token
21 27
22 class UnexpectedEOF : Exception 28 class UnexpectedEOF : Exception
23 { 29 {
24 mixin ExceptionWithPosition; 30 mixin ExceptionWithPosition;