title: Antlr Lexer rules
body: <p>I've got a rule to match a string that looks like so:</p>
  
  <pre><code>STRING
      : '"' ( ~( '"' | '\\' ) | '\\' . )* '"'
      ;
  </code></pre>
  
  <p>I dont want the quotes to be part of the tokens text.  In Antlr2 I would just put <code>'!'</code> after the quotes to tell Antlr not to add them to the text.</p>
  
  <p>Notice the <strong>'!'</strong> below.</p>
  
  <pre><code> STRING
      : '"'! ( ~( '"' | '\\' ) | '\\' . )* '"'!
      ;
  </code></pre>
  
  <p>However in Antlr3 I can no longer do this as I get the error: </p>
  
  <pre><code>warning(149): Crv__.g:0:0: rewrite syntax or operator with no output option; setting output=AST
  </code></pre>
  
  <p>I don't know if I can use a rewrite rule here as I don't know how to write the match everything token '.'</p>
  
  <p>My only other thought is to grab the matched text and return it without the quotes, but I'm not sure how to do that as the token hasn't been created yet.</p>
  
  <p>I'm using the C Antlr runtime. 
  How can I accomplish this?</p>