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

/x does not ignore commented slashes. #2037

Closed
p5pRT opened this issue Jun 2, 2000 · 8 comments
Closed

/x does not ignore commented slashes. #2037

p5pRT opened this issue Jun 2, 2000 · 8 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 2, 2000

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

Searchable as RT3315$

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2000

From krolnik@lsil.com

This is a bug report for perl from krolnik@​lsil.com,
generated with the help of perlbug 1.26 running under perl 5.00503.

# Here are three forms of regular expressions
# that should only be differing by whitespace.

$a =~ s/c|d|e//x;

$a1 =~ s/c #
  |d # here \
  |e //x;

# The above two do fine - parse correctly.

$a2 =~ s/c # /
  |d # here \
  |e //x;


This similar example (differing in 1 character) causes parsing
problems. perl (5.00503 and 5.6 ) -wc produces (among others)

Unquoted string "x" may clash with future reserved word at /tmp/spl line 16.

The slash at the end of the first line of the regular expression
terminates the regular expression - incorrectly.


Site configuration information for perl 5.00503​:

Configured by greg at Thu Oct 7 17​:35​:08 CDT 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration​:
  Platform​:
  osname=solaris, osvers=2.6, archname=sun4-solaris
  uname='sunos dts49 5.6 generic_105181-15 sun4u sparc sunw,ultra-enterprise '
  hint=previous, useposix=true, d_sigaction=define
  usethreads=undef useperlio=undef d_sfio=undef
  Compiler​:
  cc='gcc', optimize='-O', gccversion=2.8.1
  cppflags='-I/usr/local/include'
  ccflags ='-I/usr/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='gcc', ldflags =' -L/usr/local/lib'
  libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
  libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
  libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
  cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'

Locally applied patches​:
 


@​INC for perl 5.00503​:
  /design/db/lib/perl
  /usr/local/apps/perl/5.005_03/lib/5.00503/sun4-solaris
  /usr/local/apps/perl/5.005_03/lib/5.00503
  /usr/local/apps/perl/5.005_03/lib/site_perl/5.005/sun4-solaris
  /usr/local/apps/perl/5.005_03/lib/site_perl/5.005
  .


Environment for perl 5.00503​:
  HOME=/user/krolnik
  LANG=C
  LANGUAGE (unset)
  LD_LIBRARY_PATH=/usr/local/lib​:/usr/openwin/lib​:/tools/lsi_fs/2.0/arch/SunOS-5.7​:/tools/cadence/4.42/tools/lib​:/tools/cadence/4.42/tools/leapfrog/lib​:/tools/cadence/4.42/tools/verilog/lib​:/tools/summit/hdlscore/2.0.5/SunOS5/lib​:/user/krolnik/lib​:/usr/local/lib/X11
  LOGDIR (unset)
  PATH=/usr/dt/bin​:.​:/usr/openwin/bin​:/bin​:/usr/bin​:/usr/ucb​:/usr/sbin​:/usr/dt/bin​:/tools/flex/bin​:/usr/local/bin​:/user/krolnik/bin​:.​:/usr/ccs/bin​:/usr/ccs/lib​:/tools/frame/5.5.3/bin​:/tools/uslsiapp/3.0/shared​:/tools/uslsiapp/3.0/bin/sunv​:/tools/askk/5.0/common/bin​:/tools/lsi_fs/2.0/bin/SunOS-5.7​:/tools/cadence/4.42/tools/bin​:/tools/lsf/3.2/bin​:/tools/modeltech/5.3a/bin​:/design/db/com​:/design/db/blaze/com​:/design/db/blaze/bin​:/tools/Razor/Razor/bin​:/tools/Razor/Razor/scripts​:/design/db/blaze/.RAZORDB/403DB/RAZOR_UNIVERSE/Scripts​:/design/db/blaze/source/zsp_tools/sdspI/bin​:/design/db/blaze/work/z16402/bin​:/tools/debussy//4.4/bin​:/tools/summit/hdlscore/2.0.5/bin​:/design/db/blaze/com​:/design/db/blaze/bin​:/usr/openwin/bin​:/user/krolnik/bin
  PERL5LIB=/design/db/lib/perl
  PERL_BADLANG (unset)
  SHELL (unset)

@p5pRT
Copy link
Author

p5pRT commented Jun 8, 2000

From [Unknown Contact. See original ticket]

This is a bug report for perl from krolnik@​lsil.com,
generated with the help of perlbug 1.26 running under perl 5.00503.

# Here are three forms of regular expressions
# that should only be differing by whitespace.

$a =~ s/c|d|e//x;

$a1 =~ s/c #
  |d # here \
  |e //x;

# The above two do fine - parse correctly.

$a2 =~ s/c # /
  |d # here \
  |e //x;


This similar example (differing in 1 character) causes parsing
problems. perl (5.00503 and 5.6 ) -wc produces (among others)

Unquoted string "x" may clash with future reserved word at /tmp/spl line 16.

The slash at the end of the first line of the regular expression
terminates the regular expression - incorrectly.


Site configuration information for perl 5.00503​:

Configured by greg at Thu Oct 7 17​:35​:08 CDT 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration​:
  Platform​:
  osname=solaris, osvers=2.6, archname=sun4-solaris
  uname='sunos dts49 5.6 generic_105181-15 sun4u sparc sunw,ultra-enterprise
