Changeset 22829 for src

Show
Ignore:
Timestamp:
10/30/08 18:44:51 (2 months ago)
Author:
azawawi
Message:

[STD_syntax_highlight] converted CSS to one liners
[STD_syntax_highlight] redspans identifies routines and types like --simple

Location:
src/perl6
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • src/perl6/STD_syntax_highlight

    r22828 r22829  
    260260        or die "Could not open $CSS: $OS_ERROR\n"; 
    261261    my $line; 
    262     my $css_class; 
    263262    while($line = <CSS_FILE>) { 
    264         if($line =~ /^\s*\.(\w+)/) { 
    265             $css_class = $1; 
    266         } elsif($line =~ /^#\w+/) { 
    267             # ignore #elem colors 
    268             $css_class = 0; 
    269         } elsif($line =~ /color\s*:\s*(\w+)/) { 
    270             $colors{$css_class} = $1 if $css_class; 
     263        if($line =~ /^\s*\.(\w+)\s*{\s*color\s*:\s*(\w+)/) { 
     264            $colors{$1} = $2; 
    271265        } 
    272266    } 
     
    352346        or die "Could not open $CSS: $OS_ERROR\n"; 
    353347    my $line; 
    354     my $css_class; 
    355348    while($line = <CSS_FILE>) { 
    356         if($line =~ /^\s*\.(\w+)/) { 
    357             $css_class = $1; 
    358         } elsif($line =~ /^#\w+/) { 
    359             # ignore #elem colors 
    360             $css_class = 0; 
    361         } elsif($line =~ /color\s*:\s*(\w+)/) { 
    362             $colors{$css_class} = $1 if $css_class; 
     349        if($line =~ /^\s*\.(\w+)\s*{\s*color\s*:\s*(\w+)/) { 
     350            $colors{$1} = $2; 
    363351        } 
    364352    } 
     
    405393            } 
    406394            if($rule_to_color) { 
    407                 $str .= qq{<span class='$rule_to_color'>$buffer</span>}; 
     395                if($last_tree =~ /identifier/) { 
     396                    if($parser->is_type($buffer)) { 
     397                        $str .= qq{<span class="_type">$buffer</span>}; 
     398                    } elsif($parser->is_routine($buffer)) { 
     399                        $str .= qq{<span class="_routine">$buffer</span>}; 
     400                    } else { 
     401                        $str .= qq{<span class='$rule_to_color'>$buffer</span>}; 
     402                    } 
     403                } else {               
     404                    $str .= qq{<span class='$rule_to_color'>$buffer</span>}; 
     405                } 
    408406            } else { 
    409407                $str .= qq{$buffer}; 
  • src/perl6/STD_syntax_highlight.css

    r22773 r22829  
    1 .comp_unit { 
    2     color: Blue; 
    3 } 
    4 .scope_declarator { 
    5     color: DarkRed; 
    6 } 
    7 .routine_declarator { 
    8     color: DarkRed; 
    9 } 
    10 .regex_declarator { 
    11     color: DarkRed; 
    12 } 
    13 .statement_control { 
    14     color: DarkRed; 
    15 } 
    16 .block { 
    17     color: Black; 
    18 } 
    19 .regex_block { 
    20     color: Black; 
    21 } 
    22 .noun { 
    23     color: Black; 
    24 } 
    25 .sigil { 
    26     color: DarkGreen; 
    27 } 
    28 .variable { 
    29     color: DarkGreen; 
    30 } 
    31 .assertion { 
    32     color: Darkgreen; 
    33 } 
    34 .quote { 
    35     color: Brown; 
    36 }    
    37 .number { 
    38     color: DarkOrange; 
    39 } 
    40 .infix { 
    41     color: DimGray; 
    42 } 
    43 .methodop { 
    44     color: black; 
    45     font-weight: bold; 
    46 } 
     1.comp_unit { color: Blue; } 
     2.scope_declarator { color: DarkRed; } 
     3.routine_declarator { color: DarkRed; } 
     4.regex_declarator { color: DarkRed; } 
     5.statement_control { color: DarkRed; } 
     6.block { color: Black; } 
     7.regex_block { color: Black; } 
     8.noun { color: Black; } 
     9.sigil { color: DarkGreen; } 
     10.variable { color: DarkGreen; }  
     11.assertion { color: Darkgreen; } 
     12.quote { color: Brown; }    
     13.number { color: DarkOrange; } 
     14.infix { color: DimGray; } 
     15.methodop { color: black; font-weight: bold; } 
    4716 
    48 ._routine { 
    49     color: DarkRed; 
    50     font-weight: bold; 
    51 } 
    52 ._type { 
    53     color: DarkBlue; 
    54     font-weight: bold; 
    55 } 
    56 ._comment { 
    57     color: DarkGreen; 
    58     font-weight: bold; 
    59 } 
     17._routine { color: DarkRed; font-weight: bold; } 
     18._type { color: DarkBlue; font-weight: bold; } 
     19._comment { color: DarkGreen; font-weight: bold; } 
    6020 
    61 #parse_tree { 
    62     position: absolute; 
    63     right: 10px; 
    64     top: 10px; 
    65     font: 14px Verdana; 
    66 } 
    67 #parse_tree_output { 
    68     color: black; 
    69     background-color: #FFF5DF; 
    70     border: 1px solid orange; 
    71     opacity: 0.7; 
    72 } 
     21#parse_tree { position: absolute; right: 10px; top: 10px; font: 14px Verdana; } 
     22#parse_tree_output { color: black; background-color: #FFF5DF; border: 1px solid Orange; }