go: lex.sx — raw string literals (backtick) + 9 tests [nothing]
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 22s

Adds Go raw string literals per Go spec § String literals:
backtick-delimited, no escape processing, may span multiple
lines, '\r' chars discarded from the value.

gl-read-raw-string! mirrors gl-read-string! but skips escape
handling and the \r filter. scan! routes the leading backtick
to it; emits "string" type (same as interpreted strings — no
need to distinguish at parse/type time).

lex 123/123.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-27 07:22:01 +00:00
parent e60c74f8c3
commit 65467c232b
5 changed files with 90 additions and 17 deletions

View File

@@ -143,11 +143,13 @@ Progress-log line → push `origin/loops/go`.
ident/int/string/rune/{break,continue,fallthrough,return}/{++,--,),],}}.
- [x] Float / imaginary literals (decimal floats: `3.14 .5 1. 1e10 1.5e-3`;
imag: `2i 3.14i 1e2i`; hex floats `0x1.fp0` deferred)
- [ ] Raw string literals `` `...` ``
- [x] Raw string literals `` `...` `` (multi-line, no escape processing,
`\r` stripped per Go spec § String literals; same `"string"` type
as interpreted strings)
- [x] Hex/octal/binary integer literals (0x… 0o… 0b…) + underscores
(legacy 0123 octal also accepted; consumes lex-hex-digit?)
- [ ] Full operator set audit (47 distinct per Go spec)
- **Acceptance:** lex/ suite at 50+ tests. Current: 114/114.
- **Acceptance:** lex/ suite at 50+ tests. Current: 123/123.
### Phase 2 — Parser (`lib/go/parse.sx`) ⬜
- Consume `lib/guest/core/pratt.sx` + `lib/guest/core/ast.sx`. Chisel notes
@@ -406,6 +408,12 @@ _(none yet)_
_Newest first. Append one dated entry per commit._
- 2026-05-27 — Phase 1 cont.: raw string literals (backtick-delimited).
Multi-line, no escape processing, `\r` stripped per Go spec § String
literals. Same `"string"` token type as interpreted strings — parsers
/ type checkers don't need to distinguish. +9 tests, lex 123/123.
`[nothing]` — pure Go work; raw strings don't touch the substrate or
lib/guest story.
- 2026-05-27 — Phase 1 cont.: decimal float + imaginary literals.
`3.14`, `.5`, `1.`, `1e10`, `1.5e-3`, `2i`, `3.14i`. `gl-finish-number!`
handles exponent + `i` suffix; `gl-read-number!` returns the type