|
myTinySQL v0.2.0-2-g5000098
A tiny SQL interpreter over fixed-width text files
|
Classes | |
| class | Parser |
| A recursive-descent parser: one method per statement type, reading the tokens left to right. More... | |
| struct | Token |
| One token of a statement. More... | |
Enumerations | |
| enum class | TokenKind { Word , String , Symbol , End } |
| The kinds of token the tokenizer produces. More... | |
Functions | |
| bool | isWordChar (char c) |
| Tells whether a character can stand next to an apostrophe inside a word. | |
| bool | isApostrophe (std::string_view text, std::size_t i) |
Tells whether the ' at a position is an apostrophe inside a word, as in d'Asti, L'Aquila or dell'800. | |
| std::vector< Token > | tokenize (std::string_view sql) |
| Splits a statement into tokens. | |
| std::string | describe (const Token &token) |
| Describes a token for an error message. | |
| bool | isComparison (std::string_view op) |
| Tells whether a symbol is a comparison operator. | |
| bool | isComment (std::string_view sql) |
| Tells whether a line is a comment or empty. | |
Variables | |
| constexpr std::string_view | kDelimiters = " \t\r\n(),*;@=<>!'" |
The characters that end a word (a ' only when it is not an apostrophe, see isApostrophe()). | |
|
strong |
The kinds of token the tokenizer produces.
Definition at line 33 of file Parser.cpp.
| std::string tinysql::anonymous_namespace{Parser.cpp}::describe | ( | const Token & | token | ) |
Describes a token for an error message.
| token | The token. |
"FROM", 'text', or "end of statement". Definition at line 144 of file Parser.cpp.
| bool tinysql::anonymous_namespace{Parser.cpp}::isApostrophe | ( | std::string_view | text, |
| std::size_t | i | ||
| ) |
Tells whether the ' at a position is an apostrophe inside a word, as in d'Asti, L'Aquila or dell'800.
Italian (and other languages) put apostrophes inside names, so a ' with a letter or digit on both sides is part of the word, in quotes or not. Only a ' next to a space, a comma, a bracket or the end of the text starts or ends a quoted string.
| text | The text. |
| i | A position in it. |
' with word characters on both sides (see isWordChar()). Definition at line 67 of file Parser.cpp.
| bool tinysql::anonymous_namespace{Parser.cpp}::isComment | ( | std::string_view | sql | ) |
Tells whether a line is a comment or empty.
| sql | The line. |
-- ..., or REM .... Definition at line 497 of file Parser.cpp.
| bool tinysql::anonymous_namespace{Parser.cpp}::isComparison | ( | std::string_view | op | ) |
Tells whether a symbol is a comparison operator.
| op | The symbol. |
= != <> < <= > >=. Definition at line 159 of file Parser.cpp.
| bool tinysql::anonymous_namespace{Parser.cpp}::isWordChar | ( | char | c | ) |
Tells whether a character can stand next to an apostrophe inside a word.
| c | The character. |
รจ. Definition at line 52 of file Parser.cpp.
| std::vector< Token > tinysql::anonymous_namespace{Parser.cpp}::tokenize | ( | std::string_view | sql | ) |
Splits a statement into tokens.
| sql | The statement. |
| SqlError | On an unterminated quoted string or a lone !. |
Definition at line 77 of file Parser.cpp.
|
constexpr |
The characters that end a word (a ' only when it is not an apostrophe, see isApostrophe()).
Definition at line 47 of file Parser.cpp.