diff --git a/src/directive.rs b/src/directive.rs index f240197..31d955b 100644 --- a/src/directive.rs +++ b/src/directive.rs @@ -9,13 +9,13 @@ pub struct Directive { /// Fixed prefix term. prefix: String, /// The type of the prefix argument, if there is one. - prefix_arg: Option, + prefix_arg: Option, /// Fixed infix term. /// Can only be present if the prefix argument exists. infix: Option, /// The type of the infix argument. /// Can only be present if the infix term exists. - infix_arg: Option, + infix_arg: Option, /// Fixed suffix term. /// Can only be present if the infix argument exists. /// Note that this implies directives which have two terms have a prefix @@ -23,37 +23,21 @@ pub struct Directive { suffix: Option, /// The type of the suffix argument. /// Can only be present if the suffix exists. - suffix_arg: Option, + suffix_arg: Option, /// The type of the elements of the list argument, if supported. - list_arg: Option, + list_arg: Option, // TODO(zeph): macro expansion? } -/// Directive parameter type. -pub enum Type { - Named { - name: String, - doc: String, - underlying: Param, - }, - Literal(Param), -} - -impl Type { - pub fn underlying(&self) -> &Param { - match self { - Self::Named { - underlying, - name: _, - doc: _, - } => underlying, - Self::Literal(underlying) => underlying, - } - } +/// Directive parameter. +pub struct Param { + name: String, + doc: String, + typ: Type, } /// Types expected by directive arguments. -pub enum Param { +pub enum Type { /// Arbitrary text. Text, /// Speech text, possibly containing emphasis, shout, or whisper markers. @@ -72,10 +56,4 @@ pub enum Param { mod tests { use super::*; use rstest::rstest; - - const DIRECTIVE_JSON: &str = r#"{ - "name": "kessoku", - "prefix": "bocchi", - "prefix_arg": - }"#; }