2009-03-28 05:19:02 -04:00
|
|
|
! Copyright (C) 2007, 2009 Slava Pestov.
|
2007-12-28 22:51:36 -05:00
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2009-04-18 04:21:31 -04:00
|
|
|
USING: accessors source-files.errors kernel namespaces assocs ;
|
2007-12-28 22:51:36 -05:00
|
|
|
IN: compiler.errors
|
|
|
|
|
2009-04-10 04:52:12 -04:00
|
|
|
TUPLE: compiler-error < source-file-error ;
|
2009-03-28 05:19:02 -04:00
|
|
|
|
2009-04-12 17:08:46 -04:00
|
|
|
M: compiler-error error-type error>> error-type ;
|
2009-03-28 05:19:02 -04:00
|
|
|
|
2007-12-28 22:51:36 -05:00
|
|
|
SYMBOL: compiler-errors
|
|
|
|
|
2009-03-28 05:19:02 -04:00
|
|
|
compiler-errors [ H{ } clone ] initialize
|
|
|
|
|
2009-04-11 23:26:24 -04:00
|
|
|
SYMBOLS: +compiler-error+ +compiler-warning+ +linkage-error+ ;
|
|
|
|
|
2008-02-10 21:32:48 -05:00
|
|
|
: errors-of-type ( type -- assoc )
|
2007-12-28 22:51:36 -05:00
|
|
|
compiler-errors get-global
|
2009-04-12 17:08:46 -04:00
|
|
|
swap [ [ nip error-type ] dip eq? ] curry
|
2008-04-26 00:12:44 -04:00
|
|
|
assoc-filter ;
|
2007-12-28 22:51:36 -05:00
|
|
|
|
2009-04-12 17:08:46 -04:00
|
|
|
T{ error-type
|
|
|
|
{ type +compiler-error+ }
|
|
|
|
{ word ":errors" }
|
|
|
|
{ plural "compiler errors" }
|
|
|
|
{ icon "vocab:ui/tools/error-list/icons/compiler-error.tiff" }
|
|
|
|
{ quot [ +compiler-error+ errors-of-type values ] }
|
2009-04-15 01:27:02 -04:00
|
|
|
{ forget-quot [ compiler-errors get delete-at ] }
|
2009-04-12 17:08:46 -04:00
|
|
|
} define-error-type
|
|
|
|
|
|
|
|
T{ error-type
|
|
|
|
{ type +compiler-warning+ }
|
|
|
|
{ word ":warnings" }
|
|
|
|
{ plural "compiler warnings" }
|
|
|
|
{ icon "vocab:ui/tools/error-list/icons/compiler-warning.tiff" }
|
|
|
|
{ quot [ +compiler-warning+ errors-of-type values ] }
|
2009-04-15 01:27:02 -04:00
|
|
|
{ forget-quot [ compiler-errors get delete-at ] }
|
2009-04-12 17:08:46 -04:00
|
|
|
} define-error-type
|
|
|
|
|
|
|
|
T{ error-type
|
|
|
|
{ type +linkage-error+ }
|
|
|
|
{ word ":linkage" }
|
|
|
|
{ plural "linkage errors" }
|
|
|
|
{ icon "vocab:ui/tools/error-list/icons/linkage-error.tiff" }
|
|
|
|
{ quot [ +linkage-error+ errors-of-type values ] }
|
2009-04-15 01:27:02 -04:00
|
|
|
{ forget-quot [ compiler-errors get delete-at ] }
|
2009-04-17 17:16:12 -04:00
|
|
|
{ fatal? f }
|
2009-04-12 17:08:46 -04:00
|
|
|
} define-error-type
|
2008-02-10 21:32:48 -05:00
|
|
|
|
2009-03-28 05:19:02 -04:00
|
|
|
: <compiler-error> ( error word -- compiler-error )
|
2009-04-11 21:30:09 -04:00
|
|
|
\ compiler-error <definition-error> ;
|
2009-03-28 05:19:02 -04:00
|
|
|
|
2008-07-28 23:03:13 -04:00
|
|
|
: compiler-error ( error word -- )
|
2009-03-28 05:19:02 -04:00
|
|
|
compiler-errors get-global pick
|
2009-04-15 01:27:02 -04:00
|
|
|
[ [ [ <compiler-error> ] keep ] dip set-at ] [ delete-at drop ] if ;
|
2009-04-20 23:05:41 -04:00
|
|
|
|
|
|
|
ERROR: not-compiled word error ;
|