diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2012-06-27 16:53:58 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2012-06-27 16:53:58 +0000 |
commit | 1669f70273cd26d21aa775802809f40cc244cd5b (patch) | |
tree | 8db96f9c6e78f71ef75532428f676aa32b5cc541 /clang/lib/AST/CommentLexer.cpp | |
parent | 60ddd8a1b13a7a0d1519056c96a91bc2b5c2f62d (diff) | |
download | bcm5719-llvm-1669f70273cd26d21aa775802809f40cc244cd5b.tar.gz bcm5719-llvm-1669f70273cd26d21aa775802809f40cc244cd5b.zip |
Remove unsigned and a pointer from a comment token (so that each token can have only one semantic string value attached to it), at a cost of adding an additional token.
llvm-svn: 159270
Diffstat (limited to 'clang/lib/AST/CommentLexer.cpp')
-rw-r--r-- | clang/lib/AST/CommentLexer.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/clang/lib/AST/CommentLexer.cpp b/clang/lib/AST/CommentLexer.cpp index f9acd2ac919..0b76050ff0b 100644 --- a/clang/lib/AST/CommentLexer.cpp +++ b/clang/lib/AST/CommentLexer.cpp @@ -264,6 +264,9 @@ void Lexer::lexCommentText(Token &T) { case LS_VerbatimBlockBody: lexVerbatimBlockBody(T); return; + case LS_VerbatimLineText: + lexVerbatimLineText(T); + return; case LS_HTMLOpenTag: lexHTMLOpenTag(T); return; @@ -333,7 +336,7 @@ void Lexer::lexCommentText(Token &T) { return; } if (isVerbatimLineCommand(CommandName)) { - lexVerbatimLine(T, TokenPtr); + setupAndLexVerbatimLine(T, TokenPtr); return; } formTokenWithChars(T, TokenPtr, tok::command); @@ -444,16 +447,24 @@ void Lexer::lexVerbatimBlockBody(Token &T) { lexVerbatimBlockFirstLine(T); } -void Lexer::lexVerbatimLine(Token &T, const char *TextBegin) { - // Extract current line. - const char *Newline = findNewline(BufferPtr, CommentEnd); - +void Lexer::setupAndLexVerbatimLine(Token &T, const char *TextBegin) { const StringRef Name(BufferPtr + 1, TextBegin - BufferPtr - 1); - const StringRef Text(TextBegin, Newline - TextBegin); - - formTokenWithChars(T, Newline, tok::verbatim_line); + formTokenWithChars(T, TextBegin, tok::verbatim_line_name); T.setVerbatimLineName(Name); + + State = LS_VerbatimLineText; +} + +void Lexer::lexVerbatimLineText(Token &T) { + assert(State == LS_VerbatimLineText); + + // Extract current line. + const char *Newline = findNewline(BufferPtr, CommentEnd); + const StringRef Text(BufferPtr, Newline - BufferPtr); + formTokenWithChars(T, Newline, tok::verbatim_line_text); T.setVerbatimLineText(Text); + + State = LS_Normal; } void Lexer::setupAndLexHTMLOpenTag(Token &T) { |