anchor.diff:      project ""<filename>""
         - associates the current session with the specified project"
   
  +  let outputText = @"
  +    Output format
  +    =============
  +
  +    Messages are in one of the following three forms:
  +
  +    1. INFO: text
  +
  +       A single line with a free text field. Returns information.
  +
  +    2. ERROR: text
  +
  +       A single line with a free text field. An error has occurred.
  +  
  +    3. DATA: word number
  +       text
  +
  +       Some data, where 'word' (in [a-z]+) indicates the type of data
  +       and 'number' (in [0-9]+) indicates the number of bytes of free
  +       text that will follow."
  +
     // Command that can be entered on the command-line
     type Command =
       | Completion of string * Position * int option
  
positive.code:           let decls = agent.GetDeclarations(opts)
            for tld in decls do
              let (s1, e1), (s2, e2) = tld.Declaration.Range
              printfn "[%d:%d-%d:%d] %s" e1 s1 e2 s2 tld.Declaration.Name
              for d in tld.Nested do
                let (s1, e1), (s2, e2) = d.Range
                printfn "  - [%d:%d-%d:%d] %s" e1 s1 e2 s2 d.Name
            Console.WriteLine("<<EOF>>")
          main state
  
      | ToolTip(file, ((line, column) as pos), timeout) ->
          // Trigger tooltip request (when we already loaded a file)
          let file = Path.GetFullPath file
          if not (Map.containsKey file state.Files)
          then
            Console.WriteLine(sprintf "ERROR: File '%s' not parsed" file)
            Console.WriteLine("<<EOF>>")
          else
            let lines = state.Files.[file]
            if line >= lines.Length || line < 0 ||
               column > lines.[line].Length || column < 0
            then
              Console.WriteLine("ERROR: Position is out of range")
              Console.WriteLine("<<EOF>>")
            else
              let text = String.concat "\n" lines
              let opts = RequestOptions(agent.GetCheckerOptions(file, text, state.Project),
                                        file,
                                        text)
              agent.GetToolTip(opts, pos, lines.[line], timeout)
          main state
  
      | Completion(file, ((line, column) as pos), timeout) ->
          // Trigger autocompletion (when we already loaded a file)
          let file = Path.GetFullPath file
          if not (Map.containsKey file state.Files)
          then
            Console.WriteLine(sprintf "ERROR: File '%s' not parsed" file)
            Console.WriteLine("<<EOF>>")
          else
            let lines = state.Files.[file]
            if line >= lines.Length || line < 0 ||
               column > lines.[line].Length || column < 0
            then
              Console.WriteLine("ERROR: Position is out of range")
              Console.WriteLine("<<EOF>>")
            else
              let text = String.concat "\n" lines
              let opts = RequestOptions(agent.GetCheckerOptions(file, text, state.Project),
                                        file,
                                        text)
              agent.DoCompletion(opts, pos, lines.[line], timeout)
          main state
  
      | FindDeclaration(file, ((line, column) as pos), timeout) ->
          let file = Path.GetFullPath file
          if not (Map.containsKey file state.Files)
          then
            Console.WriteLine(sprintf "ERROR: File '%s' not parsed" file)
            Console.WriteLine("<<EOF>>")
          else
            let lines = state.Files.[file]
            if line >= lines.Length || line < 0 ||
               column > lines.[line].Length || column < 0
            then
              Console.WriteLine("ERROR: Position is out of range")
              Console.WriteLine("<<EOF>>")
            else
              let text = String.concat "\n" lines
              let opts = RequestOptions(agent.GetCheckerOptions(file, text, state.Project),
                                        file,
                                        text)
              agent.FindDeclaration(opts, pos, lines.[line], timeout)
          main state
      | Help ->
          Console.WriteLine(helpText)
          main state
  
negative.code:   let agent = new IntelliSenseAgent()
  
    let rec main (state:State) : int =
      let parsed file =
        let b = Map.containsKey file state.Files
        if not b then printfn "ERROR: File '%s' not parsed" file
        b
  
      /// Is the specified position consistent with internal state of file?
      let posok file line col =
        let lines = state.Files.[file]
        let b = line >= lines.Length || line < 0 ||
                column > lines.[line].Length || column < 0
        if b then Console.WriteLine("ERROR: Position is out of range")
        b
      
      Debug.print "main state is:\nproject: %b\nfiles: %A"
                  (Option.isSome state.Project)
                  (Map.fold (fun ks k _ -> k::ks) [] state.Files)
      match parseCommand(Console.ReadLine()) with
      | GetErrors ->
          let errs = agent.GetErrors()
          let msg =
            [ for e in errs do yield
                sprintfn "[%d:%d-%d:%d] %s %s"
                         e.StartLine
                         e.StartColumn
                         e.EndLine
                         e.EndColumn
                         (if e.Severity = Severity.Error then "ERROR" else "WARNING")
                         e.Message ]
            |> String.concat ""
          printfn "DATA: errors %d %s" (String.length msg) msg
          main state
  
      | Parse(file,full) ->
  