slang_solidity 1.3.2

A modular set of compiler APIs empowering the next generation of Solidity code analysis and developer tooling. Written in Rust and distributed in multiple languages.
Documentation
{# This needs to stay in sync with the wit-bindgen output #}
/// The lexical context of the scanner.
{% if model.kinds.lexical_contexts|length <= 256 -%} #[repr(u8)] {% else -%} #[repr(u16)] {% endif %}
#[derive(strum_macros::FromRepr, Clone, Copy)]
pub(crate) enum LexicalContext {
    {%- for context_name in model.kinds.lexical_contexts %}
        {{ context_name }},
    {%- endfor %}
}

/// Marker trait for type-level [`LexicalContext`] variants.
pub(crate) trait IsLexicalContext {
    /// Returns a run-time [`LexicalContext`] value.
    fn value() -> LexicalContext;
}

#[allow(non_snake_case)]
pub(crate) mod LexicalContextType {
    {%- for context_name in model.kinds.lexical_contexts %}
        pub struct {{ context_name }};

        impl super::IsLexicalContext for {{ context_name }} {
            fn value() -> super::LexicalContext {
                super::LexicalContext::{{ context_name }}
            }
        }
    {%- endfor %}
}