Perl: wrong match of braces (iterating over array indexes)

Perl: wrong match of braces (iterating over array indexes)

4
NewbieNewbie
4

    Mar 26, 2005#1

    I don't know if this has been addressed before.
    I'm using UE v11.00a+.

    UE doesn't match braces correctly when I am iterating over the indexes of an array in Perl.

    Instead UE incorrectly matches the brace (if any)
    before the loop when searching from the closing brace of the for loop
    and matches nothing when searching from the opening brace of the for loop.

    Example:

    Code: Select all

    if ($x) {
      for (0..$#list) {
        # do something
      }
    }
    
    It doesn't even match the parens of the list correctly - (0..$#list)

    This obviously has to do with the hashmark (#) in the list
    because matching is correct when iterating over a list of given numbers
    or over a list itself.

    e.g.
    for (0..9) {}
    for (@list) {}

    Is anybody in the know of a workaround?

    Thanks in advance!

    1
    NewbieNewbie
    1

      Mar 26, 2005#2

      Mine seems to work correctly - I just installed the latest hotfix, so that may have fixed it.

      I'm assuming that since # denotes a comment in Perl, and if you don't have "brace match in comments" selected in the syntax highlighting options, it gets confused.

      4
      NewbieNewbie
      4

        Mar 27, 2005#3

        Thanks for the hint, you led me on the right track.

        I couldn't install the latest hotfix because it says it's only for the english version.
        I then installed version v11.00b+ with default settings and the brace matching was just fine.
        After that I replaced the provided wordfile.txt with my own wordfile.txt and
        lo and behold the brace matching was wrong again.

        I figured out that my wordfile.txt had the standard "Perl-Tk" wordfile included in which 'Line Comment Preceding Chars = [~[^]^^$/\(]' doesn't show up in the header line, though I don't know why this is breaking the brace matching for pure Perl scripts whose wordfile (/L1) is earlier defined than the Perl-Tk wordfile (/L3) in my wordfile.txt.

        Original:
        /L20"Perl-Tk" PERL_LANG Line Comment = # File Extensions = CGI PL PM PLX

        My changes:
        /L3"Perl-Tk" Line Comment = # Line Comment Preceding Chars = [~[^]^^$/\(] Line Comment Alt = #! Escape Char = \ File Extensions = PL PLX

        I think I have to carry on dealing with the wordfile settings.

        Anyway, brace matching is now correct!
        Thank you!