sevenmark_parser/ast/
table.rs1use serde::Serialize;
2
3use super::{Element, Expression, Parameters, Span};
4
5#[derive(Debug, Clone, Serialize)]
7pub struct TableElement {
8 #[cfg_attr(not(feature = "include_locations"), serde(skip_serializing))]
9 pub span: Span,
10 pub parameters: Parameters,
11 pub children: Vec<TableRowItem>,
12}
13
14#[derive(Debug, Clone, Serialize)]
16pub enum TableRowItem {
17 Row(TableRowElement),
18 Conditional(ConditionalTableRows),
19}
20
21#[derive(Debug, Clone, Serialize)]
23pub struct TableRowElement {
24 #[cfg_attr(not(feature = "include_locations"), serde(skip_serializing))]
25 pub span: Span,
26 pub parameters: Parameters,
27 pub children: Vec<TableCellItem>,
28}
29
30#[derive(Debug, Clone, Serialize)]
32pub enum TableCellItem {
33 Cell(TableCellElement),
34 Conditional(ConditionalTableCells),
35}
36
37#[derive(Debug, Clone, Serialize)]
39pub struct TableCellElement {
40 #[cfg_attr(not(feature = "include_locations"), serde(skip_serializing))]
41 pub span: Span,
42 pub parameters: Parameters,
43 #[serde(skip_serializing_if = "Vec::is_empty")]
44 pub x: Vec<Element>,
45 #[serde(skip_serializing_if = "Vec::is_empty")]
46 pub y: Vec<Element>,
47 pub children: Vec<Element>,
48}
49
50#[derive(Debug, Clone, Serialize)]
52pub struct ConditionalTableRows {
53 #[cfg_attr(not(feature = "include_locations"), serde(skip_serializing))]
54 pub span: Span,
55 pub condition: Expression,
56 pub rows: Vec<TableRowElement>,
57}
58
59#[derive(Debug, Clone, Serialize)]
61pub struct ConditionalTableCells {
62 #[cfg_attr(not(feature = "include_locations"), serde(skip_serializing))]
63 pub span: Span,
64 pub condition: Expression,
65 pub cells: Vec<TableCellElement>,
66}