在 Visual Studio 中构建时出现 fsyacc 错误
我在 Visual Studio 中使用 fsyacc(使用解析语言入门模板),但生成输出不显示发生错误的行/列(仅:fsyacc 退出,代码为 1)。我必须从命令提示符进行构建才能获取此信息,这在某种程度上抵消了 VS 集成的好处。
有没有办法在输出窗口中显示它?
编辑
以下是输出窗口中未显示的一些错误示例。
Parser.fsy(74,4): error: parse error
这
building tables FSYACC: error FSY000: NonTerminal 'query' has no productions
是成功的输出,也很高兴看到:
building tables computing first function...time: 00:00:00.1318603 building kernels...time: 00:00:00.1027372 building kernel table...time: 00:00:00.0533044 computing lookahead relations............................. ..............time: 00:00:00.0517415 building lookahead table...time: 00:00:00.0207993 building action table...state 29: shift/reduce error on AS state 49: shift/reduce error on OR state 49: shift/reduce error on AND ... time: 00:00:00.1457792 building goto table...time: 00:00:00.0035636 returning tables. 39 shift/reduce conflicts 62 states 11 nonterminals 41 terminals 46 productions #rows in action table: 62
I'm using fsyacc within Visual Studio (using the Parsed Language Starter template), but the build output doesn't show the line/column where the error occured (only: fsyacc exited with code 1). I have to build from the command prompt to get this information, somewhat negating the benefit of VS integration.
Is there a way to show this in the output window?
EDIT
Here are some examples of errors that aren't shown in the output window.
Parser.fsy(74,4): error: parse error
and
building tables FSYACC: error FSY000: NonTerminal 'query' has no productions
Here's success output that would be nice to see also:
building tables computing first function...time: 00:00:00.1318603 building kernels...time: 00:00:00.1027372 building kernel table...time: 00:00:00.0533044 computing lookahead relations............................. ..............time: 00:00:00.0517415 building lookahead table...time: 00:00:00.0207993 building action table...state 29: shift/reduce error on AS state 49: shift/reduce error on OR state 49: shift/reduce error on AND ... time: 00:00:00.1457792 building goto table...time: 00:00:00.0035636 returning tables. 39 shift/reduce conflicts 62 states 11 nonterminals 41 terminals 46 productions #rows in action table: 62
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有使用 Parsed Language Starter 模板,而是通过使用 VS 项目属性中的
Build Events
中的Pre-build event
来构建解析器/词法分析器:这不是很理想,因为我必须在 Path 环境变量中设置 fsyacc/fslex。每当我不想重建解析器/词法分析器时,我必须在 fsproj 文件中注释掉以下部分:
但是,获胜点很明显。我们在
stdout
中拥有所有消息,包括错误和成功输出,这方便调试。Instead of using Parsed Language Starter template, I build parser/lexer by using
Pre-build event
inBuild Events
from VS Project Properties:It is not very desirable since I have to set fsyacc/fslex in Path environment variable. Whenever I don't want to rebuild parser/lexer, I have to comment out the following part in fsproj file:
However, the winning point is clear. We have all messages including errors and success output in
stdout
which is convenient for debugging.