anchor.diff:  // DGML (for Visual Studio)
   // dot (for graphviz)
   
  +/// Functions for generating color palettes.
  +// Reference : http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/
  +[<RequireQualifiedAccess>]
  +module private Palette =
  +    open System.Drawing
  +
  +    /// The conjugate of the golden ratio.
  +    let private phi_conj = ((1.0 + sqrt 5.0) / 2.0) - 1.0
  +
  +    //
  +    let private colorFromHSV (hue : float, saturation : float, brightness : float) : Color =
  +        // Preconditions
  +        if hue < 0.0 || hue > 360.0 then
  +            invalidArg "hue" "The hue must be between 0.0 and 360.0 degrees."
  +        elif saturation < 0.0 || saturation > 1.0 then
  +            invalidArg "saturation" "The saturation must be in the range [0.0, 1.0]."
  +        elif brightness < 0.0 || brightness > 1.0 then
  +            invalidArg "brightness" "The brightness value must be in the range [0.0, 1.0]."
  +
  +        let chroma = saturation * brightness
  +        
  +        let r', g', b' =
  +            let hue' = hue / 60.0
  +            let x =
  +                chroma * (1.0 - abs ((hue' % 2.0) - 1.0))
  +
  +            if hue' < 0.0 then
  +                // This shouldn't ever happen, but just to be sure...
  +                0.0, 0.0, 0.0
  +            elif hue' < 1.0 then
  +                chroma, x, 0.0
  +            elif hue' < 2.0 then
  +                x, chroma, 0.0
  +            elif hue' < 3.0 then
  +                0.0, chroma, x
  +            elif hue' < 4.0 then
  +                0.0, x, chroma
  +            elif hue' < 5.0 then
  +                x, 0.0, chroma
  +            else // x >= 5 && x < 6
  +                chroma, 0.0, x
  +
  +        let m = brightness - chroma
  +
  +        Color.FromArgb (
  +            int ((r' + m) * 255.0),
  +            int ((g' + m) * 255.0),
  +            int ((b' + m) * 255.0))
  +
  +    /// Returns a randomly-generated color palette
  +    /// with the specified number of colors.
  +    let random count =
  +        // Preconditions
  +        // TODO : Count must be non-negative.
  +
  +        // TODO : If the count is zero return an empty array.
  +
  +        let rng = System.Random ()
  +        // Create the random hue value for each color.
  +        Array.init count <| fun _ -> rng.NextDouble ()
  +        |> Array.map (fun hue ->
  +            // The saturation and brightness values can be tweaked as desired.
  +            let h = (hue + phi_conj) % 1.0
  +            colorFromHSV (h * 360.0, 0.5, 0.95))
  +
  +
   [<RequireQualifiedAccess>]
   module Dgml =
       open System.Xml
  +    open System.Xml.Linq
       open LanguagePrimitives
  +
  +    (* TODO :   Apply styles to the start state of each rule (perhaps some distinct
  +                background color which is the same for the start states of all rules);
  +                apply a style, e.g., thicker border stroke, to final (accepting) states. *)
   
       //
       let inline private dfaStateUniqueNodeId (ruleId : RuleIdentifier) (dfaStateId : DfaStateId) =
  
positive.code:                 let categoryAttr = dgmlDoc.CreateAttribute "Category"
                  dfaStateNode.Attributes.Append categoryAttr |> ignore
                  categoryAttr.Value <- ruleId
  
              // Add the transitions for this rule's DFA.
              compiledRule.Dfa.Transitions.AdjacencyMap
  
negative.code:     // NOTE : The backslash must be double-escaped so it is handled
      // correctly in the generated DGML file.
      let private escapedChar = function
          | '\u0000' -> "\\0"
          | '\u0007' -> "\\a"
          | '\u0008' -> "\\b"
          | '\u0009' -> "\\t"
          | '\u000a' -> "\\n"
          | '\u000c' -> "\\f"
          | '\u000d' -> "\\r"
          // For readability
          | ' ' -> "' '"
          | c ->
              if int c < 0x20 || int c = 0x7f then
                  sprintf "\\0x%02x" (int c)
              else
                  c.ToString ()
  
      //
      let private xlinqTest () =
          let logged = XDocument ()
  
          let name = "John Doe"
          let category = "FooBar"
          
          logged.Add [|
              XElement ("Properties",
                  XElement ("AcceptedRuleClauseIndex",
                      XAttribute ("Name", name),
                      XAttribute ("Category", category)))
  
              |]
          //logged.Save
  
      // Emits DGML where each DFA is a separate component of the graph.
      let emitSeparate (compiledSpec : CompiledSpecification) (options : CompilationOptions) =
  