diff options
author | Ilya Zakharevich <ilya@math.berkeley.edu> | 1999-09-22 15:41:30 -0400 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-09-23 06:44:42 +0000 |
commit | 17f4a12df9ef6ee2f0a77e96071b3f12999159f0 (patch) | |
tree | 8a8b13d7eda2a4df6ff788a2e607177efcfd5a5c /pp.c | |
parent | de0d19685a431728abc301db6a7957ad399d5e5f (diff) | |
download | perl-17f4a12df9ef6ee2f0a77e96071b3f12999159f0.tar.gz |
change "#" to a comment starter in pack templates; "/" now
used for specifying counted types
Message-ID: <19990922194130.A864@monk.mps.ohio-state.edu>
Subject: [PATCH 5.005_61] Enable comments in pack()/unpack() templates
p4raw-id: //depot/perl@4222
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -3288,6 +3288,11 @@ PP(pp_unpack) #endif if (isSPACE(datumtype)) continue; + if (datumtype == '#') { + while (pat < patend && *pat != '\n') + pat++; + continue; + } if (*pat == '!') { char *natstr = "sSiIlL"; @@ -3347,16 +3352,16 @@ PP(pp_unpack) DIE(aTHX_ "x outside of string"); s += len; break; - case '#': + case '/': if (oldsp >= SP) - DIE(aTHX_ "# must follow a numeric type"); + DIE(aTHX_ "/ must follow a numeric type"); if (*pat != 'a' && *pat != 'A' && *pat != 'Z') - DIE(aTHX_ "# must be followed by a, A or Z"); + DIE(aTHX_ "/ must be followed by a, A or Z"); datumtype = *pat++; if (*pat == '*') pat++; /* ignore '*' for compatibility with pack */ if (isDIGIT(*pat)) - DIE(aTHX_ "# cannot take a count" ); + DIE(aTHX_ "/ cannot take a count" ); len = POPi; /* drop through */ case 'A': @@ -4345,6 +4350,11 @@ PP(pp_pack) #endif if (isSPACE(datumtype)) continue; + if (datumtype == '#') { + while (pat < patend && *pat != '\n') + pat++; + continue; + } if (*pat == '!') { char *natstr = "sSiIlL"; @@ -4371,10 +4381,10 @@ PP(pp_pack) } else len = 1; - if (*pat == '#') { + if (*pat == '/') { ++pat; if (*pat != 'a' && *pat != 'A' && *pat != 'Z' || pat[1] != '*') - DIE(aTHX_ "# must be followed by a*, A* or Z*"); + DIE(aTHX_ "/ must be followed by a*, A* or Z*"); lengthcode = sv_2mortal(newSViv(sv_len(items > 0 ? *MARK : &PL_sv_no))); } |