Changeset 212

Show
Ignore:
Timestamp:
04/06/07 20:38:29 (2 years ago)
Author:
ingy
Message:
 r3760@dhcp199:  ingy | 2007-04-05 12:39:11 +0900
 more parser refo
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/core/Spork/lib/Spork/Parser.pm

    r211 r212  
    11package Spork::Parser; 
    22use base 'Document::Parser'; 
    3 use XXX; 
    43 
    54my $ALPHANUM = '\p{Letter}\p{Number}\pM'; 
     
    8584sub handle_indent { 
    8685    my $self = shift; 
    87     $self->subparse(indent => parse_blocks => @_, sub { 
     86    $self->subparse(parse_blocks => @_, sub { 
    8887        s/^> *//mg; 
    8988        s/\n+\z/\n/; 
     
    9392sub handle_center { 
    9493    my $self = shift; 
    95     $self->subparse(center => parse_blocks => @_); 
     94    $self->subparse(parse_blocks => @_); 
    9695} 
    9796 
    9897sub handle_h2 { 
    9998    my $self = shift; 
    100     $self->subparse(h2 => parse_phrases => @_); 
     99    $self->subparse(parse_phrases => @_); 
    101100} 
    102101 
    103102sub handle_p { 
    104103    my $self = shift; 
    105     $self->subparse(p => parse_phrases => @_, sub { s/\n+\z// }); 
     104    $self->subparse(parse_phrases => @_, sub { s/\n+\z// }); 
    106105} 
    107106 
    108107sub handle_pre { 
    109108    my $self = shift; 
    110     $self->subparse(pre => parse_phrases => @_, sub { 
     109    $self->subparse(parse_phrases => @_, sub { 
    111110        while (not /^\S/m) { 
    112111            s/^ //gm; 
     
    117116sub handle_ul { 
    118117    my $self = shift; 
    119     $self->subparse(ul => parse_blocks => @_, sub { 
     118    $self->subparse(parse_blocks => @_, sub { 
    120119        s/^\* *//mg; 
    121120        s/\n+\z/\n/; 
     
    125124sub handle_li { 
    126125    my $self = shift; 
    127     $self->subparse(li => parse_phrases => @_); 
     126    $self->subparse(parse_phrases => @_); 
    128127} 
    129128 
    130129sub handle_hilite { 
    131130    my $self = shift; 
    132     $self->subparse(hilite => parse_phrases => @_); 
     131    $self->subparse(parse_phrases => @_); 
    133132} 
    134133 
    135134sub handle_b { 
    136135    my $self = shift; 
    137     $self->subparse(b => parse_phrases => @_); 
     136    $self->subparse(parse_phrases => @_); 
    138137} 
    139138 
    140139sub handle_tt { 
    141140    my $self = shift; 
    142     $self->subparse(tt => parse_phrases => @_); 
     141    $self->subparse(parse_phrases => @_); 
    143142} 
    144143 
    145144sub handle_i { 
    146145    my $self = shift; 
    147     $self->subparse(i => parse_phrases => @_); 
     146    $self->subparse(parse_phrases => @_); 
    148147} 
    149148 
  • trunk/src/plugins/ingy/Document-Parser/lib/Document/Parser.pm

    r211 r212  
    109109    my ($self, $type, $match) = @_; 
    110110    my $func = "handle_$type"; 
    111     $self->$func($match); 
    112 
     111    $self->$func($match, $type); 
     112
     113 
     114# sub handle_p { 
     115#     my $self = shift; 
     116#     $self->subparse(p => parse_phrases => @_, sub { s/\n+\z// }); 
     117# } 
     118 
    113119 
    114120sub subparse { 
    115     my ($self, $type, $func, $match, $filter) = @_; 
     121    my ($self, $func, $match, $type, $filter) = @_; 
    116122    $self->{ast}->begin_node($type); 
    117123    my $parser = $self->new(