use of org.eclipse.titan.common.parsers.cfg.CfgInterval in project titan.EclipsePlug-ins by eclipse.
the class ParserLogger method logInterval.
/**
* Logs an interval tree.
* Internal version.
* RECURSIVE
* @param aRootInterval the root of the interval tree
* @param aLevel indentation level
*/
private static void logInterval(final Interval aRootInterval, final int aLevel) {
// root interval info
final StringBuilder sb = new StringBuilder();
sb.append("" + aRootInterval.getDepth());
sb.append(", " + aRootInterval.getStartOffset());
sb.append(", " + aRootInterval.getStartLine());
sb.append(", " + aRootInterval.getEndOffset());
sb.append(", " + aRootInterval.getEndLine());
sb.append(", " + aRootInterval.getType());
if (aRootInterval instanceof CfgInterval) {
sb.append(", " + ((CfgInterval) aRootInterval).getSectionType());
}
if (aRootInterval.getErroneous()) {
sb.append(", ERRONEOUS");
}
printIndent(sb.toString(), aLevel);
println();
if (aRootInterval.getSubIntervals() != null) {
for (Interval interval : aRootInterval.getSubIntervals()) {
logInterval(interval, aLevel + 1);
}
}
}
use of org.eclipse.titan.common.parsers.cfg.CfgInterval in project titan.EclipsePlug-ins by eclipse.
the class OpenDeclaration method getSection.
/**
* Provides position dependent section information.
*
* @param document
* The document where the check takes place.
* @param offset
* The current position of the cursor.
* @return The type of the section for the current position of the
* cursor.
*/
public section_type getSection(final IDocument document, final int offset) {
Interval interval = GlobalIntervalHandler.getInterval(document);
if (interval == null) {
return section_type.UNKNOWN;
}
for (Interval subInterval : interval.getSubIntervals()) {
int startOffset = subInterval.getStartOffset();
int endOffset = subInterval.getEndOffset();
if (subInterval instanceof CfgInterval && startOffset <= offset && endOffset >= offset) {
return ((CfgInterval) subInterval).getSectionType();
}
}
return section_type.UNKNOWN;
}
Aggregations