From: Gurusamy Sarathy Date: Thu, 29 Jul 1999 01:33:46 +0000 (+0000) Subject: minor tweaks to pods and toke.c comments X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9cbb5ea2917cb666eed5655eac07566f07548487;p=p5sagit%2Fp5-mst-13.2.git minor tweaks to pods and toke.c comments p4raw-id: //depot/perl@3826 --- diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 8a4c2d1..aad3ce3 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -134,9 +134,12 @@ C: $answer = 0b101010; printf "The answer is: %b\n", oct("0b101010"); -=head2 Too large hexadecimal, octal, and binary constants more serious +=head2 Literal hexadecimal, octal, and binary numbers must fit within native sizes -Too large hexadecimal, octal, and binary constants now cause fatal errors. +The warning that used to be produced when encountering hexadecimal, octal, +and binary literals that are too large to be represented as native integers +has now been promoted to a fatal error. Literal decimal numbers are +unaffected. =head2 syswrite() ease-of-use diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 7d27fc2..7a7b129 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -18,8 +18,11 @@ desperation): Optional warnings are enabled by using the B<-w> switch. Warnings may be captured by setting C<$SIG{__WARN__}> to a reference to a routine that will be called on each warning instead of printing it. See L. + Trappable errors may be trapped using the eval operator. See -L. +L. In almost all cases, warnings may be selectively +disabled or promoted to fatal errors using the C pragma. +See L. Some of these messages are generic. Spots that vary are denoted with a %s, just as in a printf format. Note that some messages start with a %s! @@ -469,18 +472,9 @@ likely depends on its correct operation, Perl just gave up. =item Binary number > 0b11111111111111111111111111111111 non-portable -(W) The binary number you specified is larger than 2**32-1 and -therefore non-portable between systems. If you know that your code is -always going to be used only in systems that have more than 32-bit -integers (which means that Perl should be able to use such), you can -silence this warning by - - { - no warning 'unsafe'; - .... your code here ... - } - -See also L for writing portable code. +(W) The binary number you specified is larger than 2**32-1 and therefore +generally non-portable between systems. See L for more on +portability concerns. =item bind() on closed fd @@ -1356,7 +1350,8 @@ the name. =item Format %s redefined -(W) You redefined a format. To suppress this warning, say +(W) You redefined a format, perhaps accidentally. To suppress this warning, +say { no warning; @@ -1432,17 +1427,8 @@ is now heavily deprecated. =item Hexadecimal number > 0xffffffff non-portable (W) The hexadecimal number you specified is larger than 2**32-1 and -therefore non-portable between systems. If you know that your code is -always going to be used only in systems that have more than 32-bit -integers (which means that Perl should be able to use such), you can -silence this warning by - - { - no warning 'unsafe'; - .... your code here ... - } - -See also L for writing portable code. +therefore non-portable between systems. See L for more on +portability concerns. =item Identifier too long @@ -1997,17 +1983,8 @@ try using scientific notation (e.g. "1e6" instead of "1_000_000"). =item Octal number > 037777777777 non-portable (W) The octal number you specified is larger than 2**32-1 and -therefore non-portable between systems. If you know that your code is -always going to be used only in systems that have more than 32-bit -integers (which means that Perl should be able to use such), you can -silence this warning by - - { - no warning 'unsafe'; - .... your code here ... - } - -See also L for writing portable code. +therefore non-portable between systems. See L for more on +portability concerns. =item Odd number of elements in hash assignment @@ -2642,7 +2619,8 @@ may break this. =item Subroutine %s redefined -(W) You redefined a subroutine. To suppress this warning, say +(W) You redefined a subroutine, perhaps accidentally. To suppress this +warning, say { no warning; diff --git a/pod/perllexwarn.pod b/pod/perllexwarn.pod index 484e211..81f44cc 100644 --- a/pod/perllexwarn.pod +++ b/pod/perllexwarn.pod @@ -314,8 +314,8 @@ The experimental features need bottomed out. the module should be revisited. octal - 'octal' controls illegal octal characters warning but 'unsafe' - illegal hexadecimal and binary characters warning. + 'octal' controls illegal octal characters warning, but 'unsafe' controls + illegal hexadecimal and binary characters warnings. =head1 SEE ALSO diff --git a/toke.c b/toke.c index 6f792f2..9394391 100644 --- a/toke.c +++ b/toke.c @@ -11,9 +11,8 @@ * "It all comes from here, the stench and the peril." --Frodo */ -/* toke.c - * - * This file is the tokenizer for Perl. It's closely linked to the +/* + * This file is the lexer for Perl. It's closely linked to the * parser, perly.y. * * The main routine is yylex(), which returns the next token. @@ -109,7 +108,7 @@ int* yychar_pointer = NULL; /* * Convenience functions to return different tokens and prime the - * tokenizer for the next token. They all take an argument. + * lexer for the next token. They all take an argument. * * TOKEN : generic token (used for '(', DOLSHARP, etc) * OPERATOR : generic operator @@ -126,7 +125,7 @@ int* yychar_pointer = NULL; * BAop : bitwise and * SHop : shift operator * PWop : power operator - * PMop : matching operator + * PMop : pattern-matching operator * Aop : addition-level operator * Mop : multiplication-level operator * Eop : equality-testing operator @@ -274,7 +273,6 @@ S_missingterm(pTHX_ char *s) /* * Perl_deprecate - * Warns that something is deprecated. Duh. */ void @@ -287,8 +285,7 @@ Perl_deprecate(pTHX_ char *s) /* * depcom - * Deprecate a comma-less variable list. Called from three places - * in the tokenizer. + * Deprecate a comma-less variable list. */ STATIC void @@ -298,8 +295,8 @@ S_depcom(pTHX) } /* - * text filters for win32 carriage-returns, utf16-to-utf8 and - * utf16-to-utf8-reversed, whatever that is. + * experimental text filters for win32 carriage-returns, utf16-to-utf8 and + * utf16-to-utf8-reversed. */ #ifdef WIN32 @@ -346,8 +343,8 @@ S_utf16rev_textfilter(pTHX_ int idx, SV *sv, int maxlen) /* * Perl_lex_start - * Initialize variables. Called by perl.c. It uses the Perl stack - * to save its state (for recursive calls to the parser). + * Initialize variables. Uses the Perl save_stack to save its state (for + * recursive calls to the parser). */ void @@ -417,8 +414,8 @@ Perl_lex_start(pTHX_ SV *line) /* * Perl_lex_end - * Tidy up. Called from pp_ctl.c in the sv_compile_2op(), doeval(), - * and pp_leaveeval() subroutines. + * Finalizer for lexing operations. Must be called when the parser is + * done with the lexer. */ void @@ -433,8 +430,8 @@ Perl_lex_end(pTHX) * or pinball tables. Its name is short for "increment line". It * increments the current line number in PL_curcop->cop_line and checks * to see whether the line starts with a comment of the form - * # line 500 - * If so, it sets the current line number to the number in the comment. + * # line 500 "foo.pm" + * If so, it sets the current line number and file to the values in the comment. */ STATIC void @@ -521,8 +518,10 @@ S_skipspace(pTHX_ register char *s) return s; /* try to recharge the buffer */ - if ((s = filter_gets(PL_linestr, PL_rsfp, (prevlen = SvCUR(PL_linestr)))) == Nullch) { - /* end of file. Add on the -p or -n magic */ + if ((s = filter_gets(PL_linestr, PL_rsfp, + (prevlen = SvCUR(PL_linestr)))) == Nullch) + { + /* end of file. Add on the -p or -n magic */ if (PL_minus_n || PL_minus_p) { sv_setpv(PL_linestr,PL_minus_p ? ";}continue{print or die qq(-p destination: $!\\n)" : @@ -534,7 +533,8 @@ S_skipspace(pTHX_ register char *s) sv_setpv(PL_linestr,";"); /* reset variables for next time we lex */ - PL_oldoldbufptr = PL_oldbufptr = PL_bufptr = s = PL_linestart = SvPVX(PL_linestr); + PL_oldoldbufptr = PL_oldbufptr = PL_bufptr = s = PL_linestart + = SvPVX(PL_linestr); PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr); /* Close the filehandle. Could be from -P preprocessor, @@ -673,11 +673,11 @@ S_lop(pTHX_ I32 f, expectation x, char *s) /* * S_force_next - * When the tokenizer realizes it knows the next token (for instance, + * When the lexer realizes it knows the next token (for instance, * it is reordering tokens for the parser) then it can call S_force_next - * to make the current token be the next one. It will also set - * PL_nextval, and possibly PL_expect to ensure the lexer handles the - * token correctly. + * to know what token to return the next time the lexer is called. Caller + * will need to set PL_nextval[], and possibly PL_expect to ensure the lexer + * handles the token correctly. */ STATIC void @@ -705,7 +705,7 @@ S_force_next(pTHX_ I32 type) * a keyword (do this if the word is a label, e.g. goto FOO) * int allow_pack : if true, : characters will also be allowed (require, * use, etc. do this) - * int allow_initial_tick : used by the "sub" tokenizer only. + * int allow_initial_tick : used by the "sub" lexer only. */ STATIC char * @@ -740,12 +740,11 @@ S_force_word(pTHX_ register char *start, int token, int check_keyword, int allow /* * S_force_ident - * Called when the tokenizer wants $foo *foo &foo etc, but the program + * Called when the lexer wants $foo *foo &foo etc, but the program * text only contains the "foo" portion. The first argument is a pointer * to the "foo", and the second argument is the type symbol to prefix. * Forces the next token to be a "WORD". - * Creates the symbol if it didn't already exist (through the gv_fetchpv - * call). + * Creates the symbol if it didn't already exist (via gv_fetchpv()). */ STATIC void @@ -960,7 +959,8 @@ S_sublex_push(pTHX) PL_linestr = PL_lex_stuff; PL_lex_stuff = Nullsv; - PL_bufend = PL_bufptr = PL_oldbufptr = PL_oldoldbufptr = PL_linestart = SvPVX(PL_linestr); + PL_bufend = PL_bufptr = PL_oldbufptr = PL_oldoldbufptr = PL_linestart + = SvPVX(PL_linestr); PL_bufend += SvCUR(PL_linestr); SAVEFREESV(PL_linestr); @@ -1127,10 +1127,10 @@ S_scan_const(pTHX_ char *start) ? (PL_sublex_info.sub_op->op_private & (OPpTRANS_FROM_UTF|OPpTRANS_TO_UTF)) : UTF; I32 thisutf = (PL_lex_inwhat == OP_TRANS && PL_sublex_info.sub_op) - ? (PL_sublex_info.sub_op->op_private & (PL_lex_repl ? OPpTRANS_FROM_UTF : OPpTRANS_TO_UTF)) + ? (PL_sublex_info.sub_op->op_private & (PL_lex_repl ? + OPpTRANS_FROM_UTF : OPpTRANS_TO_UTF)) : UTF; - /* leaveit is the set of acceptably-backslashed characters */ - char *leaveit = + char *leaveit = /* set of acceptably-backslashed characters */ PL_lex_inpat ? "\\.^$@AGZdDwWsSbBpPXC+*?|()-nrtfeaxcz0123456789[{]} \t\n\r\f\v#" : ""; @@ -1145,8 +1145,8 @@ S_scan_const(pTHX_ char *start) I32 max; /* last character in range */ i = d - SvPVX(sv); /* remember current offset */ - SvGROW(sv, SvLEN(sv) + 256); /* expand the sv -- there'll never be more'n 256 chars in a range for it to grow by */ - d = SvPVX(sv) + i; /* restore d after the grow potentially has changed the ptr */ + SvGROW(sv, SvLEN(sv) + 256); /* never more than 256 chars in a range */ + d = SvPVX(sv) + i; /* refresh d after realloc */ d -= 2; /* eat the first char and the - */ min = (U8)*d; /* first char in range */ @@ -1437,7 +1437,6 @@ S_scan_const(pTHX_ char *start) /* S_intuit_more * Returns TRUE if there's more to the expression (e.g., a subscript), * FALSE otherwise. - * This is the one truly awful dwimmer necessary to conflate C and sed. * * It deals with "$foo[3]" and /$foo[3]/ and /$foo[0123456789$]+/ * @@ -1454,6 +1453,8 @@ S_scan_const(pTHX_ char *start) * anything else returns TRUE */ +/* This is the one truly awful dwimmer necessary to conflate C and sed. */ + STATIC int S_intuit_more(pTHX_ register char *s) {