aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/CommentLexer.cpp
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2012-06-27 16:53:58 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2012-06-27 16:53:58 +0000
commit962668d2c192dd02f75b8ec3628a89964bfb738b (patch)
tree2f8df4bba8cada7495502f1d329762247b05cc07 /lib/AST/CommentLexer.cpp
parentf5e0aeac8a510ba1fd4c83391978cffd31e5ac69 (diff)
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159270 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/CommentLexer.cpp')
-rw-r--r--lib/AST/CommentLexer.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/lib/AST/CommentLexer.cpp b/lib/AST/CommentLexer.cpp
index f9acd2ac91..0b76050ff0 100644
--- a/lib/AST/CommentLexer.cpp
+++ b/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) {