Skip to content

Commit 761d11a

Browse files
authored
Merge pull request #61 from cvng/try-create-domain
2 parents f2fa9a2 + 7db47a7 commit 761d11a

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

crates/codegen/src/get_node_properties.rs

+7
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,13 @@ fn custom_handlers(node: &Node) -> TokenStream {
529529
"TypeCast" => quote! {
530530
tokens.push(TokenProperty::from(Token::Typecast));
531531
},
532+
"CreateDomainStmt" => quote! {
533+
tokens.push(TokenProperty::from(Token::Create));
534+
tokens.push(TokenProperty::from(Token::DomainP));
535+
if n.type_name.is_some() {
536+
tokens.push(TokenProperty::from(Token::As));
537+
}
538+
},
532539
_ => quote! {},
533540
}
534541
}

crates/parser/src/codegen.rs

+14
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,18 @@ mod tests {
9191
],
9292
)
9393
}
94+
95+
#[test]
96+
fn test_create_domain() {
97+
test_get_node_properties(
98+
"create domain us_postal_code as text check (value is not null);",
99+
SyntaxKind::CreateDomainStmt,
100+
vec![
101+
TokenProperty::from(SyntaxKind::Create),
102+
TokenProperty::from(SyntaxKind::DomainP),
103+
TokenProperty::from(SyntaxKind::As),
104+
TokenProperty::from("us_postal_code".to_string()),
105+
],
106+
)
107+
}
94108
}

0 commit comments

Comments
 (0)