alecthomas / alecthomas/participle
Proposal: Support grammar aliases.
- Lingua principale
- Go
- Stelle
- 3.9k
- Fork
- 213
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
In moderately complex grammars it's fairly common to see duplicate patterns emerge. For example, when matching a dot-separated identifier (eg. `foo.bar`) the pattern `(Ident { "." Ident })` is used repeatedly. This can be handled by a Go type alias implementing the `Parseable` interface, but that is quite onerous.
I propose adding support for grammar aliases. Here's an example creating and using an `Identifier` alias:
```go
type Assignment struct {
Name string `@Identifier=(Ident { "." Ident })`
Variable string `"=" @Identifier`
}
```
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.