diff options
author | 2018-02-15 17:31:24 -0500 | |
---|---|---|
committer | 2018-02-16 15:35:36 +0000 | |
commit | 2a8c48be4ff65d873d9d5ba65ecef989d82dd0be (patch) | |
tree | 184c3941e072103ec71ae30363098d0f9e953443 /tools/bookmaker/bookmaker.cpp | |
parent | 6848b716f7d51a2456535f9a1a5e1bed725fdd64 (diff) |
improve bookmaker defines and references
generating replacement includes exposed
errors mostly dealing with globals like
SkAlphaType and members. Rewrite finding
and resolving links to hopefully make this
area more robust.
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=107160
Bug: skia:6898
Change-Id: I9b8025160203d204286f3f6ca0cebd70da6253b4
Reviewed-on: https://skia-review.googlesource.com/107160
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'tools/bookmaker/bookmaker.cpp')
-rw-r--r-- | tools/bookmaker/bookmaker.cpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/tools/bookmaker/bookmaker.cpp b/tools/bookmaker/bookmaker.cpp index 6f7c698ca5..f3641a92d5 100644 --- a/tools/bookmaker/bookmaker.cpp +++ b/tools/bookmaker/bookmaker.cpp @@ -188,13 +188,31 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy definition = rootDefinition; definition->fFileName = fFileName; definition->fContentStart = fChar; - definition->fName = typeNameBuilder[0]; - Definition* parent = fParent; - while (parent && MarkType::kTopic != parent->fMarkType - && MarkType::kSubtopic != parent->fMarkType) { - parent = parent->fParent; + if (MarkType::kTopic == markType) { + if (fParent) { + return this->reportError<bool>("#Topic must be root"); + } + // topic name is unappended + definition->fName = typeNameBuilder[0]; + } else { + if (!fParent) { + return this->reportError<bool>("#Subtopic may not be root"); + } + Definition* parent = fParent; + while (MarkType::kTopic != parent->fMarkType && MarkType::kSubtopic != parent->fMarkType) { + parent = parent->fParent; + if (!parent) { + // subtopic must have subtopic or topic in parent chain + return this->reportError<bool>("#Subtopic missing parent"); + } + } + if (MarkType::kSubtopic == parent->fMarkType) { + // subtopic prepends parent subtopic name, but not parent topic name + definition->fName = parent->fName + '_'; + } + definition->fName += typeNameBuilder[0]; + definition->fFiddle = parent->fFiddle + '_'; } - definition->fFiddle = parent ? parent->fFiddle + '_' : ""; definition->fFiddle += Definition::NormalizedName(typeNameBuilder[0]); this->setAsParent(definition); } @@ -399,6 +417,7 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy return this->reportError<bool>("duplicate alias"); } fAliasMap[alias] = definition; + definition->fFiddle = definition->fParent->fFiddle; } else if (MarkType::kLine == markType) { const char* nextLF = this->strnchr('\n', this->fEnd); |