gren-lang / gren-lang/compiler-common
New parser rejects same-column arguments in multi-line function calls
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 1
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
I'm not sure how best to package this in a way that is reproducible, but, as I'm working on 'gren format' and calling the parse APIs directly, a gren source file I have that works just fine with the Haskell version of the compiler, fails to parse.
I'll provide it in a git repo, and just hope that you can reproduce this.
When I parse it, I get:
-- FAILED TO PARSE --------------------------------------------------- Main.gren
32| main =
33| Browser.application
34| { init = init
^
35| , view = View.view
36| , update = Update.update
Expected end of file
Expected keyword 'port'
Expected keyword 'type'
Invalid character in variable name
Claude sonnet diagnosed this for me and came up with a fix. It's commit message is:
Fix parser rejecting same-column arguments in multi-line function calls
The expression parser used scopeIndentToLineStart when parsing arguments
to a Var/VarQual, which set indent = lineStart. checkIndent then required
col > indent (strictly greater), so a multi-line call like
Browser.application
{ init = init
failed because { at col 5 is not > 5.
The Haskell compiler accepts this layout. Fix by adding
scopeIndentBelowLineStart, which sets indent = max(indent, lineStart - 1).
The max prevents the indent from dropping below the enclosing declaration's
column, which would otherwise let col-1 tokens on a same-line call be
absorbed as spurious arguments.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
I'll add the diff for its fix into my sample git repo.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the supplied sample repository, using gren format or the parse APIs on the multi-line Browser.application call. Read the expression parser's argument indentation handling, then verify that same-column arguments are accepted without allowing same-line tokens as spurious arguments.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100