faster macro processor using perl 5.10 features
This commit is contained in:
parent
6d381a5c46
commit
d7767e07a3
1 changed files with 17 additions and 17 deletions
|
|
@ -15,6 +15,7 @@ package WebGUI::Macro;
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use 5.010;
|
||||||
use WebGUI::Pluggable;
|
use WebGUI::Pluggable;
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
@ -42,24 +43,23 @@ These functions are available from this package:
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
my $parenthesis;
|
|
||||||
$parenthesis = qr{
|
|
||||||
\( # Start with '(',
|
|
||||||
(?: # Followed by
|
|
||||||
(?>\\[()]) # Escaped parenthesis
|
|
||||||
| # or
|
|
||||||
(?>[^()]) # Non-parenthesis
|
|
||||||
| # or
|
|
||||||
(??{ $parenthesis }) # a balanced parenthesis block
|
|
||||||
)* # zero or more times
|
|
||||||
\) # Ending with ')'
|
|
||||||
}x;
|
|
||||||
|
|
||||||
my $macro_re = qr{
|
my $macro_re = qr{
|
||||||
(\^ # Start with carat
|
( # capture #1 - entire macro call
|
||||||
([-a-zA-Z0-9_@#/*]{1,64}) # And one or more non-macro characters -tagged-
|
\^ # start with carat
|
||||||
((??{ $parenthesis })?) # a balanced parenthesis block
|
([-a-zA-Z0-9_@#/*]{1,64}) # capture #2 - macro name
|
||||||
;) # End with a semicolon.
|
( # capture #3 - parenthesis
|
||||||
|
\( # start with open parenthesis
|
||||||
|
(?: # followed by
|
||||||
|
(?> [^()] ) # non-parenthesis
|
||||||
|
| # or
|
||||||
|
(?>\\[()]) # Escaped parenthesis
|
||||||
|
| # or
|
||||||
|
(?3) # a balanced parenthesis block (recursive)
|
||||||
|
)* # zero or more times
|
||||||
|
\) # ending with closing parenthesis
|
||||||
|
)?
|
||||||
|
; # End with a semicolon.
|
||||||
|
)
|
||||||
}msx;
|
}msx;
|
||||||
|
|
||||||
=head2 filter ( html )
|
=head2 filter ( html )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue