alecthomas / alecthomas/participle

Proposal: Support grammar aliases.

オープン
#22 コメント 8 件 リアクション 2 件 担当者 0 名 GitHub で見る
proposal
主要言語
Go
スター
3.9k
フォーク
213
PR マージ指標
30日以内にマージされた PR はありません

説明

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`
}
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。