From 2f7192689a19b9a19155a90d53f936418fa2de76 Mon Sep 17 00:00:00 2001 From: acli Date: Mon, 16 Feb 2004 23:50:56 +0000 Subject: [PATCH] Avoid direct accessing of variables inside the module --- misc/translator/TmplTokenizer.pm | 7 +++++++ misc/translator/text-extract2.pl | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/misc/translator/TmplTokenizer.pm b/misc/translator/TmplTokenizer.pm index 6d7fa12c93..3bc746a92b 100644 --- a/misc/translator/TmplTokenizer.pm +++ b/misc/translator/TmplTokenizer.pm @@ -265,6 +265,13 @@ sub next_token (*) { ############################################################################### +# Other easy functions + +sub blank_p ($) { + my($s) = @_; + return $s =~ /^(?:\s|\ $re_end_entity|$re_tmpl_var)*$/os; +} + sub trim ($) { my($s) = @_; $s =~ s/^(?:\s|\ $re_end_entity)+//os; diff --git a/misc/translator/text-extract2.pl b/misc/translator/text-extract2.pl index fbe592d6a4..7bbfc7721e 100755 --- a/misc/translator/text-extract2.pl +++ b/misc/translator/text-extract2.pl @@ -27,7 +27,7 @@ use vars qw( $pedantic_p ); sub debug_dump (*) { # for testing only my($h) = @_; - print "re_tag_compat is /$TmplTokenizer::re_tag_compat/\n"; + print "re_tag_compat is /", TmplTokenizer::re_tag(1), "/\n"; for (;;) { my $s = TmplTokenizer::next_token $h; last unless defined $s; @@ -79,7 +79,7 @@ sub text_extract (*) { # Don't emit pure whitespace, pure numbers, or TMPL_VAR's. for my $t (keys %text) { printf "%s\n", $t - unless $t =~ /^(?:\s|\ $TmplTokenizer::re_end_entity|$TmplTokenizer::re_tmpl_var)*$/os || $t =~ /^\d+$/; + unless TmplTokenizer::blank_p($t) || $t =~ /^\d+$/; } } -- 2.39.5