Distinguish top-level parses from in-document parses.

* For top-level document, any per-document global state shared
  across all pipelines used for the document should be reset.
  We cannot rely on 'end' event to reset document state since this
  event is emitted per-pipeline, not per-document.

* An example of this top-level document state is the cite ref
  indexes.

* Fixed all instances of top-level document parses across scripts
  (parse.js, roundtrip-test.js, ParserService.js).

* This should fix [BUG 47513]. Other cite patches should fix other
  problems with cite ref numbering within a document.

Change-Id: I490edd52be75d8484358a07bef783080f4604f86
Merge "Distinguish top-level parses from in-document parses."