mirror of
https://github.com/Noratrieb/haesli.git
synced 2026-01-14 19:55:03 +01:00
write completed (hopoefully)
This commit is contained in:
parent
427cfadc11
commit
2aeb588ab3
5 changed files with 117 additions and 113 deletions
|
|
@ -5,6 +5,7 @@ use crate::parser::codegen_parser;
|
|||
use crate::write::codegen_write;
|
||||
use heck::ToUpperCamelCase;
|
||||
use std::fs;
|
||||
use std::iter::Peekable;
|
||||
use strong_xml::XmlRead;
|
||||
|
||||
#[derive(Debug, XmlRead)]
|
||||
|
|
@ -191,6 +192,27 @@ fn snake_case(ident: &str) -> String {
|
|||
}
|
||||
}
|
||||
|
||||
fn subsequent_bit_fields<'a>(
|
||||
amqp: &Amqp,
|
||||
bit_field: &'a Field,
|
||||
iter: &mut Peekable<impl Iterator<Item = &'a Field>>,
|
||||
) -> Vec<&'a Field> {
|
||||
let mut fields_with_bit = vec![bit_field];
|
||||
|
||||
loop {
|
||||
if iter
|
||||
.peek()
|
||||
.map(|f| resolve_type_from_domain(amqp, field_type(f)) == "bit")
|
||||
.unwrap_or(false)
|
||||
{
|
||||
fields_with_bit.push(iter.next().unwrap());
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
fields_with_bit
|
||||
}
|
||||
|
||||
fn invariants<'a>(asserts: impl Iterator<Item = &'a Assert>) -> String {
|
||||
asserts
|
||||
.map(|assert| match &*assert.check {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue