multi-line string literals
This commit is contained in:
@@ -253,25 +253,29 @@
|
||||
- parser-only change (`parse_branch_body` in `compiler/parser/parser.odin`): a brace-less
|
||||
body is just a 1-element statement slice, so the checker and codegen are unchanged
|
||||
|
||||
17. add slice-by-range
|
||||
- allow the use of a range in slice expressions:
|
||||
```
|
||||
excl_range range :: 0..10
|
||||
some_arr[excl_range] # slice by named exclusive range
|
||||
|
||||
incl_range range :: 0..=10
|
||||
some_arr[incl_range] # slice by named inclusive range
|
||||
```
|
||||
17. multi-line strings (implemented; see below)
|
||||
- a multi-line string is an ordinary string literal under the hood: it lowers to the
|
||||
same `.String` expr / `@[N;0]u8` type, so the checker, lowering, and codegen are
|
||||
unchanged. only the lexer and parser change.
|
||||
- the lexer (`compiler/lexer/lexer.odin`, `` case '`' ``) collapses consecutive
|
||||
backtick-marked lines into one `Multiline_String` token; the trailing newline after
|
||||
the last line stays a `.Newline` so it terminates the statement normally
|
||||
- the parser (`decode_multiline_string` in `compiler/parser/parser.odin`) strips each
|
||||
line's leading indentation and `` ` ``, takes the rest of the line raw (no escapes),
|
||||
and joins lines with an implicit `\n` (no leading/trailing newline); an empty
|
||||
`` ` `` yields a blank line
|
||||
- the value may sit on the line after `=`/`::` (the existing post-operator
|
||||
`skip_newlines` already allows this)
|
||||
- `++` concatenation (the spec's "mixing" examples) is a separate, unimplemented
|
||||
operator and is out of scope here
|
||||
|
||||
18. add `defer` statement (inspired by zig)
|
||||
|
||||
19. multi-line strings (see below)
|
||||
19. unions and tagged unions
|
||||
|
||||
20. unions and tagged unions
|
||||
20. match statements with tagged unions payload unwrapping
|
||||
|
||||
21. match statements with tagged unions payload unwrapping
|
||||
|
||||
22. dynamic heap allocation
|
||||
21. dynamic heap allocation
|
||||
- see below for direction
|
||||
- notes below are too big in scope for a first pass and the language is not mature enough to support it yet
|
||||
- this first pass should focus on just basic heap allocation, so we have something to work with
|
||||
|
||||
Reference in New Issue
Block a user