title: parser combinator: how to terminate repetition on keyword
body: <p>I'm trying to figure out how to terminate a repetition of words using a keyword. An example:</p>
  
  <pre><code>class CAQueryLanguage extends JavaTokenParsers {
      def expression = ("START" ~ words ~ "END") ^^ { x =&gt;
          println("expression: " + x);
          x
      }
      def words = rep(word) ^^ { x =&gt;
          println("words: " + x)
          x
      }
      def word = """\w+""".r
  }
  </code></pre>
  
  <p>When I execute</p>
  
  <pre><code>val caql = new CAQueryLanguage
  caql.parseAll(caql.expression, "START one two END")
  </code></pre>
  
  <p>It prints <code>words: List(one, two, END)</code>, indicating the <code>words</code> parser has consumed the <code>END</code> keyword in my input, leaving the expression parser unable to match. I would like <code>END</code> to not be matched by <code>words</code>, which will allow <code>expression</code> to successfully parse.</p>