title: Parsing input string with antlr grammar
body: <p>I have a following problem with the grammar:</p>
  
  <p>The input string i'm going to parse is as follows:</p>
  
  <pre><code>ruledef COMPLEX1 
      ftp command args = abc
      ftp command args = ftp
      ftp command args = cde
  exit
  </code></pre>
  
  <p>The grammar i use:</p>
  
  <pre><code>grammar main;
  
  /*Lexical*/
  NUM : [0-9]+;
  STRING : [0-9a-zA-Z]+;
  WS : [ \t\r\n]+ -&gt; skip; // Whitespace definition: skip spaces, tabs and newlines
  
  ruledefrule: 'ruledef' STRING (ruledef_ftpcommandargsrule )* 'exit';
  ruledef_ftpcommandargsrule: 'ftp' 'command' 'args' '=' STRING ;
  </code></pre>
  
  <p>When i run it through antlr i receive an error:</p>
  
  <pre><code>line 3:23 missing STRING at 'ftp'
  </code></pre>
  
  <p>What is more any of the words used in the input for example 'command' or 'args' causes the same problem.</p>
  
  <pre><code>ftp command args = ftp
  ftp command args = args
  ftp command args = command
  </code></pre>
  
  <p>Does anybody know how to deal with that kind of problems?</p>