ejrgilbert / whamm

5 stars 2 forks source link

Make managing provided functionality less cumbersome #19

Open ejrgilbert opened 1 month ago

ejrgilbert commented 1 month ago

Currently, everything is just stored as Strings that you have to manage in the src/parser/types.rs file. Rather, there should be some combination of structs/enums that can be documented/referenced like in the CLI clap specification.

This will make things cleaner and easier-to-manage.

ejrgilbert commented 1 month ago

I was thinking something like the following might work?

enum ProviderInfo {
    /// TODO -- documentation for Begin
    Begin,
    /// TODO -- documentation for End
    End,
    /// TODO -- documentation for Wasm
    Wasm {
        packages: WasmPackageInfo
    }
}
impl ProviderInfo {
    fn get_packages(provider: &ProviderInfo) -> Option<&dyn PackageInfo>{
        match provider {
            Self::Begin | Self::End => None,
            Self::Wasm {packages} => Some(packages)
        }
    }
}

trait PackageInfo {}

enum WasmPackageInfo {
    Bytecode
}
impl PackageInfo for WasmPackageInfo {}

enum WasmBytecodeEvents {
    /// TODO -- documentation for Call
    Call,
    /// TODO -- documentation for BrIf
    BrIf,
    /// TODO -- documentation for BrTable
    BrTable
    // ...continue here
}