| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | ! Copyright (C) 2005, 2006 Daniel Ehrenberg | 
					
						
							|  |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | 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 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | << | 
					
						
							| 
									
										
										
										
											2009-01-21 00:54:33 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | PREDICATE: generated-xml-error < tuple class-of "xml-error-class" word-prop ;
 | 
					
						
							| 
									
										
										
										
											2009-01-21 00:54:33 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04: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 ;
 | 
					
						
							| 
									
										
										
										
											2011-01-29 00:09:09 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | SYNTAX: XML-ERROR: | 
					
						
							|  |  |  |     parse-tuple-definition pick save-location | 
					
						
							|  |  |  |     define-xml-error-class ;
 | 
					
						
							| 
									
										
										
										
											2009-01-21 00:54:33 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | >> | 
					
						
							| 
									
										
										
										
											2011-01-29 00:09:09 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: expected should-be was ;
 | 
					
						
							| 
									
										
										
										
											2009-01-21 00:54:33 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: unexpected-end ;
 | 
					
						
							| 
									
										
										
										
											2011-01-29 00:09:09 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: missing-close ;
 | 
					
						
							| 
									
										
										
										
											2009-01-21 00:54:33 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: disallowed-char char ;
 | 
					
						
							| 
									
										
										
										
											2009-01-21 00:54:33 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 20:59:16 -05:00
										 |  |  | ERROR: multitags ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ERROR: pre/post-content string pre? ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: no-entity thing ;
 | 
					
						
							| 
									
										
										
										
											2008-12-02 20:59:16 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: mismatched open close ;
 | 
					
						
							| 
									
										
										
										
											2008-12-02 20:59:16 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-12 22:59:40 -04:00
										 |  |  | TUPLE: unclosed line column tags ;
 | 
					
						
							| 
									
										
										
										
											2008-12-02 20:59:16 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-24 02:08:15 -04:00
										 |  |  | : throw-unclosed ( -- * )
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  |     get-line get-column | 
					
						
							|  |  |  |     xml-stack get rest-slice [ first name>> ] map
 | 
					
						
							| 
									
										
										
										
											2015-08-13 03:04:16 -04:00
										 |  |  |     unclosed boa throw ;
 | 
					
						
							| 
									
										
										
										
											2008-12-02 20:59:16 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: bad-uri string ;
 | 
					
						
							| 
									
										
										
										
											2008-12-02 20:59:16 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: nonexist-ns name ;
 | 
					
						
							| 
									
										
										
										
											2008-12-02 20:59:16 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-29 00:09:09 -05:00
										 |  |  | ! this should give which tag was unopened | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: unopened ;
 | 
					
						
							| 
									
										
										
										
											2008-12-02 20:59:16 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: not-yes/no text ;
 | 
					
						
							| 
									
										
										
										
											2008-12-02 20:59:16 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-05-02 18:12:09 -04:00
										 |  |  | ! this should actually print the names | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: extra-attrs attrs ;
 | 
					
						
							| 
									
										
										
										
											2008-12-02 20:59:16 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: bad-version num ;
 | 
					
						
							| 
									
										
										
										
											2008-12-02 20:59:16 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | ERROR: notags ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: bad-prolog prolog ;
 | 
					
						
							| 
									
										
										
										
											2009-01-15 17:35:55 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: capitalized-prolog name ;
 | 
					
						
							| 
									
										
										
										
											2009-01-15 17:35:55 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: versionless-prolog ;
 | 
					
						
							| 
									
										
										
										
											2009-01-15 17:35:55 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: bad-directive dir ;
 | 
					
						
							| 
									
										
										
										
											2009-01-19 23:25:15 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: bad-decl ;
 | 
					
						
							| 
									
										
										
										
											2009-01-19 23:25:15 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: bad-external-id ;
 | 
					
						
							| 
									
										
										
										
											2009-01-19 23:25:15 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: misplaced-directive dir ;
 | 
					
						
							| 
									
										
										
										
											2009-01-19 23:25:15 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: bad-name name ;
 | 
					
						
							| 
									
										
										
										
											2009-01-19 23:25:15 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: unclosed-quote ;
 | 
					
						
							| 
									
										
										
										
											2009-01-19 23:25:15 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: quoteless-attr ;
 | 
					
						
							| 
									
										
										
										
											2009-01-20 16:37:21 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: attr-w/< ;
 | 
					
						
							| 
									
										
										
										
											2009-01-20 16:37:21 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: text-w/]]> ;
 | 
					
						
							| 
									
										
										
										
											2011-01-29 00:09:09 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: duplicate-attr key values ;
 | 
					
						
							| 
									
										
										
										
											2009-01-21 00:54:33 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: bad-cdata ;
 | 
					
						
							| 
									
										
										
										
											2011-01-29 00:09:09 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: not-enough-characters ;
 | 
					
						
							| 
									
										
										
										
											2009-01-21 19:16:51 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: bad-doctype contents ;
 | 
					
						
							| 
									
										
										
										
											2011-01-29 00:09:09 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  | XML-ERROR: bad-encoding encoding ;
 | 
					
						
							| 
									
										
										
										
											2009-03-18 19:32:34 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-26 17:11:30 -05:00
										 |  |  | UNION: xml-error | 
					
						
							| 
									
										
										
										
											2012-07-20 16:38:38 -04:00
										 |  |  |     unclosed multitags notags pre/post-content generated-xml-error ;
 | 
					
						
							| 
									
										
										
										
											2011-01-29 00:09:09 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | { "xml.errors" "debugger" } "xml.errors.debugger" require-when |