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/ml-flex/src/BackEnds/expand-file.sml
ViewVC logotype

Diff of /sml/trunk/src/ml-flex/src/BackEnds/expand-file.sml

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

revision 1897, Sat Feb 25 01:15:52 2006 UTC revision 1898, Mon Feb 27 05:25:47 2006 UTC
# Line 17  Line 17 
17    
18      structure TIO = TextIO      structure TIO = TextIO
19      structure SS = Substring      structure SS = Substring
20    (*
21      structure RE = RegExpFn (      structure RE = RegExpFn (
22        structure P = AwkSyntax        structure P = AwkSyntax
23        structure E = BackTrackEngine)        structure E = BackTrackEngine)
24      structure M = MatchTree      structure M = MatchTree
25    *)
26    
27      type hook = TextIO.outstream -> unit      type hook = TextIO.outstream -> unit
28    
29    (*
30      val placeholderRE = RE.compileString "[\\t ]*@([a-zA-Z][-a-zA-Z0-9_]*)@[\\t ]*"      val placeholderRE = RE.compileString "[\\t ]*@([a-zA-Z][-a-zA-Z0-9_]*)@[\\t ]*"
31      val prefixPlaceholder = RE.prefix placeholderRE SS.getc      val prefixPlaceholder = RE.prefix placeholderRE SS.getc
32    
# Line 32  Line 35 
35                  SOME(SS.string(SS.slice(pos, 0, SOME len)))                  SOME(SS.string(SS.slice(pos, 0, SOME len)))
36              | _ => NONE              | _ => NONE
37            (* end case *))            (* end case *))
38    *)
39    
40        fun findPlaceholder s = let
41              val trim = SS.dropr Char.isSpace (SS.dropl Char.isSpace (SS.full s))
42              val size = SS.size trim
43              in if size > 2 andalso
44                    SS.isPrefix "@" trim andalso
45                    SS.isSuffix "@" trim then
46                   SOME (SS.string (SS.slice (trim, 1, SOME (size - 2))))
47                 else
48                   NONE
49              end
50    
51    (* copy from inStrm to outStrm expanding placeholders *)    (* copy from inStrm to outStrm expanding placeholders *)
52      fun copy (inStrm, outStrm, hooks) = let      fun copy (inStrm, outStrm, hooks) = let
# Line 69  Line 84 
84              handle OpenOut => ())              handle OpenOut => ())
85    
86    end    end
87    
88    

Legend:
Removed from v.1897  
changed lines
  Added in v.1898

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