Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #17951
    Meir
    Participant

    Can anybody give me an example of how do I use regular expressions in syntax highlighting file (*.esy) to do either one of the following:
    1. How to not consider '$#myArray' a comment? (In Perl, the highest value of the index in @myArray can be obtained as $#myArray)
    2. How do I treat a Perl keyword as a variable name when it is prefixed with a ‘sigil’ namely'$', '@', '%' or '&'? (For example, 'date' is a keyword, but $date is a perfectly legal variable name.)
    3. Similar to the above, how do I treat a Perl object method name as such, even if it is a keyword? (For example, the 'warn' part of $myObject->warn is a ‘method’ of the object '$myObject', not a Perl keyword.)

    #18131
    Yutaka Emura
    Keymaster

    Hi Meir,

    1. Currently, there is no smart way, but you can specify “# ” as a line comment (insert a space at the end of ‘#”), and make sure to use a space after ‘#’ for every comment line.

    2.3. You could use regular expressions – negative lookbehind search (?)warn , but that could slow down the process.

    Thanks!

    #18142
    Meir
    Participant

    Thanks Yutaka,
    Your suggestion cannot be used universally. e.g., when my legacy code has some commented-out segments, they now come back to life. Also, frames such as:
    #########
    #
    #########
    are considered “code”.

    But your syntax does refer to RegEx:
    #Keyword color=4,word=on,rightall=off,case=off,insidetag=off,regexp=off,rightall2=off

    What does regexp=on do?

    And finally, Can the RegEx-enhanced syntax highlighting files be moved up your priority list please?

    #20598
    Meir
    Participant

    Dear Yutaka,
    I am trying desperately to make the syntax highlighting of perl accept ‘$#’ as color = 4 and not as $ followed by comment. So far no success :-(
    The relevant lines I tried:

    #Keyword color=4,word=off,rightall=off,case=off,insidetag=off,regexp=on,rightall2=off
    /\$\#/
    

    Please complete the RegExp…

    Many, many thanks

    — Meir

    #20599
    Yutaka Emura
    Keymaster

    Hello Meir,

    This looks good. What exactly is the issue here?
    You may post screenshots or send me screenshots to provide more information.

    Thank you,

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.