lean4-htt/src/Lean/Parser
Leonardo de Moura 578b3b822f fix: do not use nullKind for group combinator
We use `nullKind` for the `group` parser combinator.
When pattern matching `nullKind` nodes, we check their arities.
So, error recovery often fails for parsers that use the `group`
combinator.
For example, we have the parser
```
def whereDecls := leading_parser "where " >> many1Indent (group (letRecDecl >> optional ";"))
```
If there is syntax error at `letRecDecl`, the node corresponding to
```
group (letRecDecl >> optional ";")
```
will contain only one child, and the pattern matching at
```
def expandWhereDecls (whereDecls : Syntax) (body : Syntax) : MacroM Syntax :=
  match whereDecls with
  | `(whereDecls|where $[$decls:letRecDecl $[;]?]*) => `(let rec $decls:letRecDecl,*; $body)
  | _ => Macro.throwUnsupported
```
fails, and we can't elaborate the partial syntax tree for
`letRecDecl`, and auto-completion will not work there.

We address this issue by using a new kind for the `group` combinator.
The idea is to pattern match `group` as we pattern match `node`s with
proper syntax node kinds. This change is consistent with the way we
use `group` where it mainly a convenience for saving us the trouble of
defining a new parser definition that is used only once.
2021-04-07 22:30:51 -07:00
..
Attr.lean chore: remove parser! and tparser! 2021-03-11 09:36:58 -08:00
Basic.lean fix: error recovery at sepBy combinator 2021-04-05 18:38:57 -07:00
Command.lean fix: error recovery 2021-03-31 17:05:34 -07:00
Do.lean feat: introduce arg precedence 2021-03-22 16:33:37 +01:00
Extension.lean chore: implement lhs prec 2021-03-22 16:33:37 +01:00
Extra.lean fix: do not use nullKind for group combinator 2021-04-07 22:30:51 -07:00
Level.lean chore: remove parser! and tparser! 2021-03-11 09:36:58 -08:00
Module.lean fix: ignore syntactically incorrect commands that do not contain any symbol 2021-04-07 14:46:13 -07:00
StrInterpolation.lean feat: nicer token parse errors 2021-03-14 08:23:32 -07:00
Syntax.lean chore: remove parser! and tparser! 2021-03-11 09:36:58 -08:00
Tactic.lean chore: remove parser! and tparser! 2021-03-11 09:36:58 -08:00
Term.lean chore: make it clear that implementation relies on the fact that both branches of the if-then-else generate a node with the same kind 2021-04-07 22:02:17 -07:00