case AsmToken::Identifier: {
StringRef Identifier;
if (parseIdentifier(Identifier)) {
- if (FirstTokenKind == AsmToken::Dollar) {
+ // We may have failed but $ may be a valid token.
+ if (getTok().is(AsmToken::Dollar)) {
if (Lexer.getMAI().getDollarIsPC()) {
+ Lex();
// This is a '$' reference, which references the current PC. Emit a
// temporary label to the streamer and refer to it.
MCSymbol *Sym = Ctx.createTempSymbol();
SMLoc PrefixLoc = getLexer().getLoc();
// Consume the prefix character, and check for a following identifier.
- Lexer.Lex(); // Lexer's Lex guarantees consecutive token.
- if (Lexer.isNot(AsmToken::Identifier))
+
+ AsmToken Buf[1];
+ Lexer.peekTokens(Buf, false);
+
+ if (Buf[0].isNot(AsmToken::Identifier))
return true;
// We have a '$' or '@' followed by an identifier, make sure they are adjacent.
- if (PrefixLoc.getPointer() + 1 != getTok().getLoc().getPointer())
+ if (PrefixLoc.getPointer() + 1 != Buf[0].getLoc().getPointer())
return true;
+ // eat $ or @
+ Lexer.Lex(); // Lexer's Lex guarantees consecutive token.
// Construct the joined identifier and consume the token.
Res =
StringRef(PrefixLoc.getPointer(), getTok().getIdentifier().size() + 1);
.cpsetup $31, $32, __cerror
# ASM: :[[@LINE-1]]:23: error: invalid register
.cpsetup $25, $2, $3
-# ASM: :[[@LINE-1]]:28: error: expected expression
+# ASM: :[[@LINE-1]]:27: error: expected expression
.cpsetup $25, $2, 4
# ASM: :[[@LINE-1]]:28: error: expected symbol
.cpsetup $25, $2, 4+65