factor/basis/xml/errors/errors.factor

111 lines
2.3 KiB
Factor
Raw Normal View History

2007-09-20 18:09:08 -04:00
! Copyright (C) 2005, 2006 Daniel Ehrenberg
! See http://factorcode.org/license.txt for BSD license.
USING: accessors classes classes.tuple classes.tuple.parser
classes.tuple.private combinators generalizations kernel math
namespaces parser sequences vocabs.loader words xml.state ;
2007-09-20 18:09:08 -04:00
IN: xml.errors
<<
2009-01-21 00:54:33 -05:00
PREDICATE: generated-xml-error < tuple class-of "xml-error-class" word-prop ;
2009-01-21 00:54:33 -05:00
: define-xml-error-class ( class superclass slots -- )
{ "line" "column" } prepend error-slots {
[ define-tuple-class ]
[ 2drop reset-generic ]
[ 2drop t "error-class" set-word-prop ]
[ 2drop t "xml-error-class" set-word-prop ]
[
[
length 1 - nip dupd
[ [ get-line get-column ] swap ndip boa throw ]
2curry
]
[ 2drop all-slots 2 head* thrower-effect ] 3bi define-declared
]
} 3cleave ;
SYNTAX: XML-ERROR:
parse-tuple-definition pick save-location
define-xml-error-class ;
2009-01-21 00:54:33 -05:00
>>
XML-ERROR: expected should-be was ;
2009-01-21 00:54:33 -05:00
XML-ERROR: unexpected-end ;
XML-ERROR: missing-close ;
2009-01-21 00:54:33 -05:00
XML-ERROR: disallowed-char char ;
2009-01-21 00:54:33 -05:00
ERROR: multitags ;
ERROR: pre/post-content string pre? ;
XML-ERROR: no-entity thing ;
XML-ERROR: mismatched open close ;
2013-03-24 17:24:28 -04:00
ERROR: unclosed line column tags ;
2013-03-24 02:08:15 -04:00
: throw-unclosed ( -- * )
get-line get-column
xml-stack get rest-slice [ first name>> ] map
2013-03-24 17:24:28 -04:00
unclosed ;
XML-ERROR: bad-uri string ;
XML-ERROR: nonexist-ns name ;
! this should give which tag was unopened
XML-ERROR: unopened ;
XML-ERROR: not-yes/no text ;
2008-05-02 18:12:09 -04:00
! this should actually print the names
XML-ERROR: extra-attrs attrs ;
XML-ERROR: bad-version num ;
ERROR: notags ;
XML-ERROR: bad-prolog prolog ;
2009-01-15 17:35:55 -05:00
XML-ERROR: capitalized-prolog name ;
2009-01-15 17:35:55 -05:00
XML-ERROR: versionless-prolog ;
2009-01-15 17:35:55 -05:00
XML-ERROR: bad-directive dir ;
2009-01-19 23:25:15 -05:00
XML-ERROR: bad-decl ;
2009-01-19 23:25:15 -05:00
XML-ERROR: bad-external-id ;
2009-01-19 23:25:15 -05:00
XML-ERROR: misplaced-directive dir ;
2009-01-19 23:25:15 -05:00
XML-ERROR: bad-name name ;
2009-01-19 23:25:15 -05:00
XML-ERROR: unclosed-quote ;
2009-01-19 23:25:15 -05:00
XML-ERROR: quoteless-attr ;
2009-01-20 16:37:21 -05:00
XML-ERROR: attr-w/< ;
2009-01-20 16:37:21 -05:00
XML-ERROR: text-w/]]> ;
XML-ERROR: duplicate-attr key values ;
2009-01-21 00:54:33 -05:00
XML-ERROR: bad-cdata ;
XML-ERROR: not-enough-characters ;
2009-01-21 19:16:51 -05:00
XML-ERROR: bad-doctype contents ;
XML-ERROR: bad-encoding encoding ;
2009-03-18 19:32:34 -04:00
2009-01-26 17:11:30 -05:00
UNION: xml-error
unclosed multitags notags pre/post-content generated-xml-error ;
{ "xml.errors" "debugger" } "xml.errors.debugger" require-when