aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/docs/de/doc/advanced/macro.md56
-rw-r--r--doc/docs/doc/advanced/macro.md56
-rw-r--r--doc/docs/id-id/doc/advanced/macro.md56
-rw-r--r--doc/docs/pt-br/doc/advanced/macro.md56
-rw-r--r--doc/docs/zh/doc/advanced/macro.md56
-rw-r--r--doc/yue-de.md27
-rw-r--r--doc/yue-en.md27
-rw-r--r--doc/yue-id-id.md27
-rw-r--r--doc/yue-pt-br.md27
-rw-r--r--doc/yue-zh.md27
10 files changed, 415 insertions, 0 deletions
diff --git a/doc/docs/de/doc/advanced/macro.md b/doc/docs/de/doc/advanced/macro.md
index a030aea..d0760b5 100644
--- a/doc/docs/de/doc/advanced/macro.md
+++ b/doc/docs/de/doc/advanced/macro.md
@@ -229,6 +229,62 @@ print "Gültiger Enum-Typ:", $BodyType Static
229 229
230</YueDisplay> 230</YueDisplay>
231 231
232## Mehrzeiligen Yue-Code erzeugen
233
234Wenn ein Makro mehrzeiligen Yue-Code zurückgibt, ist eine mehrzeilige Zeichenkette in Anführungszeichen nicht zu empfehlen. Verwende stattdessen bevorzugt `-> |`.
235
236Eine Zeichenkette in Anführungszeichen behält den Text wörtlich bei, während ein YAML-Mehrzeilen-String die gemeinsame führende Einrückung entfernt. Dadurch bleiben erzeugte Yue-Blöcke in der Regel stabiler, besonders wenn der erzeugte Code Kommentare oder verschachtelte Blöcke enthält.
237
238```yuescript
239macro default_conf = (conf) -> "
240 -- useful; only set once
241#{conf}.identity = 'LOVE'
242#{conf}.version = \"11.5\"
243 "
244
245love.conf = (t) ->
246 $default_conf t
247```
248
249<YueDisplay>
250
251```yue
252macro default_conf = (conf) -> "
253 -- useful; only set once
254#{conf}.identity = 'LOVE'
255#{conf}.version = \"11.5\"
256 "
257
258love.conf = (t) ->
259 $default_conf t
260```
261
262</YueDisplay>
263
264```yuescript
265macro default_conf = (conf) -> |
266 -- useful; only set once
267 #{conf}.identity = 'LOVE'
268 #{conf}.version = "11.5"
269
270love.conf = (t) ->
271 $default_conf t
272```
273
274<YueDisplay>
275
276```yue
277macro default_conf = (conf) -> |
278 -- useful; only set once
279 #{conf}.identity = 'LOVE'
280 #{conf}.version = "11.5"
281
282love.conf = (t) ->
283 $default_conf t
284```
285
286</YueDisplay>
287
232## Argument-Validierung 288## Argument-Validierung
233 289
234Du kannst erwartete AST-Knotentypen in der Argumentliste deklarieren und zur Compile-Zeit prüfen, ob die übergebenen Makroargumente den Erwartungen entsprechen. 290Du kannst erwartete AST-Knotentypen in der Argumentliste deklarieren und zur Compile-Zeit prüfen, ob die übergebenen Makroargumente den Erwartungen entsprechen.
diff --git a/doc/docs/doc/advanced/macro.md b/doc/docs/doc/advanced/macro.md
index c057f40..935017e 100644
--- a/doc/docs/doc/advanced/macro.md
+++ b/doc/docs/doc/advanced/macro.md
@@ -229,6 +229,62 @@ print "Valid enum type:", $BodyType Static
229 229
230</YueDisplay> 230</YueDisplay>
231 231
232## Generating Multi-line Yue Code
233
234When a macro returns multi-line Yue code, using a quoted multi-line string is not recommended. Prefer `-> |` instead.
235
236A quoted string keeps the literal text as-is, while a YAML multiline string removes the common leading indentation. This usually makes generated Yue blocks more stable, especially when the generated code contains comments or nested blocks.
237
238```yuescript
239macro default_conf = (conf) -> "
240 -- useful; only set once
241#{conf}.identity = 'LOVE'
242#{conf}.version = \"11.5\"
243 "
244
245love.conf = (t) ->
246 $default_conf t
247```
248
249<YueDisplay>
250
251```yue
252macro default_conf = (conf) -> "
253 -- useful; only set once
254#{conf}.identity = 'LOVE'
255#{conf}.version = \"11.5\"
256 "
257
258love.conf = (t) ->
259 $default_conf t
260```
261
262</YueDisplay>
263
264```yuescript
265macro default_conf = (conf) -> |
266 -- useful; only set once
267 #{conf}.identity = 'LOVE'
268 #{conf}.version = "11.5"
269
270love.conf = (t) ->
271 $default_conf t
272```
273
274<YueDisplay>
275
276```yue
277macro default_conf = (conf) -> |
278 -- useful; only set once
279 #{conf}.identity = 'LOVE'
280 #{conf}.version = "11.5"
281
282love.conf = (t) ->
283 $default_conf t
284```
285
286</YueDisplay>
287
232## Argument Validation 288## Argument Validation
233 289
234You can declare the expected AST node types in the argument list, and check whether the incoming macro arguments meet the expectations at compile time. 290You can declare the expected AST node types in the argument list, and check whether the incoming macro arguments meet the expectations at compile time.
diff --git a/doc/docs/id-id/doc/advanced/macro.md b/doc/docs/id-id/doc/advanced/macro.md
index d33ec5b..5f0021b 100644
--- a/doc/docs/id-id/doc/advanced/macro.md
+++ b/doc/docs/id-id/doc/advanced/macro.md
@@ -229,6 +229,62 @@ print "Valid enum type:", $BodyType Static
229 229
230</YueDisplay> 230</YueDisplay>
231 231
232## Menghasilkan kode Yue multi-baris
233
234Saat macro mengembalikan kode Yue multi-baris, penggunaan string multi-baris di dalam tanda kutip tidak direkomendasikan. Sebaiknya gunakan `-> |`.
235
236String bertanda kutip mempertahankan teks apa adanya, sedangkan string multi-baris YAML menghapus indentasi awal yang sama. Ini biasanya membuat blok Yue yang dihasilkan lebih stabil, terutama ketika kode yang dihasilkan berisi komentar atau blok bertingkat.
237
238```yuescript
239macro default_conf = (conf) -> "
240 -- useful; only set once
241#{conf}.identity = 'LOVE'
242#{conf}.version = \"11.5\"
243 "
244
245love.conf = (t) ->
246 $default_conf t
247```
248
249<YueDisplay>
250
251```yue
252macro default_conf = (conf) -> "
253 -- useful; only set once
254#{conf}.identity = 'LOVE'
255#{conf}.version = \"11.5\"
256 "
257
258love.conf = (t) ->
259 $default_conf t
260```
261
262</YueDisplay>
263
264```yuescript
265macro default_conf = (conf) -> |
266 -- useful; only set once
267 #{conf}.identity = 'LOVE'
268 #{conf}.version = "11.5"
269
270love.conf = (t) ->
271 $default_conf t
272```
273
274<YueDisplay>
275
276```yue
277macro default_conf = (conf) -> |
278 -- useful; only set once
279 #{conf}.identity = 'LOVE'
280 #{conf}.version = "11.5"
281
282love.conf = (t) ->
283 $default_conf t
284```
285
286</YueDisplay>
287
232## Validasi Argumen 288## Validasi Argumen
233 289
234Anda dapat mendeklarasikan tipe node AST yang diharapkan dalam daftar argumen, dan memeriksa apakah argumen macro yang masuk memenuhi harapan pada waktu kompilasi. 290Anda dapat mendeklarasikan tipe node AST yang diharapkan dalam daftar argumen, dan memeriksa apakah argumen macro yang masuk memenuhi harapan pada waktu kompilasi.
diff --git a/doc/docs/pt-br/doc/advanced/macro.md b/doc/docs/pt-br/doc/advanced/macro.md
index 18d33e0..d1025d1 100644
--- a/doc/docs/pt-br/doc/advanced/macro.md
+++ b/doc/docs/pt-br/doc/advanced/macro.md
@@ -228,6 +228,62 @@ print "Valid enum type:", $BodyType Static
228 228
229</YueDisplay> 229</YueDisplay>
230 230
231## Gerando código Yue em múltiplas linhas
232
233Quando uma macro retorna código Yue em múltiplas linhas, não é recomendado usar uma string multilinha entre aspas. Prefira `-> |`.
234
235Uma string entre aspas preserva o texto literal, enquanto uma string multilinha estilo YAML remove a indentação inicial comum. Isso normalmente deixa os blocos Yue gerados mais estáveis, especialmente quando o código gerado contém comentários ou blocos aninhados.
236
237```yuescript
238macro default_conf = (conf) -> "
239 -- useful; only set once
240#{conf}.identity = 'LOVE'
241#{conf}.version = \"11.5\"
242 "
243
244love.conf = (t) ->
245 $default_conf t
246```
247
248<YueDisplay>
249
250```yue
251macro default_conf = (conf) -> "
252 -- useful; only set once
253#{conf}.identity = 'LOVE'
254#{conf}.version = \"11.5\"
255 "
256
257love.conf = (t) ->
258 $default_conf t
259```
260
261</YueDisplay>
262
263```yuescript
264macro default_conf = (conf) -> |
265 -- useful; only set once
266 #{conf}.identity = 'LOVE'
267 #{conf}.version = "11.5"
268
269love.conf = (t) ->
270 $default_conf t
271```
272
273<YueDisplay>
274
275```yue
276macro default_conf = (conf) -> |
277 -- useful; only set once
278 #{conf}.identity = 'LOVE'
279 #{conf}.version = "11.5"
280
281love.conf = (t) ->
282 $default_conf t
283```
284
285</YueDisplay>
286
231## Validação de argumentos 287## Validação de argumentos
232 288
233Você pode declarar os tipos de nós AST esperados na lista de argumentos e verificar se os argumentos da macro recebidos atendem às expectativas em tempo de compilação. 289Você pode declarar os tipos de nós AST esperados na lista de argumentos e verificar se os argumentos da macro recebidos atendem às expectativas em tempo de compilação.
diff --git a/doc/docs/zh/doc/advanced/macro.md b/doc/docs/zh/doc/advanced/macro.md
index 64cfa6d..7027f62 100644
--- a/doc/docs/zh/doc/advanced/macro.md
+++ b/doc/docs/zh/doc/advanced/macro.md
@@ -229,6 +229,62 @@ print "有效的枚举类型:", $BodyType Static
229 229
230</YueDisplay> 230</YueDisplay>
231 231
232## 生成多行 Yue 代码
233
234&emsp;&emsp;当宏返回多行 Yue 代码时,不推荐使用带引号的多行字符串,建议优先使用 `-> |`。
235
236&emsp;&emsp;带引号的字符串会按字面保留文本;而 YAML 风格多行字符串会移除公共前导缩进。对宏生成的 Yue 代码来说,这通常能让代码块结构更稳定,尤其是在生成代码里包含注释或嵌套块时。
237
238```yuescript
239macro default_conf = (conf) -> "
240 -- useful; only set once
241#{conf}.identity = 'LOVE'
242#{conf}.version = \"11.5\"
243 "
244
245love.conf = (t) ->
246 $default_conf t
247```
248
249<YueDisplay>
250
251```yue
252macro default_conf = (conf) -> "
253 -- useful; only set once
254#{conf}.identity = 'LOVE'
255#{conf}.version = \"11.5\"
256 "
257
258love.conf = (t) ->
259 $default_conf t
260```
261
262</YueDisplay>
263
264```yuescript
265macro default_conf = (conf) -> |
266 -- useful; only set once
267 #{conf}.identity = 'LOVE'
268 #{conf}.version = "11.5"
269
270love.conf = (t) ->
271 $default_conf t
272```
273
274<YueDisplay>
275
276```yue
277macro default_conf = (conf) -> |
278 -- useful; only set once
279 #{conf}.identity = 'LOVE'
280 #{conf}.version = "11.5"
281
282love.conf = (t) ->
283 $default_conf t
284```
285
286</YueDisplay>
287
232## 宏参数检查 288## 宏参数检查
233 289
234&emsp;&emsp;可以直接在参数列表中声明期望的 AST 节点类型,并在编译时检查传入的宏参数是否符合预期。 290&emsp;&emsp;可以直接在参数列表中声明期望的 AST 节点类型,并在编译时检查传入的宏参数是否符合预期。
diff --git a/doc/yue-de.md b/doc/yue-de.md
index 97063f4..0d4fa7a 100644
--- a/doc/yue-de.md
+++ b/doc/yue-de.md
@@ -183,6 +183,33 @@ print "Gültiger Enum-Typ:", $BodyType Static
183-- print "Kompilierungsfehler bei Enum-Typ:", $BodyType Unknown 183-- print "Kompilierungsfehler bei Enum-Typ:", $BodyType Unknown
184``` 184```
185 185
186## Mehrzeiligen Yue-Code erzeugen
187
188Wenn ein Makro mehrzeiligen Yue-Code zurückgibt, ist eine mehrzeilige Zeichenkette in Anführungszeichen nicht zu empfehlen. Verwende stattdessen bevorzugt `-> |`.
189
190Eine Zeichenkette in Anführungszeichen behält den Text wörtlich bei, während ein YAML-Mehrzeilen-String die gemeinsame führende Einrückung entfernt. Dadurch bleiben erzeugte Yue-Blöcke in der Regel stabiler, besonders wenn der erzeugte Code Kommentare oder verschachtelte Blöcke enthält.
191
192```yuescript
193macro default_conf = (conf) -> "
194 -- useful; only set once
195#{conf}.identity = 'LOVE'
196#{conf}.version = \"11.5\"
197 "
198
199love.conf = (t) ->
200 $default_conf t
201```
202
203```yuescript
204macro default_conf = (conf) -> |
205 -- useful; only set once
206 #{conf}.identity = 'LOVE'
207 #{conf}.version = "11.5"
208
209love.conf = (t) ->
210 $default_conf t
211```
212
186## Argument-Validierung 213## Argument-Validierung
187 214
188Du kannst erwartete AST-Knotentypen in der Argumentliste deklarieren und zur Compile-Zeit prüfen, ob die übergebenen Makroargumente den Erwartungen entsprechen. 215Du kannst erwartete AST-Knotentypen in der Argumentliste deklarieren und zur Compile-Zeit prüfen, ob die übergebenen Makroargumente den Erwartungen entsprechen.
diff --git a/doc/yue-en.md b/doc/yue-en.md
index 8f8370d..2c97b28 100644
--- a/doc/yue-en.md
+++ b/doc/yue-en.md
@@ -183,6 +183,33 @@ print "Valid enum type:", $BodyType Static
183-- print "Compilation error with enum type:", $BodyType Unknown 183-- print "Compilation error with enum type:", $BodyType Unknown
184``` 184```
185 185
186## Generating Multi-line Yue Code
187
188When a macro returns multi-line Yue code, using a quoted multi-line string is not recommended. Prefer `-> |` instead.
189
190A quoted string keeps the literal text as-is, while a YAML multiline string removes the common leading indentation. This usually makes generated Yue blocks more stable, especially when the generated code contains comments or nested blocks.
191
192```yuescript
193macro default_conf = (conf) -> "
194 -- useful; only set once
195#{conf}.identity = 'LOVE'
196#{conf}.version = \"11.5\"
197 "
198
199love.conf = (t) ->
200 $default_conf t
201```
202
203```yuescript
204macro default_conf = (conf) -> |
205 -- useful; only set once
206 #{conf}.identity = 'LOVE'
207 #{conf}.version = "11.5"
208
209love.conf = (t) ->
210 $default_conf t
211```
212
186## Argument Validation 213## Argument Validation
187 214
188You can declare the expected AST node types in the argument list, and check whether the incoming macro arguments meet the expectations at compile time. 215You can declare the expected AST node types in the argument list, and check whether the incoming macro arguments meet the expectations at compile time.
diff --git a/doc/yue-id-id.md b/doc/yue-id-id.md
index 39ba24d..8661ecf 100644
--- a/doc/yue-id-id.md
+++ b/doc/yue-id-id.md
@@ -183,6 +183,33 @@ print "Valid enum type:", $BodyType Static
183-- print "Compilation error with enum type:", $BodyType Unknown 183-- print "Compilation error with enum type:", $BodyType Unknown
184``` 184```
185 185
186## Menghasilkan kode Yue multi-baris
187
188Saat macro mengembalikan kode Yue multi-baris, penggunaan string multi-baris di dalam tanda kutip tidak direkomendasikan. Sebaiknya gunakan `-> |`.
189
190String bertanda kutip mempertahankan teks apa adanya, sedangkan string multi-baris YAML menghapus indentasi awal yang sama. Ini biasanya membuat blok Yue yang dihasilkan lebih stabil, terutama ketika kode yang dihasilkan berisi komentar atau blok bertingkat.
191
192```yuescript
193macro default_conf = (conf) -> "
194 -- useful; only set once
195#{conf}.identity = 'LOVE'
196#{conf}.version = \"11.5\"
197 "
198
199love.conf = (t) ->
200 $default_conf t
201```
202
203```yuescript
204macro default_conf = (conf) -> |
205 -- useful; only set once
206 #{conf}.identity = 'LOVE'
207 #{conf}.version = "11.5"
208
209love.conf = (t) ->
210 $default_conf t
211```
212
186## Validasi Argumen 213## Validasi Argumen
187 214
188Anda dapat mendeklarasikan tipe node AST yang diharapkan dalam daftar argumen, dan memeriksa apakah argumen macro yang masuk memenuhi harapan pada waktu kompilasi. 215Anda dapat mendeklarasikan tipe node AST yang diharapkan dalam daftar argumen, dan memeriksa apakah argumen macro yang masuk memenuhi harapan pada waktu kompilasi.
diff --git a/doc/yue-pt-br.md b/doc/yue-pt-br.md
index a0e3268..7bf5ab6 100644
--- a/doc/yue-pt-br.md
+++ b/doc/yue-pt-br.md
@@ -183,6 +183,33 @@ print "Valid enum type:", $BodyType Static
183-- print "Compilation error with enum type:", $BodyType Unknown 183-- print "Compilation error with enum type:", $BodyType Unknown
184``` 184```
185 185
186## Gerando código Yue em múltiplas linhas
187
188Quando uma macro retorna código Yue em múltiplas linhas, não é recomendado usar uma string multilinha entre aspas. Prefira `-> |`.
189
190Uma string entre aspas preserva o texto literal, enquanto uma string multilinha estilo YAML remove a indentação inicial comum. Isso normalmente deixa os blocos Yue gerados mais estáveis, especialmente quando o código gerado contém comentários ou blocos aninhados.
191
192```yuescript
193macro default_conf = (conf) -> "
194 -- useful; only set once
195#{conf}.identity = 'LOVE'
196#{conf}.version = \"11.5\"
197 "
198
199love.conf = (t) ->
200 $default_conf t
201```
202
203```yuescript
204macro default_conf = (conf) -> |
205 -- useful; only set once
206 #{conf}.identity = 'LOVE'
207 #{conf}.version = "11.5"
208
209love.conf = (t) ->
210 $default_conf t
211```
212
186## Validação de argumentos 213## Validação de argumentos
187 214
188Você pode declarar os tipos de nós AST esperados na lista de argumentos e verificar se os argumentos da macro recebidos atendem às expectativas em tempo de compilação. 215Você pode declarar os tipos de nós AST esperados na lista de argumentos e verificar se os argumentos da macro recebidos atendem às expectativas em tempo de compilação.
diff --git a/doc/yue-zh.md b/doc/yue-zh.md
index cb44d22..b69fcf6 100644
--- a/doc/yue-zh.md
+++ b/doc/yue-zh.md
@@ -183,6 +183,33 @@ print "有效的枚举类型:", $BodyType Static
183-- print "编译报错的枚举类型:", $BodyType Unknown 183-- print "编译报错的枚举类型:", $BodyType Unknown
184``` 184```
185 185
186## 生成多行 Yue 代码
187
188&emsp;&emsp;当宏返回多行 Yue 代码时,不推荐使用带引号的多行字符串,建议优先使用 `-> |`。
189
190&emsp;&emsp;带引号的字符串会按字面保留文本;而 YAML 风格多行字符串会移除公共前导缩进。对宏生成的 Yue 代码来说,这通常能让代码块结构更稳定,尤其是在生成代码里包含注释或嵌套块时。
191
192```yuescript
193macro default_conf = (conf) -> "
194 -- useful; only set once
195#{conf}.identity = 'LOVE'
196#{conf}.version = \"11.5\"
197 "
198
199love.conf = (t) ->
200 $default_conf t
201```
202
203```yuescript
204macro default_conf = (conf) -> |
205 -- useful; only set once
206 #{conf}.identity = 'LOVE'
207 #{conf}.version = "11.5"
208
209love.conf = (t) ->
210 $default_conf t
211```
212
186## 宏参数检查 213## 宏参数检查
187 214
188&emsp;&emsp;可以直接在参数列表中声明期望的 AST 节点类型,并在编译时检查传入的宏参数是否符合预期。 215&emsp;&emsp;可以直接在参数列表中声明期望的 AST 节点类型,并在编译时检查传入的宏参数是否符合预期。