Differences From Artifact [594acaf3ac60594c]:
- File
polemy/failure.d
- 2010-11-21 11:11:49 - part of checkin [2bdfb8a182] on branch trunk - moved build sciprt for documents into Poseidon environment (user: kinaba) [annotate]
To Artifact [701f5b1b899607f2]:
- File
polemy/failure.d
- 2010-11-21 14:24:33 - part of checkin [3995a5eb6a] on branch trunk - added iikagen pattern match (user: kinaba) [annotate]
5 5 * Error Information for Polemy Programming Language
6 6 */
7 7 module polemy.failure;
8 8 import polemy._common;
9 9
10 10 /// Represents a position in source codes
11 11
12 +alias immutable(LexPosition_t) LexPosition;
13 +
14 +/// Represents a position in source codes
15 +
12 16 class LexPosition_t
13 17 {
14 18 immutable string filename; /// name of the source file
15 19 immutable int lineno; /// 1-origin
16 20 immutable int column; /// 1-origin
17 21
18 22 mixin SimpleClass;
................................................................................
21 25 return sprintf!("%s:%d:%d")(filename, lineno, column);
22 26 }
23 27
24 28 static LexPosition dummy;
25 29 static this(){ dummy = new LexPosition("<unnamed>",0,0); }
26 30 }
27 31
28 -/// Represents a position in source codes
29 -
30 -alias immutable(LexPosition_t) LexPosition;
31 -
32 32 unittest
33 33 {
34 34 auto p = new LexPosition("hello.cpp", 123, 45);
35 35
36 36 assert_eq( p.filename, "hello.cpp" );
37 37 assert_eq( p.lineno, 123 );
38 38 assert_eq( p.column, 45 );