|| sdRegion.getType() != TwigRegionTypes.TWIG_CONTENT
|| sdRegion.getRegions().size() < 2) {
return null;
}
final ITwigScriptRegion textRegion = (ITwigScriptRegion) sdRegion
.getRegions().get(1);
try {
ITextRegion phpToken = textRegion.getTwigToken(0);
i = 0;
while (phpToken != null
&& phpToken.getType() != /*
* PHPRegionTypes.PHPDOC_COMMENT_START
*/TwigRegionTypes.TWIG_COMMENT_TEXT
&& i++ < 3) {
phpToken = textRegion.getTwigToken(phpToken.getEnd() + 1);
}
if (phpToken == null
|| phpToken.getType() != /*
* PHPRegionTypes.PHPDOC_COMMENT_START
*/TwigRegionTypes.TWIG_COMMENT_TEXT) {
return null;
}
int start = phpToken.getStart();
ITextRegion lastToken = null;
while (lastToken != phpToken
&& phpToken != null
&& phpToken.getType() != /*
* PHPRegionTypes.PHPDOC_COMMENT_END
*/TwigRegionTypes.TWIG_COMMENT_TEXT) {
phpToken = textRegion.getTwigToken(phpToken.getEnd() + 1);
}
if (phpToken != null
&& phpToken.getType() == /*
* PHPRegionTypes.PHPDOC_COMMENT_END
*/TwigRegionTypes.TWIG_COMMENT_TEXT) {
int end = phpToken.getEnd();
return new Region(sdRegion.getStartOffset()
+ textRegion.getStart() + start, end - start);
}
return null;
} catch (BadLocationException e) {
return null;