File indexing completed on 2024-05-19 15:23:14
0001 <!DOCTYPE html> 0002 <html><head> 0003 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 0004 <title>highlight.pl</title> 0005 <meta name="generator" content="KF5::SyntaxHighlighting - Definition (Perl) - Theme (Breeze Light)"/> 0006 </head><body style="background-color:#ffffff;color:#1f1c1b"><pre> 0007 <span style="font-weight:bold;">#!/usr/bin/perl -w</span> 0008 <span style="color:#898887;"># This is a pseudo Perl file to test Kate's Perl syntax highlighting.</span> 0009 <span style="color:#898887;"># </span><span style="color:#ca9219;background-color:#451e1a;font-weight:bold;">TODO</span><span style="color:#898887;">: this is incomplete, add more syntax examples!</span> 0010 0011 <span style="font-weight:bold;">sub </span><span style="color:#644a9b;">prg</span>(<span style="color:#0057ae;">$</span>) 0012 { 0013 <span style="font-weight:bold;">my</span> <span style="color:#0057ae;">$var</span> = <span style="color:#644a9b;">shift</span>; 0014 0015 <span style="color:#0057ae;">$var</span> =~ <span style="color:#006e28;font-weight:bold;">s/</span><span style="color:#006e28;">bla</span><span style="color:#006e28;font-weight:bold;">/</span><span style="color:#bf0303;">foo</span><span style="color:#006e28;font-weight:bold;">/igs</span>; 0016 <span style="color:#0057ae;">$var</span> =~ <span style="color:#006e28;font-weight:bold;">s!</span><span style="color:#006e28;">bla</span><span style="color:#006e28;font-weight:bold;">!</span><span style="color:#bf0303;">foo</span><span style="color:#006e28;font-weight:bold;">!igs</span>; 0017 <span style="color:#0057ae;">$var</span> =~ <span style="color:#006e28;font-weight:bold;">s#</span><span style="color:#006e28;">bla</span><span style="color:#006e28;font-weight:bold;">#</span><span style="color:#bf0303;">foo</span><span style="color:#006e28;font-weight:bold;">#igs</span>; 0018 <span style="color:#0057ae;">$var</span> =~ <span style="color:#006e28;font-weight:bold;">tr</span><span style="color:#006e28;">/a-z/A-Z/</span>; 0019 (<span style="color:#0057ae;">$match</span>) = (<span style="color:#0057ae;">$var</span> =~ <span style="color:#006e28;font-weight:bold;">m/</span><span style="color:#924c9d;">(</span><span style="color:#006e28;">.</span><span style="color:#924c9d;">*?)</span><span style="color:#006e28;font-weight:bold;">/igs</span>); 0020 0021 <span style="color:#0057ae;">$test</span> = <span style="color:#b08000;">2</span>/<span style="color:#b08000;">453453.21</span>; 0022 <span style="color:#0057ae;">$test</span> /= <span style="color:#b08000;">2</span>; 0023 0024 <span style="color:#644a9b;">print</span> <span style="color:#006e28;font-weight:bold;">qq~</span><span style="color:#bf0303;">d fsd fsdf sdfl sd</span><span style="color:#006e28;font-weight:bold;">~</span> 0025 0026 <span style="color:#bf0303;">$"</span> = <span style="color:#006e28;font-weight:bold;">'</span><span style="color:#ff5500;">/</span><span style="color:#006e28;font-weight:bold;">'</span>; 0027 0028 <span style="color:#0057ae;">$foo</span> = <span style="color:#006e28;font-weight:bold;"><<</span><span style="font-weight:bold;">__EOF;</span> 0029 <span style="color:#bf0303;">d ahfdklf klsdfl sdf sd</span> 0030 <span style="color:#bf0303;">fsd sdf sdfsdlkf sd</span> 0031 <span style="font-weight:bold;">__EOF</span> 0032 0033 <span style="color:#0057ae;">$x</span> = <span style="color:#006e28;font-weight:bold;">"</span><span style="color:#bf0303;">dasds</span><span style="color:#006e28;font-weight:bold;">"</span>; 0034 0035 <span style="font-weight:bold;">next</span> <span style="font-weight:bold;">if</span>( <span style="color:#0057ae;">$match</span> <span style="color:#006e28;font-weight:bold;">eq</span> <span style="color:#006e28;font-weight:bold;">"</span><span style="color:#bf0303;">two</span><span style="color:#006e28;font-weight:bold;">"</span> ); 0036 <span style="font-weight:bold;">next</span> <span style="font-weight:bold;">if</span>( <span style="color:#0057ae;">$match</span> =~ <span style="color:#006e28;font-weight:bold;">/</span><span style="color:#006e28;">go</span><span style="color:#006e28;font-weight:bold;">/i</span> ); 0037 0038 <span style="color:#0057ae;">@array</span> = (<span style="color:#b08000;">1</span>,<span style="color:#b08000;">2</span>,<span style="color:#b08000;">3</span>); <span style="color:#898887;"># a comment</span> 0039 <span style="color:#898887;"># Test qw versions with special ending characters</span> 0040 <span style="color:#0057ae;">@array</span> = <span style="color:#006e28;font-weight:bold;">qw(</span>apple foo bar<span style="color:#006e28;font-weight:bold;">)</span>; 0041 <span style="color:#0057ae;">@array</span> = <span style="color:#006e28;font-weight:bold;">qw[</span>apple foo bar<span style="color:#006e28;font-weight:bold;">]</span>; 0042 <span style="color:#0057ae;">@array</span> = <span style="color:#006e28;font-weight:bold;">qw{</span>apple foo bar<span style="color:#006e28;font-weight:bold;">}</span>; 0043 <span style="color:#0057ae;">@array</span> = <span style="color:#006e28;font-weight:bold;">qw<</span>apple foo bar<span style="color:#006e28;font-weight:bold;">></span>; 0044 <span style="color:#0057ae;">@array</span> = <span style="color:#006e28;font-weight:bold;">qw(</span> 0045 multi 0046 line 0047 test 0048 <span style="color:#006e28;font-weight:bold;">)</span>; 0049 <span style="color:#898887;"># Test qw with non special ending characters;</span> 0050 <span style="color:#0057ae;">@array</span> = <span style="color:#006e28;font-weight:bold;">qw/</span>apple foo bar<span style="color:#006e28;font-weight:bold;">/</span>; 0051 <span style="color:#0057ae;">@array</span> = <span style="color:#006e28;font-weight:bold;">qw|</span>apple foo bar<span style="color:#006e28;font-weight:bold;">|</span>; 0052 <span style="color:#0057ae;">@array</span> = <span style="color:#006e28;font-weight:bold;">qw@</span>apple foo bar<span style="color:#006e28;font-weight:bold;">@</span>; 0053 <span style="color:#0057ae;">@array</span> = <span style="color:#006e28;font-weight:bold;">qw!</span>apple foo bar<span style="color:#006e28;font-weight:bold;">!</span>; 0054 <span style="color:#0057ae;">@array</span> = <span style="color:#006e28;font-weight:bold;">qw"</span>apple foo bar<span style="color:#006e28;font-weight:bold;">"</span>; 0055 <span style="color:#0057ae;">@array</span> = <span style="color:#006e28;font-weight:bold;">qw'</span>apple foo bar<span style="color:#006e28;font-weight:bold;">'</span>; 0056 <span style="color:#644a9b;">push</span>(<span style="color:#0057ae;">@array</span>, <span style="color:#b08000;">4</span>); 0057 <span style="color:#0057ae;">%hash</span> = (red => <span style="color:#006e28;font-weight:bold;">'</span><span style="color:#ff5500;">rot</span><span style="color:#006e28;font-weight:bold;">'</span>, 0058 blue => <span style="color:#006e28;font-weight:bold;">'</span><span style="color:#ff5500;">blau</span><span style="color:#006e28;font-weight:bold;">'</span>); 0059 <span style="color:#644a9b;">print</span> <span style="color:#644a9b;">keys</span>(<span style="color:#0057ae;">%hash</span>); 0060 } 0061 0062 <span style="font-weight:bold;">sub </span><span style="color:#644a9b;">blah</span> { 0063 <span style="font-weight:bold;">my</span> <span style="color:#0057ae;">$str</span> = <span style="color:#006e28;font-weight:bold;"><<</span><span style="font-weight:bold;"> ' EOS';</span> 0064 this is my string 0065 and it's continuation 0066 <span style="font-weight:bold;"> EOS</span> 0067 0068 <span style="color:#0057ae;">$str</span> = <span style="color:#006e28;font-weight:bold;">"</span><span style="color:#bf0303;">hello world</span><span style="color:#006e28;font-weight:bold;">"</span>; 0069 0070 <span style="color:#0057ae;">$str</span> = <span style="color:#006e28;font-weight:bold;"><<</span><span style="font-weight:bold;"> " EOS";</span> 0071 <span style="color:#bf0303;"> this is my string</span> 0072 <span style="color:#bf0303;"> and it's continuation</span> 0073 <span style="font-weight:bold;"> EOS</span> 0074 } 0075 0076 &blah; 0077 prg(<span style="color:#006e28;font-weight:bold;">"</span><span style="color:#bf0303;">test</span><span style="color:#006e28;font-weight:bold;">"</span>); 0078 0079 <span style="color:#898887;"># Bracket closures in RegExp patterns (bug #364866)</span> 0080 <span style="color:#006e28;font-weight:bold;">qr{</span><span style="color:#006e28;"> </span><span style="color:#924c9d;">$</span><span style="color:#006e28;">{var} aa{aa{a}a} aa</span><span style="color:#924c9d;">*</span><span style="color:#006e28;">b</span><span style="color:#924c9d;">?</span><span style="color:#006e28;font-weight:bold;">}</span>; 0081 <span style="color:#006e28;font-weight:bold;">qr(</span><span style="color:#006e28;">aa</span><span style="color:#924c9d;">(</span><span style="color:#006e28;">a</span><span style="color:#924c9d;">(</span><span style="color:#006e28;">a</span><span style="color:#924c9d;">(</span><span style="color:#006e28;">a</span><span style="color:#924c9d;">(</span><span style="color:#006e28;">b</span><span style="color:#924c9d;">|</span><span style="color:#006e28;">c</span><span style="color:#924c9d;">)</span><span style="color:#006e28;">a</span><span style="color:#924c9d;">)</span><span style="color:#006e28;">a</span><span style="color:#924c9d;">)</span><span style="color:#006e28;">a</span><span style="color:#924c9d;">)</span><span style="color:#006e28;">aa</span><span style="color:#924c9d;">*</span><span style="color:#006e28;">b</span><span style="color:#924c9d;">?</span><span style="color:#006e28;font-weight:bold;">)</span>; 0082 <span style="color:#006e28;font-weight:bold;">s{</span><span style="color:#006e28;">aaa {aaa} a </span><span style="color:#bf0303;">\x{A2}</span><span style="color:#006e28;"> </span><span style="color:#924c9d;">*</span><span style="color:#006e28;">b</span><span style="color:#924c9d;">?</span><span style="color:#006e28;font-weight:bold;">}{</span><span style="color:#bf0303;">aa</span><span style="color:#006e28;font-weight:bold;">}</span>; 0083 <span style="color:#006e28;font-weight:bold;">s(</span><span style="color:#006e28;">aa</span><span style="color:#924c9d;">(</span><span style="color:#006e28;">a</span><span style="color:#924c9d;">(</span><span style="color:#006e28;">a</span><span style="color:#924c9d;">(</span><span style="color:#006e28;">a</span><span style="color:#924c9d;">(</span><span style="color:#006e28;">b</span><span style="color:#924c9d;">|</span><span style="color:#006e28;">c</span><span style="color:#924c9d;">)</span><span style="color:#006e28;">a</span><span style="color:#924c9d;">)</span><span style="color:#006e28;">a</span><span style="color:#924c9d;">)</span><span style="color:#006e28;">a</span><span style="color:#924c9d;">)</span><span style="color:#006e28;">aa</span><span style="color:#006e28;font-weight:bold;">)(</span><span style="color:#bf0303;">aa</span><span style="color:#006e28;font-weight:bold;">)</span>; 0084 0085 <span style="color:#898887;"># Strings as scalar references (bug #348765)</span> 0086 <span style="color:#0057ae;">$x</span> = \<span style="color:#006e28;font-weight:bold;">'</span><span style="color:#ff5500;">Reference of a String</span><span style="color:#006e28;font-weight:bold;">'</span>; 0087 <span style="color:#0057ae;">$y</span> = \<span style="color:#006e28;font-weight:bold;">"</span><span style="color:#bf0303;">Reference of a String</span><span style="color:#006e28;font-weight:bold;">"</span>; 0088 0089 <span style="color:#898887;"># Variables that start with underscore (bug #355300)</span> 0090 <span style="color:#0057ae;">$_variable</span> 0091 <span style="color:#bf0303;">$_</span> <span style="color:#898887;"># Reserved var.</span> 0092 0093 <span style="font-weight:bold;">for</span> <span style="font-weight:bold;">my</span> <span style="color:#0057ae;">$x</span> (<span style="color:#0057ae;">$hash</span>->{arr}-><span style="color:#0057ae;">@</span><span style="color:#006e28;font-weight:bold;">*</span>) { 0094 <span style="font-weight:bold;">for</span> <span style="font-weight:bold;">my</span> <span style="color:#0057ae;">$k</span> (<span style="color:#644a9b;">keys</span> <span style="color:#0057ae;">$k</span>->%<span style="color:#006e28;font-weight:bold;">*</span>) { 0095 ... 0096 } 0097 } 0098 0099 <span style="color:#898887;"># Highlight correctly operator // (bug #407327)</span> 0100 <span style="color:#0057ae;">$x</span> = ns // <span style="color:#006e28;font-weight:bold;">""</span>; 0101 <span style="color:#644a9b;">print</span> <span style="color:#0057ae;">$x</span>; 0102 </pre></body></html>