[llvm-commits] [llvm] r74462 - /llvm/trunk/tools/llvm-mc/AsmLexer.cpp
Daniel Dunbar
daniel at zuster.org
Mon Jun 29 14:58:23 PDT 2009
Author: ddunbar
Date: Mon Jun 29 16:58:22 2009
New Revision: 74462
URL: http://llvm.org/viewvc/llvm-project?rev=74462&view=rev
Log:
llvm-mc: Recognize C++ style comments.
Modified:
llvm/trunk/tools/llvm-mc/AsmLexer.cpp
Modified: llvm/trunk/tools/llvm-mc/AsmLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.cpp?rev=74462&r1=74461&r2=74462&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmLexer.cpp (original)
+++ llvm/trunk/tools/llvm-mc/AsmLexer.cpp Mon Jun 29 16:58:22 2009
@@ -109,8 +109,11 @@
/// LexSlash: Slash: /
/// C-Style Comment: /* ... */
asmtok::TokKind AsmLexer::LexSlash() {
- if (*CurPtr != '*')
- return asmtok::Slash;
+ switch (*CurPtr) {
+ case '*': break; // C style comment.
+ case '/': return ++CurPtr, LexLineComment();
+ default: return asmtok::Slash;
+ }
// C Style comment.
++CurPtr; // skip the star.
@@ -129,8 +132,9 @@
}
}
-/// LexHash: Comment: #[^\n]*
-asmtok::TokKind AsmLexer::LexHash() {
+/// LexLineComment: Comment: #[^\n]*
+/// : //[^\n]*
+asmtok::TokKind AsmLexer::LexLineComment() {
int CurChar = getNextChar();
while (CurChar != '\n' && CurChar != '\n' && CurChar != EOF)
CurChar = getNextChar();
@@ -281,7 +285,7 @@
return asmtok::Exclaim;
case '%': return LexPercent();
case '/': return LexSlash();
- case '#': return LexHash();
+ case '#': return LexLineComment();
case '"': return LexQuote();
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
More information about the llvm-commits
mailing list