use crate::parse::rules;
use std::hash::Hash;
pub trait Keyword: Hash + Eq + PartialEq + Copy + Clone {
fn from_str(s: &str) -> Self;
fn from_idx(i: usize) -> Option<Self>;
fn to_str(self) -> &'static str;
fn idx(self) -> usize;
fn n_vals() -> usize;
fn unrecognized() -> Self;
fn ann_unrecognized() -> Self;
fn is_annotation(self) -> bool;
fn idx_to_str(i: usize) -> &'static str {
Self::from_idx(i)
.map(|x| x.to_str())
.unwrap_or("<out of range>")
}
fn rule(self) -> rules::TokenFmtBuilder<Self> {
rules::TokenFmtBuilder::new(self)
}
}