xml: Word names like foo]] are not allowed.
Names like foo]] are alternative syntax for closing foo[ ] forms, e.g. foo[ foo]. foo]] parses as a foo] closer and then another ]modern-harvey2
							parent
							
								
									c3e137c08a
								
							
						
					
					
						commit
						341f2c3307
					
				| 
						 | 
				
			
			@ -30,7 +30,7 @@ T{ bad-name f 1 3 "-" } "<-/>" xml-error-test
 | 
			
		|||
T{ quoteless-attr f 1 12 } "<x value=<->/>" xml-error-test
 | 
			
		||||
T{ quoteless-attr f 1 10 } "<x value=3/>" xml-error-test
 | 
			
		||||
T{ attr-w/< f 1 11 } "<x value='<'/>" xml-error-test
 | 
			
		||||
T{ text-w/]]> f 1 6 } "<x>]]></x>" xml-error-test
 | 
			
		||||
T{ text-with-double-close-bracket f 1 6 } "<x>]]></x>" xml-error-test
 | 
			
		||||
T{ duplicate-attr f 1 21 T{ name { space "" } { main "this" } } V{ "a" "b" } } "<x this='a' this='b'/>" xml-error-test
 | 
			
		||||
T{ bad-cdata f 1 3 } "<![CDATA[]]><x/>" xml-error-test
 | 
			
		||||
T{ bad-cdata f 1 7 } "<x/><![CDATA[]]>" xml-error-test
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -92,7 +92,7 @@ XML-ERROR: quoteless-attr ;
 | 
			
		|||
 | 
			
		||||
XML-ERROR: attr-w/< ;
 | 
			
		||||
 | 
			
		||||
XML-ERROR: text-w/]]> ;
 | 
			
		||||
XML-ERROR: text-with-double-close-bracket ;
 | 
			
		||||
 | 
			
		||||
XML-ERROR: duplicate-attr key values ;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -152,14 +152,15 @@ HINTS: next* { spot } ;
 | 
			
		|||
: parse-char ( quot: ( ch -- ? ) -- seq )
 | 
			
		||||
    512 <sbuf> [ spot get (parse-char) ] keep "" like ; inline
 | 
			
		||||
 | 
			
		||||
: assure-no-]]> ( pos char -- pos' )
 | 
			
		||||
    "]]>" next-matching dup 2 > [ text-w/]]> ] when ; inline
 | 
			
		||||
: assure-no-double-bracket ( pos char -- pos' )
 | 
			
		||||
    "]]>" next-matching
 | 
			
		||||
    dup 2 > [ text-with-double-close-bracket ] when ; inline
 | 
			
		||||
 | 
			
		||||
:: parse-text ( -- string )
 | 
			
		||||
    depth get zero? :> no-text
 | 
			
		||||
    0 :> pos!
 | 
			
		||||
    |[ char |
 | 
			
		||||
        pos char assure-no-]]> pos!
 | 
			
		||||
        pos char assure-no-double-bracket pos!
 | 
			
		||||
        no-text [
 | 
			
		||||
            char blank? char char: < eq? or [
 | 
			
		||||
                char 1string t pre/post-content
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue