]> gitweb.factorcode.org Git - factor.git/blob - extra/io/encodings/strict/strict.factor
Merge branch 'master' of git://factorcode.org/git/factor
[factor.git] / extra / io / encodings / strict / strict.factor
1 ! Copyright (C) 2008 Daniel Ehrenberg
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: io.encodings kernel accessors summary ;
4 IN: io.encodings.strict
5
6 TUPLE: strict code ;
7 C: strict strict
8
9 TUPLE: decode-error ;
10 : decode-error ( -- * ) \ decode-error new throw ;
11 M: decode-error summary
12     drop "Error in decoding input stream" ;
13
14 M: strict <decoder>
15     code>> <decoder> [ strict ] change-code ;
16
17 M: strict decode-char
18     code>> decode-char dup replacement-char = [ decode-error ] when ;