如何获得很好的语法错误信息与快乐? [英] How to get nice syntax error messages with Happy?

查看:141
本文介绍了如何获得很好的语法错误信息与快乐?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



其他解析器生成器可以给出很好的消息,如意外的结束,预期的,然后。
幸福的我只是得到当前的令牌和错误的位置。



你能给我一个如何得到类似上面的错误消息的例子吗?

解决方案

我为此撰写了一个Happy功能。



查看我的博文:寻找更好的GHC语法错误

它被合并在这个拉取请求中 RFC :解析错误 - 显示下一个可能的令牌


I am currently playing with the happy parser generator.

Other parser generators can give nice messages like "unexpected endline, expected 'then'". With happy I just get the current Tokens and the position of the error.

Can you give me an example of how to get error messages like above?

解决方案

There is a Happy feature that I have authored for this purpose.

See my blog post: Toward better GHC syntax errors

It was merged in this pull request RFC: On parse error - show the next possible tokens.

这篇关于如何获得很好的语法错误信息与快乐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