Descriptiongn: attach comments to parse tree
(Split off of https://codereview.chromium.org/588813002)
The main change here is to restructure the ParseNode tree to include
comments. Comments are not included in the tree as normal nodes, but
instead attached subordinate to other |ParseNode|s. This is useful
for two reasons:
- it means neither the evaluator nor the main code of the parser need
to get more complicated, as they do not need to constantly consider
comments.
- it confers additional information about the relative location of
of the comments to their surrounding code when (in the future)
outputting the formatted code.
Comments are added in relation to the node they're attached to as
before, after, or suffix. This is so that formatting can keep them
attached to the correct thing when things are reflowed.
Timing data (Windows, Release):
Before:
Done. Wrote 1618 targets from 530 files in 2613ms
Done. Wrote 1618 targets from 530 files in 2952ms
Done. Wrote 1618 targets from 530 files in 3093ms
After:
Done. Wrote 1618 targets from 530 files in 2767ms
Done. Wrote 1618 targets from 530 files in 3120ms
Done. Wrote 1618 targets from 530 files in 2872ms
So, it seems within the noise at this point.
R=brettw@chromium.org
BUG=348474
Committed: https://crrev.com/be5d45107aeffccffa607908399ca0ae20512589
Cr-Commit-Position: refs/heads/master@{#296331}
Patch Set 1 #Patch Set 2 : tidy #Patch Set 3 : suffix comments too #
Total comments: 12
Patch Set 4 : review fixes #Patch Set 5 : x64 #
Messages
Total messages: 28 (11 generated)
|