mirror of
https://github.com/Noratrieb/haesli.git
synced 2026-01-14 19:55:03 +01:00
more renaming
This commit is contained in:
parent
7ce8f8058d
commit
186f744715
9 changed files with 213 additions and 341 deletions
|
|
@ -21,7 +21,7 @@ pub(super) fn codegen_parser(amqp: &Amqp) {
|
|||
println!(
|
||||
"pub mod parse {{
|
||||
use super::*;
|
||||
use crate::classes::parse_helper::*;
|
||||
use crate::methods::parse_helper::*;
|
||||
use crate::error::TransError;
|
||||
use nom::{{branch::alt, bytes::complete::tag}};
|
||||
use regex::Regex;
|
||||
|
|
@ -108,9 +108,8 @@ fn method_parser(amqp: &Amqp, class: &Class, method: &Method) {
|
|||
let fields_with_bit = subsequent_bit_fields(amqp, field, &mut iter);
|
||||
|
||||
let amount = fields_with_bit.len();
|
||||
// todo: remove those map_err(failure)
|
||||
println!(
|
||||
r#" let (input, bits) = bit(input, {amount}).map_err(fail_err("field {field_name_raw} in method {method_name_raw}")).map_err(failure)?;"#
|
||||
r#" let (input, bits) = bit(input, {amount}).map_err(fail_err("field {field_name_raw} in method {method_name_raw}"))?;"#
|
||||
);
|
||||
|
||||
for (i, field) in fields_with_bit.iter().enumerate() {
|
||||
|
|
@ -121,7 +120,7 @@ fn method_parser(amqp: &Amqp, class: &Class, method: &Method) {
|
|||
let fn_name = domain_function_name(field_type(field));
|
||||
let field_name = snake_case(&field.name);
|
||||
println!(
|
||||
r#" let (input, {field_name}) = {fn_name}(input).map_err(fail_err("field {field_name_raw} in method {method_name_raw}")).map_err(failure)?;"#
|
||||
r#" let (input, {field_name}) = {fn_name}(input).map_err(fail_err("field {field_name_raw} in method {method_name_raw}"))?;"#
|
||||
);
|
||||
|
||||
for assert in &field.asserts {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ pub(super) fn codegen_random(amqp: &Amqp) {
|
|||
"#[cfg(test)]
|
||||
mod random {{
|
||||
use rand::Rng;
|
||||
use crate::classes::tests::RandomMethod;
|
||||
use crate::methods::tests::RandomMethod;
|
||||
use super::*;
|
||||
"
|
||||
);
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ pub(super) fn codegen_write(amqp: &Amqp) {
|
|||
println!(
|
||||
"pub mod write {{
|
||||
use super::*;
|
||||
use crate::classes::write_helper::*;
|
||||
use crate::methods::write_helper::*;
|
||||
use crate::error::TransError;
|
||||
use std::io::Write;
|
||||
|
||||
pub fn write_method<W: Write>(class: Method, mut writer: W) -> Result<(), TransError> {{
|
||||
match class {{"
|
||||
pub fn write_method<W: Write>(method: Method, mut writer: W) -> Result<(), TransError> {{
|
||||
match method {{"
|
||||
);
|
||||
|
||||
for class in &amqp.classes {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ fn main() {
|
|||
fn help() {
|
||||
println!(
|
||||
"Available tasks:
|
||||
generate - Generate amqp method code in `amqp_transport/src/classes/generated.rs.
|
||||
generate - Generate amqp method code in `amqp_transport/src/methods/generated.rs.
|
||||
Dumps code to stdout and should be redirected manually."
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue