use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.
the class ScannerUnitTests method testDirectiveInTagBody.
public void testDirectiveInTagBody() {
String text = "<BODY <%@ include file=\"commonEventHandlers.jspf\" %> dir=\"ltr\"> ";
IStructuredDocumentRegionList documentRegionList = setUpJSP(text);
verifyLengths(0, documentRegionList, text);
checkSimpleRegionTypes(documentRegionList.item(0).getRegions(), new String[] { DOMRegionContext.XML_TAG_OPEN, DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_EQUALS, DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE, DOMRegionContext.XML_TAG_CLOSE });
ITextRegionCollection coll = (ITextRegionCollection) documentRegionList.item(0).getRegions().get(2);
checkSimpleRegionTypes(coll.getRegions(), new String[] { DOMJSPRegionContexts.JSP_DIRECTIVE_OPEN, DOMRegionContext.WHITE_SPACE, DOMJSPRegionContexts.JSP_DIRECTIVE_NAME, DOMRegionContext.WHITE_SPACE, DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_EQUALS, DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE, DOMRegionContext.WHITE_SPACE, DOMJSPRegionContexts.JSP_DIRECTIVE_CLOSE });
}
use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.
the class ScannerUnitTests method testEmbeddedJSPExpression.
public void testEmbeddedJSPExpression() {
IStructuredDocumentRegionList nodes = setUpJSP("content <foo bar=\"<%= \"Hello, World\"%>\" baz=\"il\">");
boolean sizeCheck = checkSimpleRegionCounts(nodes, new int[] { 1, 9 });
assertTrue("IStructuredDocumentRegion and ITextRegion count", sizeCheck);
boolean typeCheck = checkSimpleRegionTypes(nodes.item(0).getRegions(), new String[] { DOMRegionContext.XML_CONTENT }) && checkComplexRegionTypes(nodes.item(1).getRegions(), new String[] { DOMRegionContext.XML_TAG_OPEN, DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_EQUALS, DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE, DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_EQUALS, DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE, DOMRegionContext.XML_TAG_CLOSE }, new String[][] { { DOMJSPRegionContexts.XML_TAG_ATTRIBUTE_VALUE_DQUOTE, DOMJSPRegionContexts.JSP_EXPRESSION_OPEN, DOMJSPRegionContexts.JSP_CONTENT, DOMJSPRegionContexts.JSP_CLOSE, DOMJSPRegionContexts.XML_TAG_ATTRIBUTE_VALUE_DQUOTE, DOMRegionContext.WHITE_SPACE } });
assertTrue("region context type check", typeCheck);
verifyModelLength();
}
use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.
the class ScannerUnitTests method testEmbeddedJSPScriptlet.
public void testEmbeddedJSPScriptlet() {
IStructuredDocumentRegionList nodes = setUpJSP("content <foo bar=\"<% %>\" baz=\"il\">");
boolean sizeCheck = checkSimpleRegionCounts(nodes, new int[] { 1, 9 });
assertTrue("IStructuredDocumentRegion and ITextRegion count", sizeCheck);
boolean typeCheck = checkSimpleRegionTypes(nodes.item(0).getRegions(), new String[] { DOMRegionContext.XML_CONTENT }) && checkComplexRegionTypes(nodes.item(1).getRegions(), new String[] { DOMRegionContext.XML_TAG_OPEN, DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_EQUALS, DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE, DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_EQUALS, DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE, DOMRegionContext.XML_TAG_CLOSE }, new String[][] { { DOMJSPRegionContexts.XML_TAG_ATTRIBUTE_VALUE_DQUOTE, DOMJSPRegionContexts.JSP_SCRIPTLET_OPEN, DOMJSPRegionContexts.JSP_CONTENT, DOMJSPRegionContexts.JSP_CLOSE, DOMJSPRegionContexts.XML_TAG_ATTRIBUTE_VALUE_DQUOTE, DOMRegionContext.WHITE_SPACE } });
assertTrue("region context type check", typeCheck);
verifyModelLength();
}
use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.
the class ScannerUnitTests method testCommentMarkupLike.
public void testCommentMarkupLike() {
IStructuredDocumentRegionList nodes = setUpJSP("<!-- if (a<b) -->");
boolean sizeCheck = checkSimpleRegionCounts(nodes, new int[] { 3 });
assertTrue("IStructuredDocumentRegion and ITextRegion count", sizeCheck);
boolean typeCheck = checkSimpleRegionTypes(nodes.item(0).getRegions(), new String[] { DOMRegionContext.XML_COMMENT_OPEN, DOMRegionContext.XML_COMMENT_TEXT, DOMRegionContext.XML_COMMENT_CLOSE });
assertTrue("region context type check", typeCheck);
verifyModelLength();
}
use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.
the class ScannerUnitTests method testJSPCommentAtStartOfXMLCommentAndBlockTag.
public void testJSPCommentAtStartOfXMLCommentAndBlockTag() {
String text = "s<!--<%--c--%>\n-->\n<html>\n<body><script><%--c--%> </script>\n";
IStructuredDocumentRegionList nodes = setUpJSP(text);
boolean sizeCheck = checkSimpleRegionCounts(nodes, new int[] { 1, 4, 1, 3, 1, 3, 3, 2, 3, 1 });
assertTrue("IStructuredDocumentRegion and ITextRegion count", sizeCheck);
int item = 0;
boolean typeCheck = checkSimpleRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_CONTENT });
typeCheck = typeCheck && checkComplexRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_COMMENT_OPEN, DOMRegionContext.XML_COMMENT_TEXT, DOMRegionContext.XML_COMMENT_TEXT, DOMRegionContext.XML_COMMENT_CLOSE }, new String[][] { { DOMJSPRegionContexts.JSP_COMMENT_OPEN, DOMJSPRegionContexts.JSP_COMMENT_TEXT, DOMJSPRegionContexts.JSP_COMMENT_CLOSE } });
typeCheck = typeCheck && checkSimpleRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_CONTENT });
typeCheck = typeCheck && checkSimpleRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_TAG_OPEN, DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_CLOSE });
typeCheck = typeCheck && checkSimpleRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_CONTENT });
typeCheck = typeCheck && checkSimpleRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_TAG_OPEN, DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_CLOSE });
typeCheck = typeCheck && checkSimpleRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_TAG_OPEN, DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_CLOSE });
typeCheck = typeCheck && checkComplexRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.BLOCK_TEXT, DOMRegionContext.BLOCK_TEXT }, new String[][] { { DOMJSPRegionContexts.JSP_COMMENT_OPEN, DOMJSPRegionContexts.JSP_COMMENT_TEXT, DOMJSPRegionContexts.JSP_COMMENT_CLOSE } });
typeCheck = typeCheck && checkSimpleRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_END_TAG_OPEN, DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_CLOSE });
typeCheck = typeCheck && checkSimpleRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_CONTENT });
assertTrue("region context type check", typeCheck);
verifyLengths(0, nodes.item(0), text);
}
Aggregations