[25797] in Perl-Users-Digest
Perl-Users Digest, Issue: 8036 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 1 14:05:28 2005
Date: Sun, 1 May 2005 11:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 1 May 2005 Volume: 10 Number: 8036
Today's topics:
Re: Looking for Perl Grammar <khamis@wellcode.com>
Re: Looking for Perl Grammar <pilkowsk@informatik.uni-marburg.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 01 May 2005 13:41:23 +0200
From: Khamis Abuelkomboz <khamis@wellcode.com>
Subject: Re: Looking for Perl Grammar
Message-Id: <d52f8u$52d$04$1@news.t-online.com>
Fabian Pilkowski wrote:
> * Khamis Abuelkomboz schrieb:
>
>>However I still find clauses like
>>
>>if ( s{foo}{bar} ) ...
>>if ( s[foo][var] ) ...
>>if ( s<foo><bar> ) ...
>>
>>I still don't figure out what could be used as "brackets" for the
>>s|tr|m commands???? So I'm looking as example for grammar descriping
>>how the (s, tr, qq) could be built, something like
>>
>>S: s OP1 expr OP2 expr OP3
>>OP1: '/' | '{' | '[' | ':' | ...
>>OP2: '/' | '}{' | '][' | ...
>>OP3: '/' | '}' | ']' | ':' | ...
>>
>>I'm still guissing :-)
>
>
> This is mentioned in `perldoc perlop` in the section named "Quote and
> Quote-like Operators".
>
> Non-bracketing delimiters use the same character fore and aft, but
> the four sorts of brackets (round, angle, square, curly) will all
> nest, which means that
>
> q{foo{bar}baz}
>
> is the same as
>
> 'foo{bar}baz'
>
> [...]
>
> There can be whitespace between the operator and the quoting
> characters, except when # is being used as the quoting character.
> q#foo# is parsed as the string foo, while q #foo# is the operator q
> followed by a comment. Its argument will be taken from the next
> line. This allows you to write:
>
> s {foo} # Replace foo
> {bar} # with bar.
>
> So, for s/// you could start with a grammar similar to
>
> S: s WS BRACKETED WS BRACKETED | s WS DELIM expr DELIM expr DELIM
> BRACKETED: '(' expr ')' | '<' expr '>' | '[' expr ']' | '{' expr '}'
> WS: WHITE-SPACES *
> DELIM: '/' | '!' | ':' | '^'
>
> I'm not deeply familiar with grammar descriptions. Is there a way to
> ensure that each DELIM is the same char?
>
> Don't forget to add the special behavior of »#« to your grammar. And of
> course, do you want to allow comments between the BRACKETED parts as in
> the example above? ;-)
>
> regards,
> fabian
Hello!
Thank you all for your input. I still have a question, I found something like:
local $SIG{__DIE__} = sub {};
local $SIG{__WARN__} = sub {};
What does it mean? Does it define two local variables or two elements of an array? What does "sub
{}" here meen?
I thougt, (my|local|our) declare variables without those nasty brackets!
thanks
khamis
--
Try Code-Navigator on http://www.codenav.com
a source code navigating, analysis and developing tool.
It supports following languages:
* C/C++
* Java
* .NET (including CSharp, VB.Net and other .NET components)
* Classic Visual Basic
* PHP, HTML, XML, ASP, CSS
* Tcl/Tk,
* Perl
* Python
* SQL,
* m4 Preprocessor
* Cobol
------------------------------
Date: Sun, 1 May 2005 14:23:53 +0200
From: Fabian Pilkowski <pilkowsk@informatik.uni-marburg.de>
Subject: Re: Looking for Perl Grammar
Message-Id: <3dk022F6ur5olU1@individual.net>
* Khamis Abuelkomboz schrieb:
>
> Thank you all for your input. I still have a question, I found something like:
>
> local $SIG{__DIE__} = sub {};
> local $SIG{__WARN__} = sub {};
>
> What does it mean? Does it define two local variables or two elements
> of an array? What does "sub {}" here meen?
In Perl, there is a global hash called %SIG (see `perldoc perlvar` to
learn what it is for). Here, you want to localize the elements __DIE__
and __WARN__ (see `perldoc -f local`). The »sub« actually returns a code
ref of the closure (anonymous sub) you just created. In this case, the
closure is empty.
regards,
fabian
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 8036
***************************************