[SuperSize] Refactor MapFileParserLld.Parse() using a filtering generator.

We wish to extract more symbols from Level 3 lines from .map files.
Some lines have |size == 0| (this can happen for symbols from assembly
sources), but we can approximate actual size from |address| difference
between successive lines. We call this approximation "span".

This CL refactors MapFileParserLld.Parse() by extracting some parsing
logic into a new generator MapFileParserLld.Tokenize(). Details:
* Tokenize() is a generator that:
  * Consumes .map file lines and yields parsed fields.
  * Applies a one-step lookhead, and maintains "next" and "current"
    tokens from successive lines to compute "span" (some complication
    exist).
  * Skips Level 3 annotations ('$a', '$t.123', etc.), which also has
    |size == 0| but produces no symbols, and so should be ignored for
    "span" computation.
  * Detects Thumb2 annotations '$t' and adjusts |address| accordingly.
* Add 2 new tests to LinkerMapParserTest:
  * test_ParseArmAnnotation() for annotation parsing.
  * test_Tokenize() to dump Tokenize() output, and compare against new
    Tokenize.golden file.

As a refactoring CL, MapFileParserLld output remains unchanged. Actual
usage of "span" will be implemented in follow-ups.

Bug: 892648
Change-Id: Ia630027b85e45a234101396917ea4626b9dba1bc
Reviewed-on: https://chromium-review.googlesource.com/c/1377189
Reviewed-by: Samuel Huang <huangs@chromium.org>
Reviewed-by: agrieve <agrieve@chromium.org>
Commit-Queue: Samuel Huang <huangs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#616594}
3 files changed