type arg = int type svalue = Tokens.svalue type pos = int*int type ('a,'b) token = ('a,'b) Tokens.token type lexresult = (svalue,pos) token
Add the definition of the make_pos function. fun make_pos yypos yytext = ( (!lineNum, charPos yypos), (!lineNum, (charPos yypos) + String.size(yytext) - 1) )
%header (functor FunLexFun (structure Tokens: Fun_TOKENS));
The token constructors now take objects with type pos*pos where pos is the new position type (int*int). You can generate these using the make_pos function. For example: <INITIAL>fun => (Tokens.FUN(make_pos yypos yytext));
Similarly the type of ErrorMsg.error uses the new pos type, and so you should use make_pos to pass positions to it.