To: "Dmitriy Goldobin" <email@example.com>
Subject: Re: FLEX trouble
In-reply-to: Your message of Mon, 31 May 1999 18:44:49 PDT.
Date: Tue, 01 Jun 1999 00:15:07 PDT
From: Vern Paxson <vern>
> I have a trouble with FLEX. Why rule "/*".*"*/" work properly,=20
> but rule "/*"(.|\n)*"*/" don't work ?
The second of these will have to scan the entire input stream (because
"(.|\n)*" matches an arbitrary amount of any text) in order to see if
it ends with "*/", terminating the comment. That potentially will overflow
the input buffer.
> More complex rule "/*"([^*]|(\*/[^/]))*"*/ give an error
> 'unrecognized rule'.
You can't use the '/' operator inside parentheses. It's not clear
what "(a/b)*" actually means.
> I now use workaround with state <comment>, but single-rule is
> better, i think.
Single-rule is nice but will always have the problem of either setting
restrictions on comments (like not allowing multi-line comments) and/or
running the risk of consuming the entire input stream, as noted above.