Skip to content
This repository was archived by the owner on Dec 4, 2018. It is now read-only.

Update: support node ranges (fixes #89) #190

Merged
merged 2 commits into from
Dec 10, 2017
Merged

Conversation

not-an-aardvark
Copy link
Member

This adds a range option to the parse API. When enabled, each node has a [start, end] range property indicating its location in the comment.

When computing the range with the unwrap: true option, the returned range needs to track indices in the original comment, not the unwrapped version. To implement that behavior, this commit updates the unwrapping logic to use a regular expression rather than a state machine. When converting an index, the parser and re-matches the original comment line-by-line, keeping track of the number of discarded "wrapping" characters.

@kaicataldo
Copy link
Member

@not-an-aardvark Sorry this is so late, but looks like we have some merge conflicts.

@coveralls
Copy link

coveralls commented Nov 11, 2017

Coverage Status

Coverage decreased (-0.1%) to 99.153% when pulling bb30cf8 on range-option into aaa3729 on master.

This adds a `range` option to the `parse` API. When enabled, each node has a [start, end] range property indicating its location in the comment.

When computing the range with the `unwrap: true` option, the returned range needs to track indices in the original comment, not the unwrapped version. To implement that behavior, this commit updates the unwrapping logic to use a regular expression rather than a state machine. When converting an index, the parser and re-matches the original comment line-by-line, keeping track of the number of discarded "wrapping" characters.
@coveralls
Copy link

coveralls commented Nov 15, 2017

Coverage Status

Coverage increased (+0.01%) to 99.258% when pulling abd6d6e on range-option into 5049ee3 on master.

@not-an-aardvark not-an-aardvark merged commit 827f314 into master Dec 10, 2017
@not-an-aardvark not-an-aardvark deleted the range-option branch December 10, 2017 00:57
tmcw pushed a commit to documentationjs/doctrine that referenced this pull request Apr 11, 2018
This adds a `range` option to the `parse` API. When enabled, each node has a [start, end] range property indicating its location in the comment.

When computing the range with the `unwrap: true` option, the returned range needs to track indices in the original comment, not the unwrapped version. To implement that behavior, this commit updates the unwrapping logic to use a regular expression rather than a state machine. When converting an index, the parser and re-matches the original comment line-by-line, keeping track of the number of discarded "wrapping" characters.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants