derive Clone for grammars
This commit is contained in:
parent
3beb298a6d
commit
f99f22f477
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "purrchance"
|
||||
version = "0.3.0"
|
||||
version = "0.4.0"
|
||||
authors = ["xenofem <xenofem@xeno.science>"]
|
||||
description = "An unofficial Rust implementation of the Perchance grammar engine"
|
||||
repository = "https://git.xeno.science/xenofem/purrchance"
|
||||
|
|
|
@ -10,7 +10,7 @@ pub trait Purrchance {
|
|||
fn eval(&self, g: &Grammar) -> Option<String>;
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Symbol {
|
||||
Terminal(String),
|
||||
NonTerminal(String),
|
||||
|
@ -25,7 +25,7 @@ impl Purrchance for Symbol {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Expr(Vec<Symbol>);
|
||||
|
||||
impl Purrchance for Expr {
|
||||
|
@ -34,7 +34,7 @@ impl Purrchance for Expr {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct List(Vec<(Expr, f64)>);
|
||||
|
||||
impl Purrchance for List {
|
||||
|
@ -43,7 +43,7 @@ impl Purrchance for List {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Grammar(HashMap<String,List>);
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Reference in a new issue