Mercurial > projects > ddmd
comparison dmd/Lexer.d @ 49:0aa7d1437ada
AttribDeclaration.oneMember
Lexer.decodeUTF
WithStatement.ctor
StructDeclaration.syntaxCopy
CtorDeclaration.syntaxCopy
ConditionalStatement.syntaxCopy
ProtDeclaration.syntaxCopy
ArrayScopeSymbol.this
TemplateDeclaration.toChars
author | korDen |
---|---|
date | Sat, 21 Aug 2010 07:53:20 +0400 |
parents | 544b922227c7 |
children | b7d29f613539 |
comparison
equal
deleted
inserted
replaced
48:0bd8afbaffd7 | 49:0aa7d1437ada |
---|---|
2464 void pragma_() | 2464 void pragma_() |
2465 { | 2465 { |
2466 assert(false); | 2466 assert(false); |
2467 } | 2467 } |
2468 | 2468 |
2469 /******************************************** | |
2470 * Decode UTF character. | |
2471 * Issue error messages for invalid sequences. | |
2472 * Return decoded character, advance p to last character in UTF sequence. | |
2473 */ | |
2469 uint decodeUTF() | 2474 uint decodeUTF() |
2470 { | 2475 { |
2471 assert(false); | 2476 dchar u; |
2477 ubyte c; | |
2478 ubyte* s = p; | |
2479 size_t len; | |
2480 size_t idx; | |
2481 string msg; | |
2482 | |
2483 c = *s; | |
2484 assert(c & 0x80); | |
2485 | |
2486 // Check length of remaining string up to 6 UTF-8 characters | |
2487 for (len = 1; len < 6 && s[len]; len++) { | |
2488 ; | |
2489 } | |
2490 | |
2491 idx = 0; | |
2492 msg = utf_decodeChar(cast(string)s[0..len], &idx, &u); | |
2493 p += idx - 1; | |
2494 if (msg) | |
2495 { | |
2496 error("%s", msg); | |
2497 } | |
2498 return u; | |
2472 } | 2499 } |
2473 | 2500 |
2474 void getDocComment(Token* t, uint lineComment) | 2501 void getDocComment(Token* t, uint lineComment) |
2475 { | 2502 { |
2476 assert(false); | 2503 assert(false); |