开发者

Notepad++ Function List plugin: Javascript parsing rules to support nested functions

[Using Notepad++ 5.5.1 and Function List plugin v2.0beta]

I'm trying to add to or modify the existing rules for Javascript functions in order to show nested (or member) functions in the function list. For example:

function parentA (base){
  function childA (exp){
    return Math.pow(base, exp);
  }

  alert(childA(2)); // call private function
}

parentA(4); // alerts 4^2 = 16


var parentB = function(str1){
  return {
    childB: funct开发者_运维百科ion(str2){
      alert(str1 + str2);
    }
  };
}('foo');

parentB.childB('bar'); // alerts 'foobar'

The parentA and parentB functions are listed, but the childA and childB functions are not listed. This nested-child paradigm is common within Javascript libraries and reusable code, and important to be fully navigable in the function list.

Can this be done with groups and/or subgroups? I've tried digging through the parsing rules for other class-based languages (that list member functions using subgroups), but I can't seem to get this to work for Javascript.

Any suggestions? Has anyone accomplished this for their own use? I'm probably being stupid, but I'm going crazy trying to figure this one out - please help! ;)


Remove the "body begin" and "body end" characters and it will work:

<Group name="Functions" subgroup="" icon="" child="" autoexp="0" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
     <Rules regexbeg="^\s*function" regexfunc='\s*[&quot;\w_]+' regexend="" bodybegin="" bodyend="" sep="" />
</Group>

(this example works only for the first type of functions you have put as an example)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