| ParseJSB.java |
ParseJSB.java |
\n"+ docComments)); docComments = ""; } catch (Exception e) { System.out.println("Error line " + currentLine + ":\n" + e); } } } } private static Hashtable tagIndex = new Hashtable(); private static Hashtable tagDesc = new Hashtable(); public static void setDoc() { for(int i=0; i < JSBtags.size(); i++) { String ref, tag, tagName, attributes = ""; ref = JSBtags.elementAt(i).toString(); tag = ref.substring(0, ref.indexOf("\n")); if(tag.indexOf("JSB_") == -1) continue; if(tag.indexOf("JSB_CONSTRUCTOR") != -1) { //System.out.println("JSB_CONSTRUCTOR"+ i +"=" + tag); } else { int beg = ref.indexOf("=", ref.indexOf("NAME")) +1; if(ref.indexOf("\n",beg) == -1) tagName = ref.substring(beg); else tagName = ref.substring(beg, ref.indexOf("\n",beg)); attributes = ref.substring(ref.indexOf("\n", beg)); if(tag.indexOf("JSB_METHOD") != -1 && JSB_METHODdesc.get(tagName) != null) attributes += JSB_METHODdesc.get(tagName).toString(); if(tagIndex.get(tag) == null) { String tagIndexHeading = "\n\n\n"+ tag +" Index\n
\nObject\n |\n +----" + name + ""; } } private static String JSBpackage = ""; public static void setJSBpackage() { if(line.indexOf("JSB_DESCRIPTOR") != -1) { int firstQuote = line.indexOf("\"", line.indexOf(" NAME=")) +1; JSBpackage = line.substring(firstQuote, line.indexOf(JSBname, firstQuote) -1); String spaces = ""; for(int i=0; i < JSBpackage.length() -1; i++) { spaces += " "; } JSBpackage = "
\n" + JSBpackage + "\n" + spaces + "|\n" + spaces + "+----" + JSBname + ""; } } private static Hashtable JSB_METHODdesc = new Hashtable(); public static void setJSB_METHOD() { if(line.indexOf("JSB_METHOD") != -1) { //could have subtags (params) String saveLine = line; if(line.indexOf(" NAME") != -1) { //has no subtags int firstQuote = line.indexOf("\"", line.indexOf(" NAME=")) +1; String JSB_METHODname = line.substring(firstQuote, line.indexOf("\"", firstQuote)); JSB_METHODdesc.put(JSB_METHODname, docComments); docComments = ""; } if(line.indexOf("" + line.substring(line.indexOf("<") +1, line.indexOf(">")) +"\n"; setLine(); } } line = saveLine; } } public static void setJSB_LISTENER() { if(line.indexOf("JSB_LISTENER") != -1) { //could have subtags (params) String saveLine = line; if(line.indexOf(" -1) JSBparam += "
\n"; else JSBparam += "
\n" + docComments; docComments = ""; } else if(line.indexOf("function ") != -1 && line.indexOf("(") > line.indexOf("function ") ) { String funName = line.substring(line.indexOf(" ",line.indexOf("function ")) +1, line.indexOf("(")); funName.trim(); if(JSBdescripter.indexOf(".") != -1 && funName.indexOf("_") != -1) { int lastScore = funName.lastIndexOf("_"); funName = funName.substring(lastScore +1); } if(JSB_METHODdesc.get(funName) != null) { String tagComments = JSB_METHODdesc.get(funName).toString(); JSB_METHODdesc.put(funName, tagComments + docComments); } docComments = ""; } setLine(); } } JSB_CONSTRUCTOR = saveComments + JSB_CONSTRUCTOR; line = "JSB_CONSTRUCTOR "; } } public static String getComments() { String comments = ""; if(line.indexOf("/**") != -1 && line.indexOf("*/") == -1) { setLine(); while (line.indexOf("*") != -1 && line.indexOf("*/") == -1 && line.indexOf("function " + line + "