sclass Tok_MethodDecl { LS tok; int iStart, iModifiers, iTypeArgs, iType, iEndOfType, iJavaXMod; int iName, iOpening, iClosing; gettable S name; new LS allNames; int iBody; bool parsed; *(LS *tok, int *iStart) { iOpening = indexOf(tok, iStart, "("); if (iOpening < 0) ret; iName = iOpening-2; name = main get(tok, iName); allNames.add(name); if (!isIdentifier(name)) ret; while (eqGet(tok, iName-2, "aka") && isIdentifier(main get(tok, iName-2))) { iName -= 4; name = main get(tok, iName); allNames.add(name); } // find end of arguments iClosing = findEndOfBracketPart2(tok, iOpening)-1; // find end of block or semicolon iBody = indexOfAny(tok, iClosing, "{", ";"); // find javax modifiers, return type & modifiers iJavaXMod = tok_leftScanJavaxModifiers(tok, iName); iEndOfType = iJavaXMod; iType = tok_leftScanType(tok, iJavaXMod); iTypeArgs = tok_leftScanTypeArgsOpt(tok, iType); iModifiers = leftScanModifiers(tok, iTypeArgs); iStart = iModifiers; reverseInPlace(allNames); set parsed; } simplyCached LS args_unparsed() { ret tok_parseArgsDeclList2(subList(tok, iOpening+1, iClosing)); } // return type LS tokType() { ret subList(tok, iType-1, iName); } S type() { ret join(tokType()); } simplyCached bool isVoid() { ret containsOneOf(codeTokens(tokType()), javaxVoidAliases()); } LS tokModifiers() { ret subList(tok, iStart, iName-1); } bool get() { ret parsed; } simplyCached L argDecls() { ret tok_argDecls(subList(tok, iOpening+1, iClosing)); } LS argNames() { ret map(argDecls(), a -> a.name); } bool hasBody() { ret eqGet(tok, iBody, "{"); } simplyCached int iEndOfBody() { ret hasBody() ? tok_scanBlock_idx(tok, iBody) : iBody+2; } int iEnd() { ret iEndOfBody(); } }