Skip to content

Conversation

@schneems
Copy link
Collaborator

@schneems schneems commented Dec 4, 2020

CodeLines are now lexically aware of keywords. This is used by the AroundBlockScan to allow stopping after a keyword has been hit.

In addition to stripping heredocs before searching, the CodeSearch now also strips lines that contain only comments. The combination of stripping heredocs and comments prevents false positives from lexing individual lines (since a comment might contain valid code i.e. # def foo; end.

New APIs:

  • CodeLine#is_comment?
  • CodeLine#is_kw?
  • CodeLine#is_end?
  • AroundBlockScan.stop_after_kw
  • AroundBlockScan.scan_neighbors

CodeLines are now lexically aware of keywords. This is used by the AroundBlockScan to allow stopping after a keyword has been hit.

In addition to stripping heredocs before searching, the CodeSearch now also strips lines that contain only comments. The combination of stripping heredocs and comments prevents false positives from lexing individual lines (since a comment might contain valid code i.e. `# def foo; end`. 

New APIs:

- CodeLine#is_comment?
- CodeLine#is_kw?
- CodeLine#is_end?
- AroundBlockScan.stop_after_kw
- AroundBlockScan.scan_neighbors
@schneems schneems merged commit a20706e into main Dec 4, 2020
@schneems schneems deleted the schneems/on_kw branch December 4, 2020 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants