use of org.eclipse.wst.dtd.core.internal.text.RegionIterator in project webtools.sourceediting by eclipse.
the class ExternalNode method getPublicValueRegion.
public ITextRegion getPublicValueRegion() {
RegionIterator iter = iterator();
ITextRegion publicKeyword = getPublicKeywordRegion(iter);
if (publicKeyword != null && iter.hasNext()) {
ITextRegion quotedLiteral = getNextQuotedLiteral(iter);
if (quotedLiteral != null) {
return quotedLiteral;
}
}
return null;
}
use of org.eclipse.wst.dtd.core.internal.text.RegionIterator in project webtools.sourceediting by eclipse.
the class NamedTopLevelNode method getWhitespaceAfterName.
public ITextRegion getWhitespaceAfterName() {
ITextRegion nameRegion = getNameRegion();
RegionIterator iter = iterator();
// skip past the element tag region
getNextRegion(iter, tagStartType);
boolean foundName = false;
while (iter.hasNext()) {
ITextRegion region = iter.next();
if (!foundName && nameRegion != null && region == nameRegion) {
foundName = true;
}
if (region.getType().equals(DTDRegionTypes.WHITESPACE)) {
// there is no name region or we have already passed it
if (nameRegion == null || foundName) {
return region;
}
}
}
return null;
}
use of org.eclipse.wst.dtd.core.internal.text.RegionIterator in project webtools.sourceediting by eclipse.
the class AttributeEnumList method getItems.
// return the items that are in this enumerated list
public List getItems() {
list.clear();
RegionIterator iter = iterator();
while (iter.hasNext()) {
ITextRegion name = getNextRegion(iter, DTDRegionTypes.NAME);
if (name != null) {
list.add(getStructuredDTDDocumentRegion().getText(name));
}
}
return list;
}
use of org.eclipse.wst.dtd.core.internal.text.RegionIterator in project webtools.sourceediting by eclipse.
the class Comment method getStartAndEndOffsetForText.
private void getStartAndEndOffsetForText(StartEndPair pair) {
RegionIterator iter = iterator();
ITextRegion commentStartTag = getStartTag(iter);
ITextRegion endCommentTag = getNextRegion(iter, DTDRegionTypes.COMMENT_END);
pair.endOffset = getStructuredDTDDocumentRegion().getEndOffset();
if (commentStartTag != null) {
pair.startOffset = getStructuredDTDDocumentRegion().getEndOffset(commentStartTag);
}
if (endCommentTag != null) {
pair.endOffset = getStructuredDTDDocumentRegion().getStartOffset(endCommentTag);
}
}
use of org.eclipse.wst.dtd.core.internal.text.RegionIterator in project webtools.sourceediting by eclipse.
the class CMGroupNode method getOccurrenceRegion.
// returns the occurrenceregion, or the last region where the occurrence
// region should appear after
public ITextRegion getOccurrenceRegion() {
int nesting = 0;
// we skip past the first left paren we see since that is the
// beginning of our own node
RegionIterator iter = iterator();
// we assume the first region is the '('
iter.next();
ITextRegion currentRegion = null;
while (iter.hasNext() && nesting >= 0) {
currentRegion = iter.next();
if (currentRegion.getType() == DTDRegionTypes.LEFT_PAREN) {
nesting++;
}
if (currentRegion.getType() == DTDRegionTypes.RIGHT_PAREN) {
nesting--;
}
}
if (nesting < 0) {
// Look for an occurrence region
while (iter.hasNext()) {
currentRegion = iter.next();
if (currentRegion.getType() == DTDRegionTypes.OCCUR_TYPE) {
return currentRegion;
}
}
}
// last region
return iter.previous();
}
Aggregations