anchor.diff:                      if Set.contains nestedMacroId badMacros then
                           // We have to return something, so return Empty to take the place
                           // of this macro reference.
  -                        Choice1Of2 Regex.empty
  -                        |> cont
  +                        return Choice1Of2 Regex.empty
                       else
  -                        Choice2Of2 [ sprintf "The macro '%s' is not defined." nestedMacroId ]
  -                        |> cont
  +                        return Choice2Of2 [ sprintf "The macro '%s' is not defined." nestedMacroId ]
  +
                   | Some nestedMacro ->
                       // Return the pattern for the nested macro so it'll be "inlined" into this pattern.
  -                    Choice1Of2 nestedMacro
  -                    |> cont
  +                    return Choice1Of2 nestedMacro
   
           (* Characters and character sets *)
           | Pattern.Empty ->
  -            Regex.empty
  -            |> Choice1Of2
  -            |> cont
  +            return
  +                Regex.empty
  +                |> Choice1Of2
   
           | Pattern.Character c ->
               // Make sure the character is an ASCII character unless the 'Unicode' option is set.
               if options.Unicode || int c <= 255 then
  -                Regex.ofChar c
  -                |> Choice1Of2
  -                |> cont
  +                return
  +                    Regex.ofChar c
  +                    |> Choice1Of2
               else
  -                ["Unicode characters may not be used in patterns unless the 'Unicode' compiler option is set."]
  -                |> Choice2Of2
  -                |> cont
  +                return
  +                    ["Unicode characters may not be used in patterns unless the 'Unicode' compiler option is set."]
  +                    |> Choice2Of2
   
           | Pattern.CharacterSet charSet ->
               // Make sure all of the characters in the set are ASCII characters unless the 'Unicode' option is set.
               if options.Unicode || CharSet.forall (fun c -> int c <= 255) charSet then
  -                Regex.CharacterSet charSet
  -                |> Choice1Of2
  -                |> cont
  +                return
  +                    Regex.CharacterSet charSet
  +                    |> Choice1Of2
               else
  -                ["Unicode characters may not be used in patterns unless the 'Unicode' compiler option is set."]
  -                |> Choice2Of2
  -                |> cont
  +                return
  +                    ["Unicode characters may not be used in patterns unless the 'Unicode' compiler option is set."]
  +                    |> Choice2Of2
   
           | Pattern.UnicodeCategory abbrev ->
               if options.Unicode then
                   match UnicodeCharSet.ofAbbreviation abbrev with
                   | None ->
  -                    [ sprintf "Unknown or invalid Unicode category specified. (Category = %s)" abbrev ]
  +                    return
  +                        [ sprintf "Unknown or invalid Unicode category specified. (Category = %s)" abbrev ]
  +                        |> Choice2Of2
  +                | Some categoryCharSet ->
  +                    return
  +                        Regex.CharacterSet categoryCharSet
  +                        |> Choice1Of2
  +            else
  +                return
  +                    ["Unicode category patterns may not be used unless the 'Unicode' compiler option is set."]
                       |> Choice2Of2
  -                    |> cont
  -                | Some categoryCharSet ->
  -                    categoryCharSet
  -                    |> Regex.CharacterSet
  -                    |> Choice1Of2
  -                    |> cont
  -            else
  -                ["Unicode category patterns may not be used unless the 'Unicode' compiler option is set."]
  -                |> Choice2Of2
  -                |> cont
   
           (* Wildcard pattern *)
           | Pattern.Any ->
               // Macros are not allowed to use the wildcard pattern.
  -            ["The wildcard pattern cannot be used within macro definitions."]
  -            |> Choice2Of2
  -            |> cont
  +            return
  +                ["The wildcard pattern cannot be used within macro definitions."]
  +                |> Choice2Of2
  +        }
   
       /// Contains an error if a macro has already been defined with this name; otherwise, None.
       let duplicateNameError =
  
