Regular Expressions example in Syntax highlighting file
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.)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!
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?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
-- MeirHello Meir,
This looks good. What exactly is the issue here?
You may post screenshots or send me screenshots to provide more information.
Thank you,
5 posts in this topic