add BADCHARSET support#9
Merged
Merged
Conversation
03955e7 to
41c2aca
Compare
This could lead to unexpected bugs if `@next_token` was filled using one parser and lookahead is called with an incompatible parser, so I've made that an error. All matches that set lex_state should be immediately preceded by a "match" or "shift_token". Probably better would be to push/pop on a `lex_state` stack.
These are mostly useful when violating the RFCs, in order to workaround servers that violate the RFCs.
This encapsulates the `@lex_state` change.
Specifically, "text" is allowed to begin with "[" or "=". Disallowing that was an older RFC2060 restriction. (RFC 2060 was written in 1996. RFC 3501 in 2003) :)
`accept` can be used to replace `lookahead` + check `token.symbol` + `shift_token`. It's not being used here, but has been separated out into its own commit to reduce merge conflicts from multiple branches which use it.
`astring_chars` roughly matches the RFC2060 definition of `atom`, and is used by RFC3501's `astring`. `atom` matches the RFC3501 definition. Although nothing in the parser currently uses `atom`, future commits will update use it where it's used by RFC3501, RFC4466, etc. Made a helper method, `combine_adjacent` which is used by both `atom` and `astring_chars` to combine adjacent tokens into a single string. It would probably be better to update the lexer regexps, possibly using negative lookahead assertions, so that it returns a single token.
Always returns an array, even if empty.
41c2aca to
dcee03e
Compare
Member
|
@nevans I've merged it. Thank you! |
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Although RFC3501 defined the charset as
astring, the RFC3501 Errata (and RFC4466 too) updatescharsetto beatom / quoted.I was having a hard time extracting this one from my codebase without creating lots of merge conflicts. So instead of making it narrowly self-contained PR, I built it on top of #6 and #8. The entire unique PR is contained in 41c2aca and everything before that commit belongs to those other two PRs.