-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Make it possible to inline Go syntax into pattern templates.
For example:
(map [\ident] (expr "map[string]interface{}"))
// matches:
// map[A]map[string]interface{}
// map[B]map[string]interface{}
// etc...
(block \... (stmt "x := foo().bar().baz()") \...)
// matches:
// {x := foo().bar().baz()}
// {f(); x := foo().bar().baz()}
// {f(); g(); x := foo().bar().baz(); y--}
// etc...
The idea is to simplify some literal sub-patterns.
This syntax does not deprecate any existing ways to describe patterns as it lacks
many features like captures, \... wildcards, etc.
The change itself requires patterns expr to become overloaded with additional form that expects single literal string argument.
If Go parser fails to resolve AST for that sub-pattern, whole pattern compilation fails.
stmt and decl patterns may have same feature somewhere in future, but not it's unclear if this is as important as for expressions.
Metadata
Metadata
Assignees
Labels
No labels