aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/bookmaker/includeParser.cpp
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2017-08-29 17:36:51 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-30 11:06:02 +0000
commit73fa972d0bd9de7cb801323495b5d1fabd31b24f (patch)
tree3a376a200b59bfd5c434eba345cf8e978a8f8ba6 /tools/bookmaker/includeParser.cpp
parent1a763632d21636504d78910f7dea0aa708c6365f (diff)
work on path
Work on SkPath.h documentation; fixed self-consistency bugs identified by bookmaker. Fixed a couple of minor typos in SkPath.h itself. Also brought SkPaint and SkCanvas docs up to date. TBR=reed@google.com Docs-Preview: https://skia.org/?cl=39040 Bug: skia: 6898 Change-Id: Id89d4e2fa7fb6ee2e3cbec7ea762e06308b67d8b Reviewed-on: https://skia-review.googlesource.com/39040 Commit-Queue: Cary Clark <caryclark@skia.org> Reviewed-by: Cary Clark <caryclark@google.com> Reviewed-by: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'tools/bookmaker/includeParser.cpp')
-rw-r--r--tools/bookmaker/includeParser.cpp42
1 files changed, 39 insertions, 3 deletions
diff --git a/tools/bookmaker/includeParser.cpp b/tools/bookmaker/includeParser.cpp
index 6aed93737f..21a47d6e8a 100644
--- a/tools/bookmaker/includeParser.cpp
+++ b/tools/bookmaker/includeParser.cpp
@@ -25,6 +25,7 @@ struct IncludeKey {
const IncludeKey kKeyWords[] = {
{ "", KeyWord::kNone, KeyProperty::kNone },
+ { "SK_API", KeyWord::kSK_API, KeyProperty::kModifier },
{ "bool", KeyWord::kBool, KeyProperty::kNumber },
{ "char", KeyWord::kChar, KeyProperty::kNumber },
{ "class", KeyWord::kClass, KeyProperty::kObject },
@@ -236,7 +237,6 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
if (this->internalName(token)) {
continue;
}
- const char* methodID = bmhParser.fMaps[(int) token.fMarkType].fName;
if (!def) {
string paramName = className + "::";
paramName += string(token.fContentStart,
@@ -304,11 +304,27 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
}
}
if (!def) {
+ if ("SK_ATTR_DEPRECATED" == token.fName) {
+ break;
+ }
+ if (0 == token.fName.find("SkDEBUGCODE")) {
+ break;
+ }
+ }
+ if (!def) {
+ // simple method names inside nested classes have a bug and are missing trailing parens
+ string withParens = fullName + "()"; // FIXME: this shouldn't be necessary
+ def = root->find(withParens);
+ }
+ if (!def) {
SkDebugf("method missing from bmh: %s\n", fullName.c_str());
break;
}
- if (def->crossCheck(methodID, token)) {
+ if (def->crossCheck2(token)) {
def->fVisited = true;
+ if (MarkType::kDefinedBy == def->fMarkType) {
+ def->fParent->fVisited = true;
+ }
} else {
SkDebugf("method differs from bmh: %s\n", fullName.c_str());
}
@@ -912,11 +928,13 @@ bool IncludeParser::parseClass(Definition* includeDef, IsStruct isStruct) {
iter = std::next(iter);
++lastPublic;
}
+ fLastObject = nullptr;
while (childIter != includeDef->fChildren.end() && (*childIter)->fParentIndex < lastPublic) {
Definition* child = *childIter;
if (!this->parseObject(child, markupDef)) {
return false;
}
+ fLastObject = child;
childIter = std::next(childIter);
}
while (childIter != includeDef->fChildren.end()) {
@@ -1292,10 +1310,18 @@ bool IncludeParser::parseObject(Definition* child, Definition* markupDef) {
case Definition::Type::kBracket:
switch (child->fBracket) {
case Bracket::kParen:
+ if (fLastObject) {
+ TextParser checkDeprecated(child->fFileName, fLastObject->fTerminator + 1,
+ child->fStart, fLastObject->fLineCount);
+ checkDeprecated.skipWhiteSpace();
+ if (checkDeprecated.startsWith("SK_ATTR_DEPRECATED")) {
+ break;
+ }
+ }
if (!this->parseMethod(child, markupDef)) {
return this->reportError<bool>("failed to parse method");
}
- break;
+ break;
case Bracket::kSlashSlash:
case Bracket::kSlashStar:
// comments are picked up by parsing objects first
@@ -1336,6 +1362,9 @@ bool IncludeParser::parseObject(Definition* child, Definition* markupDef) {
case Bracket::kAngle:
// pick up templated function pieces when method is found
break;
+ case Bracket::kDebugCode:
+ // todo: handle this
+ break;
default:
return this->reportError<bool>("unhandled bracket");
}
@@ -1457,6 +1486,11 @@ bool IncludeParser::parseChar() {
case '(':
case '[':
case '{': {
+ if (fIncludeWord && '(' == test && fChar - fIncludeWord >= 10 &&
+ !strncmp("SkDEBUGCODE", fIncludeWord, 10)) {
+ this->pushBracket(Bracket::kDebugCode);
+ break;
+ }
if (fInCharCommentString) {
break;
}
@@ -1555,6 +1589,8 @@ bool IncludeParser::parseChar() {
} else {
fInFunction = '}' != test;
}
+ } else if (')' == test && Bracket::kDebugCode == this->topBracket()) {
+ this->popBracket();
} else {
return reportError<bool>("malformed close bracket");
}