Flex is backing up forever in the specific rule
Lavrentiy Ivanov <[email protected]> Fri, 17 Oct 2014 18:51:42 +0400
| Newsgroups | gmane.comp.lex.flex.general |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--===============4997481789635846607==
Content-Type: multipart/alternative;
boundary="------------060404060602070802090701"
This is a multi-part message in MIME format.
--------------060404060602070802090701
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
My parser is for assembler, here is lex and bison files just in case
https://bitbucket.org/Pugnator/zcore/src/28c783d1f860c001faed2b44076d3fbc83b42c6f/src/macroasm/z80.lex?at=asm
https://bitbucket.org/Pugnator/zcore/src/28c783d1f860c001faed2b44076d3fbc83b42c6f/src/macroasm/asm.y?at=asm
in this example all works like a charm:
|nop
nop
nop
|
Here is debug output
|--accepting rule at line 154 ("nop")
--accepting rule at line 248 ("
")
--accepting rule at line 154 ("nop")
--accepting rule at line 248 ("
")
--accepting rule at line 154 ("nop")
--accepting rule at line 248 ("
")
--(end of buffer or a NUL)
--accepting rule at line 248 ("
")
--(end of buffer or a NUL)
--EOF (start condition 0)
|
The problem raise when I try to parse this code (rule is at line 255 in
lex file)
|DEFB '?'+$80
DEFM "RN"
DEFB 'D'+$80
|
It backs up forever and looks like it can't reach newline (I have a rule
for it). I generated backup file
http://pastebin.com/UW8zct3h
from flex, but can't understand how to use it in order to find the root
cause.
|--accepting rule at line 255 ("DEFB")
--accepting rule at line 280 (" ")
--accepting rule at line 280 (" ")
--accepting rule at line 280 (" ")
--accepting rule at line 280 (" ")
--(end of buffer or a NUL)
--scanner backing up
--accepting rule at line 105 ("'?'")
--accepting rule at line 233 ("+")
--accepting rule at line 56 ("$80")
|
--------------060404060602070802090701
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="post-text" itemprop="text">
<p>My parser is for assembler, here is lex and bison files just in
case<br>
</p>
<p><a class="moz-txt-link-freetext" href="https://bitbucket.org/Pugnator/zcore/src/28c783d1f860c001faed2b44076d3fbc83b42c6f/src/macroasm/z80.lex?at=asm">https://bitbucket.org/Pugnator/zcore/src/28c783d1f860c001faed2b44076d3fbc83b42c6f/src/macroasm/z80.lex?at=asm</a><br>
</p>
<p><a class="moz-txt-link-freetext" href="https://bitbucket.org/Pugnator/zcore/src/28c783d1f860c001faed2b44076d3fbc83b42c6f/src/macroasm/asm.y?at=asm">https://bitbucket.org/Pugnator/zcore/src/28c783d1f860c001faed2b44076d3fbc83b42c6f/src/macroasm/asm.y?at=asm</a><br>
</p>
<p>in this example all works like a charm:</p>
<pre><code>nop
nop
nop
</code></pre>
<p>Here is debug output</p>
<pre><code>--accepting rule at line 154 ("nop")
--accepting rule at line 248 ("
")
--accepting rule at line 154 ("nop")
--accepting rule at line 248 ("
")
--accepting rule at line 154 ("nop")
--accepting rule at line 248 ("
")
--(end of buffer or a NUL)
--accepting rule at line 248 ("
")
--(end of buffer or a NUL)
--EOF (start condition 0)
</code></pre>
<p>The problem raise when I try to parse this code (rule is at
line 255 in lex file)</p>
<pre><code>DEFB '?'+$80
DEFM "RN"
DEFB 'D'+$80
</code></pre>
<p>It backs up forever and looks like it can't reach newline (I
have a rule for it).
I generated backup file<br>
</p>
<p><a class="moz-txt-link-freetext" href="http://pastebin.com/UW8zct3h">http://pastebin.com/UW8zct3h</a></p>
<p>from flex, but can't understand how to use it in order to find
the root cause.</p>
<pre><code>--accepting rule at line 255 ("DEFB")
--accepting rule at line 280 (" ")
--accepting rule at line 280 (" ")
--accepting rule at line 280 (" ")
--accepting rule at line 280 (" ")
--(end of buffer or a NUL)
--scanner backing up
--accepting rule at line 105 ("'?'")
--accepting rule at line 233 ("+")
--accepting rule at line 56 ("$80")
</code></pre>
</div>
</body>
</html>
--------------060404060602070802090701--
--===============4997481789635846607==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
help-flex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-flex
--===============4997481789635846607==--