97 |
$opt{file} =~ s/"/''/g; |
$opt{file} =~ s/"/''/g; |
98 |
sprintf '%s#line %d "%s"%s', "\n", $opt{line_no} || 1, $opt{file}, "\n"; |
sprintf '%s#line %d "%s"%s', "\n", $opt{line_no} || 1, $opt{file}, "\n"; |
99 |
} |
} |
100 |
|
sub literal_or_code ($$) { |
101 |
|
my ($Info, $s) = @_; |
102 |
|
substr ($s, 0, 1) ne '{' ? literal ($s) |
103 |
|
: code ($Info, substr ($s, 1, length ($s) - 2)); |
104 |
|
} |
105 |
|
|
106 |
my $parser = Message::Markup::SuikaWikiConfig20::Parser->new; |
my $parser = Message::Markup::SuikaWikiConfig20::Parser->new; |
107 |
my $plugins = $parser->parse_text ($src); |
my $plugins = $parser->parse_text ($src); |
181 |
register_plugin_const ($_, \%Info); |
register_plugin_const ($_, \%Info); |
182 |
} elsif ($_->local_name eq 'Format') { |
} elsif ($_->local_name eq 'Format') { |
183 |
print "\n", make_format ($_, \%Info); |
print "\n", make_format ($_, \%Info); |
184 |
|
# Parameter |
185 |
|
# PluginCategory |
186 |
} |
} |
187 |
} |
} |
188 |
|
|
292 |
if $def{Name}; |
if $def{Name}; |
293 |
} elsif ($def{Name}) { |
} elsif ($def{Name}) { |
294 |
$r = qq{\$Converter->{@{[literal '/'.$def{Name}.'/'.$def{Version}.$flag]}} = {$r};\n}; |
$r = qq{\$Converter->{@{[literal '/'.$def{Name}.'/'.$def{Version}.$flag]}} = {$r};\n}; |
295 |
$r |
} else { |
296 |
|
$r = 'BEGIN { die "Invalid Syntax of Converter: Type or Name property required" }'; |
297 |
} |
} |
298 |
$r; |
$r; |
299 |
} |
} |
307 |
sub @{[$name = $src->get_attribute_value ('Name')]} { |
sub @{[$name = $src->get_attribute_value ('Name')]} { |
308 |
@{[line $Info, node_path => "Function[Name='$name']/Main"]}@{[ |
@{[line $Info, node_path => "Function[Name='$name']/Main"]}@{[ |
309 |
code $Info, $src->get_attribute_value ('Main') |
code $Info, $src->get_attribute_value ('Main') |
310 |
]}@{[line $Info, reset => 1]} |
]} |
311 |
} |
} |
312 |
|
@{[line $Info, reset => 1]} |
313 |
EOH |
EOH |
314 |
} |
} |
315 |
|
|
398 |
||qq(sub @{[$method_name]} {\n)) |
||qq(sub @{[$method_name]} {\n)) |
399 |
. line ($Info, node_path => "ViewDefinition[Mode='$ViewProp->{Name}']/method[Name='$method_name']") |
. line ($Info, node_path => "ViewDefinition[Mode='$ViewProp->{Name}']/method[Name='$method_name']") |
400 |
. code ($Info, $_->value) |
. code ($Info, $_->value) |
401 |
. line ($Info, reset => 1) |
. qq(}\n) |
402 |
. qq(}\n); |
. line ($Info, reset => 1); |
403 |
} |
} |
404 |
} |
} |
405 |
my $prop = {Name => $ViewProp->{Name}, |
my $prop = {Name => $ViewProp->{Name}, |
489 |
my $name = $src->get_attribute ('Name', make_new_node => 1)->value; |
my $name = $src->get_attribute ('Name', make_new_node => 1)->value; |
490 |
$name =~ s/(?<=.)-/_/g; |
$name =~ s/(?<=.)-/_/g; |
491 |
my $main = line ($Info, node_path => "FormattingRule[name()='@{[list $type]}/$name']/Formatting") |
my $main = line ($Info, node_path => "FormattingRule[name()='@{[list $type]}/$name']/Formatting") |
492 |
. code ($Info, $src->get_attribute_value ('Formatting')) |
. code ($Info, $src->get_attribute_value ('Formatting')); |
|
. line ($Info, reset => 1); |
|
493 |
|
|
494 |
my $reg_block; |
my $reg_block; |
495 |
$reg_block = qr/[^{}]*(?>[^{}]+|{(??{$reg_block})})*/; |
$reg_block = qr/[^{}]*(?>[^{}]+|{(??{$reg_block})})*/; |
|
my $reg_attr = qr/__ATTR(TEXT|NODE)?:%(\w+)(?:->{($reg_block)})?__;/; |
|
496 |
|
|
497 |
$main = q{my ($f, $rule_name, $p, $o, %opt) = @_;}."\n".$main |
$main = q{my ($f, $rule_name, $p, $o, %opt) = @_;}."\n".$main |
498 |
if $main =~ /\$f\b/ |
if $main =~ /\$f\b/ |
504 |
$main = q{my $r = '';} . "\n" . $main . "\n" |
$main = q{my $r = '';} . "\n" . $main . "\n" |
505 |
. q{$p->{-parent}->append_node ($r, node_or_text => 1);}; |
. q{$p->{-parent}->append_node ($r, node_or_text => 1);}; |
506 |
} |
} |
507 |
$main =~ s{$reg_attr} |
$main =~ s{__ATTR(TEXT|NODE)?:%(\w+|{$reg_block})(?:->{($reg_block)})?__;} |
508 |
{($1 eq 'TEXT' ? '$p->{'.literal($2).'} = do { my $r = ' : '') |
{($1 eq 'TEXT' ? '$p->{'.literal_or_code($Info, $2) |
509 |
.'$f->parse_attr ($p=>'.literal($2).', $o, ' |
.'} = do { my $r = ' : '') |
510 |
|
.'$f->parse_attr ($p=>'.literal_or_code($Info, $2).', $o, ' |
511 |
.($3?'-parent => '.$3.', ':'') |
.($3?'-parent => '.$3.', ':'') |
512 |
.($1?'-non_parsed_to_node => 1, ':'') |
.($1?'-non_parsed_to_node => 1, ':'') |
513 |
.'%opt)' |
.'%opt)' |
514 |
.($1 eq 'TEXT' ? '; ref $r?$r->inner_text:$r}' : '') |
.($1 eq 'TEXT' ? '; ref $r?$r->inner_text:$r}' : '') |
515 |
.';'}ge; |
.';'}ge; |
516 |
|
|
517 |
my $main = <<EOH; |
$main = <<EOH; |
518 |
{ |
{ |
519 |
main => sub {$main}, |
main => sub {$main}, |
520 |
|
@{[line ($Info, reset => 1)]} |
521 |
Description => [@{[m13ed_val_list $src, 'Description']}], |
Description => [@{[m13ed_val_list $src, 'Description']}], |
522 |
Parameter => {@{[do{ |
Parameter => {@{[do{ |
523 |
my @r; |
my @r; |