alecthomas / alecthomas/participle
Proposal: Support grammar aliases.
- Lenguaje dominante
- Go
- Estrellas
- 3.9k
- Forks
- 213
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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`
}
```
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.