Skip to content

LexPerl needs to treat method same as sub #342

@pryrt

Description

@pryrt

Starting in Perl 5.38 in 2023, there are new Perl keywords class and method which are analogous to the already-existing package and sub, and the new keywords should be treated identically in the lexer.

Thus, in the code below, the special conditions that cause the $) in sub inPackageProto($) to not be treated like a variable should also be applied to the $) in method inClassProto($):

#!/usr/bin/env perl

package MyPackage::SubPackage {
    sub inPackage { return 1 }
    sub inPackageProto($) { return $_[0] }
    sub inPackageAttrib :prototype($) { return $_[0] }
}

class MyClass::SubClass {
    method inClass { return 1 }
    method inClassProto($) { return $_[0] }
    method inClassAttrib :prototype($) { return $_[0] }
}
Image

Version Shown => SciTE:5.5.8 Scintilla:5.5.8 Lexilla:5.4.6


PS: I understand that for highlighting the class and method keywords, they just need to be added to the perl.properties for SciTE. I will put in a separate issue in the SciTE tracker to request those keywords be added. The focus of this issue is the special handling of $) for subs and methods needing to be identical.

Metadata

Metadata

Assignees

No one assigned

    Labels

    perlCaused by the Perl lexer

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions