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/trunk/src/cm/parse/parse.sml
ViewVC logotype

Diff of /sml/trunk/src/cm/parse/parse.sml

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

revision 295, Wed May 26 09:20:25 1999 UTC revision 297, Thu May 27 08:29:19 1999 UTC
# Line 25  Line 25 
25                       structure Lex = CMLex                       structure Lex = CMLex
26                       structure LrParser = LrParser)                       structure LrParser = LrParser)
27    
     (* The error function must look for the source using the GroupReg  
      * group register because the source must not be hard-wired into it  
      * (via closure creation).  The reason for this is that the error  
      * function will get cached in SmlInfo.info but the source will change  
      * when one re-runs the analysis. *)  
   
28      fun parse primconf group = let      fun parse primconf group = let
29    
30          val groupreg = GroupReg.new ()          val groupreg = GroupReg.new ()
# Line 94  Line 88 
88                  val source = S.newSource (filename, 1, stream, false, errcons)                  val source = S.newSource (filename, 1, stream, false, errcons)
89                  val sourceMap = #sourceMap source                  val sourceMap = #sourceMap source
90                  val _ = GroupReg.register groupreg (group, source)                  val _ = GroupReg.register groupreg (group, source)
91                  fun error' region sev m b = let  
92                      val src = GroupReg.lookup groupreg group                  (* We can hard-wire the source into this
93                  in                   * error function because the function is only for
94                      EM.error src region sev m b                   * immediate use and doesn't get stored into persistent
95                  end                   * data structures. *)
96                  fun error region m =                  fun error r m =
97                      error' region EM.COMPLAIN m EM.nullErrorBody                      EM.error source r EM.COMPLAIN m EM.nullErrorBody
98    
99                  (* recParse returns a group (not an option).                  (* recParse returns a group (not an option).
100                   * This function is used to parse aliases and sub-groups.                   * This function is used to parse aliases and sub-groups.
# Line 118  Line 112 
112                      (error (p1, p2) (General.exnMessage exn);                      (error (p1, p2) (General.exnMessage exn);
113                       CMSemant.emptyGroup group)                       CMSemant.emptyGroup group)
114    
115                  fun doMember (p, p1, p2, c, e) =                  fun doMember (p, p1, p2, c) =
116                      CMSemant.member (params, recParse (p1, p2))                      CMSemant.member (params, recParse (p1, p2))
117                                      { sourcepath = p, group = group,                                      { sourcepath = p, class = c,
118                                        class = c, error = e }                                        group = (group, (p1, p2)) }
119    
120                  val lexarg = let                  val lexarg = let
121                      (* local state *)                      (* local state *)
# Line 190  Line 184 
184                  val (parseResult, _) =                  val (parseResult, _) =
185                      CMParse.parse (lookAhead, tokenStream,                      CMParse.parse (lookAhead, tokenStream,
186                                     fn (s,p1,p2) => error (p1, p2) s,                                     fn (s,p1,p2) => error (p1, p2) s,
187                                     (group, context, error', error, recParse,                                     (group, context, error, recParse,
188                                      doMember))                                      doMember, params))
189              in              in
190                  TextIO.closeIn stream;                  TextIO.closeIn stream;
191                  if !(#anyErrors source) then NONE                  if !(#anyErrors source) then NONE

Legend:
Removed from v.295  
changed lines
  Added in v.297

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