ladybird/Userland/Libraries/LibSQL
Jan de Visser 5c4890411b LibSQL: Make lexer and parser more standard SQL compliant
SQL was standardized before there was consensus on sane language syntax
constructs had evolved. The language is mostly case-insensitive, with
unquoted text converted to upper case. Identifiers can include lower
case characters and other 'special' characters by enclosing the
identifier with double quotes. A double quote is escaped by doubling it.
Likewise, a single quote in a literal string is escaped by doubling it.

All this means that the strategy used in the lexer, where a token's
value is a StringView 'window' on the source string, does not work,
because the value needs to be massaged before being handed to the
parser. Therefore a token now has a String containing its value. Given
the limited lifetime of a token, this is acceptable overhead.

Not doing this means that for example quote removal and double quote
escaping would need to be done in the parser or in AST node
construction, which would spread lexing basically all over the place.
Which would be suboptimal.

There was some impact on the sql utility and SyntaxHighlighter component
which was addressed by storing the token's end position together with
the start position in order to properly highlight it.

Finally, reviewing the tests for parsing numeric literals revealed an
inconsistency in which tokens we accept or reject: `1a` is accepted but
`1e` is rejected. Related to this is the fate of `0x`. Added a FIXME
reminding us to address this.
2021-06-24 00:36:53 +02:00
..
AST LibSQL: Make lexer and parser more standard SQL compliant 2021-06-24 00:36:53 +02:00
BTree.cpp LibSQL: BTree index, Heap, and Meta objects for SQL Storage layer 2021-06-19 22:06:45 +02:00
BTree.h LibSQL: BTree index, Heap, and Meta objects for SQL Storage layer 2021-06-19 22:06:45 +02:00
BTreeIterator.cpp LibSQL: BTree index, Heap, and Meta objects for SQL Storage layer 2021-06-19 22:06:45 +02:00
CMakeLists.txt LibSQL: Move Lexer and Parser machinery to AST directory 2021-06-24 00:36:53 +02:00
Database.cpp LibSQL: Database layer 2021-06-19 22:06:45 +02:00
Database.h LibSQL: Database layer 2021-06-19 22:06:45 +02:00
Forward.h LibSQL: Move Lexer and Parser machinery to AST directory 2021-06-24 00:36:53 +02:00
HashIndex.cpp LibSQL: Hash index implementation for the SQL storage layer 2021-06-19 22:06:45 +02:00
HashIndex.h LibSQL: Hash index implementation for the SQL storage layer 2021-06-19 22:06:45 +02:00
Heap.cpp LibSQL: BTree index, Heap, and Meta objects for SQL Storage layer 2021-06-19 22:06:45 +02:00
Heap.h LibSQL: BTree index, Heap, and Meta objects for SQL Storage layer 2021-06-19 22:06:45 +02:00
Index.cpp LibSQL: BTree index, Heap, and Meta objects for SQL Storage layer 2021-06-19 22:06:45 +02:00
Index.h LibSQL: BTree index, Heap, and Meta objects for SQL Storage layer 2021-06-19 22:06:45 +02:00
Key.cpp LibSQL: BTree index, Heap, and Meta objects for SQL Storage layer 2021-06-19 22:06:45 +02:00
Key.h LibSQL: BTree index, Heap, and Meta objects for SQL Storage layer 2021-06-19 22:06:45 +02:00
Meta.cpp LibSQL: Move Lexer and Parser machinery to AST directory 2021-06-24 00:36:53 +02:00
Meta.h LibSQL: Move Lexer and Parser machinery to AST directory 2021-06-24 00:36:53 +02:00
Row.cpp LibSQL: Database layer 2021-06-19 22:06:45 +02:00
Row.h LibSQL: Database layer 2021-06-19 22:06:45 +02:00
Serialize.h LibSQL: Basic dynamic value classes for SQL Storage layer 2021-06-19 22:06:45 +02:00
TreeNode.cpp LibSQL: BTree index, Heap, and Meta objects for SQL Storage layer 2021-06-19 22:06:45 +02:00
Tuple.cpp LibSQL: Move Lexer and Parser machinery to AST directory 2021-06-24 00:36:53 +02:00
Tuple.h LibSQL: Basic dynamic value classes for SQL Storage layer 2021-06-19 22:06:45 +02:00
TupleDescriptor.h LibSQL: Move Lexer and Parser machinery to AST directory 2021-06-24 00:36:53 +02:00
Type.h LibSQL: Basic dynamic value classes for SQL Storage layer 2021-06-19 22:06:45 +02:00
Value.cpp LibSQL: Basic dynamic value classes for SQL Storage layer 2021-06-19 22:06:45 +02:00
Value.h LibSQL: Basic dynamic value classes for SQL Storage layer 2021-06-19 22:06:45 +02:00