Skip to content

Commit

Permalink
CMN-1250: As Debora I want to be able to parse joins (#127)
Browse files Browse the repository at this point in the history
Co-authored-by: Kieran Kaelin <kieran_kaelin@yahoo.co.uk>
  • Loading branch information
if-loop69420 and KieranKaelin authored Aug 21, 2024
1 parent 200c75f commit 0bdab8f
Show file tree
Hide file tree
Showing 5 changed files with 762 additions and 3 deletions.
17 changes: 17 additions & 0 deletions crates/definitions/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ pub const TOKENS: Tokens<'_> = Tokens {
T!("and"),
T!("annotations"),
T!("anyschema"),
T!("apply"),
T!("array"),
T!("as"),
T!("asc"),
Expand Down Expand Up @@ -109,6 +110,7 @@ pub const TOKENS: Tokens<'_> = Tokens {
T!("containers_default"),
T!("context"),
T!("create"),
T!("cross"),
T!("crossedition"),
T!("cube"),
T!("current_user"),
Expand Down Expand Up @@ -158,6 +160,7 @@ pub const TOKENS: Tokens<'_> = Tokens {
T!("foreign"),
T!("forward"),
T!("from"),
T!("full"),
T!("function"),
T!("grant"),
T!("group"),
Expand All @@ -172,6 +175,7 @@ pub const TOKENS: Tokens<'_> = Tokens {
T!("index"),
T!("indicator"),
T!("initially"),
T!("inner"),
T!("insert"),
T!("instead"),
T!("int"),
Expand All @@ -181,10 +185,12 @@ pub const TOKENS: Tokens<'_> = Tokens {
T!("invisible"),
T!("is"),
T!("java"),
T!("join"),
T!("key"),
T!("language"),
T!("large"),
T!("last"),
T!("left"),
T!("length"),
T!("library"),
T!("like", "like", "comparison_op"),
Expand All @@ -200,6 +206,7 @@ pub const TOKENS: Tokens<'_> = Tokens {
T!("month"),
T!("name"),
T!("national"),
T!("natural"),
T!("nchar"),
T!("nclob"),
T!("new"),
Expand Down Expand Up @@ -229,10 +236,12 @@ pub const TOKENS: Tokens<'_> = Tokens {
T!("order"),
T!("others"),
T!("out"),
T!("outer"),
T!("package"),
T!("parallel_enable"),
T!("parameters"),
T!("parent"),
T!("partition"),
T!("pipelined"),
T!("plpgsql"),
T!("pls_integer"),
Expand Down Expand Up @@ -263,6 +272,7 @@ pub const TOKENS: Tokens<'_> = Tokens {
T!("reverse"),
T!("revoke"),
T!("rollup"),
T!("right"),
T!("row"),
T!("rowid"),
T!("rowtype"),
Expand Down Expand Up @@ -344,6 +354,8 @@ pub const SYNTAX_NODES: &'_ [SyntaxNode<'_>] = &[
S!("connect_by_root", "The CONNECT_BY_ROOT operator"),
S!("connect", "The CONNECT BY clause in selects"),
S!("constraint", "A node that marks a full constraint"),
S!("cross_join_clause", "A node that contains a full CROSS JOIN clause"),
S!("cross_outer_apply_clause", "A node that contains a full cross outer apply clause"),
S!("cursor_parameter_declaration", "A node containing a cursor parameter declaration"),
S!("cursor_parameter_declarations", "A node containing cursor parameter declarations"),
S!("cursor_stmt", "A node that marks a full cursor statement"),
Expand All @@ -366,19 +378,24 @@ pub const SYNTAX_NODES: &'_ [SyntaxNode<'_>] = &[
S!("hierarchical_op", "An operator in hierarchical queries"),
S!("ident", "An identifier, either quoted or unquoted"),
S!("ident_group", "An identifier group, consisting of multiple idents"),
S!("inner_join_clause", "A node that contains an INNER JOIN clause"),
S!("insert_stmt", "A node that marks a full INSERT statement"),
S!("integer", "Any integer, positive and negative"),
S!("into_clause", "A node that contains an `INTO` clause of a SELECT statement"),
S!("join_clause", "A node that contains a JOIN clause"),
S!("keyword", "A SQL keyword, e.g. `CREATE`"),
S!("logic_op", "Represents a logical SQL operator (AND, OR, NOT)"),
S!("l_paren", "Left Paren"),
S!("minus", "A minus `-`"),
S!("natural_join_clause", "A node containing an NATURAL JOIN clause"),
S!("not", "Unary logical operator NOT"),
S!("or", "Logical operator OR"),
S!("order_by_clause", "A node containing a full order by clause"),
S!("outer_join_clause", "A node containing a full OUTER JOIN clause"),
S!("package", "A node that marks a full CREATE PACKAGE BODY block"),
S!("param", "A single Param node, consisting of name & type"),
S!("param_list", "A node that consists of multiple parameters"),
S!("partition_by_clause", "A node that contains a PARTITION BY clause"),
S!("percentage", "Percentage symbol"),
S!("plus", "A plus `+`"),
S!("prior", "The PL/SQL unary prior operator"),
Expand Down
22 changes: 21 additions & 1 deletion crates/source_gen/src/lexer/generated.rs

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions crates/source_gen/src/syntax/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ pub enum SyntaxKind {
Connect,
#[doc = "A node that marks a full constraint"]
Constraint,
#[doc = "A node that contains a full CROSS JOIN clause"]
CrossJoinClause,
#[doc = "A node that contains a full cross outer apply clause"]
CrossOuterApplyClause,
#[doc = "A node containing a cursor parameter declaration"]
CursorParameterDeclaration,
#[doc = "A node containing cursor parameter declarations"]
Expand Down Expand Up @@ -102,12 +106,16 @@ pub enum SyntaxKind {
Ident,
#[doc = "An identifier group, consisting of multiple idents"]
IdentGroup,
#[doc = "A node that contains an INNER JOIN clause"]
InnerJoinClause,
#[doc = "A node that marks a full INSERT statement"]
InsertStmt,
#[doc = "Any integer, positive and negative"]
Integer,
#[doc = "A node that contains an `INTO` clause of a SELECT statement"]
IntoClause,
#[doc = "A node that contains a JOIN clause"]
JoinClause,
#[doc = "A SQL keyword, e.g. `CREATE`"]
Keyword,
#[doc = "Represents a logical SQL operator (AND, OR, NOT)"]
Expand All @@ -116,18 +124,24 @@ pub enum SyntaxKind {
LParen,
#[doc = "A minus `-`"]
Minus,
#[doc = "A node containing an NATURAL JOIN clause"]
NaturalJoinClause,
#[doc = "Unary logical operator NOT"]
Not,
#[doc = "Logical operator OR"]
Or,
#[doc = "A node containing a full order by clause"]
OrderByClause,
#[doc = "A node containing a full OUTER JOIN clause"]
OuterJoinClause,
#[doc = "A node that marks a full CREATE PACKAGE BODY block"]
Package,
#[doc = "A single Param node, consisting of name & type"]
Param,
#[doc = "A node that consists of multiple parameters"]
ParamList,
#[doc = "A node that contains a PARTITION BY clause"]
PartitionByClause,
#[doc = "Percentage symbol"]
Percentage,
#[doc = "A plus `+`"]
Expand Down Expand Up @@ -235,6 +249,7 @@ impl From<TokenKind> for SyntaxKind {
TokenKind::AndKw => SyntaxKind::Keyword,
TokenKind::AnnotationsKw => SyntaxKind::Keyword,
TokenKind::AnyschemaKw => SyntaxKind::Keyword,
TokenKind::ApplyKw => SyntaxKind::Keyword,
TokenKind::ArrayKw => SyntaxKind::Keyword,
TokenKind::AsKw => SyntaxKind::Keyword,
TokenKind::AscKw => SyntaxKind::Keyword,
Expand Down Expand Up @@ -276,6 +291,7 @@ impl From<TokenKind> for SyntaxKind {
TokenKind::ContainersDefaultKw => SyntaxKind::Keyword,
TokenKind::ContextKw => SyntaxKind::Keyword,
TokenKind::CreateKw => SyntaxKind::Keyword,
TokenKind::CrossKw => SyntaxKind::Keyword,
TokenKind::CrosseditionKw => SyntaxKind::Keyword,
TokenKind::CubeKw => SyntaxKind::Keyword,
TokenKind::CurrentUserKw => SyntaxKind::Keyword,
Expand Down Expand Up @@ -325,6 +341,7 @@ impl From<TokenKind> for SyntaxKind {
TokenKind::ForeignKw => SyntaxKind::Keyword,
TokenKind::ForwardKw => SyntaxKind::Keyword,
TokenKind::FromKw => SyntaxKind::Keyword,
TokenKind::FullKw => SyntaxKind::Keyword,
TokenKind::FunctionKw => SyntaxKind::Keyword,
TokenKind::GrantKw => SyntaxKind::Keyword,
TokenKind::GroupKw => SyntaxKind::Keyword,
Expand All @@ -339,6 +356,7 @@ impl From<TokenKind> for SyntaxKind {
TokenKind::IndexKw => SyntaxKind::Keyword,
TokenKind::IndicatorKw => SyntaxKind::Keyword,
TokenKind::InitiallyKw => SyntaxKind::Keyword,
TokenKind::InnerKw => SyntaxKind::Keyword,
TokenKind::InsertKw => SyntaxKind::Keyword,
TokenKind::InsteadKw => SyntaxKind::Keyword,
TokenKind::IntKw => SyntaxKind::Keyword,
Expand All @@ -348,10 +366,12 @@ impl From<TokenKind> for SyntaxKind {
TokenKind::InvisibleKw => SyntaxKind::Keyword,
TokenKind::IsKw => SyntaxKind::Keyword,
TokenKind::JavaKw => SyntaxKind::Keyword,
TokenKind::JoinKw => SyntaxKind::Keyword,
TokenKind::KeyKw => SyntaxKind::Keyword,
TokenKind::LanguageKw => SyntaxKind::Keyword,
TokenKind::LargeKw => SyntaxKind::Keyword,
TokenKind::LastKw => SyntaxKind::Keyword,
TokenKind::LeftKw => SyntaxKind::Keyword,
TokenKind::LengthKw => SyntaxKind::Keyword,
TokenKind::LibraryKw => SyntaxKind::Keyword,
TokenKind::LikeKw => SyntaxKind::ComparisonOp,
Expand All @@ -367,6 +387,7 @@ impl From<TokenKind> for SyntaxKind {
TokenKind::MonthKw => SyntaxKind::Keyword,
TokenKind::NameKw => SyntaxKind::Keyword,
TokenKind::NationalKw => SyntaxKind::Keyword,
TokenKind::NaturalKw => SyntaxKind::Keyword,
TokenKind::NcharKw => SyntaxKind::Keyword,
TokenKind::NclobKw => SyntaxKind::Keyword,
TokenKind::NewKw => SyntaxKind::Keyword,
Expand Down Expand Up @@ -396,10 +417,12 @@ impl From<TokenKind> for SyntaxKind {
TokenKind::OrderKw => SyntaxKind::Keyword,
TokenKind::OthersKw => SyntaxKind::Keyword,
TokenKind::OutKw => SyntaxKind::Keyword,
TokenKind::OuterKw => SyntaxKind::Keyword,
TokenKind::PackageKw => SyntaxKind::Keyword,
TokenKind::ParallelEnableKw => SyntaxKind::Keyword,
TokenKind::ParametersKw => SyntaxKind::Keyword,
TokenKind::ParentKw => SyntaxKind::Keyword,
TokenKind::PartitionKw => SyntaxKind::Keyword,
TokenKind::PipelinedKw => SyntaxKind::Keyword,
TokenKind::PlpgsqlKw => SyntaxKind::Keyword,
TokenKind::PlsIntegerKw => SyntaxKind::Keyword,
Expand Down Expand Up @@ -430,6 +453,7 @@ impl From<TokenKind> for SyntaxKind {
TokenKind::ReverseKw => SyntaxKind::Keyword,
TokenKind::RevokeKw => SyntaxKind::Keyword,
TokenKind::RollupKw => SyntaxKind::Keyword,
TokenKind::RightKw => SyntaxKind::Keyword,
TokenKind::RowKw => SyntaxKind::Keyword,
TokenKind::RowidKw => SyntaxKind::Keyword,
TokenKind::RowtypeKw => SyntaxKind::Keyword,
Expand Down
1 change: 1 addition & 0 deletions src/grammar/datatype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pub fn parse_datatype(p: &mut Parser) {
| T![integer]
| T![long]
| T![national]
| T![natural]
| T![nchar]
| T![nclob]
| T![number]
Expand Down
Loading

0 comments on commit 0bdab8f

Please sign in to comment.