File indexing completed on 2025-02-16 09:45:29
0001 /* 0002 SPDX-License-Identifier: GPL-2.0-or-later 0003 SPDX-FileCopyrightText: 2018 Sirgienko Nikita <warquark@gmail.com> 0004 */ 0005 0006 #include "luakeywords.h" 0007 0008 #include <KSyntaxHighlighting/Repository> 0009 #include <KSyntaxHighlighting/Definition> 0010 0011 LuaKeywords::LuaKeywords() 0012 { 0013 KSyntaxHighlighting::Repository m_repository; 0014 KSyntaxHighlighting::Definition definition = m_repository.definitionForName(QLatin1String("Lua")); 0015 0016 m_keywords = definition.keywordList(QLatin1String("keywords")); 0017 m_keywords << definition.keywordList(QLatin1String("control")); 0018 0019 m_variables = definition.keywordList(QLatin1String("basevar")); 0020 0021 m_functions = definition.keywordList(QLatin1String("basefunc")); 0022 } 0023 0024 LuaKeywords* LuaKeywords::instance() 0025 { 0026 static LuaKeywords* inst = nullptr; 0027 0028 if(inst == nullptr){ 0029 inst = new LuaKeywords(); 0030 qSort(inst->m_functions); 0031 qSort(inst->m_keywords); 0032 qSort(inst->m_variables); 0033 } 0034 0035 return inst; 0036 } 0037 0038 const QStringList& LuaKeywords::functions() const 0039 { 0040 return m_functions; 0041 } 0042 0043 const QStringList& LuaKeywords::keywords() const 0044 { 0045 return m_keywords; 0046 } 0047 0048 const QStringList& LuaKeywords::variables() const 0049 { 0050 return m_variables; 0051 }