ikatyang / tree-sitter-yaml

YAML grammar for tree-sitter
https://ikatyang.github.io/tree-sitter-yaml/
MIT License
94 stars 38 forks source link

Issue: Loss of Values When Using Quotations in YAML #58

Open LuisPatino92 opened 8 months ago

LuisPatino92 commented 8 months ago

Hello,

The YAML cookbook outlines scenarios where quotations are necessary. Currently, the parser is losing values in certain cases.

Correct case:

For input like turtle-doves: two, the parser produces the expected result: Correct Case

Problematic case:

Input like wildcard_in_double_quotes: "*" results in data loss: Problematic Case

Additional problematic case:

Input:

  CustomStatements:
    [
      {
        "Effect": "Allow",
        "Principal": "*",
        "Action": "execute-api: Invoke",
        "Resource": ["execute-api: /*"],
      },
    ]

Produces these leaves inside a big mapping branch: Additional Problematic Case

The desired output should resemble: Desired Output

I would be more than happy to contribute a fix for this issue. If given the green light, I'll proceed with opening a pull request to address these concerns.