pgLab/pglablib/catalog/PgKeywordList.cpp

26 lines
471 B
C++
Raw Permalink Normal View History

#include "PgKeywordList.h"
#include <unordered_set>
namespace {
using KeywordHT = std::unordered_set<Keyword>;
2022-09-06 11:17:18 +00:00
#define PG_KEYWORD(a,b,c,d) Keyword{a,c},
const KeywordHT _ScanKeywords = {
//const Keyword _ScanKeywords[] = {
2022-09-06 11:17:18 +00:00
#include "kwlist.h"
};
}
const Keyword* getPgsqlKeyword(QString s)
{
const Keyword *result = nullptr;
auto fr = _ScanKeywords.find(Keyword(s.toLower(), 0));
if (fr != _ScanKeywords.end())
result = &*fr;
return result;
}