1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768(*********************************************************************************)(* Higlo *)(* *)(* Copyright (C) 2014-2021 Institut National de Recherche en Informatique *)(* et en Automatique. All rights reserved. *)(* *)(* This program is free software; you can redistribute it and/or modify *)(* it under the terms of the GNU Lesser General Public License version *)(* 3 as published by the Free Software Foundation. *)(* *)(* 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 Library 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., 59 Temple Place, Suite 330, Boston, MA *)(* 02111-1307 USA *)(* *)(* Contact: Maxence.Guesdon@inria.fr *)(* *)(* *)(*********************************************************************************)openLangletlexemelb=Sedlexing.(Utf8.lexemelb,lexeme_lengthlb);;letsedlexeme=Sedlexing.Utf8.lexeme;;letspace=[%sedlex.regexp?Plus(' '|'\n'|'\t'|'\r')]letdigit=[%sedlex.regexp?'0'..'9']letcapchar=[%sedlex.regexp?'A'..'Z']letlowchar=[%sedlex.regexp?'a'..'z']letidchar=[%sedlex.regexp?lowchar|capchar|'_'|'-'|':'|digit]letentity=[%sedlex.regexp?'&',Plus(Compl('&'|';')),';']lettag_start=[%sedlex.regexp?'<',Opt('/'),Plus(idchar)]lettag_end=[%sedlex.regexp?Opt('/'),'>']letstring=[%sedlex.regexp?'"',Star(Compl('"')),'"']letcomment=[%sedlex.regexp?"<!--",Star(Compl(0x3E)|(Compl('-'),'>')),"-->"]letid=[%sedlex.regexp?Plus(idchar)]letrecmainlexbuf=match%sedlexlexbufwith|space->[Text(lexemelexbuf)]|comment->[Bcomment(lexemelexbuf)]|entity->[Keyword(1,lexemelexbuf)]|tag_start->lett=Keyword(0,lexemelexbuf)int::(taglexbuf)|any->[Text(lexemelexbuf)]|eof->[]|_->failwith"Invalid state"andtaglexbuf=match%sedlexlexbufwith|id->lett=Id(lexemelexbuf)int::taglexbuf|string->lett=String(lexemelexbuf)int::taglexbuf|tag_end->[Keyword(0,lexemelexbuf)]|eof->[]|any->lett=Text(lexemelexbuf)int::taglexbuf|_->failwith"Invalid state"let()=Lang.register_lang"xml"main;;