help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Flex is backing up forever in the specific rule


From: Lavrentiy Ivanov
Subject: Flex is backing up forever in the specific rule
Date: Fri, 17 Oct 2014 18:51:42 +0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

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")

reply via email to

[Prev in Thread] Current Thread [Next in Thread]