1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465(* Js_of_ocaml compiler
* http://www.ocsigen.org/js_of_ocaml/
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)open!Stdlibtypet=intlistletsplit_char~sepp=letlen=String.lengthpinletrecsplitbegcur=ifcur>=lenthenifcur-beg>0then[String.subp~pos:beg~len:(cur-beg)]else[]elseifsepp.[cur]thenString.subp~pos:beg~len:(cur-beg)::split(cur+1)(cur+1)elsesplitbeg(cur+1)insplit00letsplitv=matchsplit_char~sep:(function|'+'|'-'|'~'->true|_->false)vwith|[]->assertfalse|x::_->List.map(split_char~sep:(function|'.'->true|_->false)x)~f:int_of_stringletcurrent=splitSys.ocaml_versionletcompint(a:int)b=compareabletreccomparevv'=matchv,v'with|[x],[y]->compintxy|[],[]->0|[],y::_->compint0y|x::_,[]->compintx0|x::xs,y::ys->(matchcompintxywith|0->comparexsys|n->n)