mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 21:32:39 +00:00
simplify some error recovery stuff.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73856 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4651bca31b
commit
4226bb02fb
@ -15,7 +15,6 @@
|
|||||||
#include "llvm/Support/SourceMgr.h"
|
#include "llvm/Support/SourceMgr.h"
|
||||||
#include "llvm/Support/Streams.h"
|
#include "llvm/Support/Streams.h"
|
||||||
#include "llvm/Support/MemoryBuffer.h"
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include <ostream>
|
|
||||||
#include "llvm/Config/config.h"
|
#include "llvm/Config/config.h"
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
@ -353,19 +352,19 @@ tgtok::TokKind TGLexer::LexNumber() {
|
|||||||
|
|
||||||
// Requires at least one hex digit.
|
// Requires at least one hex digit.
|
||||||
if (CurPtr == NumStart)
|
if (CurPtr == NumStart)
|
||||||
return ReturnError(CurPtr-2, "Invalid hexadecimal number");
|
return ReturnError(TokStart, "Invalid hexadecimal number");
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
CurIntVal = strtoll(NumStart, 0, 16);
|
CurIntVal = strtoll(NumStart, 0, 16);
|
||||||
if (errno == EINVAL)
|
if (errno == EINVAL)
|
||||||
return ReturnError(CurPtr-2, "Invalid hexadecimal number");
|
return ReturnError(TokStart, "Invalid hexadecimal number");
|
||||||
if (errno == ERANGE) {
|
if (errno == ERANGE) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
CurIntVal = (int64_t)strtoull(NumStart, 0, 16);
|
CurIntVal = (int64_t)strtoull(NumStart, 0, 16);
|
||||||
if (errno == EINVAL)
|
if (errno == EINVAL)
|
||||||
return ReturnError(CurPtr-2, "Invalid hexadecimal number");
|
return ReturnError(TokStart, "Invalid hexadecimal number");
|
||||||
if (errno == ERANGE)
|
if (errno == ERANGE)
|
||||||
return ReturnError(CurPtr-2, "Hexadecimal number out of range");
|
return ReturnError(TokStart, "Hexadecimal number out of range");
|
||||||
}
|
}
|
||||||
return tgtok::IntVal;
|
return tgtok::IntVal;
|
||||||
} else if (CurPtr[0] == 'b') {
|
} else if (CurPtr[0] == 'b') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user