[Rcpp-commits] r3876 - in pkg/Rcpp: . src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Oct 31 19:38:11 CET 2012
Author: jjallaire
Date: 2012-10-31 19:38:10 +0100 (Wed, 31 Oct 2012)
New Revision: 3876
Modified:
pkg/Rcpp/ChangeLog
pkg/Rcpp/src/Attributes.cpp
pkg/Rcpp/src/AttributesParser.cpp
pkg/Rcpp/src/AttributesParser.h
Log:
restore roxygen transposition
Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog 2012-10-31 16:45:26 UTC (rev 3875)
+++ pkg/Rcpp/ChangeLog 2012-10-31 18:38:10 UTC (rev 3876)
@@ -4,8 +4,7 @@
change 'local' param to (more clear and explicit) 'envir' param;
change 'show.output' param to 'showOutput'; add parameter to
onBuild hook to indicate if the source was from a 'code' parameter
- * src/Attributes.cpp: factored parser into it's own file; eliminated
- tranposition of roxygen comments.
+ * src/Attributes.cpp: factored parser into it's own file
* src/AttributesParser.h: attributes parser header
* src/AttributesParser.cpp: attributes parser implementation
* man/sourceCpp.Rd: documentation updates
Modified: pkg/Rcpp/src/Attributes.cpp
===================================================================
--- pkg/Rcpp/src/Attributes.cpp 2012-10-31 16:45:26 UTC (rev 3875)
+++ pkg/Rcpp/src/Attributes.cpp 2012-10-31 18:38:10 UTC (rev 3876)
@@ -195,6 +195,10 @@
const Function& function = attribute.function();
if (function.empty())
continue;
+
+ // print roxygen lines
+ for (size_t i=0; i<attribute.roxygen().size(); i++)
+ ostr << attribute.roxygen()[i] << std::endl;
// build the parameter list
std::ostringstream argsOstr;
Modified: pkg/Rcpp/src/AttributesParser.cpp
===================================================================
--- pkg/Rcpp/src/AttributesParser.cpp 2012-10-31 16:45:26 UTC (rev 3875)
+++ pkg/Rcpp/src/AttributesParser.cpp 2012-10-31 18:38:10 UTC (rev 3876)
@@ -250,6 +250,12 @@
if (*(namespaceLine.rbegin()) == ';')
namespaces_.push_back(namespaceLine);
}
+
+ // look for roxygen comments
+ else if (line.find("//'") == 0) {
+ std::string roxLine = "#" + line.substr(2);
+ roxygenBuffer_.push_back(roxLine);
+ }
}
}
}
@@ -300,7 +306,8 @@
}
// Return attribute
- Attribute attribute = Attribute(name, params, function);
+ Attribute attribute = Attribute(name, params, function, roxygenBuffer_);
+ roxygenBuffer_.clear();
return attribute;
}
Modified: pkg/Rcpp/src/AttributesParser.h
===================================================================
--- pkg/Rcpp/src/AttributesParser.h 2012-10-31 16:45:26 UTC (rev 3875)
+++ pkg/Rcpp/src/AttributesParser.h 2012-10-31 18:38:10 UTC (rev 3876)
@@ -116,8 +116,9 @@
Attribute() {}
Attribute(const std::string& name,
const std::vector<Param>& params,
- const Function& function)
- : name_(name), params_(params), function_(function)
+ const Function& function,
+ const std::vector<std::string>& roxygen)
+ : name_(name), params_(params), function_(function), roxygen_(roxygen)
{
}
@@ -135,10 +136,13 @@
const Function& function() const { return function_; }
+ const std::vector<std::string>& roxygen() const { return roxygen_; }
+
private:
std::string name_;
std::vector<Param> params_;
Function function_;
+ std::vector<std::string> roxygen_;
};
// Operator << for parsed types
@@ -220,6 +224,7 @@
CharacterVector lines_;
std::vector<Attribute> attributes_;
std::vector<std::string> namespaces_;
+ std::vector<std::string> roxygenBuffer_;
};
} // namespace attributes_parser
More information about the Rcpp-commits
mailing list