Most comment parsing uses lexical states to achieve this without clash
with other tokens (since the longest match wins).
So when you encounter the "/*" you switch to a new state, and in that
state there are only 2 tokens defined, "*/" to return you to the
previous lexical state and ~[] to eat any other characters
_one_at_a_time_ so that the endOfComment token is always matchable.
On Wed, Apr 22, 2009 at 12:48 PM, Douglas Alves <
knidel@...> wrote:
> Good night.
> First, sorry for my english.
> I'm a student of Computer Scientist in Brazil.
>
> I'm work in my monografy with JavaCC.
>
> I'm having trouble writing a token that defines several lines of comments,
> as in C + +. I am using this definition:
> < COMENTARIO_VARIAS_LINHAS: "/*" (~[])* "*/" >
>
> But in this case also includes (~[])* the end of the comment "*/", error
> occurs and the time to acknowledge the comments of several lines. If you
> have any suggestions, thank you now.
> Regards,
>
>
> Saudações,
> Douglas Alves
>
--
- J.Chris Findlay
(c:
---------------------------------------------------------------------
To unsubscribe, e-mail:
users-unsubscribe@...
For additional commands, e-mail:
users-help@...