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

Faulty parsing of arrays that look like they might be strings #29

Open
dimbleby opened this issue Jul 28, 2021 · 2 comments · Fixed by tree-sitter-grammars/tree-sitter-yaml#3

Comments

@dimbleby
Copy link
Contributor

Sorry for the clumsy title!

foo: [
]

is successfully parsed by all the other parsers that I have found, as being equivalent to foo: []

But this parser says:

(ERROR
  (flow_node
    (plain_scalar
      (string_scalar))))
@char0n
Copy link

char0n commented Jul 29, 2021

Interestingly following is parsed correctly:

foo: [
 ]

One empty space makes difference here. There is actually a test case in corpus that demonstrate this empty space significance: https://github.com/ikatyang/tree-sitter-yaml/blob/master/corpus/spec.txt#L6869

@ikatyang any idea on this one? Thanks!

@rliebz
Copy link

rliebz commented Dec 22, 2021

Worth noting that we see the same thing with objects defined with a curly brace.

This parses correctly:

foo: {
 }

But this does not:

foo: {
}

rliebz added a commit to rliebz/tree-sitter-yaml that referenced this issue Mar 27, 2024
The commit as written does not include running tree-sitter generate.
Happy to run that if someone can point me to the documentation for how
that can be done for the current iteration of the repo.

Resolves: ikatyang#29
Relates-to: tree-sitter-grammars#2
rliebz added a commit to rliebz/tree-sitter-yaml that referenced this issue Mar 27, 2024
amaanq pushed a commit to tree-sitter-grammars/tree-sitter-yaml that referenced this issue Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants