in reply to Appropriate CPAN namespace for perl parser
Wiser souls than I will counsel you that only perl can parse Perl. Once upon a time I embarked on a somewhat similar project. Here is some code that you may like to use in testing. Much of it came from insults and taunts from the on again off again monk Abigail
print <<'drom"edary',<<"f#f",<<'=pod',<< ''; #comment Just another Perl Hacker drom"edary #foo f#f #bar =pod #foo #too #you $_ = "Just another Python# Hacker\n"; s {Python#} [Perl]; print; $_=<<'=pod'; Just another Perl Hacker =pod print; s[foo#] #comment [bar#]; #comment m{ \#[#] # comment \w+: # comment [#] # comment \# # comment \} # comment }x; # $_ = "Just another Perl Hacker\n"; { print if m\foo\#comment } $_ = "Just another Perl Hacker # No comment, no comment! # Yes, really! # I am really a Perl Hacker! ";print; (1) ? print "foo#\n" : print "bar#\n"; # foobar print "\"Goodnight I'm tired!\" # No comment here\n"; # but one here sleep 1; # Because tired print "Goodbye!\n"; BEGIN {if ($ARGV [0]) {eval 'sub foo () {print}'} else {eval 'sub foo ($) {print}'} } $_ = "Just another Perl Hacker\n"; foo /#/; 1;
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Appropriate CPAN namespace for perl parser
by adamk (Chaplain) on Feb 12, 2002 at 23:22 UTC |