Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /ml-lex/trunk/lexgen.sml
ViewVC logotype

Diff of /ml-lex/trunk/lexgen.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2404, Wed Apr 11 22:34:25 2007 UTC revision 3647, Sat Nov 26 16:48:51 2011 UTC
# Line 997  Line 997 
997                  | false => (say "(0, 0, \"\")]\n";                  | false => (say "(0, 0, \"\")]\n";
998                      say "fun f(n, i, x) = (n, Vector.tabulate(i, decode x)) \n")                      say "fun f(n, i, x) = (n, Vector.tabulate(i, decode x)) \n")
999    
1000              val _ = say "val s = map f (rev (tl (rev s))) \n"              val _ = say "val s = List.map f (List.rev (tl (List.rev s))) \n"
1001              val _ = say "exception LexHackingError \n"              val _ = say "exception LexHackingError \n"
1002              val _ = say "fun look ((j,x)::r, i: int) = if i = j then x else look(r, i) \n"              val _ = say "fun look ((j,x)::r, i: int) = if i = j then x else look(r, i) \n"
1003              val _ = say "  | look ([], i) = raise LexHackingError\n"              val _ = say "  | look ([], i) = raise LexHackingError\n"
# Line 1059  Line 1059 
1059    
1060          fun msg x = TextIO.output(TextIO.stdOut, x)          fun msg x = TextIO.output(TextIO.stdOut, x)
1061    
1062    in (say "in Vector.fromList(map g \n["; makeTable(rs,newfins);    in (say "in Vector.fromList(List.map g \n["; makeTable(rs,newfins);
1063        say "])\nend\n";        say "])\nend\n";
1064      msg ("\nNumber of states = " ^ (Int.toString (length trans)));      msg ("\nNumber of states = " ^ (Int.toString (length trans)));
1065      msg ("\nNumber of distinct rows = " ^ (Int.toString (!count)));      msg ("\nNumber of distinct rows = " ^ (Int.toString (!count)));
# Line 1249  Line 1249 
1249               else sayln "\t| action (i,(node::acts)::l) =";               else sayln "\t| action (i,(node::acts)::l) =";
1250           sayln "\t\tcase node of";           sayln "\t\tcase node of";
1251           sayln "\t\t    Internal.N yyk => ";           sayln "\t\t    Internal.N yyk => ";
1252           sayln "\t\t\t(let fun yymktext() = substring(!yyb,i0,i-i0)\n\           sayln "\t\t\t(let fun yymktext() = String.substring(!yyb,i0,i-i0)\n\
1253                 \\t\t\t     val yypos = i0+ !yygone";                 \\t\t\t     val yypos = i0+ !yygone";
1254           if !CountNewLines           if !CountNewLines
1255              then (sayln "\t\t\tval _ = yylineno := CharVectorSlice.foldli";              then (sayln "\t\t\tval _ = yylineno := CharVectorSlice.foldli";
# Line 1276  Line 1276 
1276           if !UsesTrailingContext then say ",nil" else ();           if !UsesTrailingContext then say ",nil" else ();
1277           say ") else";           say ") else";
1278           sayln "\t    let val newchars= if !yydone then \"\" else yyinput 1024";           sayln "\t    let val newchars= if !yydone then \"\" else yyinput 1024";
1279           sayln "\t    in if (size newchars)=0";           sayln "\t    in if (String.size newchars)=0";
1280           sayln "\t\t  then (yydone := true;";           sayln "\t\t  then (yydone := true;";
1281           say "\t\t        if (l=i0) then UserDeclarations.eof ";           say "\t\t        if (l=i0) then UserDeclarations.eof ";
1282           sayln (case !ArgCode of NONE => "()" | SOME _ => "yyarg");           sayln (case !ArgCode of NONE => "()" | SOME _ => "yyarg");
# Line 1284  Line 1284 
1284           if !UsesTrailingContext then           if !UsesTrailingContext then
1285              sayln ",nil))" else sayln "))";              sayln ",nil))" else sayln "))";
1286           sayln "\t\t  else (if i0=l then yyb := newchars";           sayln "\t\t  else (if i0=l then yyb := newchars";
1287           sayln "\t\t     else yyb := substring(!yyb,i0,l-i0)^newchars;";           sayln "\t\t     else yyb := String.substring(!yyb,i0,l-i0)^newchars;";
1288           sayln "\t\t     yygone := !yygone+i0;";           sayln "\t\t     yygone := !yygone+i0;";
1289           sayln "\t\t     yybl := size (!yyb);";           sayln "\t\t     yybl := String.size (!yyb);";
1290           sayln "\t\t     scan (s,AcceptingLeaves,l-i0,0))";           sayln "\t\t     scan (s,AcceptingLeaves,l-i0,0))";
1291           sayln "\t    end";           sayln "\t    end";
1292           sayln "\t  else let val NewChar = Char.ord(Unsafe.CharVector.sub(!yyb,l))";           sayln "\t  else let val NewChar = Char.ord(Unsafe.CharVector.sub(!yyb,l))";
# Line 1303  Line 1303 
1303           sayln "\tend";           sayln "\tend";
1304           sayln "\tend";           sayln "\tend";
1305           if !UsesPrevNewLine then () else sayln "(*";           if !UsesPrevNewLine then () else sayln "(*";
1306           sayln "\tval start= if substring(!yyb,!yybufpos-1,1)=\"\\n\"";           sayln "\tval start= if String.substring(!yyb,!yybufpos-1,1)=\"\\n\"";
1307           sayln "then !yybegin+1 else !yybegin";           sayln "then !yybegin+1 else !yybegin";
1308           if !UsesPrevNewLine then () else sayln "*)";           if !UsesPrevNewLine then () else sayln "*)";
1309           say "\tin scan(";           say "\tin scan(";

Legend:
Removed from v.2404  
changed lines
  Added in v.3647

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0