several bugfixes

added tags deprecated, overrides
DocSkin now only looks for handlers response, request, param, session
This commit is contained in:
stefanp 2002-11-21 14:27:36 +00:00
parent b8cf9b2e4c
commit 424b2f8021
4 changed files with 44 additions and 23 deletions

View file

@ -41,7 +41,7 @@ public class DocProperties extends DocFileElement {
} }
} }
protected Properties getProperties () { public Properties getProperties () {
return props; return props;
} }

View file

@ -62,6 +62,16 @@ public class DocPrototype extends DocDirElement {
} }
} }
public DocPrototype getParentPrototype () {
return parentPrototype;
}
public DocProperties getTypeProperties () {
return typeProperties;
}
/** /**
* runs through the prototype directory and parses all helma files * runs through the prototype directory and parses all helma files
*/ */

View file

@ -52,8 +52,14 @@ public class DocSkin extends DocFileElement {
if (j > i+2) { if (j > i+2) {
String str = (new String (source, i+2, j-i)).trim (); String str = (new String (source, i+2, j-i)).trim ();
str = str.substring (0, str.indexOf(" ")); str = str.substring (0, str.indexOf(" "));
if (!partBuffer.contains(str)) if (str.indexOf(".")>-1 &&
(str.startsWith ("param.")
|| str.startsWith ("response.")
|| str.startsWith("request.")
|| str.startsWith ("session.")
) && !partBuffer.contains(str)) {
partBuffer.add (str); partBuffer.add (str);
}
start = j+2; start = j+2;
} }
i = j+1; i = j+1;

View file

@ -7,13 +7,15 @@ public final class DocTag {
// for public use we have less types than // for public use we have less types than
// internally. eg, we're combining "return" and "returns" // internally. eg, we're combining "return" and "returns"
// or "arg" and "param". // or "arg" and "param".
// those that aren't combined, need to match the index of // the values here have to match the index of
// the tags-array! // the tags-array!
public static final int PARAMETER = 0; public static final int PARAMETER = 0;
public static final int RETURN = 2; public static final int RETURN = 2;
public static final int AUTHOR = 4; public static final int AUTHOR = 4;
public static final int VERSION = 5; public static final int VERSION = 5;
public static final int SEE = 6; public static final int SEE = 6;
public static final int DEPRECATED = 7;
public static final int OVERRIDES = 8;
public static final String[][] tags = { public static final String[][] tags = {
{"@arg","Argument"}, {"@arg","Argument"},
@ -22,47 +24,50 @@ public final class DocTag {
{"@returns","Returns"}, {"@returns","Returns"},
{"@author","Author"}, {"@author","Author"},
{"@version","Version"}, {"@version","Version"},
{"@see","See also"} {"@see","See also"},
{"@deprecated", "Deprecated"},
{"@overrides", "Overrides"}
}; };
private String name; private String name;
// kind is for internal use, type is external // "kind" is for internal use, "type" is external
private int kind; private int kind;
private String text; private String text;
public static boolean isTagStart (String rawLine) { public static boolean isTagStart (String rawTag) {
rawLine = rawLine.trim (); if (getTagNumber(rawTag) > -1)
for (int i=0; i<tags.length; i++) {
if (rawLine.startsWith (tags[i][0])) {
return true; return true;
} else
}
return false; return false;
} }
public static DocTag parse (String rawTag) throws DocException { public static DocTag parse (String rawTag) throws DocException {
rawTag = rawTag.trim (); int kind = getTagNumber (rawTag);
int kind = -1;
for (int i=0; i<tags.length; i++) {
if (rawTag.startsWith (tags[i][0])) {
kind = i;
break;
}
}
if (kind == -1) if (kind == -1)
throw new DocException ("unsupported tag type: " + rawTag); throw new DocException ("unsupported tag type: " + rawTag);
String content = rawTag.substring (tags[kind][0].length ()).trim (); String content = rawTag.substring (tags[kind][0].length ()+1).trim ();
if (kind == 0 || kind==1) { if (kind == 0 || kind==1) {
StringTokenizer tok = new StringTokenizer (content); StringTokenizer tok = new StringTokenizer (content);
String name = ""; String name = "";
if (tok.hasMoreTokens ()) if (tok.hasMoreTokens ())
name = tok.nextToken (); name = tok.nextToken ();
return new DocTag (kind, name, content.substring (name.length ()).trim ()); return new DocTag (kind, name, content.substring (name.length ()+1).trim ());
} else { } else {
return new DocTag (kind, "", content); return new DocTag (kind, "", content);
} }
} }
private static int getTagNumber (String rawTag) {
rawTag = rawTag.trim ().toLowerCase ();
for (int i=0; i<tags.length; i++) {
if (rawTag.startsWith (tags[i][0])) {
return i;
}
}
return -1;
}
private DocTag (int kind, String name, String text) { private DocTag (int kind, String name, String text) {
this.kind = kind; this.kind = kind;
this.name = (name!=null) ? name : ""; this.name = (name!=null) ? name : "";