fix(library/init/lean/parser/parser): symbolNoWs was not creating an atom

This commit is contained in:
Leonardo de Moura 2019-08-08 10:41:40 -07:00
parent 7a89d45391
commit 74c46d2b35

View file

@ -974,7 +974,16 @@ def symbolNoWsInfo (sym : String) (lbpNoWs : Option Nat) : ParserInfo :=
@[inline] def symbolNoWsFnAux (sym : String) (errorMsg : String) : ParserFn trailing :=
fun left c s =>
if checkTailNoWs left then
strAux sym errorMsg 0 c s
let startPos := s.pos;
let input := c.input;
let s := strAux sym errorMsg 0 c s;
if s.hasError then s
else
let leading := mkEmptySubstringAt input startPos;
let stopPos := startPos + sym.bsize;
let trailing := mkEmptySubstringAt input stopPos;
let atom := mkAtom { leading := leading, pos := startPos, trailing := trailing } sym;
s.pushSyntax atom
else
s.mkError errorMsg