use super::*;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SceneActorItem {
pub name: String,
pub number: u32,
pub span: Span,
}
#[derive(Debug, Clone)]
pub struct GlobalSceneScope {
pub name: String,
pub is_continuation: bool,
pub attrs: Vec<Attr>,
pub words: Vec<KeyWords>,
pub actors: Vec<SceneActorItem>,
pub code_blocks: Vec<CodeBlock>,
pub local_scenes: Vec<LocalSceneScope>,
pub span: Span,
}
impl GlobalSceneScope {
pub fn new(name: String) -> Self {
Self {
name,
is_continuation: false,
attrs: Vec::new(),
words: Vec::new(),
actors: Vec::new(),
code_blocks: Vec::new(),
local_scenes: Vec::new(),
span: Span::default(),
}
}
pub fn continuation(name: String) -> Self {
Self {
name,
is_continuation: true,
attrs: Vec::new(),
words: Vec::new(),
actors: Vec::new(),
code_blocks: Vec::new(),
local_scenes: Vec::new(),
span: Span::default(),
}
}
pub fn has_cue_commands(&self) -> bool {
self.local_scenes.iter().any(|ls| ls.has_cue_commands())
}
}
#[derive(Debug, Clone)]
pub struct LocalSceneScope {
pub name: Option<String>,
pub attrs: Vec<Attr>,
pub items: Vec<LocalSceneItem>,
pub code_blocks: Vec<CodeBlock>,
pub span: Span,
}
impl LocalSceneScope {
pub fn start() -> Self {
Self {
name: None,
attrs: Vec::new(),
items: Vec::new(),
code_blocks: Vec::new(),
span: Span::default(),
}
}
pub fn named(name: String) -> Self {
Self {
name: Some(name),
attrs: Vec::new(),
items: Vec::new(),
code_blocks: Vec::new(),
span: Span::default(),
}
}
pub fn has_cue_commands(&self) -> bool {
self.items
.iter()
.any(|item| matches!(item, LocalSceneItem::CueCommand(_)))
}
}
#[derive(Debug, Clone)]
pub enum LocalSceneItem {
VarSet(VarSet),
CallScene(CallScene),
ActionLine(ActionLine),
ContinueAction(ContinueAction),
CueCommand(CueCommandNode),
Choice(ChoiceNode),
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ChoiceNode {
pub target: String,
pub label: Option<String>,
pub span: Span,
}
#[derive(Debug, Clone)]
pub struct ActionLine {
pub actor: String,
pub actions: Vec<Action>,
pub span: Span,
}
#[derive(Debug, Clone)]
pub struct ContinueAction {
pub actions: Vec<Action>,
pub span: Span,
}