From 0d4f569ff3275d4d731d148ddc1a0fc7bd5639f9 Mon Sep 17 00:00:00 2001 From: acli Date: Fri, 20 Feb 2004 02:48:39 +0000 Subject: [PATCH] Try to not display like 40-line warnings too often --- misc/translator/TmplTokenizer.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/misc/translator/TmplTokenizer.pm b/misc/translator/TmplTokenizer.pm index 104515f9f5..7b2fece1bf 100644 --- a/misc/translator/TmplTokenizer.pm +++ b/misc/translator/TmplTokenizer.pm @@ -335,7 +335,9 @@ sub _next_token_internal { # following token looks like a TMPL_VAR, don't stop my($head, $tail, $post) = ($1, $2, $3); if ($tail eq '' && $post =~ $re_tmpl_var) { - warn_normal "Possible SGML \"closed start tag\" notation: $head<\n", $this->line_number; + # Don't bother to show the warning if we're too confused + warn_normal "Possible SGML \"closed start tag\" notation: $head<\n", $this->line_number + if split(/\n/, $head) < 10; } else { ($kind, $it) = (TmplTokenType::TAG, "$head>"); $this->_set_readahead( $post ); @@ -376,8 +378,10 @@ sub _next_token_internal { $this->_set_syntaxerror( 1 ); } } - warn_normal "Unrecognizable token found: $it\n", $this->line_number_start - if $kind == TmplTokenType::UNKNOWN; + warn_normal "Unrecognizable token found: " + . (split(/\n/, $it) < 10? $it: '(too confused to show details)') + . "\n", $this->line_number_start + if $kind == TmplTokenType::UNKNOWN; return defined $it? (ref $it? $it: TmplToken->new($it, $kind, $this->line_number, $this->filename)): undef; } -- 2.39.5