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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#![deny(missing_debug_implementations)]
#![deny(missing_docs)]
#![deny(warnings)]
#[macro_use]
extern crate error_chain;
#[macro_use]
extern crate quote;
extern crate syn;
pub mod check;
pub mod error;
mod parse;
mod util;
use std::collections::{HashMap, HashSet};
use quote::Tokens;
use syn::{Ident, Path, Ty};
use error::*;
pub type Expr = Tokens;
pub type Resources = HashSet<Ident>;
pub type Statics = HashMap<Ident, Static>;
pub type Tasks = HashMap<Ident, Task>;
#[derive(Debug)]
pub struct App {
pub device: Path,
pub idle: Option<Idle>,
pub init: Option<Init>,
pub resources: Option<Statics>,
pub tasks: Option<Tasks>,
_extensible: (),
}
#[derive(Debug)]
pub struct Idle {
pub path: Option<Path>,
pub resources: Option<Resources>,
_extensible: (),
}
#[derive(Debug)]
pub struct Init {
pub path: Option<Path>,
_extensible: (),
}
#[derive(Debug)]
pub struct Task {
pub enabled: Option<bool>,
pub path: Option<Path>,
pub priority: Option<u8>,
pub resources: Option<Resources>,
_extensible: (),
}
#[derive(Debug)]
pub struct Static {
pub expr: Option<Expr>,
pub ty: Ty,
_extensible: (),
}
impl App {
pub fn parse(input: &str) -> Result<Self> {
parse::app(input)
}
}