| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is not very helpful:
=item Ambiguous use of %c{%s%s} resolved to %c%s%s
especially since it is functionally identical to the previous entry:
=item Ambiguous use of %c{%s} resolved to %c%s
Not only can diagnostics.pm never find it, but it is hard for human
beings to understand what the different is at first glance, too.
So filling in the second and fourth %s’s with the two possible values
slays a twain of avians with one piece of petrified matter.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Throughout 5.13 there was temporary code to deprecate and forbid
certain values of X following a \c in qq strings. This patch fixes
this to the final 5.14 semantics.
These are:
1) a utf8 non-ASCII character will croak. This is the same
behavior as pre-5.13, but it gives a correct error message, rather than
the malformed utf8 message previously.
2) \c{ and \cX where X is above ASCII will generate a deprecated
message. The intent is to remove these capabilities in 5.16. The
original agreement was to croak on above ASCII, but that does violate
our stability policy, so I'm deprecating it instead.
3) A non-deprecated warning is generated for all other \cX; this is the
same as throughout the 5.13 series.
I did not have the tuits to use \c{} as I had planned in 5.14, but \N{}
can be used instead.
|
| |
|
|
|
|
|
|
|
|
| |
As it and Perl_yylex() both need FEATURE_IS_ENABLED, feature_is_enabled() is
no longer static, and the two macro definitions move from toke.c to perl.h
Previously, one had to cut and paste the output of perl_keywords.pl into the
middle of toke.c, and it was not clear that it was generated code.
|
|
|
|
|
|
|
|
|
| |
This patch changes the core functions to use the common names for the
fields that are shared between op.c and regcomp.c, just for consistency
of using one name throughout the core for the same thing.
A grep of cpan shows that both names are used in various modules; so
both names must be retained.
|
|
|
|
|
|
|
|
|
| |
# New Ticket Created by (Peter J. Acklam)
# Please include the string: [perl #81904]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81904 >
Signed-off-by: Abigail <abigail@abigail.be>
|
| |
|
|
|
|
|
| |
Liberalise label syntax a little more, by allowing multiple adjacent
labels with no intervening statements, as in "foo: bar: baz:".
|
|
|
|
|
|
| |
New API functions parse_fullexpr(), parse_listexpr(), parse_termexpr(),
and parse_arithexpr(), to parse an expression at various precedence
levels.
|
|
|
|
|
|
| |
Commit 356979f4a7d780fd67a92a9ca6c8659bd12e7168 failed to include two
instances in toke.c that needed the same treatment, i.e., converting
properly from I8 to native.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
With this patch:
$ ./perl -we 'sub A () {1}; if (0) {my $foo = A or die}'
$ ./perl -we 'sub A () {1}; if (0) {my $foo = 1 or die}'
Found = in conditional, should be == at -e line 1.
Since the value of a constant may not be known at the time the program
is written, it should be perfectly acceptable to do a constant assign-
ment in a conditional.
|
|
|
|
| |
Paranoid linkers warn about using sprintf(), and rightly so.
|
|
|
|
|
| |
Previously it interpreted := as an empty attribute list, and issued a
deprecation warning. This change permits := to be used as a binding operator.
|
|
|
|
|
|
|
|
|
|
| |
Deprecate ?PATTERN?, recommending the equivalent m?PATTERN? syntax, in
order to eventually allow the question mark to be used in new operators
that would currently be ambiguous.
(With minor reconciliation edits by David Golden)
Signed-off-by: David Golden <dagolden@cpan.org>
|
| |
|
|
|
|
| |
Brought to you by the campaign for the elimination of strlen().
|
|
|
|
|
|
|
| |
New API function parse_label() parses a label, separate from statements.
If a label has not already been lexed and queued up, it does not use
yylex(), but parses the label itself at the character level, to avoid
unwanted lexing past an absent optional label.
|
|
|
|
|
| |
New API function parse_barestmt() parses a pure statement, with no label,
and returns just the statement's core ops, not attaching a state op.
|
|
|
|
|
|
|
| |
As-was, it would drop out of the scanner into the backslashed-backslash
processing loop earlier than need be, and hence would be copying the octets
of strings (in place) as soon as any backslash had been seen. Now it defers
copying until copying is actually unavoidable.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The C<+> prototype is a special alternative to C<$> that will act like
C<\[@%]> when given a literal array or hash variable, but will otherwise
force scalar context on the argument. This is useful for functions which
should accept either a literal array or an array reference as the argument:
sub smartpush (+@) {
my $aref = shift;
die "Not an array or arrayref" unless ref $aref eq 'ARRAY';
push @$aref, @_;
}
When using the C<+> prototype, your function must check that the argument
is of an acceptable type.
|
|
|
|
|
| |
New API function parse_block() parses a code block, including surrounding
braces. The block is a lexical scope, but not inherently a dynamic scope.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When recursing into the parser for recursive-descent parsing, put
a special entry on the bracket stack that generates a fake EOF if a
closing bracket belonging to an outer parser frame is seen. This keeps
the bracket stack balanced across a parse_stmtseq() frame, fixing
[perl #78222].
If a recursive-descent parser frame ends by yyunlex()ing an opening
bracket, pop its entry off the bracket stack and stash it in the
forced-token queue, to be revived when the token is re-lexed. This keeps
the bracket stack balanced across a parse_fullstmt() frame.
|
|
|
|
|
| |
lex_start() is added to the API, marked experimental, and documented.
It also gains a flags parameter for foreseeable future use.
|
|
|
|
|
|
|
|
| |
Syntax plugins can modify the source being parsed. It's fine for
them to modify the lexer buffer, but this must not be the same scalar
that was supplied to lex_start() and may be in use outside. Therefore
always copy the scalar in lex_start() rather than just referencing it.
Fixes [perl #78358].
|
|
|
|
|
|
|
| |
The lex_end() function is redundant, because the lexer context object
is actually finalised by parser_free(), triggered by the save stack.
The lex_end() function has historically been empty, except when the
PL_doextract global was being misused to store lexer state.
|
|
|
|
|
|
|
|
| |
PL_doextract had two unrelated jobs, neither best served by an interpreter
global variable. The first was to track the -x command-line switch.
That is replaced with a local variable in S_parse_body(). The second
was to track whether the lexer is in the middle of a =pod section.
That is replaced with an element in PL_parser.
|
|
|
|
|
|
|
|
| |
The only uses of lex_start that had the new_filter parameter false,
to make the new lexer context share source filters with the previous
lexer context, were uses with rsfp null, which therefore never invoked
source filters. Inheriting source filters from a logically unrelated
file seems like a silly idea anyway.
|
|
|
|
|
|
| |
Put into the API op_append_elem, op_prepend_elem, and op_append_list. All
renamed from op_-less internal names. Parameter types for op_append_list
changed to match the rest of the op API and avoid some casting.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
New magic type PERL_MAGIC_checkcall attaches a function to a CV, which
will be called as the second half of the op checker for an entersub
op calling that CV. Default state, in the absence of this magic,
is to process the CV's prototype if it has one, or apply list context
to all the arguments if not. New API functions cv_get_call_checker()
and cv_set_call_checker() provide a clean interface to this facility,
hiding the internal use of magic.
Expose in the API the new functions rv2cv_op_cv(),
ck_entersub_args_list(), ck_entersub_args_proto(), and
ck_entersub_args_proto_or_list(), which are meaningful segments of
standard entersub op checking and are likely to be useful in plugged-in
call checker functions.
Expose new API function op_contextualize(), which is a public interface
to the internal scalar()/list()/scalarvoid() functions. This API is
likely to be required in most plugged-in call checker functions.
Incidentally add new function mg_free_type(), in the API, which will
remove magic of one type from an SV. (mg_free() removes all magic,
and there isn't anything else more selective.)
|
|
|
|
|
|
|
| |
Previously yylex() was conditionally populating @AnyDBM_File::ISA (if it was not
set, and the token dbmopen was seen), and init_predump_symbols() was populating
@IO::File::ISA (unconditionally, but this is so early that nothing previously
could have set it). This refactoring eliminates code duplication.
|
|
|
|
|
|
|
|
|
|
|
| |
case KEY_dbmopen in Perl_yylex() has always had special-case code to create
@AnyDBM_File::ISA, using GV_ADDMULTI. S_gv_magicalize_isa() [part of
Perl_gv_fetchpvn_flags()] has special case code to spot "AnyDBM_File::ISA"
being created with GV_ADDMULTI, and populate the variable if it is empty.
Grouping the special case code in one place makes more sense. Removing the
special case code from gv.c means that there is no longer a check clause in the
code path for *every* package's @ISA initialisation.
|
|
|
|
|
| |
New API function parse_stmtseq() parses a sequence of statements, up to
closing brace or EOF.
|
|
|
|
| |
Remove code that duplicates regcurly()
|
|
|
|
|
| |
Anywhere an API function takes a string in pvn form, ensure that there
are corresponding pv, pvs, and sv APIs.
|
|
|
|
|
|
|
| |
This patch extracts regcurly from regcomp.c and converts it
to a static inline function in a new file dquote_static.c
that is now #included by regcomp.c and toke.c. This change
will require 'make regen'.
|
|
|
|
|
|
| |
VMS seems to have a 31 character limitation for external symbols. To be able to
fit into that, rename 'coerce_qwlist_to_paren_list' to
'munge_qwlist_to_paren_list'.
|
|
|
|
|
| |
ea25a9b2cf73948b1e8c5675de027e0ad13277bd broke MAD due to incorrect
usage of the token-forcing mechanism.
|
|
|
|
|
|
|
|
|
|
| |
This makes a qw(...) list literal a distinct token type for the
parser, where previously it was munged into a "(",THING,")" sequence.
The change means that qw(...) can't accidentally supply parens to parts
of the grammar that want real parens. Due to many bits of code taking
advantage of that by "foreach my $x qw(...) {}", this patch also includes
a hack to coerce qw(...) to the old-style parenthesised THING, emitting
a deprecation warning along the way.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
yyparse() becomes reentrant. The yacc stack and related resources
are allocated in yyparse(), rather than in lex_start(), and they are
localised to yyparse(), preserving their values from any outer parser.
yyparse() now takes a parameter which determines which production it
will parse at the top level. New API function parse_fullstmt() uses this
facility to parse just a single statement. The top-level single-statement
production that is used for this then messes with the parser's head so
that the parsing stops without seeing EOF, and any lookahead token seen
after the statement is pushed back to the lexer.
|
|
|
|
|
| |
Some literals (e.g. q'abc') don't set the UTF8 flag for pure ASCII literals.
Others (e.g. -abc) do. This should be consistent.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These are left from PERL_OBJECT, which was an implementation of
multiplicity using C++ objects. PERL_OBJECT was removed in 5.8, but the
macros seem to have been cargo-culted all over the core (including in
places where they would have been inappropriate originally). Since they
now do exactly nothing, it's cleaner to remove them.
I have left the definitions in perl.h, under #ifndef PERL_CORE, since
some CPAN XS code uses them (also often incorrectly). I have also left
STATIC alone, since it seems potentially more useful and is much more
ingrained.
The only appearance of these macros this patch doesn't touch is in
Devel-PPPort, because that's a CPAN module.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes this problem :
$ perl -le' sub foo($) { print "foo" }; foo $_, exit'
foo
$ perl -le' sub foo(\$) { print "foo" }; foo $_, exit'
Too many arguments for main::foo at -e line 1, at EOF
Execution of -e aborted due to compilation errors.
for all those prototypes:
*
\sigil
\[...]
;$
;*
;\sigil
;\[...]
|
|
|
|
| |
The previous return value where NULL meant OK is outside-the-norm.
|
| |
|
|
|
|
| |
such or use &" in toke.c, so t/porting/diag.t can find it.
|
|
|
|
|
|
|
|
|
|
| |
This commit adds the new construct \o{} to express a character constant
by its octal ordinal value, along with ancillary tests and
documentation.
A function to handle this is added to util.c, and it is called from the
3 parsing places it could occur. The function is a candidate for
in-lining, though I doubt that it will ever be used frequently.
|
|
|
|
| |
Signed-off-by: David Golden <dagolden@cpan.org>
|