litex/parse/by_stmt/
mod.rs1use crate::prelude::*;
3
4mod cases_by_stmt;
5mod closed_range_by_stmt;
6mod contra_by_stmt;
7mod enumerate_by_stmt;
8mod extension_by_stmt;
9mod family_by_stmt;
10mod fn_tuple_by_stmt;
11mod for_by_stmt;
12mod induc_by_stmt;
13
14impl Runtime {
15 pub fn parse_by_prefixed_stmt(&mut self, tb: &mut TokenBlock) -> Result<Stmt, RuntimeError> {
16 tb.skip_token(BY)?;
17 let second_keyword = tb.current()?;
18 match second_keyword {
19 CASES => self.parse_by_cases_stmt(tb),
20 CONTRA => self.parse_by_contra_stmt(tb),
21 ENUMERATE => self.parse_by_enumerate_stmt(tb),
22 INDUC => self.parse_by_induc_stmt(tb),
23 FOR => self.parse_by_for_stmt(tb),
24 EXTENSION => self.parse_by_extension_stmt(tb),
25 FN_LOWER_CASE => self.parse_by_fn_stmt(tb),
26 FAMILY => self.parse_by_family_stmt(tb),
27 TUPLE => self.parse_by_tuple_stmt(tb),
28 _ => Err(RuntimeError::from(ParseRuntimeError(RuntimeErrorStruct::new_with_msg_and_line_file(format!(
29 "by: expected cases, contra, enumerate (finite_set or range), induc, for, extension, fn, fn set, family, or tuple after `by`, got `{}`",
30 second_keyword
31 ), tb.line_file.clone())))),
32 }
33 }
34}