regex - Notepad++ function list PHP not working if the function name begins with reserverd words -
the function list plugin notepad++ working fine, except function name starts "for / while / if".
for example have functions in form-class. start "form" (e.g. form_information). function name won't show in function list, because functionname starts 'for'.
has same issue, or maybe solution in regex this?
this regex , xml of php function list.
<parser id="php_function" displayname="php" commentexpr="((/\*.*?\*)/|(//.*?$))"> <classrange mainexpr="^[\s]*(class|abstract[\s]+class|final[\s]+class)[\t ]+[a-za-z_\x7f-\xff][a-za-z0-9_\x7f-\xff]*([\s]*|[\s]*(extends|implements|(extends[\s]+(\\|[a-za-z_\x7f-\xff][a-za-z0-9_\x7f-\xff]*)+[\s]+implements))[\s]+(\,[\s]*|(\\|[a-za-z_\x7f-\xff][a-za-z0-9_\x7f-\xff]*))+[\s]*)?\{" opensymbole = "\{" closesymbole = "\}" displaymode="node"> <classname> <nameexpr expr="(class|abstract[\s]+class|final[\s]+class)[\s]+[\w]+"/> <nameexpr expr="[\s]+[\w]+\z"/> <nameexpr expr="[\w]+\z"/> </classname> <function mainexpr="^[\s]*((static|public|protected|private|final)*(\s+(static|public|protected|private|final))+[\s]+)?(function[\s]+)+([\w]+([\s]+[\w]+)?([\s]+|\*[\s]+|[\s]+\*|[\s]+\*[\s]+))?([\w_]+[\s]*::)?(?!(if|while|for|switch))[\w_~]+[\s]*\([^\{]*\{"> <functionname> <funcnameexpr expr="(?!(if|while|for|switch))[\w_]+[\s]*\([^\{]*"/> <!-- comment below node if want display method parmas --> <funcnameexpr expr="(?!(if|while|for|switch))[\w_]+"/> </functionname> </function> </classrange> <function mainexpr="^[\s]*function[\s]+\w+\(" displaymode="$classname->$functionname"> <functionname> <nameexpr expr="(?!(if|while|for))[\w_]+[\s]*\("/> <nameexpr expr="(?!(if|while|for))[\w_]+"/> </functionname> <classname> <nameexpr expr="[\w_]+(?=[\s]*::)"/> </classname> </function>
thank time!
i have looked @ %appdata%\notepad++\functionlist.xml, , looks problem if|while|for|switch
checked without word boundaries around. need add word boundaries in proper places. see modified first <function>
node:
<function mainexpr="^[\s]*((static|public|protected|private|final)*(\s+(static|public|protected|private|final))+[\s]+)?(function[\s]+)+([\w]+([\s]+[\w]+)?([\s]+|\*[\s]+|[\s]+\*|[\s]+\*[\s]+))?([\w_]+[\s]*::)?\b(?!(if|while|for|switch)\b)[\w_~]+[\s]*\([^\{]*\{"> <functionname> <funcnameexpr expr="\b(?!(if|while|for|switch)\b)[\w_]+[\s]*\([^\{]*"/> <!-- comment below node if want display method parmas --> <funcnameexpr expr="\b(?!(if|while|for|switch)\b)[\w_]+"/> </functionname> </function>
the poi \b(?!(if|while|for|switch)\b)
- word boundary before negative lookahead , right after alternation group match these words whole words.
Comments
Post a Comment