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§

Ast
CCMacroError
CWidth
For concatenation widths
CodeGen
Note: the type must be unambiguous for the construction functions
Component
Concatenation
FnNames
Lower
Names
Prefixes used for codegen names and functions. Most of these should be prefixed with two underscores and the crate name to prevent collisions.
PBind
PCWidth
PText
PVal
PWidth
Usb
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.
Usbr

Enums§

Bind
ComponentType
Delimiter
FillerAlign
Text
Value
Width
Bitwidth as described by a single value or one value minus another

Constants§

AWINT_FN_NAMES
AWINT_NAMES
Default names for awint

Functions§

awi_construction_fn
awi_s
awint_awi_lit_construction_fn
awint_bits_const_wrapper
awint_bits_lit_construction_fn
awint_extawi_lit_construction_fn
awint_inlawi_lit_construction_fn
awint_macro_awi
awint_macro_bits
awint_macro_cc
awint_macro_extawi
awint_macro_inlawi
awint_must_use
awint_static_construction_fn
awint_unreachable_construction_fn
cc_construction_fn
cc_macro
Input parsing and code generation function for corresponding concatenations of components macros.
cc_macro_code_gen
Lowering of the parsed structs into Rust code.
chars_to_string
color_text
Wrap s in ANSI delimiters for terminal colors. {90..=97} => {grey, red, green, yellow, blue, purple, cyan, white}
error_and_help
extawi_construction_fn
extawi_s
i128_to_nonzerousize
i128_to_usize
i128_try_parse
Tries parsing as hexadecimal, octal, binary, and decimal
identity_const_wrapper
inlawi_construction_fn
inlawi_s
parse_range
Tries to parse raw input as a range.
parse_usb
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 the Usb and Usbr chain to get calculated into a static width.
stage1
Looks for the existence of a top level “[]” delimited group and uses the last one as a bit range.
stage2
stage3
stage4
stage5
token_stream_to_ast
Parses input TokenStream into “raw” concatenations of components in Vec<char> strings
unstable_native_bits
unstable_native_inlawi
Returns architecture-independent Rust code that returns an InlAwi preset with the value of bits.
unstable_native_inlawi_ty
Returns architecture-independent Rust code that returns an InlAwi type with bitwidth w.
usize_to_i128