[2.6] Backport parser fixes from 3.3.0 #325
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note that this DOES NOT implement identical parsing to in 3.x. Every attempt has been made to ensure this backport behaves exactly as in 2.5.x, and also allows cases that previously crashed in 2.5.x, being as lenient as possible (where identical case in 3.3.x will hard fail).
This fixes the example from #332.
How does this differ from the parsing in 3.3+:
Example 1:
2.5: parses as
#foo
2.6: parses as
#foo
3.2: parses as
#foo
(considered a bug in the 3.x series)3.3: parses as the empty string
Example 2:
2.5: parses as the empty string
2.6: parses as the empty string
3.2: parses as the empty string
3.3: parses as the empty string
Example 3:
2.5: parses as
#foo
2.6: parses as
#foo
3.2: parses as
#foo
3.3: parses as
#foo
Example 4:
2.5: fails silently
2.6: parses as
iiiiviiiixiiiiviiii\n
3.2: fails with an obscure preg error
3.3: fails saying invalid escape sequence
Example 5:
2.5: parses as
iiiiviiiixiiiiviiii\n
2.6: parses as
iiiiviiiixiiiiviiii\n
3.2: parses as
iiiiviiiixiiiiviiii\n
3.3: parses as
iiiiviiiixiiiiviiii\n