Lex 解析器:(缓冲区末尾或 NUL)段错误
我在编写 lex 解析器时遇到了分段错误问题。因此,我在构建程序时将调试开关 -d 添加到 Makefile 中。 这是我从中得到的输出。
--accepting rule at line 180 ("bxz")
--accepting rule at line 61 (" ")
--accepting rule at line 180 ("e")
--accepting rule at line 68 ("
")
--accepting rule at line 180 ("0L")
--accepting rule at line 193 ("!")
--accepting rule at line 68 ("
")
--accepting rule at line 180 ("0x")
--accepting rule at line 193 (""")
--accepting rule at line 68 ("
")
--(end of buffer or a NUL)
Segmentation fault
当我通过调试工具运行它时,我发现错误发生在 lex.yy.c:1324 处的 yy_get_next_buffer () 处,这是从我的手编码的 lex 文件自动生成的 C 文件。我该如何解决这个问题? 提前致谢。
I have been experiencing segmentation fault problem problem with the lex parser written. Therefore i have added in debugging switch -d to the Makefile when building my program.
This is the output I get from it.
--accepting rule at line 180 ("bxz")
--accepting rule at line 61 (" ")
--accepting rule at line 180 ("e")
--accepting rule at line 68 ("
")
--accepting rule at line 180 ("0L")
--accepting rule at line 193 ("!")
--accepting rule at line 68 ("
")
--accepting rule at line 180 ("0x")
--accepting rule at line 193 (""")
--accepting rule at line 68 ("
")
--(end of buffer or a NUL)
Segmentation fault
When I run this through a debugging tool, I found that the error occur at yy_get_next_buffer () at lex.yy.c:1324 which is the C file automatically generated from my handcoded lex file. How can I resolve this issue?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
(我将其标记为“不可重现”,但是它计时- 。 href="https://meta.stackoverflow.com/questions/251597/question-with-no-answers-but-issue-solved-in-the-comments">已在评论中回答。 )
@LokiAstari 写道:
@AK 写道:
@ChrisDodd 写道:
(I flagged this as "not reproducible", however it timed-out/aged away. It has been answered in the comments.)
@LokiAstari wrote:
@AK wrote:
@ChrisDodd wrote: