I suggest following:
Code: Select all
/L20"Papyrus" Nocase Line Comment Num = 2; Line Comment Preceding Chars = [~/] Line Comment Alt = ; Line Comment Valid Columns Alt =  Block Comment On = ;/ Block Comment Off = /; File Extensions = PSC
/Regexp Type = Perl
/TGFindStr = "^[\t ]*[0-9a-z_\[\]]*[\t ]*function[\t ]+([0-9a-z_]+\([^)]*\).*)$"
/Strip Comments = No
There is absolutely no possibility to force UltraEdit to evaluate the first character after
a comment starting string to determine if that string really starts a comment and which type of comment as it would be required for LUA and Papyrus (and one more language on remembering correct from more than 650 supported languages). UltraEdit supports nearly all languages ever invented by someone, but not all languages and some not in all aspects.
The definition above adds a second line comment definition for interpreting just ;
as line comment starting string only in first column in a line. Of course a block comment starting with ;/
also at column 1 of a line results in getting just this line syntax highlighted as line comment and not
as beginning of a line comment and everything else up to /;
because of UltraEdit does not evaluate / after
line comment starting string ;
to find out that this is not a line comment (but a block comment).
It would be also possible to save into a macro file a macro with following macro code and configure this macro to be automatically executed on every file load:
Code: Select all
Find MatchCase RegExp "(?<!/);(?![ /])"
Replace All "; "
The file extension psc
is interpreted case insensitive by UltraEdit. This macro executed on every load of a file results in inserting a space character after every semicolon if the file has the file extension psc
and there is neither a slash character left to the semicolon nor a space or slash right to the semicolon.
/Strip Comments = No
disables stripping line and block comments from file content in memory before running the regular expression search(es) for the strings to display in function list since UltraEdit for Windows v188.8.131.52, see Function list ignores block comments ... could this be optional?
I modified also the Perl regular expression. /s
whitespace according to Unicode which includes the newline and vertical whitespace characters carriage return and line feed and so every Perl regular expression starting with ^\s*
matches also empty and blank lines. That is usually not wanted for functions to show in function list because the line number should be the line number containing the keyword function
and not the line number of an empty or blank line above. And I suppose that Papyrus is like most programming and scripting languages and interpret only the ASCII whitespace characters normal space, horizontal tab, carriage return and line feed as horizontal and vertical whitespace characters and not all whitespace characters according to Unicode. See also Remove / delete blank and empty lines
I assume also that a function name cannot contain any word character according to Unicode for being valid for Papyrus. I think supported are only the ASCII characters 0.-9A-Za-z_
whereby a regular expression in a wordfile is always executed by UltraEdit case insensitive and therefore it is valid and more optimized to skip A-Z from this character class. Unicode defines thousands of characters as Unicode characters. So using a character class containing the word characters really supported by the programming or scripting language avoids false positives and decreases time required to complete the searches.
And last .*
at end (or beginning) of a search expression is not optimal. It is not clearly defined where to end (or begin) matching zero or more characters
. In theory .*
at end of a search expression can result in a positive match if no character is matched/selected at all. But Perl regular expression engine interprets .*
greedy per definition and for that reason it matches as much characters as possible which means all characters except newline characters (or end of file depending on a flag controlling matching behavior of dot). For that reason I appended $
to specify clearly where to stop matching any character except newline characters zero or more times greedy.