Basic documentation of Node Pattern
jodosha opened this issue ยท 1 comments
๐ Hey all, thanks for this amazing tool.
I'm opening this issue after speaking privately with @bbatsov.
Could you please cover in documentation the basics of how to compose a pattern?
Existing examples like the following give hints on how patterns should be composed, but often the intuitions don't work, leading frustrating trial and error sessions.
(_type int _ str)
I assume that the first token in a pattern is the type, that should correspond to the node type (e.g. send
), but what's next? Why often do I see nil?
right after? What's $...
? Probably a variadic capture.
Could you please help covering the basics of patterns? Thank you ๐
I'm sorry you're having difficulty with the node patterns.
There's certainly room for improvement in the docs.
The doc you referred to is about the compiler, but you should look the doc on the patterns.
The doc should probably start with a basic introduction, in particular of what is a "sequence": a node pattern that describes the sequence of children of a node (and its type): (type first_child second_child ...)
I believe that all you other answers are covered in the doc