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 /sml/branches/SMLNJ/src/ml-burg/burg-lex.sml
ViewVC logotype

Diff of /sml/branches/SMLNJ/src/ml-burg/burg-lex.sml

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

revision 42, Sun Mar 22 20:10:57 1998 UTC revision 418, Fri Sep 3 23:51:27 1999 UTC
# Line 595  Line 595 
595          | action (i,(node::acts)::l) =          | action (i,(node::acts)::l) =
596                  case node of                  case node of
597                      Internal.N yyk =>                      Internal.N yyk =>
598                          (let val yytext = substring(!yyb,i0,i-i0)                          (let fun yymktext() = substring(!yyb,i0,i-i0)
599                               val yypos = i0+ !yygone                               val yypos = i0+ !yygone
600                          open UserDeclarations Internal.StartStates                          open UserDeclarations Internal.StartStates
601   in (yybufpos := i; case yyk of   in (yybufpos := i; case yyk of
# Line 623  Line 623 
623                              else T.PPERCENT(rev(!raw),!lineNum,!lineNum)                              else T.PPERCENT(rev(!raw),!lineNum,!lineNum)
624                                          before raw := [])                                          before raw := [])
625  | 70 => (YYBEGIN COMMENT; comLevel:=1; continue())  | 70 => (YYBEGIN COMMENT; comLevel:=1; continue())
626  | 73 => (T.INT(valOf(Int.fromString yytext),!lineNum,!lineNum))  | 73 => let val yytext=yymktext() in T.INT(valOf(Int.fromString yytext),!lineNum,!lineNum) end
627  | 76 => (T.ID(yytext,!lineNum,!lineNum))  | 76 => let val yytext=yymktext() in T.ID(yytext,!lineNum,!lineNum) end
628  | 79 => (inc comLevel; continue())  | 79 => (inc comLevel; continue())
629  | 81 => (inc lineNum; continue())  | 81 => (inc lineNum; continue())
630  | 84 => (dec comLevel;  | 84 => (dec comLevel;
# Line 635  Line 635 
635                              YYBEGIN INITIAL; continue())                              YYBEGIN INITIAL; continue())
636  | 9 => (continue())  | 9 => (continue())
637  | 91 => (rawNextLine (); inc lineNum; continue())  | 91 => (rawNextLine (); inc lineNum; continue())
638  | 93 => (outputRaw yytext; continue())  | 93 => let val yytext=yymktext() in outputRaw yytext; continue() end
639  | 95 => (rawNextLine (); inc lineNum; continue())  | 95 => (rawNextLine (); inc lineNum; continue())
640  | 97 => (outputRaw yytext; continue())  | 97 => let val yytext=yymktext() in outputRaw yytext; continue() end
641  | _ => raise Internal.LexerError  | _ => raise Internal.LexerError
642    
643                  ) end )                  ) end )
644    
645          val {fin,trans} = Vector.sub(Internal.tab, s)          val {fin,trans} = Unsafe.Vector.sub(Internal.tab, s)
646          val NewAcceptingLeaves = fin::AcceptingLeaves          val NewAcceptingLeaves = fin::AcceptingLeaves
647          in if l = !yybl then          in if l = !yybl then
648               if trans = #trans(Vector.sub(Internal.tab,0))               if trans = #trans(Vector.sub(Internal.tab,0))
# Line 658  Line 658 
658                       yybl := size (!yyb);                       yybl := size (!yyb);
659                       scan (s,AcceptingLeaves,l-i0,0))                       scan (s,AcceptingLeaves,l-i0,0))
660              end              end
661            else let val NewChar = Char.ord(String.sub(!yyb,l))            else let val NewChar = Char.ord(Unsafe.CharVector.sub(!yyb,l))
662                  val NewState = if NewChar<128 then Char.ord(String.sub(trans,NewChar)) else Char.ord(String.sub(trans,128))                  val NewChar = if NewChar<128 then NewChar else 128
663                    val NewState = Char.ord(Unsafe.CharVector.sub(trans,NewChar))
664                  in if NewState=0 then action(l,NewAcceptingLeaves)                  in if NewState=0 then action(l,NewAcceptingLeaves)
665                  else scan(NewState,NewAcceptingLeaves,l+1,i0)                  else scan(NewState,NewAcceptingLeaves,l+1,i0)
666          end          end

Legend:
Removed from v.42  
changed lines
  Added in v.418

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