Implement tagged literals for IDL 2.1#3047
Draft
sugmanue wants to merge 1 commit into
Draft
Conversation
Contributor
|
This pull request does not contain a staged changelog entry. To create one, use the Make sure that the description is appropriate for a changelog entry and that the proper feature type is used. See |
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.
Background
These changes are expected to be part of the IDL 2.1 changes planed. For now, it adds support for "tagged literals" which allows a literal to be prefixed with a tag that will modify the way the literal is parsed and the resulting token. This change implements:
#b <string>Similar to b-strings in Python signals that the string contains binary data that can be composed by hex or octal escapes or literal values. The resulting token will be the string base64 encoded.#hex <string>Similar to a hex dump string that contains hexadecimal values, spaces are ignored and strings starting with#are consider comments and ignored until the end of line.#timestamp <string>This tag converts that given ISO encoded date to Smithy's epoch second with millis precision.#re <string>Takes backslashes as literal chars instead of escape sequences allowing writing regular expressions with character classes without having to escape the slashes.A model that uses all of that is shown below: