title: Fully qualified names failing to be recognised correctly with valid grammar
body: <p>I've got a basic ANTLR-4 grammar at the moment in my Eclipse IDE for Java, and have the following:</p>
  
  <pre><code>// Parser
  
  importDeclaration:
      'use' name=FQN ';'
  ;
  
  // Lexer and terminals
  
  fragment LETTER: [a-zA-Z_];
  fragment LETTER_OR_DIGIT: [a-zA-Z0-9_];
  ID: LETTER LETTER_OR_DIGIT*;
  FQN: ID ('.' ID)*;
  
  WS: [ \t\r\n]+ -&gt; skip ; // skip spaces, tabs, newlines
  COMMENT: '/*' .*? '*/' -&gt; channel(HIDDEN);
  LINE_COMMENT: '//' ~[\r\n]* -&gt; channel(HIDDEN);
  </code></pre>
  
  <p>Hopefully a short and sweet question, when I do the following:</p>
  
  <pre><code>use test;
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>line 1:4 mismatched input 'test' expecting FQN
  </code></pre>
  
  <p>And <code>name</code> throws a <code>NullPointerException</code> if I try to use it.<br>
  Except it works fine when I do:</p>
  
  <pre><code>use test.test;
  </code></pre>
  
  <p>This has to do with the <code>('.' ID)*</code> portion, but have no idea <em>why</em> it's happening.</p>
  
  <p>Any ideas?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Just realised my code was wrong, had <code>(FQN|ID)</code> which was my bad workaround. Fixed it now.</p>