diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-04-14 09:55:22 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-04-14 09:55:22 +0800 |
commit | 0b37099dca13d7bb82e8843cfc3431e5e74784c8 (patch) | |
tree | 8631ef60487c96bc143494d006f50ace7f7cdb9f | |
parent | aa60fa39a73d59c5f4036dd18bfc60666800317b (diff) | |
download | mrust-0b37099dca13d7bb82e8843cfc3431e5e74784c8.tar.gz |
Lex - Fix incorrect encoding of UTF-8 escapes
-rw-r--r-- | src/parse/lex.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/parse/lex.cpp b/src/parse/lex.cpp index 7b99c433..57a0bedc 100644 --- a/src/parse/lex.cpp +++ b/src/parse/lex.cpp @@ -1010,12 +1010,12 @@ bool Codepoint::isxdigit() const { s += (char)(0xC0 | ((cp.v >> 6) & 0x1F)); s += (char)(0x80 | ((cp.v >> 0) & 0x3F)); } - else if( cp.v <= (0x0F+1)<<(2*6) ) { + else if( cp.v < (0x0F+1)<<(2*6) ) { s += (char)(0xE0 | ((cp.v >> 12) & 0x0F)); s += (char)(0x80 | ((cp.v >> 6) & 0x3F)); s += (char)(0x80 | ((cp.v >> 0) & 0x3F)); } - else if( cp.v <= (0x07+1)<<(3*6) ) { + else if( cp.v < (0x07+1)<<(3*6) ) { s += (char)(0xF0 | ((cp.v >> 18) & 0x07)); s += (char)(0x80 | ((cp.v >> 12) & 0x3F)); s += (char)(0x80 | ((cp.v >> 6) & 0x3F)); @@ -1035,12 +1035,12 @@ bool Codepoint::isxdigit() const { os << (char)(0xC0 | ((cp.v >> 6) & 0x1F)); os << (char)(0x80 | ((cp.v >> 0) & 0x3F)); } - else if( cp.v <= (0x0F+1)<<(2*6) ) { + else if( cp.v < (0x0F+1)<<(2*6) ) { os << (char)(0xE0 | ((cp.v >> 12) & 0x0F)); os << (char)(0x80 | ((cp.v >> 6) & 0x3F)); os << (char)(0x80 | ((cp.v >> 0) & 0x3F)); } - else if( cp.v <= (0x07+1)<<(2*6) ) { + else if( cp.v < (0x07+1)<<(2*6) ) { os << (char)(0xF0 | ((cp.v >> 18) & 0x07)); os << (char)(0x80 | ((cp.v >> 12) & 0x3F)); os << (char)(0x80 | ((cp.v >> 6) & 0x3F)); |