Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hash recognition and barewords #939

Closed
p5pRT opened this issue Dec 13, 1999 · 2 comments
Closed

Hash recognition and barewords #939

p5pRT opened this issue Dec 13, 1999 · 2 comments

Comments

@p5pRT
Copy link

p5pRT commented Dec 13, 1999

Migrated from rt.perl.org#1884 (status was 'resolved')

Searchable as RT1884$

@p5pRT
Copy link
Author

p5pRT commented Dec 13, 1999

From @Tux

Below is a piece of code that will NOT compile (syntax error) in
sub strerr, that uses an anounimous hash for which all the keys
are numbers. We've tested this code in Amsterdam.pm and found it
to look like a parser inconsistency. If the hash starts with a
bareword, like sub errstr, it works out like intended. We concluded
that the parser might be confused if the intended hash was to be
a code block or an anonimous hash, but the result is - in our humble
opinion - inconsistent. (BTW using ordonary numbers instead of hex
does not influence this behaviour).

#!/usr/bin/perl -w

use strict;
use diagnostics;

sub strerr ($)
{
  my $err = shift;
  { 0x010E => "Known error",
  0x1AD3 => "Error 6867",
  0xA400 => "Out of error space",
  }->{$err} || "Error $err ignored";
  } # strerr

sub errstr ($)
{
  my $err = shift;
  { Title => "Error list",
  0x010E => "Known error",
  0x1AD3 => "Error 6867",
  0xA400 => "Out of error space",
  }->{$err} || "Error $err ignored";
  } # strerr

print strerr 0x1AD3, "\n";
print errstr 0xA400, "\n";
__END__

using perl5.005.03 on HP-UX 10.20, HP-UX 11.00, AIX 4.2, AIX 4.3,
  DEC OSF/1 4.0 and WinNT 4.0, often with perlTk 800.015
ftp​://ftp.funet.fi​:/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Member of Amsterdam Perl Mongers (http​://www.amsterdam.pm.org/)

Configuration as shown below runs on both HP 9000/800 D390 (shown)
and HP 9000/800 L1000 both running HP-UX 11.00 (64 bit)

Code example fails on *ALL* systems mentioned above.

The code above has also been tested in Amsterdam on our PM meeting,
but I do not know the system it ran on.

Perl Info


Site configuration information for perl 5.00503:

Configured by merijn at Tue Apr  6 13:47:00 METDST 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=hpux, osvers=11.00, archname=PA-RISC2.0
    uname='hp-ux d3 b.11.00 e 9000800 2015358431 8-user license '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='+O2 +Onolimit', gccversion=
    cppflags='-DDEBUGGING -D_HPUX_SOURCE -Ae -I/pro/local/include'
    ccflags ='-DDEBUGGING -D_HPUX_SOURCE -Ae -I/pro/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -L/pro/local/lib'
    libpth=/pro/local/lib /lib/pa1.1 /lib /usr/lib /usr/ccs/lib
    libs=-lnsl -lnm -lndbm -lgdbm -ldld -lm -lc -lndir -lcrypt
    libc=/lib/libc.sl, so=sl, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_hpux.xs, dlext=sl, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-B,deferred '
    cccdlflags='+z', lddlflags='-b -L/pro/local/lib'

Locally applied patches:
    


@INC for perl 5.00503:
    /pro/lib/perl5/5.00503/PA-RISC2.0
    /pro/lib/perl5/5.00503
    /pro/lib/perl5/site_perl/5.005/PA-RISC2.0
    /pro/lib/perl5/site_perl/5.005
    .


Environment for perl 5.00503:
    HOME=/u/usr/merijn
    LANG=C
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
/opt/resmon/bin:/opt/pred/bin:/opt/langtools/bin:/opt/perf/bin:/opt/imake/bin:/opt/hpnp/bin:/pro/tu/bin:/usr/sbin:/sbin
    PERL_BADLANG (unset)
    SHELL=/pro/bin/tcsh

--
Merijn

@p5pRT
Copy link
Author

p5pRT commented Dec 17, 1999

From @TimToady

h.m.brand@​hccnet.nl writes​:
: Below is a piece of code that will NOT compile (syntax error) in
: sub strerr, that uses an anounimous hash for which all the keys
: are numbers.

Inline Patch
--- perl5.005_63/toke.c	Wed Dec  8 23:40:50 1999
+++ perl5.005_63pat/toke.c	Fri Dec 17 17:22:32 1999
@@ -2940,8 +2940,10 @@
 		    }
 		    t++;
 		}
-		else if (isIDFIRST_lazy(s)) {
-		    for (t++; t < PL_bufend && isALNUM_lazy(t); t++) ;
+		else if (isALNUM_lazy(t)) {
+		    t += UTF8SKIP(t);
+		    while (t < PL_bufend && isALNUM_lazy(t))
+			 t += UTF8SKIP(t);
 		}
 		while (t < PL_bufend && isSPACE(*t))
 		    t++;

Larry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant