lean4-htt/library/init/lean/message.lean
Sebastian Ullrich 0d865b37dd feat(library/init/lean/{message,parser}): enhance lean.message
Small regression: order of messages flipped, should eventually be sorted by
position
2018-09-08 18:37:58 -07:00

36 lines
843 B
Text

/-
Copyright (c) 2018 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Sebastian Ullrich
Message type used by the Lean frontend
-/
prelude
import init.data.string.basic
namespace lean
structure position :=
(line column : nat)
inductive message_severity
| information | warning | error
structure message :=
(pos : position)
(end_pos : option position := none)
(severity : message_severity := message_severity.error)
(caption : string := "")
(text : string)
def message_log := list message
namespace message_log
def add : message → message_log → message_log :=
list.cons
def has_errors (log : message_log) : bool :=
log.any $ λ m, match m.severity with
| message_severity.error := tt
| _ := ff
end message_log
end lean