
louise
Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.
Dernier runRéussi#1197 · main · 10 min 35 s
1Étoiles
0Forks
0Issues
Syntax: a construction's `(` touches its constructor (#319)
A constructor's parentheses opened its construction whenever they were
on the same line, so `go Pin (five ())` was `go Pin(five ())`.
`louise migrate` printed the first and its formatting pass turned it
into the second (`go(Pin, five())` became a construction), and
`louise fmt`, which only changes whitespace, changed a program's
meaning by joining `go Pin` and `(x)` written on two lines.
- The parser takes `C(` as construction only when the `(` touches the
constructor (adjacency, like a template's tag, ADR 0048). After a space
it is a parenthesised argument. ADR 0062 is amended; the grammar
reference says so. Nothing in std, the tests, the examples or the
packages wrote a construction with a space.
- `Some (1)` is now an application: E0216 says the parentheses touch
the constructor.
- `louise migrate` reports a file that already parses in the new syntax
as having nothing to migrate (`MigrateError::AlreadyMigrated`), so
`migrate --check` passes on a migrated tree.
- The tree-sitter grammar: a construction's `(` is immediate; the
scanner gives no argument marker for a touching `(`, and a touching
parenthesised argument (`f(x)`, `f()`) stays an application, as in
the parser. Two corpus trees recorded misparses (`{ Some(x) }` as a
call, `list.map (add 1 _)` as a construction) and are corrected.
- The reference's links to ADR 0062 pointed at 0061.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>Parents 5b71efd
20 fichiers modifiés, 30828 ajouts, 28945 suppressions
crates/louise/src/migrate.rs+1−0crates/louise/tests/cli.rs+9−0crates/louise_syntax/src/format.rs+14−0crates/louise_syntax/src/grammar/expr.rs+8−6crates/louise_syntax/src/migrate.rs+6−0crates/louise_syntax/tests/data/ok/exprs.lse+7−0crates/louise_syntax/tests/migrate.rs+29−0crates/louise_syntax/tests/snapshots/parser__ok_corpus_parses_cleanly@exprs.lse.snap+79−2crates/louise_types/src/infer/mod.rs+7−4docs/adr/0062-parens-free-functions.md+2−2docs/reference/diagnostics.md+3−3docs/reference/grammar.md+4−4docs/reference/language.md+2−2editors/tree-sitter-louise/README.md+1−1editors/tree-sitter-louise/grammar.js+28−9editors/tree-sitter-louise/src/grammar.json+206−86editors/tree-sitter-louise/src/parser.c+30370−28815editors/tree-sitter-louise/src/scanner.c+9−1editors/tree-sitter-louise/test/corpus/expressions.txt+37−10tests/ui/currying.lse+6−0