Repository navigation
Replace 3-arg BoolToStr with StrUtils.IfThen in auth status - #13
Merged
Merged
Conversation
Delphi's BoolToStr only takes (Boolean) or (Boolean, Boolean) — there is no 3-arg form with custom true/false strings. FPC has one, which is why the original line compiled under FPC. StrUtils.IfThen has the same signature on both compilers, so swap to that. https://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon
FMXExpress
pushed a commit
that referenced
this pull request
Jun 12, 2026
Two more cheap wins for fs_grep on top of the tier-1-4 filters (deferred-hash / blocked-dirs / NUL-sniff / size-cap), this time in the inner per-file path. Tier 5 -- walk bytes, not lines. The old ScanFile did: - StringReplace(Body, #13, '', [rfReplaceAll]) -- whole-body copy - Lines := TStringList.Create / Lines.Text := ... -- one alloc per line - LowerCase(Lines[j]) -- one per match-candidate None of that's needed. The new walker splits on #10 in place, trims trailing #13 inline for CRLF, and only Copy()s the line bytes on lines that actually matched. ~3-5x faster on the per-file path for typical source files. Tier 6 -- Boyer-Moore-Horspool substring search. The old Pos(PatLower, Cmp) advanced one byte at a time. BMH precomputes a 256-entry shift table once at Tool_FSGrep startup and on a failed alignment slides the pattern by up to m bytes instead of 1. For the patterns the model actually queries (TODO, function, class, FIXME, def, return) this hits ~3-10x fewer text-byte reads than Pos. Case-insensitive is handled by folding text bytes through a 256-entry ASCII lower table (built once per call) -- one branch instead of the old per-line LowerCase(). Pattern is pre-lowered into PatLower the same way as before. Output is byte-identical to the old path except: - CRLF lines no longer carry a stray #13 in the emitted line text (the old StringReplace pass had hidden this; the byte walker now trims trailing #13 explicitly). - Lone mid-line #13 bytes (extremely rare; old Mac line endings) are no longer stripped from output. ripgrep treats them the same way -- they're not a line terminator in modern conventions. Both behaviours are pinned by src/tests/fs_grep_tier5_6_tests.pas (10 cases): line numbers exact across the walker, CRLF trimming correct, files without trailing newline still produce a final-line match, one hashline header per matched file, ignore_case round-trip through the byte-fold table, BMH overlapping/partial/embedded patterns, m=1 degenerate case, m > n early exit, empty / newline- only bodies don't crash, and the hashline ¶path#hash header still emits in the same shape so fs_edit_hashline downstream still parses the output.
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
Fixes
[dcc64 Error] PasClaw.Cmd.Auth.pas(34): E2010 Incompatible types: 'Boolean' and 'string'.Delphi's
BoolToStronly has two overloads:(B: Boolean)and(B: Boolean; UseBoolStrs: Boolean). FPC additionally hasBoolToStr(B: Boolean; const TrueS, FalseS: string), which is whatDoStatuswas relying on. Delphi tries to match against the 2-arg overload and fails on the string args.Swap to
StrUtils.IfThen(Condition, TrueStr, FalseStr)— same signature on both compilers, same result.Test plan
pasclaw auth statusprintspresent/missingper providerhttps://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon
Generated by Claude Code