mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-05 12:31:33 +00:00
Cleanup table a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121250 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
275bf63115
commit
dd2b6cbb62
@ -412,29 +412,43 @@ tgtok::TokKind TGLexer::LexBracket() {
|
||||
/// LexExclaim - Lex '!' and '![a-zA-Z]+'.
|
||||
tgtok::TokKind TGLexer::LexExclaim() {
|
||||
if (!isalpha(*CurPtr))
|
||||
return ReturnError(CurPtr-1, "Invalid \"!operator\"");
|
||||
return ReturnError(CurPtr - 1, "Invalid \"!operator\"");
|
||||
|
||||
const char *Start = CurPtr++;
|
||||
while (isalpha(*CurPtr))
|
||||
++CurPtr;
|
||||
|
||||
// Check to see which operator this is.
|
||||
unsigned Len = CurPtr-Start;
|
||||
|
||||
if (Len == 3 && !memcmp(Start, "con", 3)) return tgtok::XConcat;
|
||||
if (Len == 3 && !memcmp(Start, "sra", 3)) return tgtok::XSRA;
|
||||
if (Len == 3 && !memcmp(Start, "srl", 3)) return tgtok::XSRL;
|
||||
if (Len == 3 && !memcmp(Start, "shl", 3)) return tgtok::XSHL;
|
||||
if (Len == 2 && !memcmp(Start, "eq", 2)) return tgtok::XEq;
|
||||
if (Len == 9 && !memcmp(Start, "strconcat", 9)) return tgtok::XStrConcat;
|
||||
if (Len == 5 && !memcmp(Start, "subst", 5)) return tgtok::XSubst;
|
||||
if (Len == 7 && !memcmp(Start, "foreach", 7)) return tgtok::XForEach;
|
||||
if (Len == 4 && !memcmp(Start, "cast", 4)) return tgtok::XCast;
|
||||
if (Len == 3 && !memcmp(Start, "car", 3)) return tgtok::XCar;
|
||||
if (Len == 3 && !memcmp(Start, "cdr", 3)) return tgtok::XCdr;
|
||||
if (Len == 4 && !memcmp(Start, "null", 4)) return tgtok::XNull;
|
||||
if (Len == 2 && !memcmp(Start, "if", 2)) return tgtok::XIf;
|
||||
switch (CurPtr - Start) {
|
||||
default:
|
||||
break;
|
||||
case 2:
|
||||
if (!memcmp(Start, "eq", 2)) return tgtok::XEq;
|
||||
if (!memcmp(Start, "if", 2)) return tgtok::XIf;
|
||||
break;
|
||||
case 3:
|
||||
if (!memcmp(Start, "car", 3)) return tgtok::XCar;
|
||||
if (!memcmp(Start, "cdr", 3)) return tgtok::XCdr;
|
||||
if (!memcmp(Start, "con", 3)) return tgtok::XConcat;
|
||||
if (!memcmp(Start, "shl", 3)) return tgtok::XSHL;
|
||||
if (!memcmp(Start, "sra", 3)) return tgtok::XSRA;
|
||||
if (!memcmp(Start, "srl", 3)) return tgtok::XSRL;
|
||||
break;
|
||||
case 4:
|
||||
if (!memcmp(Start, "cast", 4)) return tgtok::XCast;
|
||||
if (!memcmp(Start, "null", 4)) return tgtok::XNull;
|
||||
break;
|
||||
case 5:
|
||||
if (!memcmp(Start, "subst", 5)) return tgtok::XSubst;
|
||||
break;
|
||||
case 7:
|
||||
if (!memcmp(Start, "foreach", 7)) return tgtok::XForEach;
|
||||
break;
|
||||
case 9:
|
||||
if (!memcmp(Start, "strconcat", 9)) return tgtok::XStrConcat;
|
||||
break;
|
||||
}
|
||||
|
||||
return ReturnError(Start-1, "Unknown operator");
|
||||
return ReturnError(Start - 1, "Unknown operator");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user