本文整理汇总了C#中ParseItem.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# ParseItem.Contains方法的具体用法?C# ParseItem.Contains怎么用?C# ParseItem.Contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParseItem
的用法示例。
在下文中一共展示了ParseItem.Contains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse_CREATE
/// <summary>
/// parses ( Variable list ) in CREATE FUNCTION, CREATE VIEW, CREATE PROCEDURE, CREATE TRIGGER
/// adds a newline for each comma in
/// CREATE PROC name (@variable, @variable)
/// </summary>
private void Parse_CREATE(ref ParseItem i_Item)
{
i_Item = i_Item.Next;
switch (getCmd(i_Item))
{
case eCmd.Function:
case eCmd.Procedure:
case eCmd.Trigger:
case eCmd.View:
break;
default:
return; // CREATE command not supported (e.g. CREATE DATABASE)
}
i_Item = i_Item.Next;
if (getType(i_Item) != eType.Unknown)
return; // name of procedure, function,... is missing
// Set linebreak after name
ParseItem.SetLinebreakAfter(i_Item, 1);
// indent only the outermost parenthesis (not "varchar(128)") if it contains a comma
int s32_Parenth = 0;
bool b_Indented = false;
bool b_RemoveLF = true;
do
{
Application.DoEvents();
if (mb_Abort)
return;
i_Item = i_Item.Next;
switch (getType(i_Item))
{
case eType.ParOpen:
if (s32_Parenth == 0)
{
if (i_Item.Contains(eType.Comma)) // ( .. , .. , .. )
{
i_Item.Indent = eIndent.DoubleLF;
b_Indented = true;
}
}
s32_Parenth++;
break;
case eType.ParClose:
s32_Parenth--;
if (b_Indented && s32_Parenth == 0)
{
i_Item.Outdent = eIndent.DoubleLF;
b_Indented = false;
}
break;
case eType.LineBreak:
if (b_RemoveLF)
i_Item.Remove(false); // remove user linebreaks
break;
case eType.Comma: // newline for each comma in CREATE (@variable, @variable)
if (getType(i_Item.Next) != eType.CommentL)
ParseItem.SetLinebreakAfter(i_Item, 1);
break;
case eType.Keyword:
switch (i_Item.Cmd)
{
case eCmd.As:
if (s32_Parenth == 0) // ignore AS inside parenthesis
{
ParseItem.SetLinebreakBefore(i_Item, 1);
return; // stop parsing here
}
break;
case eCmd.On: // Trigger
ParseItem.SetLinebreakBefore(i_Item, 1);
b_RemoveLF = false; // no further linebreak parsing for triggers
break;
case eCmd.Returns: // Function
ParseItem.SetLinebreakBefore(i_Item, 1);
break;
}
break;
case eType.Comand:
switch (i_Item.Cmd)
{
// in a Trigger these words are keywords and not commands
case eCmd.Delete:
case eCmd.Insert:
case eCmd.Update:
i_Item.Type = eType.Keyword;
//.........这里部分代码省略.........