fix: longestMatchFn: do not discard partial syntax tree of first overload

This commit is contained in:
Sebastian Ullrich 2021-04-04 23:59:03 +02:00
parent e5be9e7dd4
commit 6dc3e55c54
2 changed files with 2 additions and 5 deletions

View file

@ -1469,11 +1469,7 @@ def longestMatchFn (left? : Option Syntax) : List (Parser × Nat) → ParserFn
let startLhsPrec := s.lhsPrec
let startPos := s.pos
let s := runLongestMatchParser left? s.lhsPrec p.1.fn c s
if s.hasError then
let s := s.shrinkStack startSize
longestMatchFnAux left? startSize startLhsPrec startPos p.2 ps c s
else
longestMatchFnAux left? startSize startLhsPrec startPos p.2 ps c s
longestMatchFnAux left? startSize startLhsPrec startPos p.2 ps c s
def anyOfFn : List Parser → ParserFn
| [], _, s => s.mkError "anyOf: empty list"

View file

@ -6,6 +6,7 @@ tokenErrors.lean:14:0: error: unterminated comment
tokenErrors.lean:13:0-13:3: error: unexpected doc string
failed to pretty print term (use 'set_option pp.rawOnError true' for raw representation)
tokenErrors.lean:17:0: error: unterminated comment
tokenErrors.lean:16:0-16:6: error: unknown constant '[anonymous]'
inductive Nat : Type
constructors:
Nat.zero : Nat