Skip to content

Commit

Permalink
[analyzer] Refactor doc comment processing like a state machine
Browse files Browse the repository at this point in the history
As suggested in https://dart-review.googlesource.com/c/sdk/+/317446.

This introduces a new class CharacterSequence, an abstraction over the
two different doc comment types, and the two remarkably different ways
they need to be walked.

One good example of the complexities is that a line starting with
`// ` must be completely ignored when processing a single-line doc
comment, but must not be ignored when processing the lines of a
multi-line doc comment. Implementing the logic of the two styles in
one body was too ugly and complex.

This also fixes a bug in offsets, as can be seen in the
ast_builder_test.

Work towards #50702

Change-Id: Ife5f17a88268e5cda1ac89d4c14fa1f1cad1333f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321360
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
  • Loading branch information
srawlins authored and Commit Queue committed Aug 17, 2023
1 parent 6dcbc9f commit f286399
Show file tree
Hide file tree
Showing 3 changed files with 328 additions and 161 deletions.
Loading

0 comments on commit f286399

Please sign in to comment.