Parse error for Haskell sections

Aperta
#1,838 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
emacs-lisp, haskell
Ambito
tooling

Direzione di ricerca

Riproduci l’esempio in haskell-mode e inizia leggendo haskell-forward-sexp, haskell-backward-sexp e l’interazione con plain backward-sexp in corrispondenza della d di div. Il lavoro è completato quando C-M-u naviga correttamente da ogni posizione all’interno della sezione Haskell senza segnalare un errore di scansione per parentesi non bilanciate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Consider the program:

main = print $ (`div` 2) 3

If you put the cursor inside the brackets anywhere except on the first back-tick character and hit C-M-u (backward-up-list) the cursor is placed at the beginning of the current buffer and a scan error is echoed to the *Messages* buffer:

up-list: Scan error: "Unbalanced parentheses", 1, 1

I tried to debug this, but I'm not great with lisp. I think it has to do with the fact that "plain" backward-sexp and haskell-backward-sexp don't agree on where to go when cursor is on the d in div. There is a comment in haskell-forward-sexp saying that:

Navigate backwards using plain `backward-sexp', assume that it skipped over at least one Haskell expression

If I switch to fundamental-mode I can see that this assumption doesn't hold if you call backward-sexp with the cursor on the d in div.

I would love to provide the patch, but I'm afraid I need help digging to locate the bug.

The bug is present in at least versions 20231115.1812 and 20240116.1718.

Lingua principale
Emacs Lisp
Stelle
1.4k
Fork
357
Merge medio
7h 50m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di haskell/haskell-mode

Tutte le issue di haskell/haskell-mode

Issue simili

Altre issue su DevTools

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.