positive.code:                 if Set.contains macroId badMacros then
                      // We have to return something, so return Empty to
                      // take the place of this macro reference.
                      Choice1Of2 Regex.empty
                      |> cont
                  else
                      Choice2Of2 [ sprintf "The macro '%s' is not defined." macroId ]
                      |> cont
              | Some nestedMacro ->
                  // Return the pattern for the nested macro so it'll be "inlined" into this pattern.
                  Choice1Of2 nestedMacro
                  |> cont
  
          | Pattern.UnicodeCategory abbrev ->
              if options.Unicode then
                  // Return the CharSet representing this UnicodeCategory.
                  match UnicodeCharSet.ofAbbreviation abbrev with
                  | None ->
                      [ sprintf "Unknown or invalid Unicode category specified. (Category = %s)" abbrev ]
                      |> Choice2Of2
                      |> cont
                  | Some charSet ->
                      Regex.CharacterSet charSet
                      |> Choice1Of2
                      |> cont
              else
                  ["Unicode category patterns may not be used unless the 'Unicode' compiler option is set."]
                  |> Choice2Of2
                  |> cont
  
          | Pattern.Negate r ->
              validateAndSimplify r <| fun rResult ->
                  match rResult with
                  | (Choice2Of2 _ as err) -> err
                  | Choice1Of2 r ->
                      Regex.Negate r
                      |> Choice1Of2
                  |> cont
  
          | Pattern.Star r ->
              validateAndSimplify r <| fun rResult ->
                  match rResult with
                  | (Choice2Of2 _ as err) -> err
                  | Choice1Of2 r ->
                      Regex.Star r
                      |> Choice1Of2
                  |> cont
  
          | Pattern.Concat (r, s) ->
              validateAndSimplify r <| fun rResult ->
              validateAndSimplify s <| fun sResult ->
                  match rResult, sResult with
                  | Choice2Of2 rErrors, Choice2Of2 sErrors ->
                      Choice2Of2 (rErrors @ sErrors)
                  | (Choice2Of2 _ as err), Choice1Of2 _
                  | Choice1Of2 _, (Choice2Of2 _ as err) ->
                      err
                  | Choice1Of2 r, Choice1Of2 s ->
                      Regex.Concat (r, s)
                      |> Choice1Of2
                  |> cont
  
          | Pattern.And (r, s) ->
              validateAndSimplify r <| fun rResult ->
              validateAndSimplify s <| fun sResult ->
                  match rResult, sResult with
                  | Choice2Of2 rErrors, Choice2Of2 sErrors ->
                      Choice2Of2 (rErrors @ sErrors)
                  | (Choice2Of2 _ as err), Choice1Of2 _
                  | Choice1Of2 _, (Choice2Of2 _ as err) ->
                      err
                  | Choice1Of2 r, Choice1Of2 s ->
                      Regex.And (r, s)
                      |> Choice1Of2
                  |> cont
  
          | Pattern.Or (r, s) ->
              validateAndSimplify r <| fun rResult ->
              validateAndSimplify s <| fun sResult ->
                  match rResult, sResult with
                  | Choice2Of2 rErrors, Choice2Of2 sErrors ->
                      Choice2Of2 (rErrors @ sErrors)
                  | (Choice2Of2 _ as err), Choice1Of2 _
                  | Choice1Of2 _, (Choice2Of2 _ as err) ->
                      err
                  | Choice1Of2 r, Choice1Of2 s ->
                      Regex.Or (r, s)
                      |> Choice1Of2
                  |> cont
  
          (*  Extended patterns are rewritten using the cases of Pattern
              which have corresponding cases in Regex. *)
          | Pattern.Empty ->
              Regex.empty
              |> Choice1Of2
              |> cont
          
          | Pattern.Any ->
              Choice1Of2 Regex.Any
              |> cont
  
          | Pattern.Character c ->
              // Make sure the character is an ASCII character unless the 'Unicode' option is set.
              if options.Unicode || int c <= 255 then
                  Regex.ofChar c
                  |> Choice1Of2
                  |> cont
              else
                  ["Unicode characters may not be used in patterns unless the 'Unicode' compiler option is set."]
                  |> Choice2Of2
                  |> cont
  
          | Pattern.OneOrMore r ->
              // Rewrite r+ as rr*
  
negative.code:                 let rewritten = Pattern.repeatAtMost atMost r
  
                  // Process the rewritten expression.
                  return! preprocessMacro rewritten
  
              | Some atLeast, None ->
                  /// Repeats the pattern at least the specified number of times.
                  let rewritten = Pattern.repeatAtLeast atLeast r
  
                  // Process the rewritten expression.
                  return! preprocessMacro rewritten
  
              | Some atLeast, Some atMost
                  when atLeast > atMost ->
                  return
                      ["Invalid number of repetitions. The lower value of the range is greater than the upper value of the range."]
                      |> Choice2Of2
  
              | Some atLeast, Some atMost ->
                  /// Repeats the pattern at least 'atLeast' times and at most 'atMost' times.
                  let rewritten = Pattern.repeat atLeast atMost r
  
                  // Process the rewritten expression.
                  return! preprocessMacro rewritten
  
          | Pattern.Negate r ->
              let! rResult = preprocessMacro r
  
              match rResult with
              | Choice2Of2 _ as err ->
                  return err
              | Choice1Of2 r ->
                  return
                      Regex.Negate r
                      |> Choice1Of2
  
          (* Macro patterns *)
          | Pattern.Macro nestedMacroId ->
  