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