Differences From Artifact [5f52873e3ff7ae30]:
- File
polemy/lex.d
- 2010-11-08 11:42:14 - part of checkin [5e407d7cf8] on branch trunk - Lexer Refactored so that it can accpet multi-symbol token (user: kinaba) [annotate]
To Artifact [bee9af8d0f8f7348]:
- File
polemy/lex.d
- 2010-11-08 12:26:39 - part of checkin [80ff567c75] on branch trunk - Testing easyAST. (user: kinaba) [annotate]
27 27 immutable int column; /// column, 1, 2, ...
28 28
29 29 override string toString() const
30 30 { return sprintf!"%s:%d:%d"(filename, lineno, column); }
31 31
32 32 mixin SimpleConstructor;
33 33 mixin SimpleCompare;
34 +
35 + static immutable LexPosition dummy;
36 + static this(){ dummy = new immutable(LexPosition)("<unnamed>",0,0); }
34 37 }
35 38
36 39 unittest
37 40 {
38 41 auto p = new LexPosition("hello.cpp", 123, 45);
39 42 auto q = new LexPosition("hello.cpp", 123, 46);
40 43
................................................................................
57 60 {
58 61 immutable LexPosition pos; /// Position where the token occurred in the source
59 62 immutable string str; /// The token string itself
60 63 immutable bool quoted; /// Was it a "quoted" token or unquoted?
61 64
62 65 mixin SimpleConstructor;
63 66 mixin SimpleCompare;
67 + mixin SimpleToString;
64 68 }
65 69
66 70 unittest
67 71 {
68 72 auto p = new immutable(LexPosition)("hello.cpp", 123, 45);
69 73 auto t = new Token(p, "class", false);
70 74 auto u = new Token(p, "class", true);