Skip to content

Python Keywords in SynHighlighterPython.pas: bug fix proposal #282

@CubusEngineeringSoftware

Description

Python keywords are neither recognised nor highlighted correctly.

This is because, in the file "SynHighlighterPython.pas", the line "FKeywords.Sorted := True;" is before
the line "FKeywords.Assign (GetKeywordIdentifiers);" in the "TSynPythonSyn.Create" constructor. It should be placed after.
The assignment replaces the list and the sorting property is lost. The "Duplicates " is most probably problematic too.

constructor TSynPythonSyn.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);

  fCaseSensitive := True;

  FKeywords := TStringList.Create;
// OLD --->>> Wrong place here!  FKeywords.Sorted := True;
  FKeywords.Duplicates := dupError;
  FKeywords.Assign (GetKeywordIdentifiers);
  FKeywords.Sorted := True; // NEW --->>> Should be moved here! 

Thank you for the prompt update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions