Thrift: docstring revamp step 2.
Summary:
It was a bad idea to let doxygen comments become a part of the parse tree.
We now get them a totally different way. The lexer stashes the docsting
contents in a global, and the parser actions (not the rules) pull it out.
This should prevent doxygen comments from ever causing parse errors.
Blame Rev: 52678, 52732
Reviewed By: mcslee
Test Plan:
Recompiled thrift.
Thrifted a bunch of files and saw no parse errors (or C++ compile errors).
Thrifted DocTest.thrift with dump_docs on.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665201 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/thriftl.ll b/compiler/cpp/src/thriftl.ll
index 5e9fca9..4612858 100644
--- a/compiler/cpp/src/thriftl.ll
+++ b/compiler/cpp/src/thriftl.ll
@@ -16,6 +16,7 @@
%{
#include "main.h"
+#include "globals.h"
#include "parse/t_program.h"
/**
@@ -202,9 +203,15 @@
}
{doctext} {
- yylval.id = strdup(yytext + 3);
- yylval.id[strlen(yylval.id) - 2] = '\0';
- return tok_doctext;
+ /* This does not show up in the parse tree. */
+ /* Rather, the parser will grab it out of the global. */
+ if (g_parse_mode == PROGRAM) {
+ clear_doctext();
+ g_doctext = strdup(yytext + 3);
+ g_doctext[strlen(g_doctext) - 2] = '\0';
+ g_doctext = clean_up_doctext(g_doctext);
+ g_doctext_lineno = yylineno;
+ }
}