Skip to content

Commit

Permalink
lexgen: Support NonZero
Browse files Browse the repository at this point in the history
  • Loading branch information
aDotInTheVoid committed Sep 13, 2023
1 parent dae401b commit c8af836
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lexgen/src/compiller/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ pub(super) enum FieldType {
// U32,
I64,
U64,
NonZeroU64,
Blob,
Any,
Bool,
Expand Down Expand Up @@ -195,11 +196,15 @@ impl FieldType {
None => FieldType::U64,
_ => todo!(),
},
Some(1) => match i.maximum {
None => FieldType::NonZeroU64,
_ => todo!(),
},
None => match i.maximum {
None => FieldType::I64,
_ => todo!(),
},
_ => todo!(),
_ => todo!("{i:?}"),
};

(this, &i.description)
Expand Down Expand Up @@ -271,6 +276,7 @@ impl ToTokens for FieldType {
FieldType::Bool => quote!(bool).to_tokens(tokens),
FieldType::U64 => quote!(u64).to_tokens(tokens),
FieldType::I64 => quote!(i64).to_tokens(tokens),
FieldType::NonZeroU64 => quote!(::std::num::NonZeroU64).to_tokens(tokens),

FieldType::Vec(inner) => {
let inner = inner.to_token_stream();
Expand Down

0 comments on commit c8af836

Please sign in to comment.