Skip to content

Commit 7e0fbc2

Browse files
committed
lang: mv to a dedicated file
1 parent fb8d807 commit 7e0fbc2

2 files changed

Lines changed: 24 additions & 19 deletions

File tree

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{collections::BTreeMap, fmt};
1+
use std::fmt;
22

33
use p3_field::PrimeCharacteristicRing;
44

@@ -7,10 +7,7 @@ use crate::{
77
intermediate_bytecode::HighLevelOperation,
88
};
99

10-
#[derive(Debug, Clone)]
11-
pub struct Program {
12-
pub functions: BTreeMap<String, Function>,
13-
}
10+
pub mod program;
1411

1512
#[derive(Debug, Clone)]
1613
pub struct Function {
@@ -525,20 +522,6 @@ impl fmt::Display for Line {
525522
}
526523
}
527524

528-
impl fmt::Display for Program {
529-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
530-
let program_str = self
531-
.functions
532-
.values()
533-
.map(ToString::to_string)
534-
.collect::<Vec<_>>()
535-
.join("\n\n");
536-
537-
// Write the final, joined string to the formatter.
538-
write!(f, "{program_str}")
539-
}
540-
}
541-
542525
impl fmt::Display for Function {
543526
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
544527
let args_str = self

‎crates/leanVm/src/lang/program.rs‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use std::{collections::BTreeMap, fmt};
2+
3+
use crate::lang::Function;
4+
5+
#[derive(Debug, Clone)]
6+
pub struct Program {
7+
pub functions: BTreeMap<String, Function>,
8+
}
9+
10+
impl fmt::Display for Program {
11+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
12+
let program_str = self
13+
.functions
14+
.values()
15+
.map(ToString::to_string)
16+
.collect::<Vec<_>>()
17+
.join("\n\n");
18+
19+
// Write the final, joined string to the formatter.
20+
write!(f, "{program_str}")
21+
}
22+
}

0 commit comments

Comments
 (0)