Groups | Search | Server Info | Login | Register
Groups > comp.compilers.tools.javacc > #13
| Newsgroups | comp.compilers.tools.javacc |
|---|---|
| Date | 2013-06-26 01:54 -0700 |
| References | <a97fb75d-65e6-404e-be08-d1b4c83ece54@googlegroups.com> |
| Message-ID | <4a67f7ed-9ec9-4986-b65f-c339376a04f0@googlegroups.com> (permalink) |
| Subject | Re: .. can never be matched as .. |
| From | bbllatwork@gmail.com |
Considering the order of token definitions, the token TERM will never match anything, because it was already matched by the CONSTANT/VARIABLE definitions itself.
If you want to use tokens only within other tokens, use the following definition:
<#MY_TOKEN_PART: "bla">
<MY_TOKEN: <MY_TOKEN_PART> "blu">
Hope that helps.
> On Saturday, May 18, 2013 12:25:36 AM UTC+8, Walter Milner wrote:
> My grammar includes:
>
> TOKEN : { < CONSTANT : (["0"-"9"])+ > }
>
> TOKEN : { < VARIABLE : ["x"-"z"] > }
>
> TOKEN : { < TERM : <CONSTANT> | <VARIABLE> > }
>
> but I get warning Regular expression choice : CONSTANT can never be matched as : TERM
>
> Why not?
>
> How come
>
> 12
>
> would not be a term, since it is a constant?
>
> Aplogies for my lack of a brain
Back to comp.compilers.tools.javacc | Previous | Next — Previous in thread | Find similar
.. can never be matched as .. Walter Milner <w.w.milner@googlemail.com> - 2013-05-17 09:25 -0700 Re: .. can never be matched as .. bbllatwork@gmail.com - 2013-06-26 01:54 -0700
csiph-web