litex/parse/
parse_stmt.rs1use crate::prelude::*;
2
3impl Runtime {
4 pub fn parse_stmt(&mut self, tb: &mut TokenBlock) -> Result<Stmt, RuntimeError> {
5 match tb.current()? {
6 PROP => self.parse_def_prop_stmt(tb),
7 ABSTRACT_PROP => self.parse_def_abstract_prop_stmt(tb),
8 LET => self.parse_def_let_stmt(tb),
9 HAVE => {
10 if tb.token_at_index(1)? == FN_LOWER_CASE {
11 self.parse_have_fn_stmt(tb)
12 } else if tb.token_at_index(1)? == BY && tb.token_at_index(2)? == EXIST {
13 self.parse_have_exist(tb)
14 } else {
15 self.parse_have_obj_stmt(tb)
16 }
17 }
18 KNOW => self.parse_know_stmt(tb),
19 CLEAR => self.parse_clear_stmt(tb),
20 CLAIM => self.parse_claim_stmt(tb),
21 PROVE => self.parse_prove_stmt(tb),
22 IMPORT => self.parse_import_stmt(tb),
23 DO_NOTHING => self.parse_do_nothing_stmt(tb),
24 DOT_DOT_DOT => self.parse_do_nothing_stmt(tb),
25 RUN_FILE => self.parse_run_file_stmt(tb),
26 EVAL => self.parse_eval_stmt(tb),
27 WITNESS => self.parse_witness_stmt(tb),
28 FAMILY => self.parse_def_family_stmt(tb),
29 STRUCT => self.parse_def_struct_stmt(tb),
30 ALGO => self.parse_def_algorithm_stmt(tb),
31 STRONG_INDUC => self.parse_strong_induc_stmt(tb),
32 BY => self.parse_by_prefixed_stmt(tb),
33 _ => {
34 let fact = self.parse_fact(tb)?;
35 Ok(fact.into())
36 }
37 }
38 }
39}