I am using the pegjs parser generator for a project and I am having difficulty creating a grammar that should match all words up until a collection of words that it should not match. as an example in the string "the door is yellow" I want to be able to match all words up until is, tell the pegjs parser to start parsing from the word is. The collection of words I want to the parser to break on are "is" "has" and "of".
current grammar rule is as follows:
subject "sub" =
s:[a-zA-Z ]+ { return s.join("").trim()}
How can i create a look ahead that stops the parser from including my collection on words?
(!of|is|has)