Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /smlnj-lib/trunk/HTML4/html4-utils.sml
ViewVC logotype

View of /smlnj-lib/trunk/HTML4/html4-utils.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3531 - (download) (annotate)
Fri May 21 00:12:21 2010 UTC (9 years, 2 months ago) by jriehl
File size: 946 byte(s)
    Added rudimentary parser for tag attributes.  Hooked the attribute 
    parser into the HTML 4 lexical utilities.  The resulting test drivers 
    can handle a good deal of the existing test inputs.
(* ______________________________________________________________________
   html4-utils.sml

   Defines a set of utility data types and functions for the HTML 4 parser.
   ______________________________________________________________________ *)

structure HTML4Utils = struct

datatype 'a tree = Nd of 'a tree list
                 | Lf of 'a

type tag_payload = string * (Atom.atom * string option) list

fun attrToStr (name, NONE) = Atom.toString name
  | attrToStr (name, SOME a_val) = String.concat [Atom.toString name, " = ",
                                                  a_val]

fun attrsToStr attrs = String.concatWith "  " (map attrToStr attrs)

fun payloadToStr (payload, []) = payload
  | payloadToStr (_, attrs as (attr :: _)) = attrsToStr attrs

end

(* ______________________________________________________________________
   End of html4-utils.sml
   ______________________________________________________________________ *)

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