use serde::{Deserialize, Serialize};
pub mod aborts;
pub mod check;
pub mod decimal;
pub mod diagnostics;
pub mod emit_common;
pub mod emit_javascript;
pub mod emit_lean;
pub mod emit_rocq;
pub mod emit_rust;
mod frontend_rules;
pub mod ir;
pub mod javascript;
pub mod js_number;
pub mod lean;
pub mod lean_root_names;
pub mod lexer;
pub mod output;
pub mod proof;
pub mod rocq;
pub mod rust;
pub mod surface;
pub mod types;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct Span {
pub start: usize,
pub end: usize,
}
impl Span {
#[must_use]
pub const fn new(start: usize, end: usize) -> Self {
Self { start, end }
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Language {
JavaScript,
Rust,
Lean,
Rocq,
}
impl Language {
pub const ALL: [Self; 4] = [Self::JavaScript, Self::Rust, Self::Lean, Self::Rocq];
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Self::JavaScript => "JavaScript",
Self::Rust => "Rust",
Self::Lean => "Lean",
Self::Rocq => "Rocq",
}
}
#[must_use]
pub fn parse(name: &str) -> Option<Self> {
Self::ALL
.into_iter()
.find(|language| language.as_str() == name)
}
}