Lex yacc 更改缓冲区
Flex 提供了一种用于创建多个输入缓冲区并在多个输入缓冲区之间切换的机制。输入缓冲区是通过使用 yy_creat_buffer 创建的,并提供了使用 yy_switch_buffer 切换输入流的可能性。
问题是 lex 没有实现这样的解决方案。
您可以Flex 手册找到更多信息
Flex provides a mechanism for creating and switching between multiple input buffers. An input buffer is created by using: yy_creat_buffer and gives the possibility to switch input stream by using yy_switch_buffer.
The problem is lex does not implement a solution like that.
you can find more in the Flex manual
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,lex 中没有类似的解决方案,如果有人知道,请将其提供给我们。
唯一的可能性是您重新定义
yywrap()
,每当 Lex 到达文件末尾时就会调用它。在这种情况下,您应该提供一个 yywrap() 来安排新输入并返回 0。这指示 Lex 继续处理。默认 yywrap 始终返回 1(不添加输入)。
Unfortunately, there no similar solution in lex, and if any one knows one please please give it to us.
The only possibility is that you redefine
yywrap()
,which is called whenever Lex reaches an end-of-file.In this case, you should provide a
yywrap()
which arranges for new input and returns 0. This instructs Lex to continue processing. The default yywrap always returns 1(no added input).