Crate awint_macro_internals
source ·Expand description
This crate exists because of limitations with proc-macro
crates. We need
to be able to test errors returned from the code generation function while
also being able to test the macros themselves. This might also be reused by
people who have new storage types.
This is also available as a hidden reexport from the main awint
crate if
the “std” feature is enabled
Re-exports§
pub use awint_ext;
pub use awint_ext::awint_core;
pub use triple_arena;
Structs§
- For concatenation widths
- Note: the type must be unambiguous for the construction functions
- Prefixes used for codegen names and functions. Most of these should be prefixed with two underscores and the crate name to prevent collisions.
- Usize and/or String Bound. If
s.is_empty()
, then there is no arbitrary string in the bound and the base value is 0.x
is added on to the value.
Enums§
- Bitwidth as described by a single value or one value minus another
Constants§
- Default names for
awint
Functions§
- Input parsing and code generation function for corresponding concatenations of components macros.
- Lowering of the parsed structs into Rust code.
- Wrap
s
in ANSI delimiters for terminal colors. {90..=97} => {grey, red, green, yellow, blue, purple, cyan, white} - Tries parsing as hexadecimal, octal, binary, and decimal
- Tries to parse raw
input
as a range. Looks for the existence of top level “..” or “..=” punctuation. Ifallow_single_bit_range
is set, will return a single bit range if “..” or “..=” does not exist. - In ranges we commonly see stuff like
(x + y)
or(x - y)
with one of them being a constant we can parse, which passes upward theUsb
andUsbr
chain to get calculated into a static width. - Looks for the existence of a top level “[]” delimited group and uses the last one as a bit range.
- Parses
input
TokenStream
into “raw” concatenations of components inVec<char>
strings - Returns architecture-independent Rust code that returns an
InlAwi
preset with the value ofbits
. - Returns architecture-independent Rust code that returns an
InlAwi
type with bitwidthw
.