diff options
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fmlexer.cpp | 14 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fmlexer.h | 2 |
2 files changed, 4 insertions, 12 deletions
diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp index c8a064fad0..dc86c23b06 100644 --- a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp @@ -98,25 +98,19 @@ const XFA_FM_TOKEN KEYWORD_END = TOKendif; XFA_FM_TOKEN TokenizeIdentifier(const CFX_WideStringC& str) { uint32_t key = FX_HashCode_GetW(str, true); + const XFA_FMKeyword* end = std::begin(keyWords) + KEYWORD_END + 1; const XFA_FMKeyword* result = - std::lower_bound(std::begin(keyWords) + KEYWORD_START, std::end(keyWords), - key, [](const XFA_FMKeyword& iter, const uint32_t& val) { + std::lower_bound(std::begin(keyWords) + KEYWORD_START, end, key, + [](const XFA_FMKeyword& iter, const uint32_t& val) { return iter.m_hash < val; }); - if (result != std::end(keyWords) && result->m_hash == key) { + if (result != end && result->m_hash == key) return result->m_type; - } return TOKidentifier; } } // namespace -const wchar_t* XFA_FM_KeywordToString(XFA_FM_TOKEN op) { - if (op < KEYWORD_START || op > KEYWORD_END) - return L""; - return keyWords[op].m_keyword; -} - CXFA_FMToken::CXFA_FMToken() : m_type(TOKreserver), m_line_num(1) {} CXFA_FMToken::CXFA_FMToken(uint32_t line_num) diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer.h b/xfa/fxfa/fm2js/cxfa_fmlexer.h index c944266d37..b3f13dae7a 100644 --- a/xfa/fxfa/fm2js/cxfa_fmlexer.h +++ b/xfa/fxfa/fm2js/cxfa_fmlexer.h @@ -89,8 +89,6 @@ struct XFA_FMKeyword { const wchar_t* m_keyword; }; -const wchar_t* XFA_FM_KeywordToString(XFA_FM_TOKEN op); - class CXFA_FMToken { public: CXFA_FMToken(); |