зеркало из https://github.com/mozilla/pjs.git
Bug 260955 - add an #includesubst instruction r=Hixie
This commit is contained in:
Родитель
c0a28f458f
Коммит
54614a34ed
|
@ -427,6 +427,19 @@ sub include {
|
|||
}
|
||||
}
|
||||
|
||||
sub includesubst {
|
||||
my ($stack, $filename) = @_;
|
||||
return if $stack->disabled;
|
||||
die "argument expected\n" unless $filename;
|
||||
$filename =~ s/@(\w+)@/$stack->get($1, 1)/gose;
|
||||
$filename = File::Spec::_0_8::catpath(File::Spec::_0_8::splitpath($filename));
|
||||
if ($stack->{'dependencies'}) {
|
||||
$stack->visit($filename);
|
||||
} else {
|
||||
main::include($stack, $filename);
|
||||
}
|
||||
}
|
||||
|
||||
sub filter {
|
||||
my $stack = shift;
|
||||
return if $stack->disabled;
|
||||
|
|
|
@ -33,6 +33,7 @@ The following preprocessor instructions are recognised.
|
|||
#endif
|
||||
#error STRING
|
||||
#include FILENAME
|
||||
#includesubst @VAR@FILENAME
|
||||
#expand STRING
|
||||
#literal STRING
|
||||
#filter FILTER1 FILTER2 ... FILTERn
|
||||
|
@ -115,6 +116,9 @@ There is no predefined limit to the depth of #includes, and there is
|
|||
no restriction on self-inclusion, so care should be taken to avoid
|
||||
infinite loops.
|
||||
|
||||
The #includesubst instruction behaves like #include, except that any
|
||||
variables in @ATSIGNS@ are expanded, like the substitution filter.
|
||||
|
||||
The #expand instruction will print the given STRING with variable
|
||||
substitutions. See the substitution section below.
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче