if (CFCommentDepth == 0) {
CFCommentEndOffset = start;
commentLength = CFCommentEndOffset - CFCommentStartOffset;
try {
comment = new CFCommentItem(doc.getLineOfOffset(CFCommentStartOffset),CFCommentStartOffset,CFCommentEndOffset,doc.get(CFCommentStartOffset,commentLength));
CFCommentList.add(comment);
//System.out.println("CFML comment added to list " + comment.getContents());
}
catch (Exception e) {
e.printStackTrace();
}
}
}
//Checking for opening CFSCRIPT tag (<cfscript)
if (CFScriptDepth == 0
&& CFCommentDepth == 0
&& "<cfscript".equalsIgnoreCase(group)) {
// Looks like we've found the start of a CFSCRIPT block
//System.out.println("Found a CFSCRIPT start tag at " + start);
CFScriptDepth++;
}
//Checking for closing CFSCRIPT tag (</cfscript)
if (CFScriptDepth == 1
&& CFCommentDepth == 0
&& "</cfscript".equalsIgnoreCase(group)) {
// Looks like we've found the end of a CFSCRIPT block
//System.out.println("Found a CFSCRIPT end tag at " + start);
CFScriptDepth--;
}
//Checking for opening CFQUERY tag (<cfquery)
if (CFQueryDepth == 0
&& CFCommentDepth == 0
&& group.length() > 7
&& "<cfquery".equalsIgnoreCase(group.substring(0,8))) {
// We use substring here because the regular expression uses a space class (\s)
// to distinguish cfquery from cfqueryparam
// Looks like we've found the start of a CFQUERY block
//System.out.println("Found a CFQUERY start tag at " + start);
CFQueryDepth++;
}
//Checking for closing CFQUERY tag (</cfquery)
if (CFQueryDepth == 1
&& CFCommentDepth == 0
&& "</cfquery".equalsIgnoreCase(group)) {
// Looks like we've found the end of a CFQUERY block
//System.out.println("Found a CFQUERY end tag at " + start);
CFQueryDepth--;
}
//Checking for opening CFQUERY tag (<cfquery)
if (CFQueryDepth == 0
&& CFCommentDepth == 0
&& "<cfquery".equalsIgnoreCase(group)) {
// Looks like we've found the start of a CFQUERY block
//System.out.println("Found a CFQUERY start tag at " + start);
CFQueryDepth++;
}
//Checking for closing CFQUERY tag (</cfquery)
if (CFQueryDepth == 1
&& CFCommentDepth == 0
&& "</cfquery".equalsIgnoreCase(group)) {
// Looks like we've found the end of a CFQUERY block
//System.out.println("Found a CFQUERY end tag at " + start);
CFQueryDepth--;
}
// Checking for opening CFSCRIPT or SQL comment (/*)
if ((CFScriptDepth == 1 || CFQueryDepth == 1)
&& "/*".equalsIgnoreCase(group)
&& start > lineCommentEnd){
// Looks like we've found the start of a CFSCRIPT or SQL comment
if (CFCommentDepth == 0) {
CFCommentStartOffset = end;
//System.out.println("Found a CFSCRIPT or SQL block comment at " + start);
}
CFCommentDepth++;
}
// Check for closing CFSCRIPT or SQL comment (*/)
if ((CFScriptDepth == 1 || CFQueryDepth == 1)
&& "*/".equalsIgnoreCase(group)
&& start > lineCommentEnd) {
// Looks like we've found the end of a CFSCRIPT or SQL comment
CFCommentDepth--;
if (CFCommentDepth == 0) {
CFCommentEndOffset = start;
commentLength = CFCommentEndOffset - CFCommentStartOffset;
try {
comment = new CFCommentItem(doc.getLineOfOffset(CFCommentStartOffset),CFCommentStartOffset,CFCommentEndOffset,doc.get(CFCommentStartOffset,commentLength));
CFCommentList.add(comment);
//System.out.println("CFSCRIPT or SQL comment added to list " + comment.getContents());
}
catch (Exception e) {
e.printStackTrace();
}
}
}
// Check for single line CFSCRIPT comment (//)
if (CFScriptDepth == 1
&& "//".equalsIgnoreCase(group)) {
// Looks like we've found a single line script comment
CFCommentStartOffset = end;
//System.out.println("Found a CFSCRIPT line comment at " + start);
try {
IRegion region = doc.getLineInformationOfOffset(start);
region.getLength();
region.getOffset();
lineCommentEnd = region.getOffset() + region.getLength();
commentLength = lineCommentEnd - CFCommentStartOffset;
comment = new CFCommentItem(doc.getLineOfOffset(CFCommentStartOffset),CFCommentStartOffset,CFCommentEndOffset,doc.get(CFCommentStartOffset,commentLength));
CFCommentList.add(comment);
//System.out.println("CFSCRIPT line comment added to list " + comment.getContents());
}
catch (Exception e) {
e.printStackTrace();