adding documentation syntax to thrift
see DocTest.thrift for examples.
todo: integrate parsed documentation into code generation
review: marc k, mcslee
test plan: DocTest.thrift
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664970 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/thriftl.ll b/compiler/cpp/src/thriftl.ll
index d54a2ad..5450ad2 100644
--- a/compiler/cpp/src/thriftl.ll
+++ b/compiler/cpp/src/thriftl.ll
@@ -40,9 +40,11 @@
multicomm ("/*""/"*([^*/]|[^*]"/"|"*"[^/])*"*"*"*/")
comment ("//"[^\n]*)
unixcomment ("#"[^\n]*)
+doctext ("["(("["[^\]\[]*"]")|[^\]\[])*"]") /* allows one level of nesting */
symbol ([:;\,\{\}\(\)\=<>\[\]])
-dliteral ("\""[^"]*"\"")
-sliteral ("'"[^']*"'")
+dliteral ("\""[^"]*"\"")
+sliteral ("'"[^']*"'")
+
%%
@@ -184,4 +186,11 @@
return tok_literal;
}
+{doctext} {
+ yylval.id = strdup(yytext + 1);
+ yylval.id[strlen(yylval.id) - 1] = '\0';
+ return tok_doctext;
+}
+
+
%%