parser: preserve YAML front matter in specification files - #2890
Draft
Huruikagi wants to merge 2 commits into
Draft
parser: preserve YAML front matter in specification files#2890Huruikagi wants to merge 2 commits into
Huruikagi wants to merge 2 commits into
Conversation
Signed-off-by: huruikagi <huruikagi@gmail.com>
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.
Refs #2885
Summary
Adds support for preserving YAML Front Matter at the beginning of Gauge specification files.
The implementation does not parse or validate YAML. When the first line is
---, the lexer treats everything through the matching closing---as opaqueCommentKinditems, then resumes normal Gauge parsing.Behavior
The Front Matter is preserved by
gauge format, while Gauge syntax inside the block is not interpreted.Source line numbers for specifications, scenarios, and steps are also preserved.
Existing setext-style Scenario headings using
---outside Front Matter continue to work as before.Compatibility note
This change also preserves ordinary comments that appear before the Spec heading in their original position.
Currently, the formatter moves such comments after the Spec heading. Since the proof-of-concept represents Front Matter as ordinary comments internally, preserving Front Matter also changes that existing formatter behavior.
Validation
Verified with:
Both pass successfully.