Skip to content

Conversation

@RunDevelopment
Copy link
Contributor

Description

This PR adds support for zero-width patterns. I need this to implement lookaheads, lookbehinds, and optional patterns (think regex ?) for #1150.

Implementation-wise, I just changed the return type of Pattern:matches from Option<NonZeroUsize> to Option<usize>.

How Has This Been Tested?

Existing lints serve as tests

Checklist

  • I have performed a self-review of my own code
  • I have added tests to cover my changes

@RunDevelopment RunDevelopment mentioned this pull request Apr 28, 2025
2 tasks
elijah-potter
elijah-potter previously approved these changes Apr 29, 2025
Copy link
Collaborator

@elijah-potter elijah-potter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a pretty straightforward but likely tedious change. Thanks for doing it!

@elijah-potter elijah-potter added this pull request to the merge queue Apr 29, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 29, 2025
@elijah-potter elijah-potter added this pull request to the merge queue Apr 29, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 29, 2025
@RunDevelopment
Copy link
Contributor Author

I resolved all conflicts.

"target_metadata": {
"verb": {},
"verb": {
"tense": "Present"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Tense" is a syntactic property once words are in sentences and the sentences have been parsed. Words like "run", "walk", "eat" can be future if they come after "will", "shall", "going to", "gonna" or infinitive if they come after "to", etc.

The dictionary and affix system are lexical rather than syntactic. Terms used for this form of verbs are "dictionary form", "citation form", "lemma" - these three apply to other inflected parts of speech too. For verbs specifically "infinitive", literally "no time", "not inflected for tense".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did you make this comment here? Did GitHub mess up?

# For this reason the most important ones to include are the ones that have a noun counterpart.
# Remember not to add any affixes since only the verb part at the start undergoes inflection.

back up/4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been thinking about having a special annotation flag for these. It would already be useful in linters. The one I worked on weeks ago dealing with the "backup"/"back up" problem I think finally got merged today and it would benefit already.

But I wasn't sure if the multi-word part of the dictionary would be accepted. I guess it has been. But that's why I'd put them in a separate part of the dictionary. To make best use we would really want some kind of multi-word awareness in parsing and spell checking so I hadn't pushed it any further yet.

@elijah-potter elijah-potter added this pull request to the merge queue Apr 29, 2025
Merged via the queue into Automattic:master with commit bbb980d Apr 29, 2025
22 checks passed
@RunDevelopment RunDevelopment deleted the zero-w-patterns branch April 29, 2025 20:54
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request May 10, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [Automattic/harper/harper-ls](https://github.com/Automattic/harper) | minor | `v0.29.1` -> `v0.34.1` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>Automattic/harper (Automattic/harper/harper-ls)</summary>

### [`v0.34.1`](https://github.com/Automattic/harper/releases/tag/v0.34.1)

[Compare Source](Automattic/harper@v0.34.0...v0.34.1)

#### What's Changed

-   feat:definitive article→definite article by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1248
-   fix(obsidian): odd padding around message by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1252
-   feat: Correct "infront" and other phrases written as a single word by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1192

**Full Changelog**: Automattic/harper@v0.34.0...v0.34.1

### [`v0.34.0`](https://github.com/Automattic/harper/releases/tag/v0.34.0)

[Compare Source](Automattic/harper@v0.33.0...v0.34.0)

#### What's Changed

-   feat: articles implies no verb by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1188
-   build(deps): bump hashbrown from 0.15.2 to 0.15.3 by [@&#8203;dependabot](https://github.com/dependabot) in Automattic/harper#1230
-   fix(obsidian): pretty-print the lint kind by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1235
-   test: add snapshots for linters by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1228
-   feat: disambiguate prepositions followed by determiners by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1187
-   Nominal phrase test helper by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1227
-   feat: add single token pattern trait by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1209
-   feat:one in the same→one and the same by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1154
-   fix(core): long sentence lint should start with word by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1236
-   refactor: remove unnecessary Option in PhrasalVerbAsCompoundNoun by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1243
-   refactor: don't allocate when linting chunks by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1242
-   feat(core): use Rayon in snapshot tests by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1237
-   Tweaks for Chrome Extension by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1244
-   feat(web): render HTML descriptions on rules page by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1240
-   fix(core): don't misplace `ParagraphBreak` tokens by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1239
-   fix: fix indefinite article for "utter(ly)" by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1247
-   feat: Improved metadata applied by affix system by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1214

**Full Changelog**: Automattic/harper@v0.33.0...v0.34.0

### [`v0.33.0`](https://github.com/Automattic/harper/releases/tag/v0.33.0)

[Compare Source](Automattic/harper@v0.32.1...v0.33.0)

#### What's Changed

-   Create a Chrome extension by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1072
-   Documentation updates by [@&#8203;mcecode](https://github.com/mcecode) in Automattic/harper#1233
-   ci: add `cargo hack` by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1160
-   fix(chrome-ext): render on scroll by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1234
-   refactor: use `LSend` trait to simplify trait definitions by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1225
-   build(deps): bump chrono from 0.4.40 to 0.4.41 by [@&#8203;dependabot](https://github.com/dependabot) in Automattic/harper#1231
-   fix: "towards" is a preposition by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1213
-   perf(core): `PlainEnglish` parser in `ExactPhrase` by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1217
-   test(ls): ensure we write sorted dictionaries by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1205
-   fix: prevent crash in PhrasalVerbAsCompoundNoun by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1210
-   fix: Remove verb property from "of" by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1206
-   feat(cli): fallback to `PlainEnglish` parser by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1223
-   fix: heuristic for no-contraction-with-verb for "let go" by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1203
-   chore: minor typos in two files' comments by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1218

**Full Changelog**: Automattic/harper@v0.32.1...v0.33.0

### [`v0.32.1`](https://github.com/Automattic/harper/releases/tag/v0.32.1)

[Compare Source](Automattic/harper@v0.31.0...v0.32.1)

#### What's Changed

-   feat: aswell→as well by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1161
-   Fix false positive in let/lets→let's by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1158
-   feat: last ditched/ditch→last-ditch by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1147
-   build: add caching by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1172
-   feat: implement `assert_any_suggestion_result` as in [#&#8203;950](Automattic/harper#950) by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1033
-   Add `core_version` to `harper-core` by [@&#8203;HobbitJack](https://github.com/HobbitJack) in Automattic/harper#1168
-   fix(core): runaway `harper-ls` processes by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1163
-   fix(core): ignore whitespace when matching case by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1165
-   Rules by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1128
-   fix(core): don't lex the last period as part of a number by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1162
-   fix([#&#8203;1051](Automattic/harper#1051)): Ignore potential ordinal suffixes of length greater than 2 by [@&#8203;grantlemons](https://github.com/grantlemons) in Automattic/harper#1054
-   docs: fix incorrect documentation for some linters by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1151
-   refactor: Rename `ACO` to `Word` by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1149
-   fix(core): allow erroneous `shift` usage in spellcheck by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1166
-   feat: iterator API for pattern matches by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1155
-   feat: Flag phrasal verbs spelled as compound nouns by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#991
-   fix(core): improve `Dashes` description by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1174
-   Add snapshot tests for token metadata (aka part-of-speech tags) by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1119
-   docs(readme): fix grammar and minor rephrasing by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1176
-   feat: zero-width patterns by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1153
-   chore(harper-core/dictionary): add unpublish(ing) forms with flags by [@&#8203;uncenter](https://github.com/uncenter) in Automattic/harper#1180
-   feat(core): avoid providing multiple lints for a single long hyphen sequence in `Dashes` by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1182
-   feat: once a while→once in a while by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1191
-   chore(harper-core/dictionary): add developer-related nouns by [@&#8203;uncenter](https://github.com/uncenter) in Automattic/harper#1179
-   fix: running individual tests was broken by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1184
-   feat: how it looks like→how it looks/what it looks like by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1146
-   chore(harper-core/dictionary): add Tree-sitter by [@&#8203;uncenter](https://github.com/uncenter) in Automattic/harper#1193
-   fix: add exception to possessive_your linter by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1201
-   feat(ls): write sorted dictionaries by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1195
-   feat: dictionary curation and dialect tests by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1197
-   chore(harper-core/dictionary): add manufacturable and favicon by [@&#8203;uncenter](https://github.com/uncenter) in Automattic/harper#1194
-   fix: exception for "how did you" in how-to linter by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1200
-   feat:Guilded Age→Gilded Age; once and a while→once in a while by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1196
-   fix: heuristics to fix "comparison to expected results" by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1186
-   chore: convert commented out tests to use `#[ignore]` by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1199
-   Print version numbers by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1204

#### New Contributors

-   [@&#8203;HobbitJack](https://github.com/HobbitJack) made their first contribution in Automattic/harper#1168
-   [@&#8203;uncenter](https://github.com/uncenter) made their first contribution in Automattic/harper#1180

**Full Changelog**: Automattic/harper@v0.31.0...v0.32.1

### [`v0.31.0`](https://github.com/Automattic/harper/releases/tag/v0.31.0)

[Compare Source](Automattic/harper@v0.30.0...v0.31.0)

#### What's Changed

-   No invalid `private = true` fields in `Cargo.toml` by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1120
-   Dictionary curation 2025 04 22 by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1122
-   Flags the definite article used together with a possessive by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1112
-   dictionary: Added Schengen by [@&#8203;jpds](https://github.com/jpds) in Automattic/harper#1083
-   Removed the useless `SequencePattern` in `IndefiniteArticle` by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1125
-   Use `Option<NonZeroUsize>` as the return type of `Pattern::matches` by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1124
-   fix: Make code compile without `concurrent` feature by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1140
-   refactor: removed unused patterns by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1141
-   Dictionary curation 2025 04 25 by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1136
-   feat: `Document` QoL functions for tokens & words by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1117
-   feat: invest into→invest in by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1139

#### New Contributors

-   [@&#8203;jpds](https://github.com/jpds) made their first contribution in Automattic/harper#1083

**Full Changelog**: Automattic/harper@v0.30.0...v0.31.0

### [`v0.30.0`](https://github.com/Automattic/harper/releases/tag/v0.30.0)

[Compare Source](Automattic/harper@v0.29.1...v0.30.0)

#### What's Changed

-   docs: clarify question on FAQ by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1087
-   feat: handle some false positives in let/lets/let's/let us by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1085
-   feat: have past→have passed by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1088
-   build(deps): bump clap from 4.5.36 to 4.5.37 by [@&#8203;dependabot](https://github.com/dependabot) in Automattic/harper#1093
-   feat: Australian English affix annotation `_` by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1094
-   fix: reset vscode version to `1.96.2` by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1084
-   Dictionary (and adj-of-a) curation 2025 04 18 by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1090
-   Updated `justfile` to check tests and benches by [@&#8203;RunDevelopment](https://github.com/RunDevelopment) in Automattic/harper#1098
-   feat: worse-case scenario→worst-case scenario by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1104
-   docs(obsidian): wrote initial contributor's guide by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1105
-   feat: incase→in case by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1103
-   feat: adds a `t_ws()` shorthand for `then_whitespace()` in the spirit of `t_aco()` by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1115
-   feat: implement dialect indicator for Obsidian plugin by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1102
-   Fix Lua syntax in neovim example config by [@&#8203;nikosavola](https://github.com/nikosavola) in Automattic/harper#1110
-   feat: client's side→client-side, server's side→server side by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1109
-   fix(obsidian): console contamination by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1116
-   feat(core): add several novel rules by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1108

#### New Contributors

-   [@&#8203;nikosavola](https://github.com/nikosavola) made their first contribution in Automattic/harper#1110

**Full Changelog**: Automattic/harper@v0.29.1...v0.30.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yNTcuOCIsInVwZGF0ZWRJblZlciI6IjQwLjEwLjQiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbIlJlbm92YXRlIEJvdCJdfQ==-->
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.

3 participants