« Return to Thread: JAVACC - Problems if coments lines

Re: Re: JAVACC - Problems if coments lines

by J.Chris Findlay :: Rate this Message:

Reply to Author | View in Thread

Thanx for the translation and example (c:

On Fri, Apr 24, 2009 at 4:47 AM, Kenneth Reid Beesley
<krbeesley@...> wrote:

> Hola Douglas,
>
> Desculpe meu português.
>
> O tokenizador de JavaCC é sempre em um estado ou em outro.  Geralment, o
> tokenizador
> começa no estado DEFAULT.  Depois de encontrar "/*", o tokenizador deve
> mudar (?)
> de DEFAULT a um outro estado "dentro de comentário".  Por exemplo
>
> SKIP: {
>        "/*" : IN_DELIMITED_COMMENT
> |       " "
> |       "\n"
> |       "\r"
> |       "\t"
> |       "\f"
> }
>
> Neste estado IN_DELIMITED_COMMENT, o tokenizador deve aceitar qualquer
> caráter,
> ou sequencia de caracteres, mas depois de aceitar "*/", o estado deve voltar
> ao estado DEFAULT.
>
>
> // special lexical state for skipping a delimited comment
> < IN_DELIMITED_COMMENT >
> SKIP: {
>   // find */ and shift back to DEFAULT state
>   "*/": DEFAULT
> |
>   // or just match and skip any character
>   < ~[] >
> }
>
> Você pode ver esta solução nas FAQ
> http://www.engr.mun.ca/~theo/JavaCC-FAQ/javacc-faq-moz.htm
>
> Boa sorte,
>
> Ken
>
>
> On 23 Apr 2009, at 02:17
>>
>> ----------------------------------------------------------------------
>>
>> From: Douglas Alves <knidel@...>
>> Date: 21 April 2009 18:48:35 MDT
>> To: users@...
>> Subject: JAVACC - Problems if coments lines
>>
>>
>> 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
>>
>>
>
>
> ******************************
> Kenneth R. Beesley, D.Phil.
> P.O. Box 540475
> North Salt Lake, UT
> 84054  USA
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>



--
 - J.Chris Findlay
   (c:

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

 « Return to Thread: JAVACC - Problems if coments lines