lwb_parser/parser/syntax_file/ast/
ast_impls.rs

1#![allow(unused)]
2#![allow(non_snake_case)]
3#![allow(non_camel_case_types)]
4#![allow(clippy::all)]
5// |==========================================================|
6// |      WARNING: THIS FILE IS AUTOMATICALLY GENERATED.      |
7// |      CHANGES TO IT WILL BE DELETED WHEN REGENERATED.     |
8// | IN GENERAL, THIS FILE SHOULD NOT BE MODIFIED IN ANY WAY. |
9// |==========================================================|
10use super::prelude::*;
11impl<M: AstInfo> AstNode<M> for Program<M> {
12    fn ast_info(&self) -> &M {
13        let Self(meta, ..) = self;
14        meta
15    }
16    fn constructor(&self) -> &'static str {
17        "program"
18    }
19    fn sort(&self) -> &'static str {
20        "program"
21    }
22}
23impl<M: AstInfo> AstNode<M> for Layout<M> {
24    fn ast_info(&self) -> &M {
25        match self {
26            Self::Simple(meta, ..) => meta,
27            Self::Comment(meta, ..) => meta,
28            _ => unreachable!(),
29        }
30    }
31    fn constructor(&self) -> &'static str {
32        match self {
33            Self::Simple(..) => "simple",
34            Self::Comment(..) => "comment",
35            _ => unreachable!(),
36        }
37    }
38    fn sort(&self) -> &'static str {
39        "layout"
40    }
41}
42impl<M: AstInfo> AstNode<M> for CharacterClassItem<M> {
43    fn ast_info(&self) -> &M {
44        match self {
45            Self::Range(meta, ..) => meta,
46            Self::SingleChar(meta, ..) => meta,
47            _ => unreachable!(),
48        }
49    }
50    fn constructor(&self) -> &'static str {
51        match self {
52            Self::Range(..) => "range",
53            Self::SingleChar(..) => "single-char",
54            _ => unreachable!(),
55        }
56    }
57    fn sort(&self) -> &'static str {
58        "character-class-item"
59    }
60}
61impl<M: AstInfo> AstNode<M> for String<M> {
62    fn ast_info(&self) -> &M {
63        match self {
64            Self::Single(meta, ..) => meta,
65            Self::Double(meta, ..) => meta,
66            _ => unreachable!(),
67        }
68    }
69    fn constructor(&self) -> &'static str {
70        match self {
71            Self::Single(..) => "single",
72            Self::Double(..) => "double",
73            _ => unreachable!(),
74        }
75    }
76    fn sort(&self) -> &'static str {
77        "string"
78    }
79}
80impl<M: AstInfo> AstNode<M> for CharacterClass<M> {
81    fn ast_info(&self) -> &M {
82        let Self(meta, ..) = self;
83        meta
84    }
85    fn constructor(&self) -> &'static str {
86        "class"
87    }
88    fn sort(&self) -> &'static str {
89        "character-class"
90    }
91}
92impl<M: AstInfo> AstNode<M> for Annotation<M> {
93    fn ast_info(&self) -> &M {
94        match self {
95            Self::Injection(meta, ..) => meta,
96            Self::NoPrettyPrint(meta, ..) => meta,
97            Self::SingleString(meta, ..) => meta,
98            Self::NoLayout(meta, ..) => meta,
99            Self::Hidden(meta, ..) => meta,
100            Self::Error(meta, ..) => meta,
101            Self::PartOf(meta, ..) => meta,
102            _ => unreachable!(),
103        }
104    }
105    fn constructor(&self) -> &'static str {
106        match self {
107            Self::Injection(..) => "injection",
108            Self::NoPrettyPrint(..) => "no-pretty-print",
109            Self::SingleString(..) => "single-string",
110            Self::NoLayout(..) => "no-layout",
111            Self::Hidden(..) => "hidden",
112            Self::Error(..) => "error",
113            Self::PartOf(..) => "part-of",
114            _ => unreachable!(),
115        }
116    }
117    fn sort(&self) -> &'static str {
118        "annotation"
119    }
120}
121impl<M: AstInfo> AstNode<M> for Expression<M> {
122    fn ast_info(&self) -> &M {
123        match self {
124            Self::Star(meta, ..) => meta,
125            Self::Plus(meta, ..) => meta,
126            Self::Maybe(meta, ..) => meta,
127            Self::RepeatExact(meta, ..) => meta,
128            Self::RepeatRange(meta, ..) => meta,
129            Self::RepeatLower(meta, ..) => meta,
130            Self::Delimited(meta, ..) => meta,
131            Self::Literal(meta, ..) => meta,
132            Self::Paren(meta, ..) => meta,
133            Self::Labelled(meta, ..) => meta,
134            Self::Sort(meta, ..) => meta,
135            Self::Class(meta, ..) => meta,
136            _ => unreachable!(),
137        }
138    }
139    fn constructor(&self) -> &'static str {
140        match self {
141            Self::Star(..) => "star",
142            Self::Plus(..) => "plus",
143            Self::Maybe(..) => "maybe",
144            Self::RepeatExact(..) => "repeat-exact",
145            Self::RepeatRange(..) => "repeat-range",
146            Self::RepeatLower(..) => "repeat-lower",
147            Self::Delimited(..) => "delimited",
148            Self::Literal(..) => "literal",
149            Self::Paren(..) => "paren",
150            Self::Labelled(..) => "labelled",
151            Self::Sort(..) => "sort",
152            Self::Class(..) => "class",
153            _ => unreachable!(),
154        }
155    }
156    fn sort(&self) -> &'static str {
157        "expression"
158    }
159}
160impl<M: AstInfo> AstNode<M> for Constructor<M> {
161    fn ast_info(&self) -> &M {
162        match self {
163            Self::ConstructorDocumented(meta, ..) => meta,
164            Self::Constructor(meta, ..) => meta,
165            Self::ConstructorBare(meta, ..) => meta,
166            _ => unreachable!(),
167        }
168    }
169    fn constructor(&self) -> &'static str {
170        match self {
171            Self::ConstructorDocumented(..) => "constructor-documented",
172            Self::Constructor(..) => "constructor",
173            Self::ConstructorBare(..) => "constructor-bare",
174            _ => unreachable!(),
175        }
176    }
177    fn sort(&self) -> &'static str {
178        "constructor"
179    }
180}
181impl<M: AstInfo> AstNode<M> for DocComment<M> {
182    fn ast_info(&self) -> &M {
183        let Self(meta, ..) = self;
184        meta
185    }
186    fn constructor(&self) -> &'static str {
187        "doc-comment"
188    }
189    fn sort(&self) -> &'static str {
190        "doc-comment"
191    }
192}
193impl<M: AstInfo> AstNode<M> for StringChar<M> {
194    fn ast_info(&self) -> &M {
195        match self {
196            Self::Escaped(meta, ..) => meta,
197            Self::Normal(meta, ..) => meta,
198            _ => unreachable!(),
199        }
200    }
201    fn constructor(&self) -> &'static str {
202        match self {
203            Self::Escaped(..) => "escaped",
204            Self::Normal(..) => "normal",
205            _ => unreachable!(),
206        }
207    }
208    fn sort(&self) -> &'static str {
209        "string-char"
210    }
211}
212impl<M: AstInfo> AstNode<M> for Meta<M> {
213    fn ast_info(&self) -> &M {
214        let Self(meta, ..) = self;
215        meta
216    }
217    fn constructor(&self) -> &'static str {
218        "start"
219    }
220    fn sort(&self) -> &'static str {
221        "meta"
222    }
223}
224impl<M: AstInfo> AstNode<M> for Sort<M> {
225    fn ast_info(&self) -> &M {
226        match self {
227            Self::SortDocumented(meta, ..) => meta,
228            Self::Sort(meta, ..) => meta,
229            Self::SortSingle(meta, ..) => meta,
230            _ => unreachable!(),
231        }
232    }
233    fn constructor(&self) -> &'static str {
234        match self {
235            Self::SortDocumented(..) => "sort-documented",
236            Self::Sort(..) => "sort",
237            Self::SortSingle(..) => "sort-single",
238            _ => unreachable!(),
239        }
240    }
241    fn sort(&self) -> &'static str {
242        "sort"
243    }
244}
245impl<M: AstInfo> AstNode<M> for EscapeClosingBracket<M> {
246    fn ast_info(&self) -> &M {
247        match self {
248            Self::Escaped(meta, ..) => meta,
249            Self::Unescaped(meta, ..) => meta,
250            _ => unreachable!(),
251        }
252    }
253    fn constructor(&self) -> &'static str {
254        match self {
255            Self::Escaped(..) => "escaped",
256            Self::Unescaped(..) => "unescaped",
257            _ => unreachable!(),
258        }
259    }
260    fn sort(&self) -> &'static str {
261        "escape-closing-bracket"
262    }
263}
264impl<M: AstInfo> AstNode<M> for Number<M> {
265    fn ast_info(&self) -> &M {
266        let Self(meta, ..) = self;
267        meta
268    }
269    fn constructor(&self) -> &'static str {
270        "number"
271    }
272    fn sort(&self) -> &'static str {
273        "number"
274    }
275}
276impl<M: AstInfo> AstNode<M> for AnnotationList<M> {
277    fn ast_info(&self) -> &M {
278        let Self(meta, ..) = self;
279        meta
280    }
281    fn constructor(&self) -> &'static str {
282        "annotation-list"
283    }
284    fn sort(&self) -> &'static str {
285        "annotation-list"
286    }
287}
288impl<M: AstInfo> AstNode<M> for DelimitedBound<M> {
289    fn ast_info(&self) -> &M {
290        match self {
291            Self::NumNum(meta, ..) => meta,
292            Self::NumInf(meta, ..) => meta,
293            Self::Num(meta, ..) => meta,
294            Self::Star(meta, ..) => meta,
295            Self::Plus(meta, ..) => meta,
296            _ => unreachable!(),
297        }
298    }
299    fn constructor(&self) -> &'static str {
300        match self {
301            Self::NumNum(..) => "num-num",
302            Self::NumInf(..) => "num-inf",
303            Self::Num(..) => "num",
304            Self::Star(..) => "star",
305            Self::Plus(..) => "plus",
306            _ => unreachable!(),
307        }
308    }
309    fn sort(&self) -> &'static str {
310        "delimited-bound"
311    }
312}
313impl<M: AstInfo> AstNode<M> for Identifier<M> {
314    fn ast_info(&self) -> &M {
315        let Self(meta, ..) = self;
316        meta
317    }
318    fn constructor(&self) -> &'static str {
319        "identifier"
320    }
321    fn sort(&self) -> &'static str {
322        "identifier"
323    }
324}
325impl<M: AstInfo> AstNode<M> for SortOrMeta<M> {
326    fn ast_info(&self) -> &M {
327        match self {
328            Self::Meta(meta, ..) => meta,
329            Self::Sort(meta, ..) => meta,
330            _ => unreachable!(),
331        }
332    }
333    fn constructor(&self) -> &'static str {
334        match self {
335            Self::Meta(..) => "meta",
336            Self::Sort(..) => "sort",
337            _ => unreachable!(),
338        }
339    }
340    fn sort(&self) -> &'static str {
341        "sort-or-meta"
342    }
343}