Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file lexer.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596openParser(* let new_line_assert buffer =
let line = (snd @@ Sedlexing.lexing_positions buffer).pos_lnum in
Sedlexing.new_line buffer;
let line' = (snd @@ Sedlexing.lexing_positions buffer).pos_lnum in
if line <> line' - 1 then
failwith (Printf.sprintf "line : %d, line' : %d" line line') *)letformat_flag=[%sedlex.regexp?'#'|'0'|'-'|'+']letsimple_format=[%sedlex.regexp?(Optformat_flag,('d'|'i'|'u'|'n'|'l'|'N'|'L'|'x'|'o'|'X'|'s'|'c'|'S'|'C'|'f'|'e'|'E'|'g'|'G'|'h'|'H'|'b'|'B'|('l'|'n'|'L'),('d'|'i'|'u'|'x'|'X'|'o')|'a'|'t'))]letget_textbufferfirst=lettext=CCVector.of_arrayfirstinletrecaux()=match%sedlexbufferwith|"<%",simple_format,"-"|"<_%",simple_format,"-"|"<%"|"<%#"|"<%-"|"%>"|"<%("|"%)-"|"<_%"|"<_%-"|"%_>"|"<_%("->Sedlexing.rollbackbuffer|eof->()|any->CCVector.append_arraytext(Sedlexing.lexemebuffer);aux()|_->assertfalseinaux();CCVector.to_arraytextletget_whitespacesbufferfirst=lettext=CCVector.of_arrayfirstinletrecaux()=match%sedlexbufferwith|eof->()|white_space->CCVector.append_arraytext(Sedlexing.lexemebuffer);aux()|_->Sedlexing.rollbackbufferinaux();CCVector.to_arraytextletprint_tokentoken=print_endlinePrintf.(matchtokenwith|LParb->sprintf"LPar(%B)"b|RParb->sprintf"LPar(%B)"b|LParArgs->"LParArgs"|LParOutputb->sprintf"LParOutput(%B)"b|LFormatOutput(b,format)->sprintf"LFormatOutput(%B, %S)"bformat|LParFormatb->sprintf"LParFormat(%B)"b|RParFormat->"RParFormat"|Textt->sprintf"Text(%S)"t|Whitespacest->sprintf"Whitespaces(%S)"t|EOF->"EOF")lettokenbuffer=match%sedlexbufferwith|"<%",simple_format,"-"->letmatched=Ustring.to_string(Sedlexing.lexemebuffer)inLFormatOutput(false,String.submatched2(String.lengthmatched-3))|"<_%",simple_format,"-"->letmatched=Ustring.to_string(Sedlexing.lexemebuffer)inLFormatOutput(true,String.submatched3(String.lengthmatched-4))|"<%"->LParfalse|"<%#"->LParArgs|"<%-"->LParOutputfalse|"%>"->RParfalse|"<%("->LParFormatfalse|"%)-"->RParFormat|"<_%"->LPartrue|"<_%-"->LParOutputtrue|"%_>"->RPartrue|"<_%("->LParFormattrue|eof->EOF|white_space->Whitespaces(Ustring.to_string(get_whitespacesbuffer(Sedlexing.lexemebuffer)))|any->Text(Ustring.to_string(get_textbuffer(Sedlexing.lexemebuffer)))|_->assertfalse(*let token buffer =
let tok = token buffer in
print_token tok;
tok*)letlexerbuffer=Sedlexing.with_tokenizertokenbuffer