本文整理汇总了C#中MasterList类的典型用法代码示例。如果您正苦于以下问题:C# MasterList类的具体用法?C# MasterList怎么用?C# MasterList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MasterList类属于命名空间,在下文中一共展示了MasterList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenericType
/// <summary>
/// Initializes a new instance of the GenericType class.
/// </summary>
/// <param name="childTokens">
/// The list of child tokens that form the generic token.
/// </param>
/// <param name="location">
/// The location of the generic in the code.
/// </param>
/// <param name="parent">
/// The parent of the token.
/// </param>
/// <param name="generated">
/// True if the token is inside of a block of generated code.
/// </param>
internal GenericType(MasterList<CsToken> childTokens, CodeLocation location, Reference<ICodePart> parent, bool generated)
: base(childTokens, location, parent, CsTokenClass.GenericType, generated)
{
Param.AssertNotNull(childTokens, "childTokens");
Param.AssertGreaterThanOrEqualTo(childTokens.Count, 3, "childTokens");
Param.AssertNotNull(location, "location");
Param.AssertNotNull(parent, "parent");
Param.Ignore(generated);
}
示例2: ConstructorConstraint
/// <summary>
/// Initializes a new instance of the ConstructorConstraint class.
/// </summary>
/// <param name="childTokens">
/// The list of child tokens that form the token.
/// </param>
/// <param name="location">
/// The location of the token in the code.
/// </param>
/// <param name="parent">
/// The parent of the token.
/// </param>
/// <param name="generated">
/// True if the token is inside of a block of generated code.
/// </param>
internal ConstructorConstraint(MasterList<CsToken> childTokens, CodeLocation location, Reference<ICodePart> parent, bool generated)
: base(CsTokenType.Other, CsTokenClass.ConstructorConstraint, location, parent, generated)
{
Param.AssertNotNull(childTokens, "childTokens");
Param.AssertNotNull(location, "location");
Param.AssertNotNull(parent, "parent");
Param.Ignore(generated);
this.childTokens = childTokens;
}
示例3: CheckSpacing
private void CheckSpacing(MasterList<CsToken> tokens, bool v, object p)
{
for (Node<CsToken> tokenNode = tokens.First; tokenNode != null; tokenNode = tokenNode.Next)
{
if ((tokenNode.Next == null || tokenNode.Next.Value.CsTokenType == CsTokenType.EndOfLine) &&
tokenNode.Value.CsTokenClass == CsTokenClass.Whitespace)
{
this.Violate(tokenNode.Value);
}
}
}
示例4: CheckSpacing
private void CheckSpacing(MasterList<CsToken> tokens, bool v, object p)
{
for (Node<CsToken> tokenNode = tokens.First; tokenNode != null; tokenNode = tokenNode.Next)
{
if (tokenNode.Value.CsTokenClass == CsTokenClass.Whitespace &&
tokenNode.Value.Text.Contains(" "))
{
this.Violate(tokenNode.Value);
}
}
}
示例5: Attribute
/// <summary>
/// Initializes a new instance of the Attribute class.
/// </summary>
/// <param name="childTokens">
/// The list of child tokens for the attribute.
/// </param>
/// <param name="location">
/// The location of the attribute.
/// </param>
/// <param name="parent">
/// The parent of the attribute.
/// </param>
/// <param name="attributeExpressions">
/// The list of attribute expressions within this attribute.
/// </param>
/// <param name="generated">
/// Indicates whether the attribute resides within a block of generated code.
/// </param>
internal Attribute(
MasterList<CsToken> childTokens, CodeLocation location, Reference<ICodePart> parent, IEnumerable<AttributeExpression> attributeExpressions, bool generated)
: base(CsTokenType.Attribute, CsTokenClass.Attribute, location, parent, generated)
{
Param.AssertNotNull(childTokens, "childTokens");
Param.AssertGreaterThanOrEqualTo(childTokens.Count, 2, "childTokens");
Param.AssertNotNull(location, "location");
Param.AssertNotNull(parent, "parent");
Param.AssertNotNull(attributeExpressions, "attributeExpressions");
Param.Ignore(generated);
this.childTokens = childTokens;
this.attributeExpressions = new CodeUnitCollection<AttributeExpression>(this);
this.attributeExpressions.AddRange(attributeExpressions);
}
示例6: CheckSpacing
private void CheckSpacing(MasterList<CsToken> tokens, bool v, object p)
{
for (Node<CsToken> tokenNode = tokens.First; tokenNode != null; tokenNode = tokenNode.Next)
{
if (tokenNode.Previous?.Value.CsTokenType == CsTokenType.EndOfLine &&
tokenNode.Value.CsTokenClass == CsTokenClass.Whitespace)
{
var trimedSpace = tokenNode.Value.Text.TrimStart('\t');
if (trimedSpace.Contains("\t") ||
trimedSpace.Length >= 4)
{
this.Violate(tokenNode.Value);
}
}
}
}
示例7: CheckCloseCurlyBracket
private void CheckCloseCurlyBracket(DocumentRoot root, MasterList<CsToken> tokens, Node<CsToken> tokenNode)
{
Node<CsToken> previous = tokenNode.Previous;
if (((previous != null) && (previous.Value.CsTokenType != CsTokenType.WhiteSpace)) && (previous.Value.CsTokenType != CsTokenType.EndOfLine))
{
base.AddViolation(root, tokenNode.Value.LineNumber, Microsoft.StyleCop.CSharp.Rules.ClosingCurlyBracketsMustBeSpacedCorrectly, new object[0]);
}
Node<CsToken> next = tokenNode.Next;
if (next != null)
{
CsTokenType csTokenType = next.Value.CsTokenType;
if ((((csTokenType != CsTokenType.WhiteSpace) && (csTokenType != CsTokenType.EndOfLine)) && ((csTokenType != CsTokenType.CloseParenthesis) && (csTokenType != CsTokenType.Semicolon))) && (csTokenType != CsTokenType.Comma))
{
base.AddViolation(root, tokenNode.Value.LineNumber, Microsoft.StyleCop.CSharp.Rules.ClosingCurlyBracketsMustBeSpacedCorrectly, new object[0]);
}
if (csTokenType == CsTokenType.WhiteSpace)
{
foreach (CsToken token in tokens.ForwardIterator(tokenNode.Next.Next))
{
CsTokenType type2 = token.CsTokenType;
switch (type2)
{
case CsTokenType.CloseParenthesis:
case CsTokenType.Semicolon:
case CsTokenType.Comma:
{
base.AddViolation(root, tokenNode.Value.LineNumber, Microsoft.StyleCop.CSharp.Rules.ClosingCurlyBracketsMustBeSpacedCorrectly, new object[0]);
continue;
}
}
if (type2 != CsTokenType.WhiteSpace)
{
return;
}
}
}
}
}
示例8: CheckCloseParen
private void CheckCloseParen(MasterList<CsToken> tokens, Node<CsToken> tokenNode)
{
Param.AssertNotNull(tokens, "tokens");
Param.AssertNotNull(tokenNode, "tokenNode");
// Close parens should never be preceded by whitespace.
Node<CsToken> previousNode = tokenNode.Previous;
if (previousNode != null)
{
if (previousNode.Value.CsTokenType == CsTokenType.WhiteSpace
|| (previousNode.Value.CsTokenType == CsTokenType.EndOfLine && previousNode.Previous.Value.CsTokenType != CsTokenType.SingleLineComment))
{
this.AddViolation(tokenNode.Value.FindParentElement(), previousNode.Value.Location, Rules.ClosingParenthesisMustBeSpacedCorrectly);
}
}
// Find out what comes after the closing paren.
Node<CsToken> nextNode = tokenNode.Next;
if (nextNode != null)
{
CsTokenType nextType = nextNode.Value.CsTokenType;
CsTokenType nextNextType = nextNode.Next == null ? CsTokenType.Other : nextNode.Next.Value.CsTokenType;
if (tokenNode.Value.Parent is CastExpression)
{
// There should not be any whitespace after the closing parenthesis in a cast expression.
if (nextType == CsTokenType.WhiteSpace)
{
this.AddViolation(tokenNode.Value.FindParentElement(), nextNode.Value.Location, Rules.ClosingParenthesisMustBeSpacedCorrectly);
}
}
else if (nextType == CsTokenType.LabelColon || nextNextType == CsTokenType.LabelColon)
{
// If the next token is a colon, it's allowed to omit the whitespace only if we are in a switch\case statement.
bool followsCase = false;
foreach (CsToken item in tokens.ReverseIterator(tokenNode.Previous))
{
CsTokenType itemType = item.CsTokenType;
if (itemType == CsTokenType.EndOfLine)
{
break;
}
else if (itemType == CsTokenType.Case)
{
followsCase = true;
break;
}
}
if ((followsCase && nextType == CsTokenType.WhiteSpace) || (!followsCase && nextType != CsTokenType.WhiteSpace))
{
this.AddViolation(tokenNode.Value.FindParentElement(), nextNode.Value.Location, Rules.ClosingParenthesisMustBeSpacedCorrectly);
}
}
else if (nextType == CsTokenType.WhiteSpace)
{
// Make sure that the character just after the whitespace is not a paren, bracket, a comma, or a semicolon.
foreach (CsToken item in tokens.ForwardIterator(tokenNode.Next.Next))
{
if (IsAllowedAfterClosingParenthesis(item))
{
this.AddViolation(tokenNode.Value.FindParentElement(), nextNode.Value.Location, Rules.ClosingParenthesisMustBeSpacedCorrectly);
}
else if (item.CsTokenType != CsTokenType.WhiteSpace)
{
break;
}
}
}
else
{
// For all other types, the parenthesis must be followed by whitespace, unless the next character is a paren, bracket, comma, or a semicolon.
if (nextNode.Value.CsTokenType != CsTokenType.EndOfLine && !IsAllowedAfterClosingParenthesis(nextNode.Value))
{
this.AddViolation(tokenNode.Value.FindParentElement(), nextNode.Value.Location, Rules.ClosingParenthesisMustBeSpacedCorrectly);
}
}
}
}
示例9: GetGenericArgumentList
private MasterList<CsToken> GetGenericArgumentList(Reference<ICodePart> genericTypeReference, bool unsafeCode, CsToken name, int startIndex, out int endIndex)
{
Param.AssertNotNull(genericTypeReference, "genericTypeReference");
Param.Ignore(unsafeCode);
Param.Ignore(name);
Param.AssertGreaterThanOrEqualToZero(startIndex, "startIndex");
endIndex = -1;
MasterList<CsToken> genericArgumentListTokens = null;
// Move past whitespace and comments.
int index = startIndex;
while (true)
{
Symbol next = this.symbols.Peek(index);
if (next == null
|| (next.SymbolType != SymbolType.WhiteSpace && next.SymbolType != SymbolType.EndOfLine && next.SymbolType != SymbolType.SingleLineComment
&& next.SymbolType != SymbolType.MultiLineComment && next.SymbolType != SymbolType.PreprocessorDirective))
{
break;
}
++index;
}
// The next symbol should be an opening bracket, if this is a generic.
Symbol symbol = this.symbols.Peek(index);
if (symbol != null && symbol.SymbolType == SymbolType.LessThan)
{
// This might be a generic. Assume that it is and start creating tokens.
genericArgumentListTokens = new MasterList<CsToken>();
// Add the name if one was provided.
if (name != null)
{
genericArgumentListTokens.Add(name);
}
Node<CsToken> openingGenericBracketNode = null;
// Add everything up to the opening bracket into the token list.
for (int i = startIndex; i <= index; ++i)
{
symbol = this.symbols.Peek(i);
Debug.Assert(symbol != null, "The next symbol should not be null");
if (symbol.SymbolType == SymbolType.LessThan)
{
if (openingGenericBracketNode != null)
{
// This is not a generic statement.
return null;
}
Bracket openingGenericBracket = new Bracket(
symbol.Text, CsTokenType.OpenGenericBracket, symbol.Location, genericTypeReference, this.symbols.Generated);
openingGenericBracketNode = genericArgumentListTokens.InsertLast(openingGenericBracket);
}
else
{
genericArgumentListTokens.Add(this.ConvertSymbol(symbol, TokenTypeFromSymbolType(symbol.SymbolType), genericTypeReference));
}
}
// Loop through the rest of the symbols.
while (true)
{
symbol = this.symbols.Peek(++index);
if (symbol == null)
{
// The code ran out before we found the end of the generic.
throw new SyntaxException(this.document.SourceCode, name.LineNumber);
}
else if (symbol.SymbolType == SymbolType.GreaterThan)
{
if (openingGenericBracketNode == null)
{
// This is not a generic statement.
return null;
}
// This is the end of the generic statement. Add the closing bracket to the token list.
Bracket closingGenericBracket = new Bracket(
symbol.Text, CsTokenType.CloseGenericBracket, symbol.Location, genericTypeReference, this.symbols.Generated);
Node<CsToken> closingGenericBracketNode = genericArgumentListTokens.InsertLast(closingGenericBracket);
((Bracket)openingGenericBracketNode.Value).MatchingBracketNode = closingGenericBracketNode;
closingGenericBracket.MatchingBracketNode = openingGenericBracketNode;
endIndex = index;
break;
}
else if (symbol.SymbolType == SymbolType.Out || symbol.SymbolType == SymbolType.In)
{
// Get the in or out keyword.
genericArgumentListTokens.Add(
this.ConvertSymbol(symbol, symbol.SymbolType == SymbolType.In ? CsTokenType.In : CsTokenType.Out, genericTypeReference));
}
else if (symbol.SymbolType == SymbolType.Other)
{
//.........这里部分代码省略.........
示例10: CheckOpenParen
private void CheckOpenParen(MasterList<CsToken> tokens, Node<CsToken> tokenNode)
{
Param.AssertNotNull(tokens, "tokens");
Param.AssertNotNull(tokenNode, "tokenNode");
bool firstOnLine = false;
bool lastOnLine = false;
// Open parenthesis should never be preceded by whitespace unless it is the
// first thing on the line or it follows a keyword or it follows a symbol or a number.
Node<CsToken> previousNode = tokenNode.Previous;
if (previousNode != null)
{
if (previousNode.Value.CsTokenType == CsTokenType.WhiteSpace)
{
foreach (CsToken item in tokens.ReverseIterator(previousNode))
{
CsTokenType itemType = item.CsTokenType;
if (itemType == CsTokenType.WhiteSpace)
{
continue;
}
if (itemType == CsTokenType.EndOfLine)
{
firstOnLine = true;
break;
}
if (itemType == CsTokenType.Case || itemType == CsTokenType.Catch || itemType == CsTokenType.CloseSquareBracket || itemType == CsTokenType.Comma
|| itemType == CsTokenType.Equals || itemType == CsTokenType.Fixed || itemType == CsTokenType.For || itemType == CsTokenType.Foreach
|| itemType == CsTokenType.From || ////itemType == CsTokenType.Goto ||
itemType == CsTokenType.Group || itemType == CsTokenType.If || itemType == CsTokenType.In || itemType == CsTokenType.Into
|| itemType == CsTokenType.Join || itemType == CsTokenType.Let || itemType == CsTokenType.Lock || itemType == CsTokenType.MultiLineComment
|| ////itemType == CsTokenType.New ||
itemType == CsTokenType.Number || itemType == CsTokenType.OperatorSymbol || itemType == CsTokenType.OpenCurlyBracket
|| itemType == CsTokenType.OrderBy || itemType == CsTokenType.Return || itemType == CsTokenType.Select || itemType == CsTokenType.Semicolon
|| ////itemType == CsTokenType.SingleLineComment ||
itemType == CsTokenType.Switch || itemType == CsTokenType.Throw || itemType == CsTokenType.Using || itemType == CsTokenType.Where
|| itemType == CsTokenType.While || itemType == CsTokenType.WhileDo || itemType == CsTokenType.Yield || itemType == CsTokenType.LabelColon
|| itemType == CsTokenType.Async || itemType == CsTokenType.By || itemType == CsTokenType.When)
{
break;
}
this.AddViolation(tokenNode.Value.FindParentElement(), previousNode.Value.Location, Rules.OpeningParenthesisMustBeSpacedCorrectly);
}
}
}
// Open parens should never be followed by whitespace unless
// it is the last thing on the line.
Node<CsToken> next = tokenNode.Next;
if (next != null && (next.Value.CsTokenType == CsTokenType.WhiteSpace || next.Value.CsTokenType == CsTokenType.EndOfLine))
{
// Look to see if there is any non whitespace character
// on this line other than a comment.
foreach (CsToken item in tokens.ForwardIterator(next))
{
CsTokenType itemType = item.CsTokenType;
if (itemType == CsTokenType.EndOfLine)
{
lastOnLine = true;
break;
}
else if (itemType != CsTokenType.WhiteSpace && itemType != CsTokenType.SingleLineComment && itemType != CsTokenType.MultiLineComment)
{
this.AddViolation(tokenNode.Value.FindParentElement(), next.Value.Location, Rules.OpeningParenthesisMustBeSpacedCorrectly);
break;
}
}
}
// Open parens cannot be the only thing on the line.
if (firstOnLine && lastOnLine)
{
this.AddViolation(tokenNode.Value.FindParentElement(), tokenNode.Value.Location, Rules.OpeningParenthesisMustBeSpacedCorrectly);
}
}
示例11: CheckOpenCurlyBracket
/// <summary>
/// Checks a open bracket for spacing.
/// </summary>
/// <param name="tokens">
/// The list of tokens being parsed.
/// </param>
/// <param name="tokenNode">
/// The token to check.
/// </param>
private void CheckOpenCurlyBracket(MasterList<CsToken> tokens, Node<CsToken> tokenNode)
{
Param.AssertNotNull(tokens, "tokens");
Param.AssertNotNull(tokenNode, "tokenNode");
// Open curly brackets should be preceded either by whitespace, or an open paren.
Node<CsToken> previousNode = tokenNode.Previous;
if (previousNode != null)
{
CsTokenType lastType = previousNode.Value.CsTokenType;
if (lastType != CsTokenType.WhiteSpace && lastType != CsTokenType.EndOfLine && lastType != CsTokenType.OpenParenthesis)
{
this.AddViolation(tokenNode.Value.FindParentElement(), tokenNode.Value.Location, Rules.OpeningCurlyBracketsMustBeSpacedCorrectly);
}
if (lastType == CsTokenType.WhiteSpace)
{
// If this is preceded by whitespace, make sure that the character just
// before the whitespace is not an open paren.
foreach (CsToken item in tokens.ReverseIterator(previousNode))
{
CsTokenType itemType = item.CsTokenType;
if (itemType == CsTokenType.OpenParenthesis)
{
this.AddViolation(tokenNode.Value.FindParentElement(), tokenNode.Value.Location, Rules.OpeningCurlyBracketsMustBeSpacedCorrectly);
}
else if (itemType != CsTokenType.WhiteSpace)
{
break;
}
}
}
}
// Open curly brackets should always be followed by whitespace.
Node<CsToken> nextNode = tokenNode.Next;
if (nextNode != null && nextNode.Value.CsTokenType != CsTokenType.WhiteSpace && nextNode.Value.CsTokenType != CsTokenType.EndOfLine)
{
this.AddViolation(tokenNode.Value.FindParentElement(), tokenNode.Value.Location, Rules.OpeningCurlyBracketsMustBeSpacedCorrectly);
}
}
示例12: CheckSingleLineComment
private void CheckSingleLineComment(DocumentRoot root, MasterList<CsToken> tokens, Node<CsToken> tokenNode)
{
if (tokenNode.Value.Text.Length > 2)
{
string text = tokenNode.Value.Text;
if ((((text[2] != ' ') && (text[2] != '\t')) && ((text[2] != '/') && (text[2] != '\\'))) && (((text[1] != '\n') && (text[1] != '\r')) && (((text.Length < 4) || (text[2] != '-')) || (text[3] != '-'))))
{
base.AddViolation(root, tokenNode.Value.LineNumber, Microsoft.StyleCop.CSharp.Rules.SingleLineCommentsMustBeginWithSingleSpace, new object[0]);
}
else if (((text.Length > 3) && ((text[3] == ' ') || (text[3] == '\t'))) && (text[2] != '\\'))
{
bool flag = true;
int num = 0;
foreach (CsToken token in tokens.ReverseIterator(tokenNode.Previous))
{
if (token.CsTokenType == CsTokenType.EndOfLine)
{
if (++num != 2)
{
continue;
}
break;
}
if (token.CsTokenType == CsTokenType.SingleLineComment)
{
flag = false;
break;
}
if (token.CsTokenType != CsTokenType.WhiteSpace)
{
break;
}
}
if (flag)
{
base.AddViolation(root, tokenNode.Value.LineNumber, Microsoft.StyleCop.CSharp.Rules.SingleLineCommentsMustBeginWithSingleSpace, new object[0]);
}
}
}
}
示例13: CheckOpenParen
private void CheckOpenParen(DocumentRoot root, MasterList<CsToken> tokens, Node<CsToken> tokenNode)
{
Node<CsToken> node2;
bool flag = false;
bool flag2 = false;
Node<CsToken> previous = tokenNode.Previous;
if ((previous != null) && (previous.Value.CsTokenType == CsTokenType.WhiteSpace))
{
foreach (CsToken token in tokens.ReverseIterator(previous))
{
switch (token.CsTokenType)
{
case CsTokenType.WhiteSpace:
{
continue;
}
case CsTokenType.EndOfLine:
flag = true;
goto Label_017C;
case CsTokenType.Case:
case CsTokenType.Catch:
case CsTokenType.CloseSquareBracket:
case CsTokenType.Comma:
case CsTokenType.Equals:
case CsTokenType.Fixed:
case CsTokenType.For:
case CsTokenType.Foreach:
case CsTokenType.From:
case CsTokenType.Group:
case CsTokenType.If:
case CsTokenType.In:
case CsTokenType.Into:
case CsTokenType.Join:
case CsTokenType.Let:
case CsTokenType.Lock:
case CsTokenType.MultiLineComment:
case CsTokenType.Number:
case CsTokenType.OperatorSymbol:
case CsTokenType.OpenCurlyBracket:
case CsTokenType.OrderBy:
case CsTokenType.Return:
case CsTokenType.Select:
case CsTokenType.Semicolon:
case CsTokenType.Switch:
case CsTokenType.Throw:
case CsTokenType.Using:
case CsTokenType.Where:
case CsTokenType.While:
case CsTokenType.WhileDo:
case CsTokenType.Yield:
goto Label_017C;
}
base.AddViolation(root, tokenNode.Value.LineNumber, Microsoft.StyleCop.CSharp.Rules.OpeningParenthesisMustBeSpacedCorrectly, new object[0]);
}
}
Label_017C:
node2 = tokenNode.Next;
if ((node2 != null) && ((node2.Value.CsTokenType == CsTokenType.WhiteSpace) || (node2.Value.CsTokenType == CsTokenType.EndOfLine)))
{
foreach (CsToken token2 in tokens.ForwardIterator(node2))
{
CsTokenType csTokenType = token2.CsTokenType;
if (csTokenType == CsTokenType.EndOfLine)
{
flag2 = true;
break;
}
if (((csTokenType != CsTokenType.WhiteSpace) && (csTokenType != CsTokenType.SingleLineComment)) && (csTokenType != CsTokenType.MultiLineComment))
{
base.AddViolation(root, tokenNode.Value.LineNumber, Microsoft.StyleCop.CSharp.Rules.OpeningParenthesisMustBeSpacedCorrectly, new object[0]);
break;
}
}
}
if (flag && flag2)
{
base.AddViolation(root, tokenNode.Value.LineNumber, Microsoft.StyleCop.CSharp.Rules.OpeningParenthesisMustBeSpacedCorrectly, new object[0]);
}
}
示例14: CheckNewKeywordSpacing
private void CheckNewKeywordSpacing(DocumentRoot root, MasterList<CsToken> tokens, Node<CsToken> tokenNode)
{
Node<CsToken> next = tokenNode.Next;
if (next != null)
{
if ((next.Value.CsTokenType == CsTokenType.WhiteSpace) || (next.Value.CsTokenType == CsTokenType.EndOfLine))
{
foreach (CsToken token in tokens.ForwardIterator(next.Next))
{
if (token.CsTokenType == CsTokenType.OpenSquareBracket)
{
base.AddViolation(root, tokenNode.Value.LineNumber, Microsoft.StyleCop.CSharp.Rules.CodeMustNotContainSpaceAfterNewKeywordInImplicitlyTypedArrayAllocation, new object[0]);
break;
}
if ((token.CsTokenType != CsTokenType.WhiteSpace) && (token.CsTokenType != CsTokenType.EndOfLine))
{
break;
}
}
}
else if (next.Value.CsTokenType != CsTokenType.OpenSquareBracket)
{
base.AddViolation(root, tokenNode.Value.LineNumber, Microsoft.StyleCop.CSharp.Rules.KeywordsMustBeSpacedCorrectly, new object[] { tokenNode.Value.Text });
}
}
}
示例15: CheckSymbol
private void CheckSymbol(DocumentRoot root, MasterList<CsToken> tokens, Node<CsToken> tokenNode)
{
Node<CsToken> previous = tokenNode.Previous;
if (((previous != null) && (previous.Value.CsTokenType != CsTokenType.WhiteSpace)) && (previous.Value.CsTokenType != CsTokenType.EndOfLine))
{
base.AddViolation(root, tokenNode.Value.LineNumber, Microsoft.StyleCop.CSharp.Rules.SymbolsMustBeSpacedCorrectly, new object[] { tokenNode.Value.Text });
}
Node<CsToken> next = tokenNode.Next;
if (((next != null) && (next.Value.CsTokenType != CsTokenType.WhiteSpace)) && (next.Value.CsTokenType != CsTokenType.EndOfLine))
{
if (previous != null)
{
foreach (CsToken token in tokens.ReverseIterator(previous))
{
if (token.CsTokenType == CsTokenType.Operator)
{
return;
}
if (((token.CsTokenType != CsTokenType.WhiteSpace) && (token.CsTokenType != CsTokenType.EndOfLine)) && (((token.CsTokenType != CsTokenType.SingleLineComment) && (token.CsTokenType != CsTokenType.MultiLineComment)) && (token.CsTokenType != CsTokenType.PreprocessorDirective)))
{
break;
}
}
}
base.AddViolation(root, tokenNode.Value.LineNumber, Microsoft.StyleCop.CSharp.Rules.SymbolsMustBeSpacedCorrectly, new object[] { tokenNode.Value.Text });
}
}