Please sign in to comment.
Fix pathological backtracking in cfws, quoted strings
This reprises 0ed9339, more broadly. Backtracking is only necessary when parsing of a token could be ambiguous -- and the BNF for email address is many things, but thankfully is essentially never ambiguous. Alter `cfws` to mean "one or more comments, or just space" -- since comments include space, this is no loss in generality over `(comment|space)*`. Using this phrasing prevents backtracking into the `cwfs` token, which is key because of the nested nature of the comments regex therein. Changing the `atom` definition is the only one strictly necessary to resolve this particular case, but greediness is applied throughout, for safety.
- Loading branch information...