Changeset 210
- Timestamp:
- 04/06/07 20:38:08 (1 year ago)
- Files:
-
- trunk/src/core/Spork/lib/Spork/Parser.pm (modified) (7 diffs)
- trunk/src/plugins/ingy/Document-Parser/lib/Document/Parser.pm (modified) (4 diffs)
- trunk/test/spork-parser.t (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/core/Spork/lib/Spork/Parser.pm
r205 r210 1 1 package Spork::Parser; 2 use strict;3 use warnings;4 2 use base 'Document::Parser'; 5 use XXX;6 3 7 4 my $ALPHANUM = '\p{Letter}\p{Number}\pM'; … … 24 21 { 25 22 top => { 26 contains => $all_blocks,23 blocks => $all_blocks, 27 24 }, 28 25 center => { 29 contains => $all_blocks,26 blocks => $all_blocks, 30 27 match => qr/^\.center\n(.*?\n)(?:.center\n|\z)\n?/s, 31 28 }, 32 29 indent => { 33 contains => $all_blocks,30 blocks => $all_blocks, 34 31 match => qr/^((?m:^>+.*\n)+\n?)/, 35 32 }, … … 38 35 }, 39 36 p => { 40 contains => $all_phrases,37 phrases => $all_phrases, 41 38 match => qr/^(((?!>).*\S.*\n)+)(?m:^\s*\n)*/, 42 39 }, 43 40 ul => { 44 contains => [qw(ul li)],41 blocks => [qw(ul li)], 45 42 match => qr/^((?m:^\*+ .*\n)+)\n*/, 46 43 }, 47 44 li => { 48 contains => $all_phrases,45 phrases => $all_phrases, 49 46 match => qr/(.*)\n/, 50 47 }, 51 48 h2 => { 52 contains => $all_phrases,49 phrases => $all_phrases, 53 50 match => qr/^={2}\s+(.*?)\s*\n+/, 54 51 }, 55 52 b => { 56 contains => $all_phrases, 57 match => [ 58 qr/((?:^|(?<=[^${ALPHANUM}\*]))\*\S[^\*]*\*(?=[^{$ALPHANUM}\*]|\z))/, 53 phrases => $all_phrases, 54 match => [ 55 qr/( 56 (?:^|(?<=[^${ALPHANUM}\*])) 57 \*\S[^\*]*\* 58 (?=[^{$ALPHANUM}\*]|\z) 59 )/x, 59 60 qr/(\{\*.*?\*\})/, 60 61 ], … … 62 63 i => { 63 64 match => [ 64 qr/((?:^|(?<=[^${ALPHANUM}\/]))\/\S[^\/]*\/(?=[^{$ALPHANUM}\/]|\z))/, 65 qr/( 66 (?:^|(?<=[^${ALPHANUM}\/])) 67 \/\S[^\/]*\/ 68 (?=[^{$ALPHANUM}\/]|\z) 69 )/x, 65 70 qr/(\{\/.*?\/\})/, 66 71 ], … … 68 73 tt => { 69 74 match => [ 70 qr/((?:^|(?<=[^${ALPHANUM}`]))`\S[^`]*`(?=[^{$ALPHANUM}`]|\z))/, 75 qr/( 76 (?:^|(?<=[^${ALPHANUM}`])) 77 `\S[^`]*` 78 (?=[^{$ALPHANUM}`]|\z) 79 )/x, 71 80 qr/(\{`.*?`\})/, 72 81 ], … … 74 83 hilite => { 75 84 match => [ 76 qr/((?:^|(?<=[^${ALPHANUM}\|]))\|\S[^\|]*\|(?=[^{$ALPHANUM}\|]|\z))/, 85 qr/( 86 (?:^|(?<=[^${ALPHANUM}\|])) 87 \|\S[^\|]*\| 88 (?=[^{$ALPHANUM}\|]|\z) 89 )/x, 77 90 qr/(\{\|.*?\|\})/, 78 91 ], … … 168 181 package Spork::AST; 169 182 use base 'Document::AST'; 170 use XXX;171 183 172 184 sub insert { trunk/src/plugins/ingy/Document-Parser/lib/Document/Parser.pm
r206 r210 2 2 use strict; 3 3 use warnings; 4 use XXX;5 4 6 5 #------------------------------------------------------------------------------- … … 30 29 my $self = shift; 31 30 my $container_type = shift; 32 my $types = $self->{grammar}{$container_type}{ contains};31 my $types = $self->{grammar}{$container_type}{blocks}; 33 32 while (my $length = length $self->{input}) { 34 33 for my $type (@$types) { … … 54 53 my $self = shift; 55 54 my $container_type = shift; 56 my $types = $self->{grammar}{$container_type}{ contains};55 my $types = $self->{grammar}{$container_type}{phrases}; 57 56 while (length $self->{input}) { 58 57 my $match; … … 197 196 198 197 1; 198 199 =head1 trunk/test/spork-parser.t
r204 r210 4 4 use Spork::Parser; 5 5 use Spork::Emitter::HTML; 6 use XXX;7 6 8 7 run_is spork => 'html';
