! (c)2009 Joe Groff, see BSD license
-USING: accessors arrays assocs fry kernel math
+USING: accessors arrays assocs kernel math
math.affine-transforms math.functions math.parser math.trig
peg.ebnf sequences sequences.squish splitting strings xml.data
-xml.syntax ;
+xml.syntax multiline ;
IN: svg
[ string>number ] [ [ string>number 10^ ] [ 1 ] if* ] bi* *
>float ;
-EBNF: svg-transform>affine-transform
+EBNF: svg-transform>affine-transform [=[
transforms =
transform:m comma-wsp+ transforms:n => [[ m n a. ]]
transform-list = wsp* transforms?:t wsp*
=> [[ t [ identity-transform ] unless* ]]
-;EBNF
+]=]
: tag-transform ( tag -- transform )
"transform" svg-name attr svg-transform>affine-transform ;
: (set-relative) ( args rel -- args )
'[ [ _ >>relative? drop ] each ] keep ;
-EBNF: svg-path>array
+EBNF: svg-path>array [=[
moveto-drawto-command-groups =
moveto-drawto-command-group:first wsp* moveto-drawto-command-groups:rest
svg-path = wsp* moveto-drawto-command-groups?:x wsp* => [[ x ]]
-;EBNF
+]=]
: tag-d ( tag -- d )
"d" svg-name attr svg-path>array ;