Commit 0184a139

0184a1398359Merged

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

Description

Predefined punctuation globals $! $; $, $/

$/ reads the record separator "\n"; $! $; $, read nil (spinel does not honor the split/print-sep defaults). Their names are not C identifiers so they were previously unregistered and any reference failed to compile.

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

Details

Commit
0184a1398359
Parent
c26a8281a457

src/analyze.cmodifiedView file

@@ -812,6 +812,9 @@
812812 }
813813 if (!strcmp(ty, "GlobalVariableReadNode")) {
814814 const char *nm = nt_str(nt, id, "name");
815+ /* predefined punctuation globals: $/ defaults to "\n"; $! / $; / $, read nil */
816+ if (nm && !strcmp(nm, "$/")) return TY_STRING;
817+ if (nm && (!strcmp(nm, "$!") || !strcmp(nm, "$;") || !strcmp(nm, "$,"))) return TY_NIL;
815818 LocalVar *lv = nm ? comp_gvar(c, nm + 1) : NULL;
816819 return lv ? lv->type : TY_UNKNOWN;
817820 }