conch_parser/ast/builder/
empty_builder.rs1use ast::{AndOr, RedirectOrCmdWord, RedirectOrEnvVar};
2use ast::builder::*;
3use void::Void;
4
5#[derive(Debug, Copy, Clone)]
10pub struct EmptyBuilder;
11
12impl Default for EmptyBuilder {
13 fn default() -> Self {
14 EmptyBuilder::new()
15 }
16}
17
18impl EmptyBuilder {
19 pub fn new() -> Self {
21 EmptyBuilder
22 }
23}
24
25impl Builder for EmptyBuilder {
26 type Command = ();
27 type CommandList = ();
28 type ListableCommand = ();
29 type PipeableCommand = ();
30 type CompoundCommand = ();
31 type Word = ();
32 type Redirect = ();
33 type Error = Void;
34
35 fn complete_command(&mut self,
36 _pre_cmd_comments: Vec<Newline>,
37 _cmd: Self::Command,
38 _separator: SeparatorKind,
39 _cmd_comment: Option<Newline>)
40 -> Result<Self::Command, Self::Error>
41 {
42 Ok(())
43 }
44
45 fn and_or_list(&mut self,
46 _first: Self::ListableCommand,
47 _rest: Vec<(Vec<Newline>, AndOr<Self::ListableCommand>)>)
48 -> Result<Self::CommandList, Self::Error>
49 {
50 Ok(())
51 }
52
53 fn pipeline(&mut self,
54 _bang: bool,
55 _cmds: Vec<(Vec<Newline>, Self::Command)>)
56 -> Result<Self::Command, Self::Error>
57 {
58 Ok(())
59 }
60
61 fn simple_command(
62 &mut self,
63 _redirects_or_env_vars: Vec<RedirectOrEnvVar<Self::Redirect, String, Self::Word>>,
64 _redirects_or_cmd_words: Vec<RedirectOrCmdWord<Self::Redirect, Self::Word>>
65 ) -> Result<Self::PipeableCommand, Self::Error>
66 {
67 Ok(())
68 }
69
70 fn brace_group(&mut self,
71 _cmds: CommandGroup<Self::Command>,
72 _redirects: Vec<Self::Redirect>)
73 -> Result<Self::Command, Self::Error>
74 {
75 Ok(())
76 }
77
78 fn subshell(&mut self,
79 _cmds: CommandGroup<Self::Command>,
80 _redirects: Vec<Self::Redirect>)
81 -> Result<Self::Command, Self::Error>
82 {
83 Ok(())
84 }
85
86 fn loop_command(&mut self,
87 __kind: LoopKind,
88 __guard_body_pair: GuardBodyPairGroup<Self::Command>,
89 __redirects: Vec<Self::Redirect>)
90 -> Result<Self::CompoundCommand, Self::Error>
91 {
92 Ok(())
93 }
94
95 fn if_command(&mut self,
96 _fragments: IfFragments<Self::Command>,
97 _redirects: Vec<Self::Redirect>)
98 -> Result<Self::Command, Self::Error>
99 {
100 Ok(())
101 }
102
103 fn for_command(&mut self,
104 _fragments: ForFragments<Self::Word, Self::Command>,
105 _redirects: Vec<Self::Redirect>)
106 -> Result<Self::Command, Self::Error>
107 {
108 Ok(())
109 }
110
111 fn case_command(&mut self,
112 _fragments: CaseFragments<Self::Word, Self::Command>,
113 _redirects: Vec<Self::Redirect>)
114 -> Result<Self::Command, Self::Error>
115 {
116 Ok(())
117 }
118
119 fn function_declaration(&mut self,
120 _name: String,
121 _post_name_comments: Vec<Newline>,
122 _body: Self::CompoundCommand)
123 -> Result<Self::Command, Self::Error>
124 {
125 Ok(())
126 }
127
128 fn comments(&mut self,
129 _comments: Vec<Newline>)
130 -> Result<(), Self::Error>
131 {
132 Ok(())
133 }
134
135 fn word(&mut self,
136 _kind: ComplexWordKind<Self::Command>)
137 -> Result<Self::Word, Self::Error>
138 {
139 Ok(())
140 }
141
142 fn redirect(&mut self,
143 _kind: RedirectKind<Self::Word>)
144 -> Result<Self::Redirect, Self::Error>
145 {
146 Ok(())
147 }
148
149 fn compound_command_into_pipeable(&mut self,
150 _cmd: Self::CompoundCommand)
151 -> Result<Self::PipeableCommand, Self::Error>
152 {
153 Ok(())
154 }
155}