add include header in morphism-base

This commit is contained in:
Michael Sippel 2025-03-15 18:28:57 +01:00
parent 5993923338
commit 5a64334b1d
Signed by: senvas
GPG key ID: F96CF119C34B64A6
4 changed files with 25 additions and 4 deletions

View file

@ -1,3 +1,6 @@
```
```
morph_digit_as_char_to_uint8 (Radix:)
<Digit Radix> ~ Char ~ Ascii ~ x86.UInt8
--> <Digit Radix> ~ x86.UInt8

View file

@ -1,3 +1,7 @@
```
#include <array/length-prefix.h>
```
morph_array_as_valterm_to_lenpfx (Terminator:x86.UInt8)
<Seq~<ValueTerminated Terminator> x86.UInt8>
--> <Seq~<LengthPrefix x86.UInt64> x86.UInt8>

View file

@ -1,3 +1,6 @@
```
#include <array/length-prefix.h>
```
morph_nat_as_u64_to_pos ()

View file

@ -335,10 +335,19 @@ impl Morphism for LdmcMorphism {
*/
fn parser(
type_dict: Arc<RwLock< BimapTypeDict >>
) -> impl Parser<char, Vec<LdmcPrimCMorphism>, Error = Simple<char>> {
) -> impl Parser<char, (String, Vec<LdmcPrimCMorphism>), Error = Simple<char>> {
just("```")
.then(take_until(just("```")))
.map(
move |(a, (b, c))| {
b.iter().collect()
}
)
// morph name
ident().padded()
.then(
ident().padded()
// type args
.then(
@ -383,6 +392,8 @@ fn parser(
}
})
.separated_by(text::newline())
)
}
fn main() {
@ -401,8 +412,9 @@ fn main() {
let src = std::fs::read_to_string(mb_path.clone()).expect("read");
let result = parser(type_dict.clone()).parse(src.clone());
match result {
Ok(morphisms) => {
Ok((includes, morphisms)) => {
eprintln!("[{}] parse ok.", mb_path.bright_yellow());
println!("{}", includes);
for m in morphisms {
morphism_base.add_morphism(LdmcMorphism::Primitive(m));
}
@ -444,7 +456,6 @@ fn main() {
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <array/length-prefix.h>
"#);
let mut existing_instantiations = Vec::new();