Commit 3b84af9f
3b84af9f4ffbMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 2 files · ~2 modified
Description
fix(strscan): add matched? method to stub + C impl (#814)
StringScanner#matched? was missing from the Ruby-level stub.
Calls fell through to the unresolved-call warning and returned 0.
The .rb stub gets a definition that checks the @matched ivar (scan/check/scan_until/getch already update this slot, so the predicate matches CRuby's "did the last scan succeed?" semantics as long as those entry points stay consistent). The .c implementation gains a parallel sp_StringScanner_matched_p for parity, though the user-facing path is the .rb stub.
The wider gap -- the StringScanner stub doesn't actually scan yet -- is documented but out of scope for this commit.
Closes #814
Co-Authored-By: Claude Opus 4.7 [email protected]
Details
- Commit
- 3b84af9f4ffb
- Parent
- a711baca34db
lib/strscan.cmodifiedView file
return sc->matched ? sc->matched : "";}/* Issue #814: matched? -- true when the last scan succeeded. */int sp_StringScanner_matched_p(sp_StringScanner *sc) { if (!sc) return 0; return sc->matched != NULL ? 1 : 0;}/* pos — current position */int64_t sp_StringScanner_pos(sp_StringScanner *sc) { return sc->pos;lib/strscan.rbmodifiedView file
Loading diff…