Skip to main content

croma_core/syntax/
lyric.rs

1//! Lyric and symbol line surface AST: the token streams produced from `w:`
2//! lyric lines and `s:` symbol lines.
3
4use crate::diagnostic::Span;
5use crate::parse::field::Spanned;
6
7#[derive(Debug, Clone, PartialEq, Eq)]
8pub struct LyricLineSyntax {
9    pub line_index: usize,
10    pub span: Span,
11    pub value: Spanned<String>,
12    pub tokens: Vec<LyricTokenSyntax>,
13}
14
15#[derive(Debug, Clone, PartialEq, Eq)]
16pub struct LyricTokenSyntax {
17    pub span: Span,
18    pub text: String,
19    pub kind: LyricTokenKind,
20}
21
22#[derive(Debug, Clone, Copy, PartialEq, Eq)]
23pub enum LyricTokenKind {
24    Syllable,
25    Hyphen,
26    Extender,
27    Skip,
28    Bar,
29}
30
31#[derive(Debug, Clone, PartialEq, Eq)]
32pub struct SymbolLineSyntax {
33    pub line_index: usize,
34    pub span: Span,
35    pub value: Spanned<String>,
36    pub tokens: Vec<SymbolTokenSyntax>,
37}
38
39#[derive(Debug, Clone, PartialEq, Eq)]
40pub struct SymbolTokenSyntax {
41    pub span: Span,
42    pub text: String,
43    pub kind: SymbolTokenKind,
44}
45
46#[derive(Debug, Clone, Copy, PartialEq, Eq)]
47pub enum SymbolTokenKind {
48    Decoration,
49    ChordSymbol,
50    Annotation,
51    Raw,
52    Skip,
53    Bar,
54}