anchor.diff:              IndentedTextWriter.indented writer <| fun writer ->
                   writer.WriteLine "("
                   IndentedTextWriter.indented writer <| fun writer ->
  -                    // TODO : May need to split 'code' into individual lines and write them to the
  -                    // IndentedTextWriter one-by-one to preserve correct indentation level.
  -                    writer.WriteLineNoTabs action
  +                    // Write the trimmed action-code lines to the IndentedTextWriter one-by-one.
  +                    // This ensures they're indented correctly with respect to the rest of the emitted code.
  +                    trimmedActionLines
  +                    |> Array.iter writer.WriteLine
                   writer.WriteLine ")"
   
               // Emit the nonterminal type for this production rule.
  
positive.code:         oneLineArrayUInt16 ("_fsyacc_immediateActions", false,
              _fsyacc_immediateActions) writer
  
      //
      let private reduction (processedSpec : ProcessedSpecification<NonterminalIdentifier, TerminalIdentifier>,
                             nonterminal : NonterminalIdentifier,
                             symbols : Symbol<NonterminalIdentifier, TerminalIdentifier>[],
  
negative.code:                 // Create a generic type parameter to use for this nonterminal and let
                  // the F# compiler use type inference to figure out what type it should be.
                  "'" + nonterminal
  
          (*  Split 'action' into multiple lines. Determine the minimum amount of whitespace
              which appears on the left of any line in the action, but do not consider blank
              lines. Then, trim this minimum amount of whitespace from the left side of each
              line. When this is done, the action can be written line-by-line using the standard
              'writer.WriteLine' method of the IndentedTextWriter, and the generated code will
              have the correct indentation. *)
  
          /// The individual lines of the reduction action code, trimmed to remove a number of
          /// leading spaces common to all non-empty/non-whitespace lines.
          let trimmedActionLines =
              /// The individual lines of the reduction action code,
              /// annotated with the number of leading spaces on that line.
              let annotatedActionLines =
                  action.Split ([| "\r\n"; "\n"; "\r" |], StringSplitOptions.None)
                  |> Array.map (fun line ->
                      // First replace any tab characters in the string.
                      let line = replaceTabs "    " line
                      let leadingSpaces = countLeadingSpaces line
                      line, leadingSpaces)
          
              /// The minimum number of spaces on the left side of any line of code.
              let minIndentation =
                  let minIndentation =
                      (None, annotatedActionLines)
                      ||> Array.fold (fun x (_, y) ->
                          match x, y with
                          | None, None ->
                              None
                          | (Some _ as x), None ->
                              x
                          | None, (Some _ as y) ->
                              y
                          | Some x, Some y ->
                              Some <| min x y)
  
                  // Default to zero (0) indentation.
                  defaultArg minIndentation GenericZero
  
              // Remove the same amount of indentation from every non-empty line.
              annotatedActionLines
              |> Array.map (fun (line, leadingSpaces) ->
                  match leadingSpaces with
                  | None ->
                      assert (String.IsNullOrWhiteSpace line)
                      String.Empty
                  | Some _ ->
                      // Remove the computed number of spaces from the left side of this line.
                      line.Substring (int minIndentation))
              
          // Emit the semantic action code, wrapped in a bit of code which boxes the return value.
          writer.WriteLine "Microsoft.FSharp.Core.Operators.box"
  