Skip to content

Remove possibility of 'Illegal token' from haskell-indentation #962

Closed
@gracjan

Description

@gracjan

There are two places where 'Illegal token' can be triggered in haskell-indentation:

  1. In haskell-indentation-with-starter: the case there seems to be when a lexical structure expect a closing token/keyword and the token is not present:
(defun haskell-indentation-with-starter (parser &optional end where-expr?)
 ...
 (cond 
   ...
      (end (haskell-indentation-parse-error
             "Illegal token: %s" current-token))))))

The expected token at this point is one of closing ')', ']', '}'. I do not see why we could not eat everything up to a closing token, maybe treating layout as taking priority.

  1. In haskell-indentation-parse-to-indentations: top level problem.

It seems to be a variation on the same, as top level list is a layout delimited list.

Solution seems to be:

  1. React to leading keywords only if, let, import, case etc.
  2. React to following keywords only in context of a leading keyword, so then and else only as part of if.
  3. Allow partial statements, that is if that is not followed by then

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions