feat(match-input): replace regex parser with tokenizer, remove moment (#177, #230) - #231
Merged
Merged
Conversation
Steps 1-9 of plan #177: - ParseConfidence type + optional confidence field on Input - Token types, interfaces in match-input.ts - weekdayVocab() / monthVocab() as string[] (stop joining to regex) - Recognizer functions with wordEnd() boundary check - tokenize() loop: explicit priority order, no alternation-order surprises - tokensToInput() mapper replacing extractX / resolveX methods - resolveRelatedWeekNM / resolveDayOfMonthNM replace moment calls - Parallel phase in parseInput(): tokenizer runs alongside regex, logs divergences via logger.debug; regex still authoritative - Dialogues: $(check)/$(warning) ThemeIcon prefix in description driven by parsed.confidence (QuickPick lacks validationMessage) - match-input-vocab.test.ts: 40+ scenarios covering shortcuts, offsets, ISO forms, weekday/week/month+day, task flags, prefix collision guard, and vocab sweep for false-positive detection #177
Step 10 of plan #177: - parseInput() now calls tokenize() + tokensToInput() directly - Deleted: getExpression(), getMonthPattern(), getWeekdayPattern(), extractText/Flags/Offset/Week/Tags, hasTemporalToken, resolveRelatedWeek, resolveNumberedWeek, resolveDayOfMonth, this.expr cache field - Removed: import moment (no moment calls remain in this file) - resolveRelatedWeekNM / resolveDayOfMonthNM are the authoritative week/month-day resolvers going forward #177
Proves recognizeWeek uses zero-width lookahead — no character consumed from following text. Covers: week+text, standalone week, w<num> priority. #230 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Jun 1, 2026
Owner
Author
|
Code review and test verification for PR #231 (Fixes #177, #230):
Approval Recommendation: The PR is technically sound, well-tested, and addresses the root causes of multiple reported issues. Recommending approval and merge. |
Owner
Author
|
CI Failure Analysis: Crucially, all MatchInput tests (including the 56 new tokenizer tests) passed in CI. I've verified that the same #144 failure occurs on the develop branch. PR #231 is safe to merge. |
This was referenced Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
getExpression()regex dispatch inMatchInputwith a left-to-right priority-ordered tokenizer (tokenize→tokensToInput). Each recognizer is a pure function with explicit word-boundary checks viawordEnd()— closes the(?=\s|$)bug class from Wrong day is set when enter a new entry #170.import momentfrommatch-input.ts; all date arithmetic replaced withgetCurrentISOWeek+Date.UTC(moment remains in other files — Phase 3).ParseConfidence(resolved/ambiguous/text-only) onInput; QuickPick description prefixed with$(check)/$(warning)ThemeIcons for visual feedback.recognizeWeekuses zero-width lookahead by design; three regression tests added.Related issues
Closes #177
Closes #230
Specs / Plans
Test plan
npm test -- --grep "MatchInput"— all vocab + regression tests pass (40+ scenarios)npm test— 221 passing; 2 pre-existing failures unrelated to this PR (sync-note-links,issue-144-cmd) verified ondevelopbefore this branchCtrl+Shift+J), typemon→$(check)prefix; typedi→$(warning)prefix; typetask week Buy groceries→ task created on current week with full text preserved🤖 Generated with Claude Code
Also closes #232