12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485(* Yoann Padioleau
*
* Copyright (C) 2010 Facebook
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation, with the
* special exception on linking described in file license.txt.
*
* This library 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 file
* license.txt for more details.
*)openLexer_nwmodulePI=Parse_info(*****************************************************************************)(* Token Helpers *)(*****************************************************************************)letis_eof=function|EOF_->true|_->falseletis_comment=function|TComment_|TCommentSpace_|TCommentNewline_->true|_->falselettoken_kind_of_tokt=matchtwith|TOBrace_->PI.LBrace|TCBrace_->PI.RBrace|TOBracket_->PI.LBracket|TCBracket_->PI.RBracket|TComment_->PI.EsthetPI.Comment|TCommentSpace_->PI.EsthetPI.Space|TCommentNewline_->PI.EsthetPI.Newline|_->PI.Other(*****************************************************************************)(* Visitors *)(*****************************************************************************)letvisitor_info_of_tokf=function|TCommentii->TComment(fii)|TCommentSpaceii->TCommentSpace(fii)|TCommentNewlineii->TCommentNewline(fii)|TCommand(s,ii)->TCommand(s,fii)|TFootnote(c,ii)->TFootnote(c,fii)|TOBraceii->TOBrace(fii)|TCBraceii->TCBrace(fii)|TOBracketii->TOBracket(fii)|TCBracketii->TCBracket(fii)|TWord(s,ii)->TWord(s,fii)|TSymbol(s,ii)->TSymbol(s,fii)|TNumber(s,ii)->TNumber(s,fii)|TUnit(s,ii)->TUnit(s,fii)|TBeginVerbatimii->TBeginVerbatim(fii)|TEndVerbatimii->TEndVerbatim(fii)|TVerbatimLine(s,ii)->TVerbatimLine(s,fii)|TBeginNowebChunkii->TBeginNowebChunk(fii)|TEndNowebChunkii->TEndNowebChunk(fii)|TNowebChunkStr(s,ii)->TNowebChunkStr(s,fii)|TNowebChunkName(s,ii)->TNowebChunkName(s,fii)|TNowebCode(s,ii)->TNowebCode(s,fii)|TNowebCodeLink(s,ii)->TNowebCodeLink(s,fii)|TUnknownii->TUnknown(fii)|EOFii->EOF(fii)letinfo_of_toktok=letres=refNoneinvisitor_info_of_tok(funii->res:=Someii;ii)tok|>ignore;Common2.some!res