%x escape param optional %% <*>"\\"/[{}()] { this.begin("escape"); } [{}()] { this.popState(); return "STRING"; } <*>"\\"/![{}()] { return "STRING"; } <*>[^{}()\\]+ { return "STRING"; } <*>"{" { this.begin("param"); return "OPEN_PARAM"; } <*>"(" { this.begin("optional"); return "OPEN_OPTIONAL"; } "}" { this.popState(); return "CLOSE"; } ")" { this.popState(); return "CLOSE"; } "}"|")" { return "STRING"; } <> { return 'EOF'; }