use std::path::PathBuf;
#[derive(Debug, PartialEq)]
pub enum VimNode {
StandaloneDocComment {
doc: String,
},
Function {
name: String,
args: Vec<String>,
modifiers: Vec<String>,
doc: Option<String>,
},
Command {
name: String,
modifiers: Vec<String>,
doc: Option<String>,
},
Variable {
name: String,
init_value_token: String,
doc: Option<String>,
},
Flag {
name: String,
default_value_token: Option<String>,
doc: Option<String>,
},
}
impl VimNode {
pub fn get_doc(&self) -> Option<&str> {
match self {
VimNode::StandaloneDocComment { doc } => Some(doc.as_str()),
VimNode::Function { doc, .. }
| VimNode::Command { doc, .. }
| VimNode::Variable { doc, .. }
| VimNode::Flag { doc, .. } => doc.as_deref(),
}
}
}
#[derive(Debug, PartialEq)]
pub struct VimModule {
pub path: Option<PathBuf>,
pub doc: Option<String>,
pub nodes: Vec<VimNode>,
}
#[derive(Debug, PartialEq)]
pub struct VimPlugin {
pub content: Vec<VimModule>,
}