summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibSQL/AST/Parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibSQL/AST/Parser.cpp')
-rw-r--r--Userland/Libraries/LibSQL/AST/Parser.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/Userland/Libraries/LibSQL/AST/Parser.cpp b/Userland/Libraries/LibSQL/AST/Parser.cpp
index 585b5657bc..51abcf8d0b 100644
--- a/Userland/Libraries/LibSQL/AST/Parser.cpp
+++ b/Userland/Libraries/LibSQL/AST/Parser.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2021, Tim Flynn <trflynn89@serenityos.org>
+ * Copyright (c) 2021, Mahmoud Mandour <ma.mandourr@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -46,6 +47,8 @@ NonnullRefPtr<Statement> Parser::parse_statement()
return parse_alter_table_statement();
case TokenType::Drop:
return parse_drop_table_statement();
+ case TokenType::Describe:
+ return parse_describe_table_statement();
case TokenType::Insert:
return parse_insert_statement({});
case TokenType::Update:
@@ -181,6 +184,16 @@ NonnullRefPtr<DropTable> Parser::parse_drop_table_statement()
return create_ast_node<DropTable>(move(schema_name), move(table_name), is_error_if_table_does_not_exist);
}
+NonnullRefPtr<DescribeTable> Parser::parse_describe_table_statement()
+{
+ consume(TokenType::Describe);
+ consume(TokenType::Table);
+
+ auto table_name = parse_qualified_table_name();
+
+ return create_ast_node<DescribeTable>(move(table_name));
+}
+
NonnullRefPtr<Insert> Parser::parse_insert_statement(RefPtr<CommonTableExpressionList> common_table_expression_list)
{
// https://sqlite.org/lang_insert.html