Fix some mistakes in the language reference

This commit is contained in:
Stone_Red
2026-03-05 03:08:42 +01:00
parent 8e882a5fd9
commit 672479bdee
+9 -10
View File
@@ -26,19 +26,18 @@ Execution proceeds top-to-bottom unless a control-flow statement changes the lin
## Basic rules ## Basic rules
- Lines are trimmed of leading and trailing whitespace before execution. - Scripts are plain text files with the `.ynt` extension.
- Blank lines are silently skipped. - Each non-empty line is one statement. There are no multi-line expressions.
- Lines starting with `#` are comments and are silently skipped. - Leading and trailing whitespace on each line is ignored.
- Variable interpolation uses `${name}` and is evaluated before the statement runs. - Lines starting with `#` are comments. Inline comments are not supported. Everything after the keyword is treated as its argument.
- Special characters inside string literals are encoded internally and decoded on output - this is transparent to scripts. - `${variable}` anywhere in a line is replaced with the variable's value before the statement runs.
- Text wrapped in double quotes (`"..."`) is a string literal. Its contents are not matched as keywords and support escape sequences like `\n` and `\t`.
---
## Comments ## Comments
```ynt ```ynt
# This is a comment. # This is a comment.
print_line Hello # inline comments are NOT supported - everything after print_line is the argument print_line Hello # inline comments are NOT supported. Everything after print_line is the argument
``` ```
Only whole-line comments (lines whose first non-whitespace character is `#`) are supported. Only whole-line comments (lines whose first non-whitespace character is `#`) are supported.
@@ -311,7 +310,7 @@ goto <name>
``` ```
`label` marks a target. `goto` performs an unconditional jump to that label. `label` marks a target. `goto` performs an unconditional jump to that label.
At the top level, labels are file-scoped you can jump to any label in the file. Inside a function, labels are restricted to the current function; you cannot jump to a label outside the calling function. At the top level, labels are file-scoped, you can jump to any label in the file. Inside a function, labels are restricted to the current function; you cannot jump to a label outside the calling function.
```ynt ```ynt
label loop: label loop:
@@ -598,7 +597,7 @@ print_line Main thread continues.
#### Recommended pattern #### Recommended pattern
Use a direct function call with `task`, and terminate inside that function with `exit`. Use a direct function call with `task`, and terminate inside that function with `exit`.
This keeps the worker logic isolated and avoids `goto` scaffolding. This keeps the worker logic isolated.
```ynt ```ynt
call background_job task call background_job task