1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
//! AST type definitions for parser2 based on pasta2.pest grammar.
//!
//! This module defines all AST types corresponding to the grammar rules
//! defined in grammar.pest. The types follow a 3-layer scope hierarchy:
//! FileScope ⊃ GlobalSceneScope ⊃ LocalSceneScope.
//!
//! # Differences from pasta.pest
//!
//! - `ContinueAction`: Continuation lines now explicitly start with `:` or `:`
//! (pasta2.pest specification change from pasta.pest)
pub use *;
pub use *;
pub use *;
pub use *;
use PathBuf;
// ============================================================================
// FileItem - File-Level Item
// ============================================================================
/// ファイルレベルで出現するアイテムの統一表現
///
/// grammar.pest の `file = ( file_scope | global_scene_scope | actor_scope )*` に対応。
/// file_scope 内の attrs と words は個別のバリアントとして分離。
///
/// # grammar.pest 対応関係
///
/// - `FileAttr`: file_scope 内の attr(ファイルレベル属性)
/// - `GlobalWord`: file_scope 内の key_words(ファイルレベル単語定義)
/// - `GlobalSceneScope`: global_scene_scope(グローバルシーン)
/// - `ActorScope`: actor_scope(アクター定義)
///
/// # 使用例
///
/// ```ignore
/// for item in &file.items {
/// match item {
/// FileItem::FileAttr(attr) => { /* 属性処理 */ }
/// FileItem::GlobalWord(word) => { /* 単語定義処理 */ }
/// FileItem::GlobalSceneScope(scene) => { /* シーン処理 */ }
/// FileItem::ActorScope(actor) => { /* アクター処理 */ }
/// }
/// }
/// ```
// ============================================================================
// Top-Level AST: PastaFile
// ============================================================================
/// Complete AST representation of a Pasta file.
///
/// grammar.pest `file = ( file_scope | global_scene_scope )*` に完全準拠。
/// ファイル内の全アイテムを記述順序で保持します。
///
/// # 使用例
///
/// ```ignore
/// // 順序保持アクセス(transpiler向け - 推奨)
/// for item in &file.items {
/// match item {
/// FileItem::FileAttr(attr) => { /* 属性処理 */ }
/// FileItem::GlobalWord(word) => { /* 単語定義処理 */ }
/// FileItem::GlobalSceneScope(scene) => { /* シーン処理 */ }
/// FileItem::ActorScope(actor) => { /* アクター処理 */ }
/// }
/// }
/// ```
// ============================================================================
// ActorScope - Actor Definition Scope
// ============================================================================
/// アクター定義スコープ
///
/// grammar.pest の `actor_scope = { actor_line ~ actor_scope_item* }` に対応。
/// アクター(キャラクター)の名前とその属性・単語定義・変数設定を保持します。
///
/// # 例
///
/// ```pasta
/// %さくら
/// @通常 :\s[0]
/// @照れ :\s[1]
/// $デフォルト表情=0
/// ```
// ============================================================================
// FileScope - File-Level Scope
// ============================================================================
/// File-level scope containing attributes and word definitions.
///
/// Corresponds to the `file_scope` rule in grammar.pest.