Merge pull request #2 from TGIshib/hex-bug

Fixed bug with negative hex constants (2).
This commit is contained in:
Raman 2016-07-12 20:52:16 +03:00 committed by GitHub
commit 247388a20c
1 changed files with 6 additions and 0 deletions

View File

@ -423,6 +423,12 @@ CheckedError Parser::Next() {
return NoError();
} else if (isdigit(static_cast<unsigned char>(c)) || c == '-') {
const char *start = cursor_ - 1;
if (c == '-' && *cursor_ == '0' && (cursor_[1] == 'x' || cursor_[1] == 'X')) {
++start;
++cursor_;
attribute_.append(&c, &c + 1);
c = '0';
}
if (c == '0' && (*cursor_ == 'x' || *cursor_ == 'X')) {
cursor_++;
while (isxdigit(static_cast<unsigned char>(*cursor_))) cursor_++;