projects
/
cfb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Further unit tests: getVar()
[cfb.git]
/
prod
/
net
/
jaekl
/
cfb
/
xml
/
SourceLine.java
diff --git
a/prod/net/jaekl/cfb/xml/SourceLine.java
b/prod/net/jaekl/cfb/xml/SourceLine.java
index c78ae3af8717835bf21d207b3c9660a19d55edcf..e5e82f6aa3e8e88f47042bdf9795dfee1049e668 100644
(file)
--- a/
prod/net/jaekl/cfb/xml/SourceLine.java
+++ b/
prod/net/jaekl/cfb/xml/SourceLine.java
@@
-1,14
+1,16
@@
package net.jaekl.cfb.xml;
package net.jaekl.cfb.xml;
-import
org.xml.sax.Attributes
;
+import
java.io.PrintWriter
;
import net.jaekl.qd.xml.MissingAttributeException;
import net.jaekl.qd.xml.ParseResult;
import net.jaekl.qd.xml.XmlParseException;
import net.jaekl.qd.xml.MissingAttributeException;
import net.jaekl.qd.xml.ParseResult;
import net.jaekl.qd.xml.XmlParseException;
+import org.xml.sax.Attributes;
+
public class SourceLine extends ParseResult {
public class SourceLine extends ParseResult {
- static final String
ROOT_
TAG = "SourceLine";
+ static final String TAG = "SourceLine";
static final String[] INTERNAL = { };
static final Object[][] EXTERNAL = { };
static final String[] INTERNAL = { };
static final Object[][] EXTERNAL = { };
@@
-21,41
+23,48
@@
public class SourceLine extends ParseResult {
int m_end;
public SourceLine() {
int m_end;
public SourceLine() {
- super(
ROOT_
TAG, INTERNAL, EXTERNAL);
+ super(TAG, INTERNAL, EXTERNAL);
m_className = null;
m_start = m_end = (-1);
}
m_className = null;
m_start = m_end = (-1);
}
+ public String getClassName() { return m_className; }
+ public int getStart() { return m_start; }
+ public int getEnd() { return m_end; }
+
@Override
@Override
- public void endContents(String uri, String localName, String qName, String chars, Attributes attr)
- throws XmlParseException
- {
+ public void handleMainAttributes(Attributes attr) throws MissingAttributeException {
String scratch;
String scratch;
- m_className = getRequiredAttr(
localName
, attr, ATTR_CLASS_NAME);
+ m_className = getRequiredAttr(
TAG
, attr, ATTR_CLASS_NAME);
- scratch = get
RequiredAttr(localName, attr, ATTR_START
);
+ scratch = get
OptionalAttr(attr, ATTR_START, "-1"
);
m_start = Integer.parseInt(scratch);
m_start = Integer.parseInt(scratch);
- scratch = get
RequiredAttr(localName, attr, ATTR_END
);
+ scratch = get
OptionalAttr(attr, ATTR_END, "-1"
);
m_end = Integer.parseInt(scratch);
}
m_end = Integer.parseInt(scratch);
}
- String getRequiredAttr(String tagName, Attributes attr, String attrName)
- throws MissingAttributeException
+ @Override
+ public void endContents(String uri, String localName, String qName, String chars)
+ throws XmlParseException
{
{
- String result = attr.getValue(attrName);
- if (null == result) {
- throw new MissingAttributeException(tagName, attrName);
- }
- return result;
+ // no-op
}
}
-
+
@Override
public void endExternal(String uri, String localName, String qName)
throws XmlParseException
{
// no-op
}
@Override
public void endExternal(String uri, String localName, String qName)
throws XmlParseException
{
// no-op
}
-
+
+ @Override
+ public void dump(PrintWriter pw, int indent)
+ {
+ super.dump(pw, indent);
+ String tab = String.format("%" + (indent + 2) + "s", "");
+
+ pw.println(tab + m_className + " (" + m_start + " .. " + m_end + ")");
+ }
}
}