Skip to content

Add support for BlockStrings #131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 6, 2021
Merged

Add support for BlockStrings #131

merged 5 commits into from
Jul 6, 2021

Conversation

Shane32
Copy link
Member

@Shane32 Shane32 commented Jun 28, 2021

As a BlockString is a form of a StringValue, no changes were made to the public API. A BlockString is allowed anywhere a StringValue is accepted, pursuant to the current (June 2018) specification.

Considering the scope of the change, I propose that the version number be bumped to 7.2.0, even though there are no public API changes.

The new ReadBlockString() method first reads the string, unescaping \""" to """ and replacing line termination sequences with \n. Then the string value is passed to a secondary method (a static local function) to strip leading and trailing blank lines and unindent the text if needed, all according to spec. If the string is small enough, both of these allocations occur on the stack. For larger sequences, heap allocation may be necessary. A multitude of tests are added to cover the range of indenting scenarios and so on that are provided for by the spec.

@Shane32 Shane32 self-assigned this Jun 28, 2021
@github-actions github-actions bot added the test Pull request that adds new or changes existing tests label Jun 28, 2021
@Shane32 Shane32 requested a review from sungam3r June 28, 2021 18:22
@Shane32 Shane32 added enhancement New feature or request and removed test Pull request that adds new or changes existing tests labels Jun 28, 2021
@Shane32 Shane32 merged commit 69342d5 into master Jul 6, 2021
@Shane32 Shane32 deleted the blockstring branch July 6, 2021 14:22
@Shane32
Copy link
Member Author

Shane32 commented Jul 6, 2021

I merged this as there has not been any comments on it in a week.

@sungam3r
Copy link
Member

sungam3r commented Nov 5, 2021

Great job! I will make PR with cosmetic edits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants