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<perlvar>.
+
Trappable errors may be trapped using the eval operator. See
-L<perlfunc/eval>.
+L<perlfunc/eval>. In almost all cases, warnings may be selectively
+disabled or promoted to fatal errors using the C<warning> pragma.
+See L<warning>.
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!
=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<perlport> 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<perlport> for more on
+portability concerns.
=item bind() on closed fd
=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;
=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<perlport> for writing portable code.
+therefore non-portable between systems. See L<perlport> for more on
+portability concerns.
=item Identifier too long
=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<perlport> for writing portable code.
+therefore non-portable between systems. See L<perlport> for more on
+portability concerns.
=item Odd number of elements in hash assignment
=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;
* "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.
/*
* 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
* 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
/*
* Perl_deprecate
- * Warns that something is deprecated. Duh.
*/
void
/*
* depcom
- * Deprecate a comma-less variable list. Called from three places
- * in the tokenizer.
+ * Deprecate a comma-less variable list.
*/
STATIC void
}
/*
- * 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
/*
* 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
/*
* 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
* 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
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)" :
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,
/*
* 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
* 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 *
/*
* 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
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);
? (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#"
: "";
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 */
/* 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$]+/
*
* 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)
{