Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::KeywordHelper Class Reference

Static Public Member Functions

static bool IsKeyword (const string &text, KeywordCategory category=KeywordCategory::KEYWORD_NONE)
 Returns true if the given text matches a keyword of the parser.
static KeywordCategory KeywordCategoryType (const string &text)
static string EscapeQuotes (const string &text, char quote='"')
static bool RequiresQuotes (const string &text, bool allow_caps=true, KeywordCategory category=KeywordCategory::KEYWORD_NONE)
 Returns true if the given string needs to be quoted when written as an identifier.
static string WriteQuoted (const string &text, char quote='\'')
 Writes a string that is quoted.
static string WriteOptionallyQuoted (const string &text, char quote='"', bool allow_caps = true, KeywordCategory category = KeywordCategory::KEYWORD_NONE)
 Writes a string that is optionally quoted + escaped so it can be used as an identifier.

Member Function Documentation

◆ IsKeyword()

bool duckdb::KeywordHelper::IsKeyword ( const string & text,
KeywordCategory category = KeywordCategory::KEYWORD_NONE )
static

Returns true if the given text matches a keyword of the parser.

337995 {
337996 return Parser::IsKeyword(text) != category;
337997}
static KeywordCategory IsKeyword(const string &text)
Returns true if the given text matches a keyword of the parser.
Definition duckdb.cpp:347516
Here is the call graph for this function:
Here is the caller graph for this function:

◆ KeywordCategoryType()

KeywordCategory duckdb::KeywordHelper::KeywordCategoryType ( const string & text)
static
337999 {
338000 return Parser::IsKeyword(text);
338001}

◆ EscapeQuotes()

string duckdb::KeywordHelper::EscapeQuotes ( const string & text,
char quote = '"' )
static
338024 {
338025 return StringUtil::Replace(text, string(1, quote), string(2, quote));
338026}

◆ RequiresQuotes()

bool duckdb::KeywordHelper::RequiresQuotes ( const string & text,
bool allow_caps = true,
KeywordCategory category = KeywordCategory::KEYWORD_NONE )
static

Returns true if the given string needs to be quoted when written as an identifier.

338003 {
338004 for (size_t i = 0; i < text.size(); i++) {
338005 if (i > 0 && (text[i] >= '0' && text[i] <= '9')) {
338006 continue;
338007 }
338008 if (text[i] >= 'a' && text[i] <= 'z') {
338009 continue;
338010 }
338011 if (allow_caps) {
338012 if (text[i] >= 'A' && text[i] <= 'Z') {
338013 continue;
338014 }
338015 }
338016 if (text[i] == '_') {
338017 continue;
338018 }
338019 return true;
338020 }
338021 return IsKeyword(text, category);
338022}
static bool IsKeyword(const string &text, KeywordCategory category=KeywordCategory::KEYWORD_NONE)
Returns true if the given text matches a keyword of the parser.
Definition duckdb.cpp:337995
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteQuoted()

string duckdb::KeywordHelper::WriteQuoted ( const string & text,
char quote = '\'' )
static

Writes a string that is quoted.

338028 {
338029 // 1. Escapes all occurences of 'quote' by doubling them (escape in SQL)
338030 // 2. Adds quotes around the string
338031 return string(1, quote) + EscapeQuotes(text, quote) + string(1, quote);
338032}
Here is the caller graph for this function:

◆ WriteOptionallyQuoted()

string duckdb::KeywordHelper::WriteOptionallyQuoted ( const string & text,
char quote = '"',
bool allow_caps = true,
KeywordCategory category = KeywordCategory::KEYWORD_NONE )
static

Writes a string that is optionally quoted + escaped so it can be used as an identifier.

338034 {
338035 if (!RequiresQuotes(text, allow_caps, category)) {
338036 return text;
338037 }
338038 return WriteQuoted(text, quote);
338039}
static bool RequiresQuotes(const string &text, bool allow_caps=true, KeywordCategory category=KeywordCategory::KEYWORD_NONE)
Returns true if the given string needs to be quoted when written as an identifier.
Definition duckdb.cpp:338003
static string WriteQuoted(const string &text, char quote='\'')
Writes a string that is quoted.
Definition duckdb.cpp:338028
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: