HI Gerwin,
Thanks for the explanation. I can now get the maven plugin to process the spec successfully.
- Russ
On May 30, 2013, at 5:13 AM, Gerwin Klein <Ger...@ni...> wrote:
> Hi Russel,
>
> the problem is that this rule could match nothing (the empty string) and therefore lead to an infinite loop.
>
> In more detail, in
>
>> <ACTION_END> ([^<>\'\"]|{SQUOT}|{DQUOT})*[^<>]*$
>
> you have the structure
>
> A*B*$
>
> which would match an empty line and make no progress matching it, i.e. it would match the same empty line again and again. Lex doesn't detect the problem because of the $, but JFlex does.
>
> It's possible that the problem never occurs in practise, because an empty line might be matched by a rule higher up in the spec that does make progress. Usually, this kind of rule still points to a bug in the lexer spec, though.
>
> It's often possible to just replace one or both of the * with a +, but that depends on the language you're trying to parse, of course.
>
> Since matching the empty line is definitely an error, most likely the language wants to have at least one of A or B there, so you could reformulate the rule as
>
> (A+B* | A*B+)$
>
> This is what the Lex spec would be equivalent to if the empty line match is indeed caught by another rule higher up in the spec.
>
> Hope this helps!
>
> Cheers,
> Gerwin
>
> On 30.05.2013, at 1:45 AM, Russell Gold <rus...@gm...> wrote:
>
>> I am attempting to convert some old files written a decade ago for Lex to JFlex. I am running into this error:
>>
>> Error in file "/Users/rgold/projects/plugin-tests/src/main/jflex/JspScanner.lex" (line 537):
>> Lookahead expression must have match with at least length 1.
>> <ACTION_END> ([^<>\'\"]|{SQUOT}|{DQUOT})*[^<>]*$ { return endAction(false, false); }
>>
>>
>> Some earlier definitions which seem relevant:
>>
>> ANY=(.|\n|\r)
>> SQUOT=("'"([^\'\\]|(\\{ANY}))*"'")
>> DQUOT=("\""([^\"\\]|(\\{ANY}))*"\"")
>>
>> Could somebody explain what is wrong here? I know that there are some minor differences between Lex and JFlex, but I don't know what the issue is, here.
>>
>> Thanks,
>> Russ
>>
>>
>> ------------------------------------------------------------------------------
>> Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
>> Get 100% visibility into your production application - at no cost.
>> Code-level diagnostics for performance bottlenecks with <2% overhead
>> Download for free and get started troubleshooting in minutes.
>> http://p.sf.net/sfu/appdyn_d2d_ap1--
>> jflex-users mailing list
>> https://lists.sourceforge.net/lists/listinfo/jflex-users
>
>
> ________________________________
>
> The information in this e-mail may be confidential and subject to legal professional privilege and/or copyright. National ICT Australia Limited accepts no liability for any damage caused by this email or its attachments.
|