Friendlier grouping/clumping error message

db4
Jon Harper 2012-10-28 13:50:16 +01:00 committed by Doug Coleman
parent 1cdd080445
commit 40ca3fc7f3
2 changed files with 6 additions and 3 deletions

View File

@ -10,7 +10,7 @@ classes compiler.units generic.standard generic.single vocabs
init kernel.private io.encodings accessors math.order
destructors source-files parser classes.tuple.parser
effects.parser lexer generic.parser strings.parser vocabs.loader
vocabs.parser source-files.errors ;
vocabs.parser source-files.errors grouping ;
IN: debugger
GENERIC: error-help ( error -- topic )
@ -220,6 +220,8 @@ M: slice-error summary
M: bounds-error summary drop "Sequence index out of bounds" ;
M: groups-error summary drop "Non positive group size" ;
M: condition error. error>> error. ;
M: condition summary error>> summary ;

View File

@ -4,6 +4,7 @@ USING: kernel math math.order strings arrays vectors sequences
sequences.private accessors fry combinators ;
IN: grouping
ERROR: groups-error seq group-size ;
<PRIVATE
MIXIN: chunking
@ -53,8 +54,8 @@ M: abstract-clumps group@
TUPLE: chunking-seq { seq read-only } { n read-only } ;
: check-groups ( n -- n )
dup 0 <= [ "Invalid group count" throw ] when ; inline
: check-groups ( seq n -- seq n )
dup 0 <= [ groups-error ] when ; inline
: new-groups ( seq n class -- groups )
[ check-groups ] dip boa ; inline