Commit e465c053

e465c05368b1Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 2 files · ~2 modified

Description

$1..$9 regex capture global variables

NumberedReferenceReadNode was unhandled. Resolve $1..$9 to the matching sp_re_captures[] slot (a nullable string: NULL when the group did not participate or the index is out of range), typed as a string so interpolation and .inspect work.

Co-Authored-By: Claude Opus 4.8 [email protected]

Details

Commit
e465c05368b1
Parent
7f507bbb6732

src/analyze.cmodifiedView file

@@ -906,6 +906,7 @@
906906 return TY_UNKNOWN;
907907 }
908908 if (!strcmp(ty, "DefinedNode")) return TY_STRING; /* a label string, or nil (NULL) */
909+ if (!strcmp(ty, "NumberedReferenceReadNode")) return TY_STRING; /* $1..$9: capture, or nil (NULL) */
909910 if (!strcmp(ty, "SelfNode")) {
910911 Scope *s = comp_scope_of(c, id);
911912 return s->class_id >= 0 ? ty_object(s->class_id) : TY_UNKNOWN;