lexer: Generalize lex_match_phrase() to handle any syntax.