diff --git a/extra/xml/literal.factor b/extra/xml/literal.factor deleted file mode 100644 index 9aad2c2166..0000000000 --- a/extra/xml/literal.factor +++ /dev/null @@ -1,19 +0,0 @@ -USING: peg peg.ebnf kernel strings sequences combinators.lib ; -IN: xml.literal - -! EBNF-based XML generation syntax -! This is a terrible grammar for XML, only suitable for literals like this - -: &ident ( -- parser ) - [ { - [ printable? ] - [ blank? not ] - [ "<>" member? not ] - } <-&& ] satisfy ; - -: make-name ( str/3array -- name ) - dup array? [ first3 nip f ] [ name-tag ] if ; - - make-name -EBNF> diff --git a/extra/xml/literal/literal.factor b/extra/xml/literal/literal.factor deleted file mode 100644 index 50d4753858..0000000000 --- a/extra/xml/literal/literal.factor +++ /dev/null @@ -1,64 +0,0 @@ -USING: peg peg.ebnf kernel strings sequences combinators.lib arrays xml.data -namespaces assocs xml.generator ; -IN: xml.literal - -! EBNF-based XML generation syntax -! This is a terrible grammar for XML, only suitable for literals like this - -: &ident ( -- parser ) - [ { - [ printable? ] - [ blank? not ] - [ "<>" member? not ] - } <-&& ] satisfy repeat1 [ >string ] action ; - -: 2choice 2array choice ; - -: &name ( -- parser ) - &ident ":" token &ident 3array seq [ first3 nip f ] action - &ident [ ] action - 2choice ; - -: "e ( quote -- parser ) - [ token ] keep [ = not ] curry satisfy dupd seq swap seq ; - -DEFER: " -: &code ( -- parser ) - [ "[]" member? not ] satisfy [ " ] delay 2choice repeat0 ; - -: " ( -- parser ) - ! This doesn't deal with "[" or "]" properly - "[" token &code - "]" token 3array seq [ second parse ] action ; - -: &value ( -- parser ) - "'" "e "\"" "e " 3array choice ; - -: &attr ( -- parser ) - &name "=" token &value sp 3array seq [ first3 nip 2array ] action ; - -: &attrs ( -- parser ) - &attr repeat0 [ - [ swap [ set ] 2curry ] { } assoc>map concat - ] action ; - -: &tag-start ( -- parser ) - "<" token &name sp &attrs sp 3array seq - [ first3 2array nip ] action ; - -: tag-open-code ( {name,attrs} contents -- quot ) - swap first2 dup empty? [ drop swap [ tag, ] 3curry ] - [ swap rot [ >r >r H{ } make-assoc r> r> swapd tag*, ] 3curry ] if ; - -: &tag-open ( -- parser ) - &tag-start ">" token " 3array seq - [ first3 nip tag-open-code ] action ; - -: tag-contained-code ( {name,attrs} -- quot ) - first2 dup empty? [ drop [ contained, ] curry ] - [ swap [ >r H{ } make-assoc r> swap contained*, ] 2curry ] if ; - -: &tag-contained ( -- parser ) - &tag-start "/>" token 2array seq - [ first tag-contained-code ] action ; -