title: Matching a "text" in line by line file with XText
body: <p>I try to write the Xtext BNF for Configuration files (known with the <code>.ini</code> extension)</p>
  
  <p>For instance, I'd like to successfully parse</p>
  
  <pre><code>[Section1]
  a = Easy123
  b = This *is* valid too
  
  [Section_2]
  c = Voilà # inline comments are ignored
  </code></pre>
  
  <p>My problem is matching the property value (what's on the right of the '=').</p>
  
  <p>My current grammar works if the property matches the <code>ID</code> terminal (eg <code>a = Easy123</code>). </p>
  
  <pre><code>PropertyFile hidden(SL_COMMENT, WS):
      sections+=Section*;
  
  Section:
      '[' name=ID ']'
      (NEWLINE properties+=Property)+
      NEWLINE+;
  
  Property:
      name=ID (':' | '=') value=ID ';'?;
  
  terminal WS:
      (' ' | '\t')+;
  
  terminal NEWLINE:
  // New line on DOS or Unix 
      '\r'? '\n';
  
  terminal ID:
      ('A'..'Z' | 'a'..'z') ('A'..'Z' | 'a'..'z' | '_' | '-' | '0'..'9')*;
  
  terminal SL_COMMENT:
  // Single line comment
      '#' !('\n' | '\r')*;
  </code></pre>
  
  <p>I don't know how to generalize the grammar to match any text (eg <code>c = Voilà</code>).</p>
  
  <p>I certainly need to introduce a new terminal
      Property:
          name=ID (':' | '=') value=TEXT ';'?;</p>
  
  <p>Question is: <em>how should I define this <code>TEXT</code> terminal?</em></p>
  
  <p>I have tried</p>
  
  <ul>
  <li><p><code>terminal TEXT: ANY_OTHER+;</code>
  This raises a warning </p>
  
  <blockquote>
    <p>The following token definitions can never be matched because prior tokens match the same input: RULE_INT,RULE_STRING,RULE_ML_COMMENT,RULE_ANY_OTHER</p>
  </blockquote>
  
  <p>(I think it doesn't matter).</p>
  
  <p><strong>Parsing Fails</strong> with </p>
  
  <blockquote>
    <p>Required loop (...)+ did not match anything at input 'à'</p>
  </blockquote></li>
  <li><p><code>terminal TEXT: !('\r'|'\n'|'#')+;</code>
  This raises a warning </p>
  
  <blockquote>
    <p>The following token definitions can never be matched because prior tokens match the same input: RULE_INT</p>
  </blockquote>
  
  <p>(I think it doesn't matter).</p>
  
  <p><strong>Parsing Fails</strong> with </p>
  
  <blockquote>
    <p>Missing EOF at [Section1]</p>
  </blockquote></li>
  <li><p><code>terminal TEXT: ('!'|'$'..'~');</code> (which covers most characters, except <code>#</code> and <code>"</code>) 
  No warning during the generation of the lexer/parser.
  However <strong>Parsing Fails</strong> with </p>
  
  <blockquote>
    <p>Mismatch input 'Easy123' expecting RULE_TEXT</p>
    
    <p>Extraneous input 'This'  expecting RULE_TEXT</p>
    
    <p>Required loop (...)+  did not match anything at 'is'</p>
  </blockquote></li>
  </ul>
  
  <p>Thanks for your help (and I hope this grammar can be useful for others too)</p>