1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use syn::punctuated::Punctuated;
use syn::token::Comma;
use syn::{Expr, Ident, LitStr, Path};
mod gen;
mod parse;
#[derive(Debug)]
pub(crate) struct Menus {
items: Punctuated<Menu, Comma>,
}
#[derive(Debug)]
struct Menu {
name: Ident,
items: Punctuated<MenuElement, Comma>,
}
#[derive(Debug)]
enum MenuElement {
Item(Box<MenuItem>),
Custom(LitStr),
Section(MenuSection),
}
#[derive(Debug)]
enum MenuItem {
Entry(Box<MenuEntry>),
SubMenu(Box<SubMenu>),
}
#[derive(Debug)]
struct MenuEntry {
expr: Expr,
action_ty: Path,
value: Option<Expr>,
}
#[derive(Debug)]
struct SubMenu {
expr: Expr,
items: Punctuated<MenuElement, Comma>,
}
#[derive(Debug)]
struct MenuSection {
name: Ident,
items: Punctuated<MenuElement, Comma>,
}