title: Ignoring whitespace in ANTLRworks
body: <p>I have the following ANTLR grammar:</p>
  
  <pre><code>grammar mygrammar;
  
  ASSIGNMENT 
      :   ID '=' INT
      ;
  
  ID  :   ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*
      ;
  
  INT :   '0'..'9'+
      ;
  
  WS  :   ( ' '
          | '\t'
          | '\r'
          | '\n'
          ) {$channel=HIDDEN;}
      ;
  </code></pre>
  
  <p>Only the ASSIGNMENT rule is actually mine, the rest are defaults added by ANTLRWorks 1.4.3.</p>
  
  <p>When I come to try the grammar in the interpreter, strings such as "a=5" succeed, but strings such as "b[space]=[space]6" fail: I get a MismatchedTokenException because of the spaces:</p>
  
  <p><img src="https://i.stack.imgur.com/cCtmq.png" alt="Picture of the interface with a MismatchedTokenException"></p>
  
  <p>From reading the ANTLR website, and the <pre>Ignore rules: WS</pre> and <pre>{$channel=HIDDEN}</pre> text/grammar rule, it seems the whitespace should be ignored, however this is not the case.</p>
  
  <p>What am I doing wrong?</p>