llvm-mc: Recognize C++ style comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74462 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2009-06-29 21:58:22 +00:00
parent 099879687f
commit 383a4a8db0

View File

@ -109,8 +109,11 @@ asmtok::TokKind AsmLexer::LexPercent() {
/// LexSlash: Slash: / /// LexSlash: Slash: /
/// C-Style Comment: /* ... */ /// C-Style Comment: /* ... */
asmtok::TokKind AsmLexer::LexSlash() { asmtok::TokKind AsmLexer::LexSlash() {
if (*CurPtr != '*') switch (*CurPtr) {
return asmtok::Slash; case '*': break; // C style comment.
case '/': return ++CurPtr, LexLineComment();
default: return asmtok::Slash;
}
// C Style comment. // C Style comment.
++CurPtr; // skip the star. ++CurPtr; // skip the star.
@ -129,8 +132,9 @@ asmtok::TokKind AsmLexer::LexSlash() {
} }
} }
/// LexHash: Comment: #[^\n]* /// LexLineComment: Comment: #[^\n]*
asmtok::TokKind AsmLexer::LexHash() { /// : //[^\n]*
asmtok::TokKind AsmLexer::LexLineComment() {
int CurChar = getNextChar(); int CurChar = getNextChar();
while (CurChar != '\n' && CurChar != '\n' && CurChar != EOF) while (CurChar != '\n' && CurChar != '\n' && CurChar != EOF)
CurChar = getNextChar(); CurChar = getNextChar();
@ -281,7 +285,7 @@ asmtok::TokKind AsmLexer::LexToken() {
return asmtok::Exclaim; return asmtok::Exclaim;
case '%': return LexPercent(); case '%': return LexPercent();
case '/': return LexSlash(); case '/': return LexSlash();
case '#': return LexHash(); case '#': return LexLineComment();
case '"': return LexQuote(); case '"': return LexQuote();
case '0': case '1': case '2': case '3': case '4': case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '5': case '6': case '7': case '8': case '9':