package Ġpi ac enti . dsl maker . dsl Ċ Ċ import Ġpi ac enti . dsl maker . ab straction . Production Step Ċ import Ġpi ac enti . dsl maker . interfaces . Grammar Inventory Ċ import Ġpi ac enti . dsl maker . structures . Grammar Ċ Ċ object ĠXML Token Ġ: ĠGram mar Inventory Ġ{ ĊĠĠĠ Ġoverride Ġval Ġproduction s : ĠMutable List < Production Step > Ġ= Ġmutable ListOf () ĊĠĠĠ Ġoverride Ġval Ġtokens : ĠMutable List < Production Step > Ġ= Ġmutable ListOf () ĊĊĠĠĠ Ġval Ġvalue Ġ= Ġcreate Token (" value ", Ġ"< ! \\ [ CDATA \\ [ .+ ? \\ ]\\ ]> |[ ^ < ]+ ", Ġcontext Ġ= Ġ" value ", Ġvalidate Token Ġ= Ġ{ it . isNotBlank () }) ĊĠĠĠ Ġval Ġvalue Encoded Ġ= Ġcreate Token (" value Encoded ", Ġ"& lt ; ! \\ [ CDATA \\ [ .+ ? \\ ]\\ ]& gt ; |( ?: .( ?! lt ; ))+ ", Ġcontext Ġ= Ġ" value Encoded ") ĊĠĠĠ Ġval Ġless Than Ġ= Ġcreate Token (" less Than ", Ġ"< ", Ġremove Context Ġ= Ġ" value ", Ġadd Context Ġ= Ġ" element ") ĊĠĠĠ Ġval Ġless Than Than Encoded Ġ= Ġcreate Token (" less Than Than Encoded ", Ġ"& lt ;", Ġremove Context Ġ= Ġ" value Encoded ", Ġadd Context Ġ= Ġ" element ") ĊĠĠĠ Ġval Ġgreater Than Ġ= Ġcreate Token (" greater Than ", Ġ"> ", Ġadd Context Ġ= Ġ" value ", Ġremove Context Ġ= Ġ" element ") ĊĠĠĠ Ġval Ġgreater Than Encoded Ġ= Ġcreate Token (" greater Than Encoded ", Ġ"& gt ;", Ġadd Context Ġ= Ġ" value Encoded ", Ġremove Context Ġ= Ġ" element ") ĊĊĠĠĠ Ġval Ġslash Ġ= Ġcreate Token (" slash ", Ġ"/", Ġcontext Ġ= Ġ" element ") ĊĠĠĠ Ġval Ġcolon Ġ= Ġcreate Token (" colon ", Ġ" :", Ġcontext Ġ= Ġ" element ") ĊĠĠĠ Ġval Ġquestion Mark Ġ= Ġcreate Token (" question Mark ", Ġ"\\ ?", Ġcontext Ġ= Ġ" element ") ĊĠĠĠ Ġval Ġequals Mark Ġ= Ġcreate Token (" equals Mark ", Ġ"=", Ġcontext Ġ= Ġ" element ") ĊĠĠĠ Ġval Ġal phanumeric Sequence Ġ= Ġcreate Token (" al phanumeric Sequence ", Ġ"\\ w +", Ġcontext Ġ= Ġ" element ") ĊĠĠĠ Ġval Ġquoted Sequence Ġ= Ġcreate Token (" quoted Sequence ", Ġ"\" (?: .* ?( ? <! \\\\ )) \"", Ġcontext Ġ= Ġ" element ") ĊĠĠĠ Ġval Ġempty Ġ= Ġcreate Token (" empty ", Ġ"") ĊĊĠĠĠ Ġval ĠELEMENT Ġ= Ġcreate Production (" ELEMENT ") ĊĠĠĠ Ġval ĠELEMENT S Ġ= Ġcreate Production (" ELEMENT S ") ĊĠĠĠ Ġval ĠHEADER _ ELEMENT Ġ= Ġcreate Production (" HEADER _ ELEMENT ") ĊĠĠĠ Ġval ĠHEADER _ ELEMENT _ ENCODE D Ġ= Ġcreate Production (" HEADER _ ELEMENT _ ENCODE D ") ĊĠĠĠ Ġval ĠELEMENT _ START Ġ= Ġcreate Production (" ELEMENT _ START ") ĊĠĠĠ Ġval ĠELEMENT _ END Ġ= Ġcreate Production (" ELEMENT _ END ") ĊĠĠĠ Ġval ĠELEMENT _ START _ ENCODE D Ġ= Ġcreate Production (" ELEMENT _ START _ ENCODE D ") ĊĠĠĠ Ġval ĠELEMENT _ END _ ENCODE D Ġ= Ġcreate Production (" ELEMENT _ END _ ENCODE D ") ĊĠĠĠ Ġval ĠATTRIBUT E Ġ= Ġcreate Production (" ATTRIBUTE ") ĊĠĠĠ Ġval ĠATTRIBUT ES Ġ= Ġcreate Production (" ATTRIBUTES ") ĊĠĠĠ Ġval ĠSTART Ġ= Ġcreate Production (" START ") ĊĠĠĠ Ġval ĠNAME Ġ= Ġcreate Production (" NAME ") ĊĠĠĠ Ġval ĠS IB LING _ ELEMENT S Ġ= Ġcreate Production (" SI BL ING _ ELEMENT S ") ĊĠĠĠ Ġval ĠOPTIONAL _ VALUE Ġ= Ġcreate Production (" OPTIONAL _ VALUE ") ĊĠĠĠ Ġval ĠOPTIONAL _ ENCODE D _ VALUE Ġ= Ġcreate Production (" OPTIONAL _ ENCODE D _ VALUE ") Ċ } Ċ Ċ class ĠXML Grammar ( root : ĠProduction Step Ġ= ĠXML Token . START ) Ġ: ĠGram mar < XML Token >( root , ĠXML Token ) Ġ{ ĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ ĠXML Token . apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġp ( START , Ġe ( ELEMENT S )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġp ( ELEMENT S , Ġe ( SI BL ING _ ELEMENT S )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġp ( SI BL ING _ ELEMENT S , Ġe ( ELEMENT , ĠS IB LING _ ELEMENT S ), Ġe ( ELEMENT )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġp ( ELEMENT , Ġe ( HEADER _ ELEMENT , ĠELEMENT ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġe ( ELEMENT _ START , ĠELEMENT S , ĠELEMENT _ END ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġe ( ELEMENT _ START , ĠOPTIONAL _ VALUE , ĠELEMENT _ END ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ// par ses Ġhtml Ġencoded Ġxml ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġe ( HEADER _ ELEMENT _ ENCODE D , ĠELEMENT ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġe ( ELEMENT _ START _ ENCODE D , ĠELEMENT S , ĠELEMENT _ END _ ENCODE D ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġe ( ELEMENT _ START _ ENCODE D , ĠOPTIONAL _ ENCODE D _ VALUE , ĠELEMENT _ END _ ENCODE D )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġp ( HEADER _ ELEMENT , Ġe ( less Than , Ġquestion Mark , Ġal phanumeric Sequence , ĠATTRIBUT ES , Ġquestion Mark , Ġgreater Than )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġp ( HEADER _ ELEMENT _ ENCODE D , Ġe ( less Than Than Encoded , Ġquestion Mark , Ġal phanumeric Sequence , ĠATTRIBUT ES , Ġquestion Mark , Ġgreater Than Encoded )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġp ( ELEMENT _ START , Ġe ( less Than , ĠNAME , ĠATTRIBUT ES , Ġgreater Than )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġp ( ELEMENT _ END , Ġe ( less Than , Ġslash , ĠNAME , Ġgreater Than )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġp ( ELEMENT _ START _ ENCODE D , Ġe ( less Than Than Encoded , ĠNAME , ĠATTRIBUT ES , Ġgreater Than Encoded )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġp ( ELEMENT _ END _ ENCODE D , Ġe ( less Than Than Encoded , Ġslash , ĠNAME , Ġgreater Than Encoded )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġp ( ATTRIBUTES , Ġe ( ATTRIBUTE , ĠATTRIBUT ES ), Ġe ( ATTRIBUTE ), Ġe ( empty )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġp ( ATTRIBUTE , Ġe ( NAME , Ġequals Mark , Ġquoted Sequence )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġp ( NAME , Ġe ( al phanumeric Sequence , Ġcolon , Ġal phanumeric Sequence ), Ġe ( al phanumeric Sequence )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġp ( OPTIONAL _ VALUE , Ġe ( value ), Ġe ( empty )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġp ( OPTIONAL _ ENCODE D _ VALUE , Ġe ( value Encoded ), Ġe ( empty )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }