| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Vim's filetype declarations are case sensitive. The correct types for
Perl, C, and Pod are perl, c, and pod, respectively.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
Using class attributes in the unit class syntax was a syntax error. This change makes the following two lines equivalent:
class B :isa(A) ;
class B :isa(A) { }
Addresses GH issue #20888.
|
|
|
|
|
|
|
|
| |
This is a companion patch to the previous one, it is generated with a
slightly more modern Bison which produces better indented output, and
puts parens around constant defines and other minor changes. It is
recommended to view this patch with the -w option to skip most of the
the "non change" changes it contains.
|
|
|
|
|
|
|
|
|
|
|
| |
* Free the attrlist OP fragment when applying class or field attribute
* Free the OP_PADxV ops we only use to get the pad index out for
fieldvar declarations
* Add a refcount to the `struct padname_fieldinfo` to keep track of its
capture in inner closures so it can be freed at the right time
* Free the class-related fields out of HvAUX
* Free the actual ObjectFIELDS() array when destroying an object instance
* Dup fieldinfo->paramname at sv_dup() time / free it at free time
|
| |
|
| |
|
|
|
|
|
| |
Allows non-constant expressions with side effects. Evaluated during the
constructor of each instance.
|
|
|
|
| |
are yet defined
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds a new experimental warning, feature, keywords and enough parsing to
implement basic classes with an empty `new` constructor method.
Inject a $self lexical into method bodies; populate it with the object instance, suitably shifted
Creates a new OP_METHSTART opcode to perform method setup
Define an aux flag to remark which stashes are classes
Basic implementation of fields.
Basic anonymous methods.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Assignment operators (`==`) were missing, as were both the logical and
the low-precedence shortcutting OR and AND operators (`&&`, `||`,
`and`, `or`)
Also renumbered them around somewhat to even out the spacing. This is
fine during a development cycle.
Also renamed the tokenizer/parser symbol names from "PLUG*OP" to
"PLUGIN_*_OP" for better readability.
|
|
|
|
|
|
|
|
|
|
| |
The `pval` field of the token type union is currently only used in one
place; storing the result of the infix operator plugin. Its use here
stores a structure pointer, not a string. The union should define this
field as a `void *` and not a `char *`.
In addition we should not attempt to debug print it as a string because
its value is not valid as one.
|
|
|
|
|
|
|
|
|
| |
Runs for identifier-named custom infix operators and sequences of
non-identifier symbol characters.
Defines multiple precedence levels for custom infix operators that fit
alongside exponentiation, multiplication, addition, or relational
comparision operators, as well as a "high" and "low" at either end.
|
|
|
|
|
|
| |
These create parameters where the default expression is assigned
whenever the caller did not pass a defined (or true) value. I.e. both if
it is missing, or is present but undef (or false).
|
|
|
|
|
|
|
|
|
|
|
| |
In 1557e6c32831defe4b25a924a88baf5f5e7bcbdd we added a perldiag entry
for 'Unimplemented', which was good. But in theory the message should
have been picked up by the diagnostics tests when it was introduced.
However, this error message is not constructed in the normal way, and
the string was not identified as a message. This adds the appropriate
comment in the appropirate place so that the diagnostics test will
notice it should it change in the future. This necessitated a
make perly_regen.
|
|
|
|
|
|
|
|
|
|
|
| |
I want to modify perly with a comment. But that would leave us with
output files that are out of date in comparison with the input files.
My bison is later than the last used for perl, so running it
without my patch makes large changes. Therefore I have separated the
change into two pieces, the first just updates everything using my
more modern bison, the second runs bison again with the change I
actually made. This is the first of the pair, nothing changes here
except that which bison changed.
|
|
|
|
|
|
|
|
|
|
|
| |
The previous code would handle subroutine attributes directly against
`PL_compcv` as a side-effect of merely parsing the syntax in
`yyl_colon()`, an unlikely place for anyone to find it. This complicates
the way the parser works.
The new structure creates a new function to apply all the builtin
attributes out of an attribute list to any given CV, and invokes it from
the parser at a slightly better time.
|
|
|
|
|
| |
Explains why KW_PACKAGE and KW_USE_or_NO appear to have the package name
and version barewords in the wrong order.
|
|
|
|
|
|
|
|
|
|
|
| |
Some of the token types represent simple keywords; some of them do not.
It's easier to read and work out what's going on if all the simple
keyword ones have a common prefix; `KW_...` in this case.
Additionally I've renamed the four `sub`-related keywords to have a bit
more structure to them.
Also added comments.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These token names are shared between perl.y and toke.c, to communicate
on the nature of various tokens parsed from perl source. The name
FUNCMETH used to refer to a method call with possible arguments
->NAME(...)
whereas METHOD referred to one without even the parens
->NAME
These names are a little confusing, and most importantly, METHOD was in
the way of my adding a new `method` keyword as part of the upcoming work
on 'use feature "class"'.
As such, this simple rename moves them out of the way and makes them
slightly more consistent and easier to read/remember, by calling them
METHCALL and METHCALL0.
This commit also renames the `method` grammar rule to `methodname`, for
similar reasons.
As all of these names are entirely internal to the tokenizer/parser,
there is not expected to be any upstream CPAN incompatibility, or other
issues, caused by these renames.
|
|
|
|
|
|
|
|
|
|
|
|
| |
As suggested in https://github.com/Perl/perl5/issues/19811, this now
outputs the message:
$ ./perl -Mexperimental=try
try { A() }
catch { B() }
catch block requires a (VAR) at - line 2, near "catch {"
Execution of - aborted due to compilation errors.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new
for my ($x,$y,...) (...) { ... }
syntax has a couple of problems in the degenerate case of a single
variable:
for my ($x) (...) { ... }
First, the loop variable is marked as lexical, but not as a variable
to be introduced. So it behaves roughly as if written like:
{ my $x; for $x (...) { ... } }
I can't think of any user-visible runtime change in behaviour this bug
causes, so I haven't included a test for it.
Second, it was being incorrectly deparsed as
for $x (...) { ... }
(i.e. without the 'my').
This commit fixes both of these issues.
The basic problem is that the parser, in the case of multiple vars,
passes a list subtree of PADSVs as the 'sv' argument of Perl_newFOROP,
but in the case of a single var, passes a single PADSV op instead.
This single PADSV doesn't have the LVINTRO flag set, so is
indistinguishable from plain
my $x; for $x ....
This commit makes the parser set the OPf_PARENS flag on the lone PADSV
to signal to newFOROP() that it's a degenerate 1-var list, and
newFOROP() sets the OPf_PARENS flag on the ENTERITER op to signal to the
deparser that this is "for my (...)" syntax, even if it only has a
single var.
|
| |
|
| |
|
|
|
|
|
| |
- start with `opt` (renamed `siglistornull`)
- employ bison's default rule whenever possible
|
|
|
|
| |
to save few keystrokes ...
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Multiple commas between the lexicals in the list shouldn't change the
parsing.
|
|
|
|
|
|
|
|
|
| |
For example, this now works:
for my ($key, $value) (%hash) { ... }
Only for scalars declared with my as a list in the for loop statement.
As many as you want (unless you want more than 4294967296).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Each 'try' block has a nextstate COP prepended to it. Currently this cop
has the line number of the line following the end of the try block. Fix
it so that it has the line number of the line containing the 'try'
keyword instead.
This is achieved using the same technique as other block-introducing
keywords like 'while': set the .ival of the 'try' token returned by the
lexer to the current line number, then set PL_parser->copline back to that
value after parsing the block but before creating the COP.
This issue was showing up as a failure in
cd t; ./TEST -deparse op/try.t
since that test script is line-number sensitive.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds syntax `defer { BLOCK }` to create a deferred block; code that is
deferred until the scope exits. This syntax is guarded by
use feature 'defer';
Adds a new opcode, `OP_PUSHDEFER`, which is a LOGOP whose `op_other` field
gives the start of an optree to be deferred until scope exit. That op
pointer will be stored on the save stack and invoked as part of scope
unwind.
Included is support for `B::Deparse` to deparse the optree back into
syntax.
|
| |
|
|
|
|
|
|
|
|
|
| |
* Add feature, experimental warning, keyword
* Basic parsing
* Basic implementation as optree fragment
See also
https://github.com/Perl/perl5/issues/18504
|
| |
|
|
|
|
| |
f23102e2d6 removed DOROP token (KEY_err) but related grammar remained
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|