Skip to content
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

Handle closing flow sequence after explicit key #295

Merged
merged 1 commit into from
May 7, 2024

Commits on May 6, 2024

  1. Handle closing flow sequence after explicit key

    Currently after an explicit flow key '?' in a flow sequence, an immediately
    following closing ] is ignored by the parser:
    
        % echo '[ ? ]' | ./tests/run-parser-test-suite --flow keep
        +STR
        +DOC
        +SEQ []
        +MAP {}
        =VAL :
        =VAL :
        -MAP
        Parse error: did not find expected ',' or ']'
        Line: 2 Column: 1
        % echo '[ ? ] ]' | ./tests/run-parser-test-suite --flow keep
        +STR
        +DOC
        +SEQ []
        +MAP {}
        =VAL :
        =VAL :
        -MAP
        -SEQ
        -DOC
        -STR
    
    It is read correctly by the scanner as a YAML_FLOW_SEQUENCE_END_TOKEN, and
    the flow_level is decreased. Then it is passed to the parser where it gets
    ignored.
    This leads to invalid YAML being accepted, and valid YAML resulting in an
    error.
    
    Also the flow_level is incorrectly decreased, so you can nest sequences
    like that without running in to the MAX_NESTING_LEVEL.
    perlpunk committed May 6, 2024
    Configuration menu
    Copy the full SHA
    588eabf View commit details
    Browse the repository at this point in the history