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

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

Closed
gracjan opened this issue Oct 26, 2015 · 0 comments
Closed

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

gracjan opened this issue Oct 26, 2015 · 0 comments

Comments

@gracjan
Copy link
Contributor

gracjan commented Oct 26, 2015

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
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

1 participant