syntax: Fix complexity of string parsing. Closes #16624.

Note that this contains a 9.5MB test file, but it should compress thoroughly.