Mercurial > projects > dil
comparison trunk/src/dil/Unicode.d @ 737:f88b5285b86b
Implemented DDocEmitter.
Fixed quite a few bugs.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Sat, 09 Feb 2008 02:00:20 +0100 |
parents | ceaac6a24258 |
children | 49fe21aa387c |
comparison
equal
deleted
inserted
replaced
736:2eee29aaa357 | 737:f88b5285b86b |
---|---|
58 } | 58 } |
59 | 59 |
60 /// index is set one past the last trail byte of the valid UTF-8 sequence. | 60 /// index is set one past the last trail byte of the valid UTF-8 sequence. |
61 dchar decode(char[] str, ref size_t index) | 61 dchar decode(char[] str, ref size_t index) |
62 in { assert(str.length && index < str.length); } | 62 in { assert(str.length && index < str.length); } |
63 out(c) { assert(isValidChar(c)); } | 63 out(c) { assert(isValidChar(c) || c == ERROR_CHAR); } |
64 body | 64 body |
65 { | 65 { |
66 char* p = str.ptr + index; | 66 char* p = str.ptr + index; |
67 char* end = str.ptr + str.length; | 67 char* end = str.ptr + str.length; |
68 dchar c = decode(p, end); | 68 dchar c = decode(p, end); |
72 } | 72 } |
73 | 73 |
74 /// ref_p is set to the last trail byte of the valid UTF-8 sequence. | 74 /// ref_p is set to the last trail byte of the valid UTF-8 sequence. |
75 dchar decode(ref char* ref_p, char* end) | 75 dchar decode(ref char* ref_p, char* end) |
76 in { assert(ref_p && ref_p < end); } | 76 in { assert(ref_p && ref_p < end); } |
77 out(c) { assert(isValidChar(c)); } | 77 out(c) { assert(isValidChar(c) || c == ERROR_CHAR); } |
78 body | 78 body |
79 { | 79 { |
80 char* p = ref_p; | 80 char* p = ref_p; |
81 dchar c = *p; | 81 dchar c = *p; |
82 | 82 |