mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-16 14:31:59 +00:00
Switch AsmLexer::Lex to returning a reference to the current token.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77328 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2d4e6d3f12
commit
a3c924f83a
@ -110,8 +110,8 @@ public:
|
||||
AsmLexer(SourceMgr &SrcMgr);
|
||||
~AsmLexer();
|
||||
|
||||
AsmToken::TokenKind Lex() {
|
||||
return CurTok = LexToken(), getKind();
|
||||
const AsmToken &Lex() {
|
||||
return CurTok = LexToken();
|
||||
}
|
||||
|
||||
AsmToken::TokenKind getKind() const { return CurTok.getKind(); }
|
||||
|
@ -318,7 +318,7 @@ bool AsmParser::ParseStatement() {
|
||||
StringRef IDVal = ID.getString();
|
||||
|
||||
// Consume the identifier, see what is after it.
|
||||
switch (Lexer.Lex()) {
|
||||
switch (Lexer.Lex().getKind()) {
|
||||
case AsmToken::Colon: {
|
||||
// identifier ':' -> Label.
|
||||
Lexer.Lex();
|
||||
@ -609,7 +609,7 @@ bool AsmParser::ParseDirectiveSet() {
|
||||
|
||||
StringRef Name = Lexer.getTok().getString();
|
||||
|
||||
if (Lexer.Lex() != AsmToken::Comma)
|
||||
if (Lexer.Lex().isNot(AsmToken::Comma))
|
||||
return TokError("unexpected token in '.set'");
|
||||
Lexer.Lex();
|
||||
|
||||
|
@ -83,9 +83,8 @@ static int AsLexInput(const char *ProgName) {
|
||||
|
||||
bool Error = false;
|
||||
|
||||
AsmToken::TokenKind Tok = Lexer.Lex();
|
||||
while (Tok != AsmToken::Eof) {
|
||||
switch (Tok) {
|
||||
while (Lexer.Lex().isNot(AsmToken::Eof)) {
|
||||
switch (Lexer.getKind()) {
|
||||
default:
|
||||
Lexer.PrintMessage(Lexer.getLoc(), "unknown token", "warning");
|
||||
Error = true;
|
||||
@ -136,8 +135,6 @@ static int AsLexInput(const char *ProgName) {
|
||||
case AsmToken::Star: outs() << "Star\n"; break;
|
||||
case AsmToken::Tilde: outs() << "Tilde\n"; break;
|
||||
}
|
||||
|
||||
Tok = Lexer.Lex();
|
||||
}
|
||||
|
||||
return Error;
|
||||
|
Loading…
x
Reference in New Issue
Block a user