purescript-mode
purescript-mode copied to clipboard
Indentation fails when keywords are used as record field names
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)