'
  hint=previous, useposix=true, d_sigaction=define
  usethreads=undef useperlio=undef d_sfio=undef
  Compiler​:
  cc='gcc', optimize='-O', gccversion=2.8.1
  cppflags='-I/usr/local/include'
  ccflags ='-I/usr/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='gcc', ldflags =' -L/usr/local/lib'
  libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
  libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
  libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
  cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'

Locally applied patches​:
 


@​INC for perl 5.00503​:
  /design/db/lib/perl
  /usr/local/apps/perl/5.005_03/lib/5.00503/sun4-solaris
  /usr/local/apps/perl/5.005_03/lib/5.00503
  /usr/local/apps/perl/5.005_03/lib/site_perl/5.005/sun4-solaris
  /usr/local/apps/perl/5.005_03/lib/site_perl/5.005
  .


Environment for perl 5.00503​:
  HOME=/user/krolnik
  LANG=C
  LANGUAGE (unset)
 
LD_LIBRARY_PATH=/usr/local/lib​:/usr/openwin/lib​:/tools/lsi_fs/2.0/arch/SunOS-5.7​:/tools/cadence/4.42/tools/lib​:/tools/cadence/4.42/tools/leapfrog/lib​:/tools/cadence/4.42/tools/verilog/lib​:/tools/summit/hdlscore/2.0.5/SunOS5/lib​:/user/krolnik/lib​:/usr/local/lib/X11
  LOGDIR (unset)
 
PATH=/usr/dt/bin​:.​:/usr/openwin/bin​:/bin​:/usr/bin​:/usr/ucb​:/usr/sbin​:/usr/dt/bin​:/tools/flex/bin​:/usr/local/bin​:/user/krolnik/bin​:.​:/usr/ccs/bin​:/usr/ccs/lib​:/tools/frame/5.5.3/bin​:/tools/uslsiapp/3.0/shared​:/tools/uslsiapp/3.0/bin/sunv​:/tools/askk/5.0/common/bin​:/tools/lsi_fs/2.0/bin/SunOS-5.7​:/tools/cadence/4.42/tools/bin​:/tools/lsf/3.2/bin​:/tools/modeltech/5.3a/bin​:/design/db/com​:/design/db/blaze/com​:/design/db/blaze/bin​:/tools/Razor/Razor/bin​:/tools/Razor/Razor/scripts​:/design/db/blaze/.RAZORDB/403DB/RAZOR_UNIVERSE/Scripts​:/design/db/blaze/source/zsp_tools/sdspI/bin​:/design/db/blaze/work/z16402/bin​:/tools/debussy//4.4/bin​:/tools/summit/hdlscore/2.0.5/bin​:/design/db/blaze/com​:/design/db/blaze/bin​:/usr/openwin/bin​:/user/krolnik/bin
  PERL5LIB=/design/db/lib/perl
  PERL_BADLANG (unset)
  SHELL (unset)

@p5pRT
Copy link
Author

p5pRT commented Jun 8, 2000

From [Unknown Contact. See original ticket]

This is a bug report for perl from krolnik@​lsil.com,
generated with the help of perlbug 1.26 running under perl 5.00503.

$a =~ s/c|d|e//x;

$a1 =~ s/c #
|d # here \
|e //x;

# The above two do fine - parse correctly.

$a2 =~ s/c # /
|d # here \
|e //x;

Unquoted string "x" may clash with future reserved word at
/tmp/spl line 16.

All is correct - you try to divide s/// by x.
s/// / x; is probably not what you want.

Vadim.

@p5pRT
Copy link
Author

p5pRT commented Jun 8, 2000

From [Unknown Contact. See original ticket]

Annoying, but as documented​: see the perlre man page. Basically,
perl's main parser, which knows nothing about the effects of the /x
flag, uses the chosen regex delimiter to decide what to hand off to
the specialized regex parser. The regex parser subsequently uses the
/x flag, if present, to modify the way in which it parses what it's
been handed. Fixing the small niggle you've stumbled across would
require modifying the main parser to find and interpret the /x flag.
It was decided a long time ago that the gain was not worth the pain.

@p5pRT
Copy link
Author

p5pRT commented Jun 8, 2000

From [Unknown Contact. See original ticket]

Dominic Dunlop <domo@​computer.org> wrote

Fixing the small niggle you've stumbled across would
require modifying the main parser to find and interpret the /x flag.
It was decided a long time ago that the gain was not worth the pain.

It's worse than that. Examples of this sort are actually ambiguous,
and regexes existed long before the /x switch. So backwards
compatibility precludes "fixing" anything.

Mike Guy

@p5pRT
Copy link
Author

p5pRT commented Jun 8, 2000

From [Unknown Contact. See original ticket]

"Fixing" this is not just not a case where the gain is not worth the pain,
it is a case where the *pain* is not worth the pain!

Consider the following code​:

if ($foo =~ /#/) {
  # Do something
}
# Time passes
print "eg. In DOS you would use /x instead of -x\n";

How should that be parsed?

Cheers,
Ben

@p5pRT
Copy link
Author

p5pRT commented May 2, 2003

From @iabyn

not-a-bug

@p5pRT
Copy link
Author

p5pRT commented May 2, 2003

@iabyn - Status changed from 'open' to 'resolved'

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