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 269, Mon May 10 13:34:43 1999 UTC revision 270, Tue May 11 07:45:42 1999 UTC
# Line 1  Line 1 
1    (*
2     * Parser for CM description files.
3     *
4     * (C) 1999 Lucent Technologies, Bell Laboratories
5     *
6     * Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)
7     *)
8  signature CMPARSE = sig  signature CMPARSE = sig
9      val parse : AbsPath.t -> CMSemant.group option      val parse : AbsPath.t -> CMSemant.group option
10  end  end
# Line 18  Line 25 
25                       structure Lex = CMLex                       structure Lex = CMLex
26                       structure LrParser = LrParser)                       structure LrParser = LrParser)
27    
28      fun parse filename = let      fun parse group = let
29          val currentDir = AbsPath.dir filename  
30          val filename = AbsPath.name filename          (* recParse returns a group (not an option)
31             * and re-raises LrParser.ParseError.
32             * This exception will be handled by the surrounding
33             * call to parse.
34             * This function is used to parse aliases and sub-groups. *)
35            fun recParse p =
36                case parse p of
37                    NONE => raise LrParser.ParseError
38                  | SOME res => res
39    
40            fun doMember (p, c) =
41                CMSemant.member recParse { sourcepath = p,
42                                           group = group,
43                                           class = c }
44    
45            val currentDir = AbsPath.dir group
46            val context = AbsPath.relativeContext (AbsPath.dir group)
47            val filename = AbsPath.name group
48          val stream = TextIO.openIn filename          val stream = TextIO.openIn filename
49          val errcons =          val errcons =
50              { linewidth = !P.linewidth, flush = P.flush, consumer = P.say }              { linewidth = !P.linewidth, flush = P.flush, consumer = P.say }
# Line 92  Line 116 
116          val (parseResult, _) =          val (parseResult, _) =
117              CMParse.parse (lookAhead, tokenStream,              CMParse.parse (lookAhead, tokenStream,
118                             fn (s,p1,p2) => error (p1, p2) s,                             fn (s,p1,p2) => error (p1, p2) s,
119                             (currentDir, error))                             (context, error, recParse, doMember))
120      in      in
121          TextIO.closeIn stream;          TextIO.closeIn stream;
122          SOME parseResult          SOME parseResult

Legend:
Removed from v.269  
changed lines
  Added in v.270

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