Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file token_helpers_ml.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319(* 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.
*)openParser_mlmodulePI=Parse_info(*****************************************************************************)(* Token Helpers *)(*****************************************************************************)letis_eof=function|EOF_->true|_->falseletis_comment=function|TComment_|TCommentSpace_|TCommentNewline_->true|TCommentMisc_->true|_->false(*
let is_just_comment = function
| TComment _ -> true
| _ -> false
*)lettoken_kind_of_tokt=matchtwith|TOBrace_->PI.LBrace|TCBrace_->PI.RBrace|TOParen_->PI.LPar|TCParen_->PI.RPar(* less: also TOBracket? (and TOBracketAt...) *)|TComment_|TCommentMisc_->PI.EsthetPI.Comment|TCommentSpace_->PI.EsthetPI.Space|TCommentNewline_->PI.EsthetPI.Newline|_->PI.Other(*****************************************************************************)(* Visitors *)(*****************************************************************************)letinfo_of_tok=function|TCommentSpaceii->ii|TCommentNewlineii->ii|TCommentii->ii|TCommentMiscii->ii|TUnknownii->ii|EOFii->ii|TSharpDirectiveii->ii|TInt(_s,ii)->ii|TFloat(_s,ii)->ii|TChar(_s,ii)->ii|TString(_s,ii)->ii|TLowerIdent(_s,ii)->ii|TUpperIdent(_s,ii)->ii|TLabelUse(_s,ii)->ii|TLabelDecl(_s,ii)->ii|TOptLabelUse(_s,ii)->ii|TOptLabelDecl(_s,ii)->ii|TPrefixOperator(_s,ii)->ii|TInfixOperator(_s,ii)->ii|Tfunii->ii|Tfunctionii->ii|Trecii->ii|Ttypeii->ii|Tofii->ii|Tifii->ii|Tthenii->ii|Telseii->ii|Tmatchii->ii|Twithii->ii|Twhenii->ii|Tletii->ii|Tinii->ii|Tasii->ii|Ttryii->ii|Texceptionii->ii|Tbeginii->ii|Tendii->ii|Tforii->ii|Tdoii->ii|Tdoneii->ii|Tdowntoii->ii|Twhileii->ii|Ttoii->ii|Tvalii->ii|Texternalii->ii|Ttrueii->ii|Tfalseii->ii|Tmoduleii->ii|Topenii->ii|Tfunctorii->ii|Tincludeii->ii|Tsigii->ii|Tstructii->ii|Tclassii->ii|Tnewii->ii|Tinheritii->ii|Tconstraintii->ii|Tinitializerii->ii|Tmethodii->ii|Tobjectii->ii|Tprivateii->ii|Tvirtualii->ii|Tlazyii->ii|Tmutableii->ii|Tassertii->ii|Tandii->ii|Torii->ii|Tmodii->ii|Tlorii->ii|Tlslii->ii|Tlsrii->ii|Tlxorii->ii|Tasrii->ii|Tlandii->ii|TOParenii->ii|TCParenii->ii|TOBraceii->ii|TCBraceii->ii|TOBracketii->ii|TCBracketii->ii|TOBracketPipeii->ii|TPipeCBracketii->ii|TOBracketLessii->ii|TGreaterCBracketii->ii|TOBraceLessii->ii|TGreaterCBraceii->ii|TOBracketGreaterii->ii|TColonGreaterii->ii|TLessii->ii|TGreaterii->ii|TDotii->ii|TDotDotii->ii|TCommaii->ii|TEqii->ii|TAssignii->ii|TAssignMutableii->ii|TColonii->ii|TColonColonii->ii|TBangii->ii|TBangEqii->ii|TTildeii->ii|TPipeii->ii|TSemiColonii->ii|TSemiColonSemiColonii->ii|TQuestionii->ii|TQuestionQuestionii->ii|TUnderscoreii->ii|TStarii->ii|TArrowii->ii|TQuoteii->ii|TBackQuoteii->ii|TAndii->ii|TAndAndii->ii|TSharpii->ii|TMinusDotii->ii|TPlusDotii->ii|TPlusii->ii|TMinusii->ii|TBracketAtii->ii|TBracketAtAtii->ii|TBracketAtAtAtii->ii|TBracketPercentii->ii|TBracketPercentPercentii->iiletvisitor_info_of_tokf=function|TCommentSpaceii->TCommentSpace(fii)|TCommentNewlineii->TCommentNewline(fii)|TCommentii->TComment(fii)|TCommentMiscii->TCommentMisc(fii)|TUnknownii->TUnknown(fii)|EOF(ii)->EOF(fii)|TSharpDirectiveii->TSharpDirective(fii)|TInt(s,ii)->TInt(s,fii)|TFloat(s,ii)->TFloat(s,fii)|TChar(s,ii)->TChar(s,fii)|TString(s,ii)->TString(s,fii)|TLowerIdent(s,ii)->TLowerIdent(s,fii)|TUpperIdent(s,ii)->TUpperIdent(s,fii)|TLabelUse(s,ii)->TLabelUse(s,fii)|TLabelDecl(s,ii)->TLabelDecl(s,fii)|TOptLabelUse(s,ii)->TOptLabelUse(s,fii)|TOptLabelDecl(s,ii)->TOptLabelDecl(s,fii)|TPrefixOperator(s,ii)->TPrefixOperator(s,fii)|TInfixOperator(s,ii)->TInfixOperator(s,fii)|Tfun(ii)->Tfun(fii)|Tfunction(ii)->Tfunction(fii)|Trec(ii)->Trec(fii)|Ttype(ii)->Ttype(fii)|Tof(ii)->Tof(fii)|Tif(ii)->Tif(fii)|Tthen(ii)->Tthen(fii)|Telse(ii)->Telse(fii)|Tmatch(ii)->Tmatch(fii)|Twith(ii)->Twith(fii)|Twhen(ii)->Twhen(fii)|Tlet(ii)->Tlet(fii)|Tin(ii)->Tin(fii)|Tas(ii)->Tas(fii)|Ttry(ii)->Ttry(fii)|Texception(ii)->Texception(fii)|Tbegin(ii)->Tbegin(fii)|Tend(ii)->Tend(fii)|Tfor(ii)->Tfor(fii)|Tdo(ii)->Tdo(fii)|Tdone(ii)->Tdone(fii)|Tdownto(ii)->Tdownto(fii)|Twhile(ii)->Twhile(fii)|Tto(ii)->Tto(fii)|Tval(ii)->Tval(fii)|Texternal(ii)->Texternal(fii)|Ttrue(ii)->Ttrue(fii)|Tfalse(ii)->Tfalse(fii)|Tmodule(ii)->Tmodule(fii)|Topen(ii)->Topen(fii)|Tfunctor(ii)->Tfunctor(fii)|Tinclude(ii)->Tinclude(fii)|Tsig(ii)->Tsig(fii)|Tstruct(ii)->Tstruct(fii)|Tclass(ii)->Tclass(fii)|Tnew(ii)->Tnew(fii)|Tinherit(ii)->Tinherit(fii)|Tconstraint(ii)->Tconstraint(fii)|Tinitializer(ii)->Tinitializer(fii)|Tmethod(ii)->Tmethod(fii)|Tobject(ii)->Tobject(fii)|Tprivate(ii)->Tprivate(fii)|Tvirtual(ii)->Tvirtual(fii)|Tlazy(ii)->Tlazy(fii)|Tmutable(ii)->Tmutable(fii)|Tassert(ii)->Tassert(fii)|Tand(ii)->Tand(fii)|Tor(ii)->Tor(fii)|Tmod(ii)->Tmod(fii)|Tlor(ii)->Tlor(fii)|Tlsl(ii)->Tlsl(fii)|Tlsr(ii)->Tlsr(fii)|Tlxor(ii)->Tlxor(fii)|Tasr(ii)->Tasr(fii)|Tland(ii)->Tland(fii)|TOParen(ii)->TOParen(fii)|TCParen(ii)->TCParen(fii)|TOBrace(ii)->TOBrace(fii)|TCBrace(ii)->TCBrace(fii)|TOBracket(ii)->TOBracket(fii)|TCBracket(ii)->TCBracket(fii)|TOBracketPipe(ii)->TOBracketPipe(fii)|TPipeCBracket(ii)->TPipeCBracket(fii)|TOBracketLess(ii)->TOBracketLess(fii)|TGreaterCBracket(ii)->TGreaterCBracket(fii)|TOBraceLess(ii)->TOBraceLess(fii)|TGreaterCBrace(ii)->TGreaterCBrace(fii)|TOBracketGreater(ii)->TOBracketGreater(fii)|TColonGreater(ii)->TColonGreater(fii)|TLess(ii)->TLess(fii)|TGreater(ii)->TGreater(fii)|TDot(ii)->TDot(fii)|TDotDot(ii)->TDotDot(fii)|TComma(ii)->TComma(fii)|TEq(ii)->TEq(fii)|TAssign(ii)->TAssign(fii)|TAssignMutable(ii)->TAssignMutable(fii)|TColon(ii)->TColon(fii)|TColonColon(ii)->TColonColon(fii)|TBang(ii)->TBang(fii)|TBangEq(ii)->TBangEq(fii)|TTilde(ii)->TTilde(fii)|TPipe(ii)->TPipe(fii)|TSemiColon(ii)->TSemiColon(fii)|TSemiColonSemiColon(ii)->TSemiColonSemiColon(fii)|TQuestion(ii)->TQuestion(fii)|TQuestionQuestion(ii)->TQuestionQuestion(fii)|TUnderscore(ii)->TUnderscore(fii)|TStar(ii)->TStar(fii)|TArrow(ii)->TArrow(fii)|TQuote(ii)->TQuote(fii)|TBackQuote(ii)->TBackQuote(fii)|TAnd(ii)->TAnd(fii)|TAndAnd(ii)->TAndAnd(fii)|TSharp(ii)->TSharp(fii)|TMinusDot(ii)->TMinusDot(fii)|TPlusDot(ii)->TPlusDot(fii)|TPlus(ii)->TPlus(fii)|TMinus(ii)->TMinus(fii)|TBracketAtii->TBracketAt(fii)|TBracketAtAtii->TBracketAtAt(fii)|TBracketAtAtAtii->TBracketAtAtAt(fii)|TBracketPercentii->TBracketPercent(fii)|TBracketPercentPercentii->TBracketPercentPercent(fii)(*****************************************************************************)(* Accessors *)(*****************************************************************************)letline_of_toktok=letinfo=info_of_toktokinPI.line_of_infoinfo