Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

19
LINES

< > BotCompany Repo | #1003194 // findFunctionDefinitions - returns names. OLD (no tokenizing)

JavaX fragment (include)

static boolean findFunctionDefinitions_debug;

static List<String> findFunctionDefinitions(String src) {
  Pattern pattern = Pattern.compile("(?:static|svoid|ssynchronized|sbool|^sS|^sO|^sL)[^={]*\\s+([\\w$]+)\\s*\\(");

  //System.out.println("Scanning for functions");
  List<String> functions = new ArrayList<String>();
  for (String line : toLines(src)) {
    line = jreplace(line, "svoid <id> {", "svoid $2() {");
    Matcher matcher = pattern.matcher(line);
    if (matcher.find()) {
      String f = matcher.group(1);
      functions.add(f);
      if (findFunctionDefinitions_debug)
        System.out.println("Function found: " + f + " in line: " + line);
    }
  }
  return functions;
}

Author comment

After editing, retranspile #1002474

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1003194
Snippet name: findFunctionDefinitions - returns names. OLD (no tokenizing)
Eternal ID of this version: #1003194/5
Text MD5: 5dd3c951f33f51f9292ad4295e4c73d5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-18 21:37:25
Source code size: 713 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 562 / 647
Version history: 4 change(s)
Referenced in: [show references]