From db6528b463841e9ea05fb9dad1559d263b1f6a34 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 17 Jul 2017 14:37:48 +1000 Subject: Backport: Implement style metadata for some languages. Add some helper methods to SubStyles for finding style metadata of substyles. Backport of changeset 6349:f350a2543488. --- lexlib/SubStyles.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'lexlib') diff --git a/lexlib/SubStyles.h b/lexlib/SubStyles.h index f5b15e9cf..07b0f1507 100644 --- a/lexlib/SubStyles.h +++ b/lexlib/SubStyles.h @@ -37,6 +37,10 @@ public: return firstStyle; } + int Last() const { + return firstStyle + lenStyles - 1; + } + int Length() const { return lenStyles; } @@ -153,6 +157,24 @@ public: return secondaryDistance; } + int FirstAllocated() const { + int start = 257; + for (std::vector::const_iterator it = classifiers.begin(); it != classifiers.end(); ++it) { + if (start > it->Start()) + start = it->Start(); + } + return (start < 256) ? start : -1; + } + + int LastAllocated() const { + int last = -1; + for (std::vector::const_iterator it = classifiers.begin(); it != classifiers.end(); ++it) { + if (last < it->Last()) + last = it->Last(); + } + return last; + } + void SetIdentifiers(int style, const char *identifiers) { int block = BlockFromStyle(style); if (block >= 0) -- cgit v1.2.3