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 300, Thu May 27 22:01:36 1999 UTC revision 301, Fri May 28 09:43:39 1999 UTC
# Line 6  Line 6 
6   * Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)   * Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)
7   *)   *)
8  signature CMPARSE = sig  signature CMPARSE = sig
9      val parse : GeneralParams.param -> AbsPath.t -> CMSemant.group option      val parse :
10            GeneralParams.param -> AbsPath.t
11            -> (CMSemant.group * GeneralParams.info) option
12  end  end
13    
14  structure CMParse :> CMPARSE = struct  structure CMParse :> CMPARSE = struct
# Line 30  Line 32 
32          val groupreg = GroupReg.new ()          val groupreg = GroupReg.new ()
33          val ginfo = { param = param, groupreg = groupreg }          val ginfo = { param = param, groupreg = groupreg }
34    
35          val gc = ref AbsPathMap.empty   (* the "group cache" *)          (* The "group cache" -- we store "group options";  having
36             * NONE registered for a group means that a previous attempt
37             * to parse it had failed. *)
38            val gc = ref (AbsPathMap.empty: CMSemant.group option AbsPathMap.map)
39    
40          fun mparse (group, groupstack) =          fun mparse (group, groupstack) =
41              case AbsPathMap.find (!gc, group) of              case AbsPathMap.find (!gc, group) of
# Line 113  Line 118 
118                                      { sourcepath = p, class = c,                                      { sourcepath = p, class = c,
119                                        group = (group, (p1, p2)) }                                        group = (group, (p1, p2)) }
120    
121                    (* Build the argument for the lexer; the lexer's local
122                     * state is encapsulated here to make sure the parser
123                     * is re-entrant. *)
124                  val lexarg = let                  val lexarg = let
125                      (* local state *)                      (* local state *)
126                      val depth = ref 0                      val depth = ref 0
# Line 194  Line 202 
202                | [] => normal_processing ()                | [] => normal_processing ()
203          end          end
204    
205            fun finalResult g =
206                (SmlInfo.forgetAllBut (Reachable.reachable g);
207                 (g, ginfo))
208      in      in
209          mparse (group, [])          Option.map finalResult (mparse (group, []))
210      end      end
211  end  end

Legend:
Removed from v.300  
changed lines
  Added in v.301

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