本文整理汇总了C#中ParseTree.EscapePartialStatementContainers方法的典型用法代码示例。如果您正苦于以下问题:C# ParseTree.EscapePartialStatementContainers方法的具体用法?C# ParseTree.EscapePartialStatementContainers怎么用?C# ParseTree.EscapePartialStatementContainers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParseTree
的用法示例。
在下文中一共展示了ParseTree.EscapePartialStatementContainers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseSQL
//.........这里部分代码省略.........
{
sqlTree.ConsiderStartingNewClause();
XmlElement unionClause = sqlTree.SaveNewElement(SqlXmlConstants.ENAME_SET_OPERATOR_CLAUSE, "");
sqlTree.SaveNewElement(SqlXmlConstants.ENAME_OTHERKEYWORD, token.Value, unionClause);
}
else if (significantTokensString.StartsWith("WHILE "))
{
sqlTree.ConsiderStartingNewStatement();
XmlElement newWhileLoop = sqlTree.SaveNewElement(SqlXmlConstants.ENAME_WHILE_LOOP, "");
XmlElement whileContainerOpen = sqlTree.SaveNewElement(SqlXmlConstants.ENAME_CONTAINER_OPEN, "", newWhileLoop);
sqlTree.SaveNewElement(SqlXmlConstants.ENAME_OTHERKEYWORD, token.Value, whileContainerOpen);
sqlTree.CurrentContainer = sqlTree.SaveNewElement(SqlXmlConstants.ENAME_BOOLEAN_EXPRESSION, "", newWhileLoop);
}
else if (significantTokensString.StartsWith("IF "))
{
sqlTree.ConsiderStartingNewStatement();
sqlTree.StartNewContainer(SqlXmlConstants.ENAME_IF_STATEMENT, token.Value, SqlXmlConstants.ENAME_BOOLEAN_EXPRESSION);
}
else if (significantTokensString.StartsWith("ELSE "))
{
sqlTree.EscapeAnyBetweenConditions();
sqlTree.EscapeAnySelectionTarget();
sqlTree.EscapeJoinCondition();
if (sqlTree.PathNameMatches(0, SqlXmlConstants.ENAME_CONTAINER_GENERALCONTENT)
&& sqlTree.PathNameMatches(1, SqlXmlConstants.ENAME_CASE_THEN)
)
{
sqlTree.MoveToAncestorContainer(3, SqlXmlConstants.ENAME_CASE_STATEMENT);
sqlTree.StartNewContainer(SqlXmlConstants.ENAME_CASE_ELSE, token.Value, SqlXmlConstants.ENAME_CONTAINER_GENERALCONTENT);
}
else
{
sqlTree.EscapePartialStatementContainers();
if (sqlTree.PathNameMatches(0, SqlXmlConstants.ENAME_SQL_CLAUSE)
&& sqlTree.PathNameMatches(1, SqlXmlConstants.ENAME_SQL_STATEMENT)
&& sqlTree.PathNameMatches(2, SqlXmlConstants.ENAME_CONTAINER_SINGLESTATEMENT)
)
{
//we need to pop up the single-statement containers stack to the next "if" that doesn't have an "else" (if any; else error).
// LOCAL SEARCH - we're not actually changing the "CurrentContainer" until we decide to start a statement.
XmlElement currentNode = (XmlElement)sqlTree.CurrentContainer.ParentNode.ParentNode;
bool stopSearching = false;
while (!stopSearching)
{
if (sqlTree.PathNameMatches(currentNode, 1, SqlXmlConstants.ENAME_IF_STATEMENT))
{
//if this is in an "If", then the "Else" must still be available - yay!
sqlTree.CurrentContainer = (XmlElement)currentNode.ParentNode;
sqlTree.StartNewContainer(SqlXmlConstants.ENAME_ELSE_CLAUSE, token.Value, SqlXmlConstants.ENAME_CONTAINER_SINGLESTATEMENT);
sqlTree.StartNewStatement();
stopSearching = true;
}
else if (sqlTree.PathNameMatches(currentNode, 1, SqlXmlConstants.ENAME_ELSE_CLAUSE))
{
//If this is in an "Else", we should skip its parent "IF" altogether, and go to the next singlestatementcontainer candidate.
//singlestatementcontainer.else.if.clause.statement.NEWCANDIDATE
currentNode = (XmlElement)currentNode.ParentNode.ParentNode.ParentNode.ParentNode.ParentNode;
}
else if (sqlTree.PathNameMatches(currentNode, 1, SqlXmlConstants.ENAME_WHILE_LOOP))
{
//If this is in a "While", we should skip to the next singlestatementcontainer candidate.
//singlestatementcontainer.while.clause.statement.NEWCANDIDATE
currentNode = (XmlElement)currentNode.ParentNode.ParentNode.ParentNode.ParentNode;
}