summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-24 13:51:44 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-10-24 13:51:44 (GMT)
commitc10e981fd072258a28822a373bf7a270d31ef181 (patch)
treea9843b44a89ec523d215f9103641ea6d10212911 /Source
parenta25c440f195e0ebc3f812c5e68f7f9a7546f249d (diff)
parent2945814de29923b8f063fa179f282fbbae630a36 (diff)
downloadCMake-c10e981fd072258a28822a373bf7a270d31ef181.zip
CMake-c10e981fd072258a28822a373bf7a270d31ef181.tar.gz
CMake-c10e981fd072258a28822a373bf7a270d31ef181.tar.bz2
Merge topic 'cmake-syntax-updates'
2945814 cmRST: Teach cmake-module directive to scan bracket comments 8bb2ee9 cmake-developer.7: Improve flow of module documentation instructions efcf318 Add \-continuation to CMake language quoted arguments
Diffstat (limited to 'Source')
-rw-r--r--Source/cmListFileLexer.c2
-rw-r--r--Source/cmListFileLexer.in.l2
-rw-r--r--Source/cmRST.cxx50
-rw-r--r--Source/cmRST.h1
4 files changed, 42 insertions, 13 deletions
diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c
index 3b08b03..be27884 100644
--- a/Source/cmListFileLexer.c
+++ b/Source/cmListFileLexer.c
@@ -1127,7 +1127,7 @@ case 17:
YY_RULE_SETUP
#line 224 "cmListFileLexer.in.l"
{
- cmListFileLexerAppend(lexer, yytext, yyleng);
+ /* Continuation: text is not part of string */
++lexer->line;
lexer->column = 1;
}
diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l
index ecaf156..d45a8ea 100644
--- a/Source/cmListFileLexer.in.l
+++ b/Source/cmListFileLexer.in.l
@@ -222,7 +222,7 @@ LEGACY {MAKEVAR}|{UNQUOTED}|\"({MAKEVAR}|{UNQUOTED}|[ \t[=])*\"
}
<STRING>\\\n {
- cmListFileLexerAppend(lexer, yytext, yyleng);
+ /* Continuation: text is not part of string */
++lexer->line;
lexer->column = 1;
}
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index d2eeb0c..6d4e281 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -34,6 +34,7 @@ cmRST::cmRST(std::ostream& os, std::string const& docroot):
ReplaceDirective("^.. (\\|[^|]+\\|) replace::[ \t]*(.*)$"),
IncludeDirective("^.. include::[ \t]+([^ \t\n]+)$"),
TocTreeDirective("^.. toctree::[ \t]*(.*)$"),
+ ModuleRST("^#\\[(=*)\\[\\.rst:$"),
CMakeRole("(:cmake)?:("
"command|generator|variable|module|policy|"
"prop_cache|prop_dir|prop_gbl|prop_sf|prop_test|prop_tgt|"
@@ -85,28 +86,55 @@ void cmRST::ProcessModule(std::istream& is)
std::string rst;
while(cmSystemTools::GetLineFromStream(is, line))
{
- if(rst == "#")
+ if(!rst.empty() && rst != "#")
{
- if(line == "#")
+ // Bracket mode: check for end bracket
+ std::string::size_type pos = line.find(rst);
+ if(pos == line.npos)
{
- this->ProcessLine("");
- continue;
- }
- else if(line.substr(0, 2) == "# ")
- {
- this->ProcessLine(line.substr(2, line.npos));
- continue;
+ this->ProcessLine(line);
}
else
{
+ if(line[0] != '#')
+ {
+ this->ProcessLine(line.substr(0, pos));
+ }
rst = "";
this->Reset();
this->OutputLinePending = true;
}
}
- if(line == "#.rst:")
+ else
{
- rst = "#";
+ // Line mode: check for .rst start (bracket or line)
+ if(rst == "#")
+ {
+ if(line == "#")
+ {
+ this->ProcessLine("");
+ continue;
+ }
+ else if(line.substr(0, 2) == "# ")
+ {
+ this->ProcessLine(line.substr(2, line.npos));
+ continue;
+ }
+ else
+ {
+ rst = "";
+ this->Reset();
+ this->OutputLinePending = true;
+ }
+ }
+ if(line == "#.rst:")
+ {
+ rst = "#";
+ }
+ else if(this->ModuleRST.find(line))
+ {
+ rst = "]" + this->ModuleRST.match(1) + "]";
+ }
}
}
if(rst == "#")
diff --git a/Source/cmRST.h b/Source/cmRST.h
index 1a3cd99..fa987cd 100644
--- a/Source/cmRST.h
+++ b/Source/cmRST.h
@@ -84,6 +84,7 @@ private:
cmsys::RegularExpression ReplaceDirective;
cmsys::RegularExpression IncludeDirective;
cmsys::RegularExpression TocTreeDirective;
+ cmsys::RegularExpression ModuleRST;
cmsys::RegularExpression CMakeRole;
cmsys::RegularExpression Substitution;