1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859(* TyXML
* http://www.ocsigen.org/tyxml
* Copyright (C) 2016 Anton Bachin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, with linking exception;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1301, USA.
*)letfind_assembler(lang,name)=let(moduleReflected)=Namespace.getlanginletname=tryList.assocnameReflected.renamed_elementswithNot_found->Name_convention.identnameintrySome(name,List.assocnameReflected.element_assemblers)withNot_found->Noneletparse~loc~parent_lang~name:((lang,name)aselement_name)~attributeschildren=letattributes=Attributes.parselocelement_nameattributesinlet(moduleReflected)=Namespace.getlanginletlang=matchparent_lang,langwith|Common.Html,Svg->Common.Html|Html,Html|Svg,Svg->lang|Svg,Html->Common.errorloc"Nesting of Html element inside svg element is not supported"inletname,assembler=matchfind_assemblerelement_namewith|Somee->e|None->Common.errorloc"Unknown %s element %s"(Common.langlang)nameinletelement_function=Common.make~loclangnameinletchildren=assembler~lang~loc~namechildreninAst_helper.Exp.apply~locelement_function(attributes@children)letcomment~loc~langs=lettot=Common.make~loclang"tot"inletcomment=Common.make~loclang"Xml.comment"inlets=Common.stringlocsin(* Using metaquot here avoids fiddling with labels. *)[%expr[%etot]([%ecomment][%es])][@metalocloc]