aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/bookmaker/definition.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/bookmaker/definition.cpp')
-rw-r--r--tools/bookmaker/definition.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/tools/bookmaker/definition.cpp b/tools/bookmaker/definition.cpp
index 18ce808068..056e4f7fe4 100644
--- a/tools/bookmaker/definition.cpp
+++ b/tools/bookmaker/definition.cpp
@@ -530,6 +530,67 @@ bool Definition::checkMethod() const {
return paramError.reportError<bool>("#Param without param in #Method");
}
}
+ // check after end of #Line and before next child for description
+ const char* descStart = fContentStart;
+ const char* descEnd = nullptr;
+ for (auto& child : fChildren) {
+ if (MarkType::kAnchor == child->fMarkType) {
+ continue;
+ }
+ if (MarkType::kCode == child->fMarkType) {
+ continue;
+ }
+ if (MarkType::kDeprecated == child->fMarkType) {
+ return true;
+ }
+ if (MarkType::kExperimental == child->fMarkType) {
+ return true;
+ }
+ if (MarkType::kFormula == child->fMarkType) {
+ continue;
+ }
+ if (MarkType::kList == child->fMarkType) {
+ continue;
+ }
+ if (MarkType::kMarkChar == child->fMarkType) {
+ continue;
+ }
+ if (MarkType::kPhraseRef == child->fMarkType) {
+ continue;
+ }
+ if (MarkType::kPrivate == child->fMarkType) {
+ return true;
+ }
+ TextParser emptyCheck(fFileName, descStart, child->fStart, child->fLineCount);
+ if (!emptyCheck.eof() && emptyCheck.skipWhiteSpace()) {
+ descStart = emptyCheck.fChar;
+ emptyCheck.trimEnd();
+ descEnd = emptyCheck.fEnd;
+ break;
+ }
+ descStart = child->fTerminator;
+ }
+ if (!descEnd) {
+ return methodParser.reportError<bool>("missing description");
+ }
+ TextParser description(fFileName, descStart, descEnd, fLineCount);
+ // expect first word capitalized and pluralized. expect a trailing period
+ SkASSERT(descStart < descEnd);
+ if (!isupper(descStart[0])) {
+ description.reportWarning("expected capital");
+ } else if ('.' != descEnd[-1]) {
+ description.reportWarning("expected period");
+ } else {
+ if (!description.startsWith("For use by Android")) {
+ description.skipToSpace();
+ if (',' == description.fChar[-1]) {
+ --description.fChar;
+ }
+ if ('s' != description.fChar[-1]) {
+ description.reportWarning("expected plural");
+ }
+ }
+ }
return true;
}
@@ -852,6 +913,9 @@ bool Definition::methodHasReturn(string name, TextParser* methodParser) const {
if (methodParser->skipExact("static")) {
methodParser->skipWhiteSpace();
}
+ if (methodParser->skipExact("virtual")) {
+ methodParser->skipWhiteSpace();
+ }
const char* lastStart = methodParser->fChar;
const char* nameInParser = methodParser->strnstr(name.c_str(), methodParser->fEnd);
methodParser->skipTo(nameInParser);