Added support in MC for Directional Local Labels.
[oota-llvm.git] / lib / MC / MCParser / AsmLexer.cpp
index 1183312784844a2d5bd4cb38a0fc7dba9fbb2c94..e74eac5f62161bc902998580ac6e3143643a38c9 100644 (file)
@@ -132,11 +132,6 @@ AsmToken AsmLexer::LexLineComment() {
 ///   Decimal integer: [1-9][0-9]*
 /// TODO: FP literal.
 AsmToken AsmLexer::LexDigit() {
-  if (*CurPtr == ':')
-    return ReturnError(TokStart, "FIXME: local label not implemented");
-  if (*CurPtr == 'f' || *CurPtr == 'b')
-    return ReturnError(TokStart, "FIXME: directional label not implemented");
-  
   // Decimal integer: [1-9][0-9]*
   if (CurPtr[-1] != '0') {
     while (isdigit(*CurPtr))
@@ -158,6 +153,13 @@ AsmToken AsmLexer::LexDigit() {
   
   if (*CurPtr == 'b') {
     ++CurPtr;
+    // See if we actually have "0b" as part of something like "jmp 0b\n"
+    if (CurPtr[0] == '\n') {
+      --CurPtr;
+      StringRef Result(TokStart, CurPtr - TokStart);
+      ++CurPtr;
+      return AsmToken(AsmToken::Integer, Result, 0);
+    }
     const char *NumStart = CurPtr;
     while (CurPtr[0] == '0' || CurPtr[0] == '1')
       ++CurPtr;