Re:[JavaCC] Scanning an identifier with same value as a token

View: New views
2 Messages — Rating Filter:   Alert me  

Re:[JavaCC] Scanning an identifier with same value as a token

by Henrik Wahlberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Tom.

Good idea.
Introducing the binary token and the new delta_type non terminal would
indeed solve the problem.
Thanks.

Out of curiosity, the Author is produced similar to how i initially
attempted to solve the deltatype.
---------------
1.1
date    2009.07.13.04.34.34;    author hew;    state Exp;
---------------

 <AUTHOR>   s   = id()   { node.setAuthor(s); }    ";"

Would it be simple to have the scanner return the text between the "author" and ";" tokens?
As it's handled here, the user cannot have initials that conflict with any token.
(or have embedded blanks for that matter)

--

 
Med venlig hilsen / Best regards / Mit freundlichen GrĂ¼ssen
Henrik Wahlberg


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


Re: Re:[JavaCC] Scanning an identifier with same value as a token

by Tom Copeland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Jul 16, 2009, at 4:08 AM, Henrik Wahlberg wrote:

> Hi Tom.
>
> Good idea.
> Introducing the binary token and the new delta_type non terminal  
> would indeed solve the problem.
> Thanks.

No problem, glad it helped!

> Out of curiosity, the Author is produced similar to how i initially  
> attempted to solve the deltatype.
> ---------------
> 1.1
> date    2009.07.13.04.34.34;    author hew;    state Exp;
> ---------------
>
> <AUTHOR>   s   = id()   { node.setAuthor(s); }    ";"
>
> Would it be simple to have the scanner return the text between the  
> "author" and ";" tokens?
> As it's handled here, the user cannot have initials that conflict  
> with any token.
> (or have embedded blanks for that matter)

Hm.  Yes, that's a good idea, it might be better for the tokenizer to  
go into a different lexical state after encountering the "author"  
token.  That would prevent the problem that you're noticing there.

Yours,

Tom
http://generatingparserswithjavacc.com/



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