/[svn]/tests/notes.cd
ViewVC logotype

Contents of /tests/notes.cd

Parent Directory Parent Directory | Revision Log Revision Log


Revision 116 - (show annotations)
Tue Jul 10 17:07:37 2007 UTC (5 years, 10 months ago) by abate
File size: 767 byte(s)
[r2002-11-11 18:55:45 by cvscast] Empty log message

Original author: cvscast
Date: 2002-11-11 18:55:45+00:00
1 type Doc = <doc>Text;;
2 type Text = [ (Char | (Letter+ ' '* Note))* ];;
3 type Letter = 'a'--'z' | 'A'--'Z';;
4 type Note = <note>[ PCDATA ];;
5
6 type Flow = [ (Char | <ref no=Int>[ PCDATA ])* ];;
7 type Notes = [ <note no=Int>[ PCDATA ]* ];;
8 type Result = <doc>[ <body>Flow <notes>Notes ];;
9
10 let fun format (<doc>s : Doc) : Result =
11 let (body,notes) = text (s,1) in
12 <doc>[ <body>body <notes>notes ];;
13
14 let fun text ( (Text,Int) -> (Flow,Notes) )
15 | ([ pre::Char*? (word::Letter+ ' '* <note>n); rem ], count) ->
16 let (body,notes) = text (rem, count + 1) in
17 (pre @ [<ref no=count>word] @ body,
18 [<note no=count>n] @ notes)
19 | (body,_) -> (body, []);;
20
21 match load_xml "tests/notes.xml" with
22 | x & Doc -> format x
23 | _ -> raise "Invalid input document";;

CVS Admin">CVS Admin
ViewVC Help
Powered by ViewVC 1.1.5