mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +03:00
034bb562d4
This patch adds the `Matcher` monad, which is capable of filtering any recursive data structure, bottom-up, yielding a list of (or an optional) result. These functions are probably going to be used over `Term` values, so API is provided to wrap common projection functions. The API was more or less copied directly from that of Clang's AST matching facilities. There are a lot of things we can do in the future: * Binding results yielded in matchers to associated names, for future transformation stages to look up and modify. * Actual transformation stages. * Optimizations. This is not very fast. A million thanks to @robrix, whose sage advice managed to turn my kooky idea for an API into something really special and exciting.
10 lines
119 B
Go
10 lines
119 B
Go
package main
|
|
|
|
func merle() {
|
|
for ii := 0; ii < 10; ii+=1 {
|
|
for jj := 0; jj < 10; jj+=1 {
|
|
print(ii + jj)
|
|
}
|
|
}
|
|
}
|