From 6ce8f6dbdc794ca6162b5d652b8f7a0d8511df7c Mon Sep 17 00:00:00 2001 From: "D. Rimron-Soutter" Date: Mon, 13 Oct 2025 15:19:14 +0100 Subject: [PATCH] Make searching just more robust, by making it a lot dumber --- src/utils/register_parser.ts | 4 ++++ src/utils/register_parsers/reg_default.ts | 10 ++++++---- src/utils/register_parsers/reg_f0.ts | 4 +++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/utils/register_parser.ts b/src/utils/register_parser.ts index 07d2406..2777139 100644 --- a/src/utils/register_parser.ts +++ b/src/utils/register_parser.ts @@ -35,6 +35,8 @@ export interface Register { description: string; issue_4_only: boolean; source: string[]; + search: string; + wiki_link: string; text: string; notes: Note[]; } @@ -94,6 +96,8 @@ export function processRegisterBlock(paragraph: string, registers: Register[]) { modes: [], issue_4_only: false, source: [], + search: "", + wiki_link: "", text: "", notes: [], }; diff --git a/src/utils/register_parsers/reg_default.ts b/src/utils/register_parsers/reg_default.ts index 938166a..c8f97c5 100644 --- a/src/utils/register_parsers/reg_default.ts +++ b/src/utils/register_parsers/reg_default.ts @@ -8,11 +8,13 @@ export const parseDescriptionDefault = (reg: Register, description: string) => { const detail: RegisterDetail = { read: undefined, write: undefined, common: undefined, text: ''}; for (const line of descriptionLines) { - if (line.includes('Issue 4 Only')) reg.issue_4_only = true; - - const spaces_at_start = line.match(/^(\s*)/)?.[0].length || 0; - const trimmedLine = line.trim(); reg.source.push(line); + reg.search += line + " "; + + const trimmedLine = line.trim(); + const spaces_at_start = line.match(/^(\s*)/)?.[0].length || 0; + + if (line.includes('Issue 4 Only')) reg.issue_4_only = true; if (trimmedLine.startsWith('//')) continue; diff --git a/src/utils/register_parsers/reg_f0.ts b/src/utils/register_parsers/reg_f0.ts index 7d2e20b..2249091 100644 --- a/src/utils/register_parsers/reg_f0.ts +++ b/src/utils/register_parsers/reg_f0.ts @@ -17,8 +17,10 @@ export const parseDescriptionF0 = (reg: Register, description: string) => { for (const line of descriptionLines) { reg.source.push(line); - const spaces_at_start = line.match(/^(\s*)/)?.[0].length || 0; + reg.search += line + " "; + const trimmedLine = line.trim(); + const spaces_at_start = line.match(/^(\s*)/)?.[0].length || 0; if(spaces_at_start == 2) { if (trimmedLine.startsWith('*')) {