This works, but it gives me one token containing &quot;12:34:56&quot;.  I still need to parse the hh,mm,ss values.  What is the best way to do that?<br><br>It seems that I want the parser to be able to tell the lexer &quot;normally you can consider INT:INT:INT as a STRING.  But right now, return tokens for each piece.&quot;  Isn&#39;t that what a semantic predicate does?  Or am I really missing something?  <br>
<br><div class="gmail_quote">On Tue, Feb 24, 2009 at 3:32 PM, Gavin Lambert <span dir="ltr">&lt;<a href="mailto:antlr@mirality.co.nz">antlr@mirality.co.nz</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">At 08:52 25/02/2009, Rick Schumeyer wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
If the input string is &quot;12:34:45&quot;, then of course antlr returns a STRING token.  I understand why it does that (I think) but I&#39;m not really sure how to fix that.  I&#39;m fuzzy on the difference between a semantic and syntactic predicate, and whether one of those is what I need.<br>

<br>
grammar STest;<br>
<br>
line    :    timestamp;<br>
<br>
timestamp<br>
    :    INT &#39;:&#39; INT &#39;:&#39; INT<br>
    ;<br>
<br>
INT    :    (&#39;0&#39;..&#39;9&#39;)+;<br>
<br>
STRING    :    (&#39;!&#39;..&#39;+&#39; | &#39;-&#39;..&#39;~&#39;)+; /* anything but ws or comma */<br>
</blockquote>
<br></div>
fragment TIMESTAMP: INT &#39;:&#39; INT &#39;:&#39; INT ;<br>
<br>
INT : (&#39;0&#39;..&#39;9&#39;)+ ;<br>
<br>
STRING<br>
  : (TIMESTAMP) =&gt; TIMESTAMP { $type = TIMESTAMP; }<div class="Ih2E3d"><br>
  | (&#39;!&#39;..&#39;+&#39; | &#39;-&#39;..&#39;~&#39;)+; /* anything but ws or comma */<br></div>
  ;<br>
<br>
</blockquote></div><br>