sqparse/ast/
table.rs

1use crate::ast::slot::Slot;
2use crate::ast::Expression;
3use crate::token::Token;
4
5/// Slot in a [`TableExpression`] with an optional separator.
6///
7/// Grammar: [TableSlotType] `,`?
8///
9/// [`TableExpression`]: crate::ast::TableExpression
10#[derive(Debug, Clone)]
11pub struct TableSlot<'s> {
12    pub ty: TableSlotType<'s>,
13    pub comma: Option<&'s Token<'s>>,
14}
15
16/// Slot in a [`TableExpression`].
17///
18/// [`TableExpression`]: crate::ast::TableExpression
19#[derive(Debug, Clone)]
20pub enum TableSlotType<'s> {
21    /// Grammar: [Slot]
22    Slot(Slot<'s>),
23
24    /// JSON property slot.
25    ///
26    /// Grammar: "literal string" `:` [Expression]
27    JsonProperty {
28        name: &'s str,
29        name_token: &'s Token<'s>,
30        colon: &'s Token<'s>,
31        value: Box<Expression<'s>>,
32    },
33}