strings
This commit is contained in:
21
specs.md
21
specs.md
@@ -20,10 +20,31 @@ Line comments start with `//` and extend to end of line.
|
||||
| Integer | `0`, `42`, `0xFF`, `0b1010` | `s64` |
|
||||
| Float | `0.3`, `0.9` | `f32` |
|
||||
| String | `"Hello"`, `"z: {z}"` | `string` |
|
||||
| Multi-line String | `` `line1\nline2` `` | `string` |
|
||||
| Heredoc String | `#string END`...`END` | `string` |
|
||||
| Boolean | `true`, `false` | `bool` |
|
||||
| Enum | `.variant1` | inferred from context |
|
||||
| Undefined | `---` | context-dependent |
|
||||
|
||||
**Multi-line strings** use backtick delimiters (`` ` ``). They may span multiple lines and support the same escape sequences as regular strings (`\n`, `\t`, `\r`, `\\`, `\"`, `` \` ``, `\0`). Content between backticks is taken verbatim (no indentation stripping).
|
||||
```sx
|
||||
shader_src := `#version 330 core
|
||||
void main() {
|
||||
gl_Position = vec4(0.0);
|
||||
}
|
||||
`;
|
||||
```
|
||||
|
||||
**Heredoc strings** use `#string DELIMITER` syntax (inspired by Jai). Content is completely raw — no escape processing. The delimiter is any identifier. Content starts after the newline following the delimiter and ends when the delimiter appears at column 0 of a line.
|
||||
```sx
|
||||
vert_src := #string GLSL
|
||||
#version 330 core
|
||||
void main() {
|
||||
gl_Position = vec4(aPos, 1.0);
|
||||
}
|
||||
GLSL;
|
||||
```
|
||||
|
||||
### Keywords
|
||||
`if`, `else`, `then`, `while`, `break`, `continue`, `true`, `false`, `enum`, `struct`, `union`, `case`, `return`, `defer`, `xx`, `and`, `or`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user