X-Received: by 10.224.29.76 with SMTP id p12mr2256369qac.5.1372236845081; Wed, 26 Jun 2013 01:54:05 -0700 (PDT) X-Received: by 10.50.126.67 with SMTP id mw3mr959041igb.15.1372236845045; Wed, 26 Jun 2013 01:54:05 -0700 (PDT) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!j2no1486142qak.0!news-out.google.com!fv2ni168qab.0!nntp.google.com!j2no2688223qak.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.compilers.tools.javacc Date: Wed, 26 Jun 2013 01:54:04 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=59.120.32.27; posting-account=wj68tQoAAACVjfrPspaaljeT-8CQ8TnS NNTP-Posting-Host: 59.120.32.27 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <4a67f7ed-9ec9-4986-b65f-c339376a04f0@googlegroups.com> Subject: Re: .. can never be matched as .. From: bbllatwork@gmail.com Injection-Date: Wed, 26 Jun 2013 08:54:05 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: csiph.com comp.compilers.tools.javacc:13 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"> "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 : | > } > > 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