diff options
author | Cary Clark <caryclark@skia.org> | 2018-03-09 15:32:01 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-09 20:57:50 +0000 |
commit | bbfda2583f5bff3b9b0c76e0bdb132ff0cce7f8d (patch) | |
tree | 6b71992ae1570ce6432b4aa53e9e3d56d342f724 /tools | |
parent | 0fc41da384fdb7e52b3254b33d663e55912e7fea (diff) |
add starting template support
some support for interfaces containing
template <typename x> class x
includeParser now correctly balances
bracket indentions and builds correct hierarchy.
Cross-check does not detect that the bmh definition
is missing the class; then includeWriter asserts
when the bmh class can't be found.
TBR=caryclark@google.com
Bug: skia:6898
Change-Id: Ibb70667ed4a6f8e553eec3924b56dfde737b4383
Reviewed-on: https://skia-review.googlesource.com/113460
Reviewed-by: Cary Clark <caryclark@skia.org>
Commit-Queue: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/bookmaker/bookmaker.h | 2 | ||||
-rw-r--r-- | tools/bookmaker/includeParser.cpp | 13 | ||||
-rw-r--r-- | tools/bookmaker/includeWriter.cpp | 1 |
3 files changed, 10 insertions, 6 deletions
diff --git a/tools/bookmaker/bookmaker.h b/tools/bookmaker/bookmaker.h index db0d9926db..633f883972 100644 --- a/tools/bookmaker/bookmaker.h +++ b/tools/bookmaker/bookmaker.h @@ -1616,7 +1616,7 @@ public: bool parseMethod(Definition* child, Definition* markupDef); bool parseObject(Definition* child, Definition* markupDef); bool parseObjects(Definition* parent, Definition* markupDef); - bool parseTemplate(); + bool parseTemplate(Definition* child, Definition* markupDef); bool parseTypedef(Definition* child, Definition* markupDef); bool parseUnion(); diff --git a/tools/bookmaker/includeParser.cpp b/tools/bookmaker/includeParser.cpp index 07189dcc3f..c69af7a05a 100644 --- a/tools/bookmaker/includeParser.cpp +++ b/tools/bookmaker/includeParser.cpp @@ -1723,7 +1723,7 @@ bool IncludeParser::parseObject(Definition* child, Definition* markupDef) { } break; case KeyWord::kTemplate: - if (!this->parseTemplate()) { + if (!this->parseTemplate(child, markupDef)) { return child->reportError<bool>("failed to parse template"); } break; @@ -1849,9 +1849,8 @@ bool IncludeParser::parseObject(Definition* child, Definition* markupDef) { return true; } -bool IncludeParser::parseTemplate() { - - return true; +bool IncludeParser::parseTemplate(Definition* child, Definition* markupDef) { + return this->parseObjects(child, markupDef); } bool IncludeParser::parseTypedef(Definition* child, Definition* markupDef) { @@ -2142,7 +2141,8 @@ bool IncludeParser::parseChar() { } if (Definition::Type::kKeyWord == fParent->fType && KeyProperty::kObject == (kKeyWords[(int) fParent->fKeyWord].fProperty)) { - if (KeyWord::kClass == fParent->fKeyWord && fParent->fParent && + bool parentIsClass = KeyWord::kClass == fParent->fKeyWord; + if (parentIsClass && fParent->fParent && KeyWord::kEnum == fParent->fParent->fKeyWord) { this->popObject(); } @@ -2150,6 +2150,9 @@ bool IncludeParser::parseChar() { fInEnum = false; } this->popObject(); + if (parentIsClass && fParent && KeyWord::kTemplate == fParent->fKeyWord) { + this->popObject(); + } fPriorEnum = nullptr; } else if (Definition::Type::kBracket == fParent->fType && fParent->fParent && Definition::Type::kKeyWord == fParent->fParent->fType diff --git a/tools/bookmaker/includeWriter.cpp b/tools/bookmaker/includeWriter.cpp index 83895ea78a..2442138ea2 100644 --- a/tools/bookmaker/includeWriter.cpp +++ b/tools/bookmaker/includeWriter.cpp @@ -1413,6 +1413,7 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti case KeyWord::kFriend: case KeyWord::kInline: case KeyWord::kSK_API: + case KeyWord::kTemplate: case KeyWord::kTypedef: break; case KeyWord::kSK_BEGIN_REQUIRE_DENSE: |