feat: use truncateTrailing at error messages

This commit is contained in:
Leonardo de Moura 2020-01-22 16:19:07 -08:00
parent ae84270226
commit 1ff7950a77
2 changed files with 6 additions and 1 deletions

View file

@ -10,7 +10,7 @@ import Init.Lean.Parser
namespace Lean
def Syntax.prettyPrint (stx : Syntax) : Format :=
match stx.reprint with -- TODO use syntax pretty printer
match stx.truncateTrailing.reprint with -- TODO use syntax pretty printer
| some str => format str.toFormat
| none => format stx

View file

@ -236,6 +236,11 @@ match setTailInfoAux info stx with
| some stx => stx
| none => stx
def truncateTrailing (stx : Syntax) : Syntax :=
match stx.getTailInfo with
| none => stx
| some info => stx.setTailInfo info.truncateTrailing
private def reprintLeaf : Option SourceInfo → String → String
-- no source info => add gracious amounts of whitespace to definitely separate tokens
-- Note that the proper pretty printer does not use this function.