alex / alex/rply

Recursion in parser rules

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

説明

I'm unsure of how recursion works in parser rules, I assumed it would be similar to `ply`, but this does not work:
```py
@self.production("struct : STRUCT IDENT (IDENT COLON IDENT (COMMA IDENT COLON IDENT)*)?")
def struct(tokens: list[Token]):
...
```
This would match the following text:
```
struct Foo {}
struct Bar {
one: String,
two: i32
}
```

This produces: `KeyError: '(IDENT'` pointing to `rply\grammar.py` line 148: `for p in self.prod_names[n]:`

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

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

評価

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

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

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