![]() |
|
We don't bite newbies here... much | |
PerlMonks |
Re: Perl script compressorby haukex (Archbishop) |
on Dec 08, 2019 at 08:14 UTC ( [id://11109834]=note: print w/replies, xml ) | Need Help?? |
I am not even sure what kind of complicated code patterns may exist in a perl script. Classic example of "only perl can parse Perl" (based heavily on tye's example here):
That's perfectly valid Perl code even under strict. Run that though B::Deparse a few times, and sometimes you'll get
and sometimes
In other words, sometimes it's a function call to which the result of a regex is being passed followed by a constant (that gets optimized away), and sometimes it's the return value of a function call, followed by a division operator, a comment, and the divisor. Which it is depends entirely on a random number that changes from run to run, and the result can't be known until the perl binary executes the first line of Perl code; doing the same with a static parse (without executing code) is impossible. I need to come up with a logic that can interpret a line of complex perl code and remove comments and spaces in such a way that it won't break the code. Perl Cannot Be Parsed: A Formal Proof The closest thing to a static Perl parser is PPI (and perhaps PPR; Update 2: and new: Guacamole), and marto already pointed you to one module based on it; see also Perl::Squish. Update: You could also look at Perl::Tidy. Update 3: I think RPerl also implements its own parser.
In Section
Seekers of Perl Wisdom
|
|
因祸得福是什么意思 | 贸易壁垒是什么意思 | 出类拔萃是什么意思 | 较真的人是什么性格 | 排卵期一般是什么时候 |
又什么又什么造句 | 放屁多什么原因 | 砂锅是什么材料做的 | 慢性咽喉炎什么症状 | 什么花草 |
肩周炎挂什么科 | 西汉后面是什么朝代 | messi是什么意思 | 清奇是什么意思 | 肚子大什么原因 |
大腿肌肉酸痛是什么病 | 大姨妈血块多是什么原因 | 三斤八两什么意思 | 中二病是什么意思 | 酷儿是什么意思 |
脂蛋白是什么意思hcv7jop7ns3r.cn | 威士忌兑什么好喝hcv9jop5ns7r.cn | 三晋是什么意思hcv9jop3ns2r.cn | 龟苓膏有什么作用hcv9jop1ns9r.cn | 是什么样的感觉我不懂是什么歌hcv8jop3ns0r.cn |
风疹病毒igg阳性是什么意思hcv8jop3ns0r.cn | PT医学上是什么意思0297y7.com | 东南方五行属什么bjcbxg.com | 脱肛是什么症状hcv7jop9ns5r.cn | 傻缺什么意思hcv9jop1ns1r.cn |
月经期间应该吃什么食物比较好hcv8jop4ns6r.cn | 状元郎是什么生肖hcv8jop0ns5r.cn | 补肾壮阳吃什么效果好hcv8jop2ns8r.cn | 切除子宫有什么危害hcv8jop8ns1r.cn | 什么是211大学hcv9jop4ns9r.cn |
胃食管反流吃什么中成药最好hcv9jop1ns5r.cn | 九九重阳节是什么意思hcv8jop1ns4r.cn | joseph是什么意思hcv9jop0ns3r.cn | 尿遁什么意思hanqikai.com | 孕妇吃什么helloaicloud.com |