{"id":65,"date":"2009-01-09T00:02:34","date_gmt":"2009-01-09T00:02:34","guid":{"rendered":"http:\/\/blog.benny-baumann.de\/?p=65"},"modified":"2010-06-03T14:53:35","modified_gmt":"2010-06-03T12:53:35","slug":"highlighting-perl-in-all-its-oddity","status":"publish","type":"post","link":"https:\/\/blog.benny-baumann.de\/?p=65","title":{"rendered":"Highlighting Perl in all its oddity"},"content":{"rendered":"<p>Following up on a discussion on the GeSHi-devel mailing list I got some interesting <a href=\"http:\/\/tech.ification.org\/?p=63\">testcases for testing Perl in all its oddity<\/a>.<\/p>\n<p>So lets get things startet: Open up the testcase, and see: The CSS is not fully precise on some stuff (some classes in GeSHi can be used for different things like .co5 for perl is used for predefined variables). So I did a quick editing of the CSS stylesheet with the Web Developer Toolbar to mark everything that was of specific classes (as expected) in a different color than white to see if it actually is highlighted (which most stuff was). <\/p>\n<p>Adding the missing stuff into the language file I got an updated version for Perl that can be found as revision 1975 in the GeSHi SVN repository for testing. Things I didn&#8217;t include there are file descriptors as they should already be highlighted (even if &lt;&gt; and &lt;test&gt; are marked as different things.<\/p>\n<p>But in one thing the testcase wasn&#8217;t right: Heredocs As well as Regular expressions are supported by GeSHi, see:<\/p>\n<pre lang=\"perl\" escaped=\"true\">$test = &lt;&lt;HEREIAM;\r\nSome text to show this is a heredoc part\r\nHEREIAM;\r\n$match =~ \/te[sx]t\/g;\r\n$replace =~ s\/x\/s\/i;<\/pre>\n<p>Just to be complete on this. Oh, and the <\/p>\n<pre>&lt;&nbsp;&lt;<\/pre>\n<p> bug is a problem with my WordPress. The <a href=\"http:\/\/qbnz.com\/highlighter\/demo.php\">demo page<\/a> does the Heredoc correctly, for those that don&#8217;t believe me \ud83d\ude09<\/p>\n<p>Now I&#8217;m only lacking this little testcase as a file for inclusion into the Code Repository of GeSHi and I can declare this &#8222;done&#8220; &#8230;<\/p>\n<p><b>Update:<\/b> Revision 1977 contains some important updates on the rev1975\\r1974 version of this file: I missed some things due to some issue I had with encoding $ inside of regexps (I missed the escapes PHP needed inside the string). I also added the few remaining cases that the previous version didn&#8217;t yet.<\/p>\n<p>What will not be highlighted correctly are bacreferences to numbers (and I thought C was odd &#8230;) and nested Heredocs (i.e. Heredocs with two or more starters on one line).<\/p>\n<p>But given the current state this should somewhat resemble most of what even most insane Perl programmers need when puking their code &#8230;<\/p>\n<p class=\"wp-flattr-button\"><a href=\"https:\/\/blog.benny-baumann.de\/?flattrss_redirect&amp;id=65&amp;md5=deda125ede6c28b5525398c5651365a5\" title=\"Flattr\" target=\"_blank\"><img src=\"http:\/\/blog.benny-baumann.de\/wp-content\/plugins\/flattr\/img\/flattr-badge-large.png\" srcset=\"http:\/\/blog.benny-baumann.de\/wp-content\/plugins\/flattr\/img\/flattr-badge-large.png\" alt=\"Flattr this!\"\/><\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>Following up on a discussion on the GeSHi-devel mailing list I got some interesting testcases for testing Perl in all its oddity. So lets get things startet: Open up the testcase, and see: The CSS is not fully precise on some stuff (some classes in GeSHi can be used for different things like .co5 for [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[3],"tags":[345,53],"class_list":["post-65","post","type-post","status-publish","format-standard","hentry","category-geshi","tag-geshi","tag-perl"],"_links":{"self":[{"href":"https:\/\/blog.benny-baumann.de\/index.php?rest_route=\/wp\/v2\/posts\/65","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.benny-baumann.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.benny-baumann.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.benny-baumann.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.benny-baumann.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=65"}],"version-history":[{"count":12,"href":"https:\/\/blog.benny-baumann.de\/index.php?rest_route=\/wp\/v2\/posts\/65\/revisions"}],"predecessor-version":[{"id":696,"href":"https:\/\/blog.benny-baumann.de\/index.php?rest_route=\/wp\/v2\/posts\/65\/revisions\/696"}],"wp:attachment":[{"href":"https:\/\/blog.benny-baumann.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=65"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.benny-baumann.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=65"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.benny-baumann.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=65"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}