ikatyang / tree-sitter-yaml

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

CST and literals #9

Closed char0n closed 3 years ago

char0n commented 3 years ago

Hi @ikatyang,

I was wondering if the CST that tree-sitter-yaml produces could additionally contain literals like :.

Having a following yaml

openapi: 3.1.0

I'd expect CST to contain the : literal as a SyntaxNode with a location information. Currently literals are consumed by the grammar. For example tree-sitter-json does provide literals as SyntaxNodes within CST.

Thank you

char0n commented 3 years ago

@ikatyang not sure I see a difference in CST. What has actually changed ? Thanks!

ikatyang commented 3 years ago

They are now anonymous nodes, and you can verify it by enabling "Query" in the playground:

image

char0n commented 3 years ago

Hm interesting. This is what I see:

image

I've used Incognito Chrome window to eliminate any cache problems.

char0n commented 3 years ago

I do confirm though, that I'm seeing anonymous nodes when building tree-sitter-yaml@0.2.0 locally. Great job!