squawk_syntax/ast/
traits.rs1use squawk_parser::SyntaxKind;
2
3use crate::ast::{AstNode, support};
6use crate::{SyntaxToken, ast};
7
8pub trait NameLike: AstNode {}
9
10pub trait HasCreateTable: AstNode {
11 #[inline]
12 fn path(&self) -> Option<ast::Path> {
13 support::child(self.syntax())
14 }
15
16 #[inline]
17 fn table_arg_list(&self) -> Option<ast::TableArgList> {
18 support::child(self.syntax())
19 }
20
21 #[inline]
22 fn temp_token(&self) -> Option<SyntaxToken> {
23 support::token(self.syntax(), SyntaxKind::TEMP_KW)
24 }
25
26 #[inline]
27 fn temporary_token(&self) -> Option<SyntaxToken> {
28 support::token(self.syntax(), SyntaxKind::TEMPORARY_KW)
29 }
30
31 #[inline]
32 fn inherits(&self) -> Option<ast::Inherits> {
33 support::child(self.syntax())
34 }
35}
36
37pub trait HasWithClause: AstNode {
38 #[inline]
39 fn with_clause(&self) -> Option<ast::WithClause> {
40 support::child(self.syntax())
41 }
42}
43
44pub trait HasParamList: AstNode {
45 fn param_list(&self) -> Option<ast::ParamList> {
46 support::child(self.syntax())
47 }
48}