Config-Scoped
view release on metacpan or search on metacpan
lib/Config/Scoped.pm view on Meta::CPAN
name => $item{key},
value => $item{value},
);
# rule success, errors in the method don't raise syntax errors
1;
}
| <error?> <reject>
# call recursively a new P::RD parser for this include file
# call by value for the current $warnings
include : <rulevar: local $thisparser->{local}{warnings} =
Storable::dclone $thisparser->{local}{warnings}>
include : '%include' <commit> { ++$break } value stop_pattern
{
$thisparser->{local}{line} = $thisline;
$thisparser->_include( file => $item{value}, );
# rule success, errors in the method don't raise syntax errors
1;
}
| <error?> <reject>
warning : warning_short | warning_long
warning_short : /%warnings?/i on_off <commit> { ++$break } stop_pattern
{
$thisparser->{local}{line} = $thisline;
$thisparser->_set_warnings( switch => $item{on_off} );
# rule success, errors in the method don't raise syntax errors
1;
}
| <error?> <reject>
warning_long :
/%warnings?/i ...!on_off key <commit> { ++$break } on_off stop_pattern
{
$thisparser->{local}{line} = $thisline;
$thisparser->_set_warnings(
name => $item{key},
switch => $item{on_off},
);
# rule success, errors in the method don't raise syntax errors
1;
}
| <error?> <reject>
on_off : /on|off/i
#########################################################################
# KEY and VALUE'S
#########################################################################
#
key : perl_code | token | perl_quote
value : perl_code | token | perl_quote
# everything unless separator characters, better than \w in unicode times
token : /[^ \s >< }{ )( [\] ; , ' " = # % ]+/x
perl_quote : .../"|'|<</ <perl_quotelike>
{
$thisparser->{local}{line} = $thisline;
$return = $thisparser->_quotelike( value => $item{__DIRECTIVE1__} );
}
perl_code : /perl_code|eval/i <perl_codeblock>
{
$thisparser->{local}{line} = $thisline;
$return = $thisparser->_perl_code( expr => $item{__DIRECTIVE1__}, );
}
#########################################################################
# helpers
#########################################################################
#
# The skip reset is necessary, since the default eats the newlines.
# stop_pattern is:
# a newline, a semicolon, a comma or a look-ahead for '}', ']', '\s'
#
stop_pattern : <skip: qr//> m/\s* (\n | ; | , | \z | (?=[ \} \] \s ]) )/x
eofile : /\z/
comment : m/#.*\n/
#########################################################################
#
# END of GRAMMAR, without headache?
#
#########################################################################
( run in 0.864 second using v1.01-cache-2.11-cpan-39bf76dae61 )