Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indentation fails when keywords are used as record field names #4

Open
purcell opened this issue Feb 18, 2019 · 1 comment
Open

Indentation fails when keywords are used as record field names #4

purcell opened this issue Feb 18, 2019 · 1 comment

Comments

@purcell
Copy link
Member

purcell commented Feb 18, 2019

Given the apparently-legal snippet:

type MyRec = {
  data :: Number
}

the indentation explodes with "Illegal token: data" after hitting TAB twice. It seems that all reserved words can legally be used as field names, which (in particular) allows FFI support of JS record types with arbitrary field names.

It's not obvious how to fix this. A workaround is to double-quote the record field names, but this really shouldn't be necessary.

Debugger entered--Lisp error: (parse-error . "Illegal token: data")
  signal(parse-error "Illegal token: data")
  parse-error("Illegal token: %s" "data")
  purescript-indentation-with-starter((lambda nil (purescript-indentation-separated (function purescript-indentation-type) "," nil)) "}")
  purescript-indentation-list(purescript-indentation-type "}" "," nil)
  (lambda nil (purescript-indentation-list (function purescript-indentation-type) "}" "," nil))()
  purescript-indentation-type()
  purescript-indentation-separated(purescript-indentation-type "|" "deriving")
  #f(compiled-function () #<bytecode 0x4c296ed1>)()
  purescript-indentation-with-starter(#f(compiled-function () #<bytecode 0x4c296ed1>) nil)
  #f(compiled-function () #<bytecode 0x4c296ef5>)()
  purescript-indentation-with-starter(#f(compiled-function () #<bytecode 0x4c296ef5>) nil)
  purescript-indentation-data()
  purescript-indentation-statement-right(purescript-indentation-data)
  (lambda nil (purescript-indentation-statement-right (function purescript-indentation-data)))()
  #f(compiled-function () #<bytecode 0x4c296e79>)()
  purescript-indentation-implicit-layout-list(#f(compiled-function () #<bytecode 0x4c296e79>))
  purescript-indentation-layout(#f(compiled-function () #<bytecode 0x4c296e79>))
  purescript-indentation-toplevel()
  purescript-indentation-parse-to-indentations()
  purescript-indentation-find-indentations()
  purescript-indentation-indent-line()
  indent--funcall-widened(purescript-indentation-indent-line)
  indent-for-tab-command(nil)
  funcall-interactively(indent-for-tab-command nil)
  call-interactively(indent-for-tab-command nil nil)
  command-execute(indent-for-tab-command)
@Hi-Angel
Copy link
Contributor

Hi-Angel commented Oct 2, 2024

Though not fixed, but should be much better with this PR #21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants