mirror of https://github.com/Icinga/icinga2.git
parent
930dc603af
commit
aa00f4183a
|
@ -80,34 +80,9 @@ static char *ConsoleCompleteHelper(const char *word, int state)
|
|||
if (state == 0) {
|
||||
matches.clear();
|
||||
|
||||
AddSuggestion(matches, word, "object");
|
||||
AddSuggestion(matches, word, "template");
|
||||
AddSuggestion(matches, word, "include");
|
||||
AddSuggestion(matches, word, "include_recursive");
|
||||
AddSuggestion(matches, word, "library");
|
||||
AddSuggestion(matches, word, "null");
|
||||
AddSuggestion(matches, word, "true");
|
||||
AddSuggestion(matches, word, "false");
|
||||
AddSuggestion(matches, word, "const");
|
||||
AddSuggestion(matches, word, "var");
|
||||
AddSuggestion(matches, word, "this");
|
||||
AddSuggestion(matches, word, "globals");
|
||||
AddSuggestion(matches, word, "locals");
|
||||
AddSuggestion(matches, word, "use");
|
||||
AddSuggestion(matches, word, "apply");
|
||||
AddSuggestion(matches, word, "to");
|
||||
AddSuggestion(matches, word, "where");
|
||||
AddSuggestion(matches, word, "import");
|
||||
AddSuggestion(matches, word, "assign");
|
||||
AddSuggestion(matches, word, "ignore");
|
||||
AddSuggestion(matches, word, "function");
|
||||
AddSuggestion(matches, word, "return");
|
||||
AddSuggestion(matches, word, "break");
|
||||
AddSuggestion(matches, word, "continue");
|
||||
AddSuggestion(matches, word, "for");
|
||||
AddSuggestion(matches, word, "if");
|
||||
AddSuggestion(matches, word, "else");
|
||||
AddSuggestion(matches, word, "while");
|
||||
BOOST_FOREACH(const String& keyword, ConfigCompiler::GetKeywords()) {
|
||||
AddSuggestion(matches, word, keyword);
|
||||
}
|
||||
|
||||
{
|
||||
ObjectLock olock(l_ScriptFrame.Locals);
|
||||
|
|
|
@ -329,3 +329,40 @@ void ConfigCompiler::RegisterZoneDir(const String& tag, const String& ppath, con
|
|||
m_ZoneDirs[zoneName].push_back(zf);
|
||||
}
|
||||
|
||||
const std::vector<String>& ConfigCompiler::GetKeywords(void)
|
||||
{
|
||||
static std::vector<String> keywords;
|
||||
|
||||
if (keywords.empty()) {
|
||||
keywords.push_back("object");
|
||||
keywords.push_back("template");
|
||||
keywords.push_back("include");
|
||||
keywords.push_back("include_recursive");
|
||||
keywords.push_back("library");
|
||||
keywords.push_back("null");
|
||||
keywords.push_back("true");
|
||||
keywords.push_back("false");
|
||||
keywords.push_back("const");
|
||||
keywords.push_back("var");
|
||||
keywords.push_back("this");
|
||||
keywords.push_back("globals");
|
||||
keywords.push_back("locals");
|
||||
keywords.push_back("use");
|
||||
keywords.push_back("apply");
|
||||
keywords.push_back("to");
|
||||
keywords.push_back("where");
|
||||
keywords.push_back("import");
|
||||
keywords.push_back("assign");
|
||||
keywords.push_back("ignore");
|
||||
keywords.push_back("function");
|
||||
keywords.push_back("return");
|
||||
keywords.push_back("break");
|
||||
keywords.push_back("continue");
|
||||
keywords.push_back("for");
|
||||
keywords.push_back("if");
|
||||
keywords.push_back("else");
|
||||
keywords.push_back("while");
|
||||
}
|
||||
|
||||
return keywords;
|
||||
}
|
||||
|
|
|
@ -109,6 +109,8 @@ public:
|
|||
static std::vector<ZoneFragment> GetZoneDirs(const String& zone);
|
||||
static void RegisterZoneDir(const String& tag, const String& ppath, const String& zoneName);
|
||||
|
||||
static const std::vector<String>& GetKeywords(void);
|
||||
|
||||
private:
|
||||
boost::promise<boost::shared_ptr<Expression> > m_Promise;
|
||||
|
||||
|
|
|
@ -18,10 +18,12 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "config/configwriter.hpp"
|
||||
#include "config/configcompiler.hpp"
|
||||
#include "base/exception.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <iterator>
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
|
@ -131,34 +133,8 @@ void ConfigWriter::EmitIdentifier(const String& identifier, bool inAssignment)
|
|||
{
|
||||
static std::set<String> keywords;
|
||||
if (keywords.empty()) {
|
||||
keywords.insert("object");
|
||||
keywords.insert("template");
|
||||
keywords.insert("include");
|
||||
keywords.insert("include_recursive");
|
||||
keywords.insert("library");
|
||||
keywords.insert("null");
|
||||
keywords.insert("true");
|
||||
keywords.insert("false");
|
||||
keywords.insert("const");
|
||||
keywords.insert("var");
|
||||
keywords.insert("this");
|
||||
keywords.insert("globals");
|
||||
keywords.insert("locals");
|
||||
keywords.insert("use");
|
||||
keywords.insert("apply");
|
||||
keywords.insert("to");
|
||||
keywords.insert("where");
|
||||
keywords.insert("import");
|
||||
keywords.insert("assign");
|
||||
keywords.insert("ignore");
|
||||
keywords.insert("function");
|
||||
keywords.insert("return");
|
||||
keywords.insert("break");
|
||||
keywords.insert("continue");
|
||||
keywords.insert("for");
|
||||
keywords.insert("if");
|
||||
keywords.insert("else");
|
||||
keywords.insert("while");
|
||||
const std::vector<String>& vkeywords = ConfigCompiler::GetKeywords();
|
||||
std::copy(vkeywords.begin(), vkeywords.end(), std::inserter(keywords, keywords.begin()));
|
||||
}
|
||||
|
||||
if (keywords.find(identifier) != keywords.end()) {
|
||||
|
|
Loading…
Reference in New Issue