Just wanted to report on the list that the issue Pascal found and reported has been fixed in the development version, with the fix to be included in the upcoming 1.8.0 release.
The defect turned out to be in the code for removal of dead states after the computation of the negated automaton. In the scanner generation process, after an NFA is negated, there can be states from which no final state is reachable any more. These have to be removed from the automaton for the scanning engine to work correctly, and under specific circumstances that removal went wrong.
This bug triggers very rarely. One can determine wether a lexer spec was affected by looking at the number of DFA states before minimisation in JFlex 1.7.0 and (the upcoming) JFLex 1.8.0 or the current development snapshot. If the number of states differ, it may have been affected by the bug, if the number of states is equal, it was not.
Thanks again to Pascal for reporting this one, it was one of the more interesting bugs in JFlex in the past few years.
Cheers,
Gerwin
> On 24 Oct 2019, at 14:08, Gerwin Klein <ge...@do...> wrote:
>
> Hi Pascal,
>
> I haven’t really gotten to the bottom of it yet, but it is some interaction between the presence of a negated character class and the negation operator.
>
> If you need a work-around, changing the spec to the equivalent
>
> EXP = [\u{0}-`b-\u{10FFFF}] [^]* [\u{0}-`b-\u{10FFFF}]
>
> should make it work as expected (you can tell when jflex warns that the second action can never be matched).
>
> Cheers,
> Gerwin
>
>> On 22 Oct 2019, at 02:50, Pascal HENNEQUIN <pas...@te...> wrote:
>>
>> hello,
>> I found an issue with the negation operator "!"
>> With the following specification, string "baba" is not matched
>> by either EXP ou !EXP .
>>
>> Pascal Hennequin
>>
>>
>> -------------------------------
>> %%
>> %standalone
>> %{
>> void ECHO(String cat) { System.out.print("["+cat+":"+yytext()+"]"); }
>> %}
>>
>> EXP = ( [^a] [^]* [^a] )
>> ALL = {EXP} | ! {EXP}
>>
>> %%
>> {ALL} { ECHO("1"); }
>> baba { ECHO("2"); }
>> ---------------------------------
>>
>>
>> --
>> jflex-users mailing list
>> https://lists.sourceforge.net/lists/listinfo/jflex-users
>
>
>
> --
> jflex-users mailing list
> https://lists.sourceforge.net/lists/listinfo/jflex-users
|