From: Gurusamy Sarathy Date: Fri, 26 Mar 1999 01:30:25 +0000 (+0000) Subject: specify type of bracket in "Unmatched bracket" diagnostic; X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d98d5fffa337682ca6cac752b32ff55e863a53a0;hp=a7ae9550f26a080556f67048e2697d3c5a20f9f4;p=p5sagit%2Fp5-mst-13.2.git specify type of bracket in "Unmatched bracket" diagnostic; prefer 'brace' or 'curly bracket' over 'curly brace' p4raw-id: //depot/perl@3170 --- diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 73a4693..7e5ab16 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -399,7 +399,7 @@ Perl yourself. =item Bareword "%s" not allowed while "strict subs" in use (F) With "strict subs" in use, a bareword is only allowed as a -subroutine identifier, in curly braces or to the left of the "=>" symbol. +subroutine identifier, in curly brackets or to the left of the "=>" symbol. Perhaps you need to predeclare a subroutine? =item Bareword "%s" refers to nonexistent package @@ -1579,11 +1579,11 @@ construction, but the command was missing or blank. (S) This is an educated guess made in conjunction with the message "%s found where operator expected". Often the missing operator is a comma. -=item Missing right bracket +=item Missing right curly or square bracket -(F) The lexer counted more opening curly brackets (braces) than closing ones. -As a general rule, you'll find it's missing near the place you were last -editing. +(F) The lexer counted more opening curly or square brackets than +closing ones. As a general rule, you'll find it's missing near the place +you were last editing. =item Modification of a read-only value attempted @@ -2781,12 +2781,12 @@ representative, who probably put it there in the first place. expressions. If you're a vi user, the % key is valuable for finding the matching parenthesis. See L. -=item Unmatched right bracket +=item Unmatched right %s bracket -(F) The lexer counted more closing curly brackets (braces) than opening -ones, so you're probably missing an opening bracket. As a general -rule, you'll find the missing one (so to speak) near the place you were -last editing. +(F) The lexer counted more closing curly or square brackets than +opening ones, so you're probably missing a matching opening bracket. +As a general rule, you'll find the missing one (so to speak) near the +place you were last editing. =item unmatched [] in regexp diff --git a/pod/perlreftut.pod b/pod/perlreftut.pod index 4526e4a..09bea59 100644 --- a/pod/perlreftut.pod +++ b/pod/perlreftut.pod @@ -336,11 +336,11 @@ other references. =item * -In B, you can omit the curly braces whenever the thing +In B, you can omit the curly brackets whenever the thing inside them is an atomic scalar variable like C<$aref>. For example, C<@$aref> is the same as C<@{$aref}>, and C<$$aref[1]> is the same as C<${$aref}[1]>. If you're just starting out, you may want to adopt -the habit of always including the curly braces. +the habit of always including the curly brackets. =item * diff --git a/pod/perlstyle.pod b/pod/perlstyle.pod index cf280ce..04aab98 100644 --- a/pod/perlstyle.pod +++ b/pod/perlstyle.pod @@ -16,7 +16,7 @@ The C and even C pragmas may also prove useful. Regarding aesthetics of code lay out, about the only thing Larry -cares strongly about is that the closing curly brace of +cares strongly about is that the closing curly bracket of a multi-line BLOCK should line up with the keyword that started the construct. Beyond that, he has other preferences that aren't so strong: diff --git a/t/op/misc.t b/t/op/misc.t index 48e22f6..8281bf0 100755 --- a/t/op/misc.t +++ b/t/op/misc.t @@ -349,7 +349,7 @@ Sequence (?{...}) not terminated or not {}-balanced at - line 1, within pattern ######## /(?{"{"}})/ # Check it outside of eval too EXPECT -Unmatched right bracket at (re_eval 1) line 1, at end of line +Unmatched right curly bracket at (re_eval 1) line 1, at end of line syntax error at (re_eval 1) line 1, near ""{"}" Compilation failed in regexp at - line 1. ######## diff --git a/t/op/re_tests b/t/op/re_tests index 7009596..5abe217 100644 --- a/t/op/re_tests +++ b/t/op/re_tests @@ -402,7 +402,7 @@ a(?{{})b - c - /a(?{{})b/: Sequence (?{...}) not terminated or not {}-balanced a(?{}})b - c - /a(?{}})b/: Sequence (?{...}) not terminated or not {}-balanced a(?{"{"})b - c - /a(?{"{"})b/: Sequence (?{...}) not terminated or not {}-balanced a(?{"\{"})b cabd y $& ab -a(?{"{"}})b - c - Unmatched right bracket +a(?{"{"}})b - c - Unmatched right curly bracket a(?{$bl="\{"}).b caxbd y $bl { x(~~)*(?:(?:F)?)? x~~ y - - ^a(?#xxx){3}c aaac y $& aaac diff --git a/toke.c b/toke.c index 4b26a64..5ad891b 100644 --- a/toke.c +++ b/toke.c @@ -1928,7 +1928,7 @@ int yylex(PERL_YYLEX_PARAM_DECL) PL_last_uni = 0; PL_last_lop = 0; if (PL_lex_brackets) - yyerror("Missing right bracket"); + yyerror("Missing right curly or square bracket"); TOKEN(0); } if (s++ < PL_bufend) @@ -2372,7 +2372,7 @@ int yylex(PERL_YYLEX_PARAM_DECL) case ']': s++; if (PL_lex_brackets <= 0) - yyerror("Unmatched right bracket"); + yyerror("Unmatched right square bracket"); else --PL_lex_brackets; if (PL_lex_state == LEX_INTERPNORMAL) { @@ -2529,7 +2529,7 @@ int yylex(PERL_YYLEX_PARAM_DECL) rightbracket: s++; if (PL_lex_brackets <= 0) - yyerror("Unmatched right bracket"); + yyerror("Unmatched right curly bracket"); else PL_expect = (expectation)PL_lex_brackstack[--PL_lex_brackets]; if (PL_lex_brackets < PL_lex_formbrack)