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

Improvement of error messages for pattern macros #2415

Closed
Kodiologist opened this issue Feb 25, 2023 · 0 comments · Fixed by #2471
Closed

Improvement of error messages for pattern macros #2415

Kodiologist opened this issue Feb 25, 2023 · 0 comments · Fixed by #2471

Comments

@Kodiologist
Copy link
Member

Advancements to funcpaserlib such as vlasovskikh/funcparserlib#52 should allow improving error messages produced while parsing calls to Hy's core pattern macros. In an error like the below example, expected: some(...) could probably be changed to expected symbol.

Traceback (most recent call last):
  File "<string>", line 1
    (defmacro 1)
              ^
hy.errors.HySyntaxError: parse error for pattern macro 'defmacro': got unexpected token: hy.models.Integer(1), expected: some(...)

It's conceivable that most of the patterns for Hy's core macros are too complex to admit useful automatic descriptions of the kind of form that's expected. If so, it's probably better to forget about this than to hand-write descriptions for lots of patterns. Manually writing lots of error messages like that is the sort of thing I intended to avoid by using funcparserlib in the first place.

A simpler sort of improvement would be rewording "unexpected end of input", as provoked by e.g. (defmacro), to something that makes it clearer that the form, as opposed to the entire file, ended prematurely.

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

Successfully merging a pull request may close this issue.

1 participant