matthewdown/blocks/
block_command.rs

1use super::*;
2
3use std::sync::Arc;
4
5pub struct Parser
6{
7    command_map: Arc<command::Map<command::Block>>
8}
9
10impl Parser
11{
12    pub(crate) fn new(command_map: Arc<command::Map<command::Block>>) -> Self
13    {
14        Self { command_map }
15    }
16}
17
18impl parser::Block for Parser
19{
20    fn create<'a>(&self, tok_iter: &mut grammar::TokenIter<'a>)
21        -> Result<Box<dyn walker::Block + 'a>>
22    {
23        self.command_map.build(command::parse(tok_iter)?)
24    }
25
26    fn rule(&self) -> grammar::Rule { grammar::Rule::block_command }
27}