本文整理汇总了C#中System.Char.IsName方法的典型用法代码示例。如果您正苦于以下问题:C# Char.IsName方法的具体用法?C# Char.IsName怎么用?C# Char.IsName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Char
的用法示例。
在下文中一共展示了Char.IsName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AtKeywordRest
/// <summary>
/// 4.4.8. At-keyword-rest state
/// </summary>
CssToken AtKeywordRest(Char current)
{
while (true)
{
if (current.IsName())
_stringBuffer.Append(current);
else if (IsValidEscape(current))
{
current = Next;
_stringBuffer.Append(ConsumeEscape(current));
}
else
{
Back();
return CssKeywordToken.At(FlushBuffer());
}
current = Next;
}
}
示例2: HashRest
/// <summary>
/// 4.4.5. Hash-rest state
/// </summary>
CssToken HashRest(Char current)
{
while (true)
{
if (current.IsName())
_stringBuffer.Append(current);
else if (IsValidEscape(current))
{
current = Next;
_stringBuffer.Append(ConsumeEscape(current));
}
else if (current == Specification.ReverseSolidus)
{
RaiseErrorOccurred(ErrorCode.InvalidCharacter);
Back();
return CssKeywordToken.Hash(FlushBuffer());
}
else
{
Back();
return CssKeywordToken.Hash(FlushBuffer());
}
current = Next;
}
}
示例3: IdentRest
/// <summary>
/// 4.4.10. Ident-rest state
/// </summary>
CssToken IdentRest(Char current)
{
while (true)
{
if (current.IsName())
_stringBuffer.Append(current);
else if (IsValidEscape(current))
{
current = Next;
_stringBuffer.Append(ConsumeEscape(current));
}
else if (current == Specification.RoundBracketOpen)
{
var fn = _stringBuffer.ToString().ToLower();
if (fn == FunctionNames.Url)
{
_stringBuffer.Clear();
return UrlStart(Next, CssTokenType.Url);
}
else if (fn == FunctionNames.Domain)
{
_stringBuffer.Clear();
return UrlStart(Next, CssTokenType.Domain);
}
else if (fn == FunctionNames.Url_Prefix)
{
_stringBuffer.Clear();
return UrlStart(Next, CssTokenType.UrlPrefix);
}
return CssKeywordToken.Function(FlushBuffer());
}
//false could be replaced with a transform whitespace flag, which is set to true if in SVG transform mode.
//else if (false && Specification.IsSpaceCharacter(current))
// InstantSwitch(TransformFunctionWhitespace);
else
{
Back();
return CssKeywordToken.Ident(FlushBuffer());
}
current = Next;
}
}
示例4: IdentRest
/// <summary>
/// 4.4.10. Ident-rest state
/// </summary>
CssToken IdentRest(Char current)
{
while (true)
{
if (current.IsName())
{
_stringBuffer.Append(current);
}
else if (IsValidEscape(current))
{
current = GetNext();
_stringBuffer.Append(ConsumeEscape(current));
}
else if (current == Symbols.RoundBracketOpen)
{
var fn = FlushBuffer();
var type = fn.GetTypeFromName();
switch (type)
{
case CssTokenType.Function:
return NewFunction(fn);
default:
return UrlStart(type);
}
}
else
{
Back();
return NewIdent(FlushBuffer());
}
current = GetNext();
}
}
示例5: Dimension
/// <summary>
/// 4.4.15. Dimension state
/// </summary>
CssToken Dimension(Char current, String number)
{
while (true)
{
if (current.IsName())
_stringBuffer.Append(current);
else if (IsValidEscape(current))
{
current = Next;
_stringBuffer.Append(ConsumeEscape(current));
}
else
{
Back();
return CssUnitToken.Dimension(number, FlushBuffer());
}
current = Next;
}
}
示例6: IdentRest
/// <summary>
/// 4.4.10. Ident-rest state
/// </summary>
CssToken IdentRest(Char current)
{
while (true)
{
if (current.IsName())
_stringBuffer.Append(current);
else if (IsValidEscape(current))
{
current = _src.Next;
_stringBuffer.Append(ConsumeEscape(current));
}
else if (current == Specification.RBO)
{
switch (_stringBuffer.ToString().ToLower())
{
case FunctionNames.URL:
_stringBuffer.Clear();
return UrlStart(_src.Next, CssTokenType.Url);
case FunctionNames.DOMAIN:
_stringBuffer.Clear();
return UrlStart(_src.Next, CssTokenType.Domain);
case FunctionNames.URL_PREFIX:
_stringBuffer.Clear();
return UrlStart(_src.Next, CssTokenType.UrlPrefix);
default:
return CssKeywordToken.Function(FlushBuffer());
}
}
//false could be replaced with a transform whitespace flag, which is set to true if in SVG transform mode.
//else if (false && Specification.IsSpaceCharacter(current))
// InstantSwitch(TransformFunctionWhitespace);
else
{
_src.Back();
return CssKeywordToken.Ident(FlushBuffer());
}
current = _src.Next;
}
}
示例7: AtKeywordRest
/// <summary>
/// 4.4.8. At-keyword-rest state
/// </summary>
CssToken AtKeywordRest(Char current)
{
while (true)
{
if (current.IsName())
{
_stringBuffer.Append(current);
}
else if (IsValidEscape(current))
{
current = GetNext();
_stringBuffer.Append(ConsumeEscape(current));
}
else
{
Back();
return NewAtKeyword(FlushBuffer());
}
current = GetNext();
}
}
示例8: EntityDeclarationAfter
DtdToken EntityDeclarationAfter(Char c, DtdEntityToken decl)
{
while (c.IsSpaceCharacter())
c = _src.Next;
if (c == Specification.EOF)
throw new ArgumentException("The document ended unexpectedly.");
else if (c == Specification.GT)
return decl;
else if (decl.IsExtern && String.IsNullOrEmpty(decl.ExternNotation))
{
if (_src.ContinuesWith("NDATA"))
{
_src.Advance(4);
c = _src.Next;
while (c.IsSpaceCharacter())
c = _src.Next;
if (c.IsNameStart())
{
_stringBuffer.Clear();
do
{
_stringBuffer.Append(c);
c = _src.Next;
}
while (c.IsName());
decl.ExternNotation = _stringBuffer.ToString();
return EntityDeclarationAfter(c, decl);
}
}
}
throw new ArgumentException("Declaration invalid.");
}
示例9: AttributeDeclarationTypeEnumeration
void AttributeDeclarationTypeEnumeration(Char c, AttributeEnumeratedType parent)
{
while (true)
{
while (c.IsSpaceCharacter())
c = _src.Next;
if (c == Specification.EOF)
throw new ArgumentException("The document ended unexpectedly.");
if (!c.IsName())
throw new ArgumentException("Declaration invalid.");
do
{
_stringBuffer.Append(c);
c = _src.Next;
}
while (c.IsName());
while (c.IsSpaceCharacter())
c = _src.Next;
parent.Names.Add(_stringBuffer.ToString());
_stringBuffer.Clear();
if (c == Specification.RBC)
break;
else if (c == Specification.PIPE)
c = _src.Next;
else
throw new ArgumentException("Declaration invalid.");
}
}
示例10: CharacterReference
XmlEntityToken CharacterReference(Char c)
{
_stringBuffer.Clear();
if (c == Specification.NUM)
{
c = _src.Next;
while (c.IsHex())
{
_stringBuffer.Append(c);
c = _src.Next;
}
if (_stringBuffer.Length > 0 && c == Specification.SC)
return new XmlEntityToken { Value = _stringBuffer.ToString(), IsNumeric = true };
}
else if (c.IsNameStart())
{
do
{
_stringBuffer.Append(c);
c = _src.Next;
}
while (c.IsName());
if (c == Specification.SC)
return new XmlEntityToken { Value = _stringBuffer.ToString() };
}
throw new ArgumentException("Invalid entity reference.");
}
示例11: IdentRest
/// <summary>
/// 4.4.10. Ident-rest state
/// </summary>
CssToken IdentRest(Char current)
{
while (true)
{
if (current.IsName())
{
_stringBuffer.Append(current);
}
else if (IsValidEscape(current))
{
current = GetNext();
_stringBuffer.Append(ConsumeEscape(current));
}
else if (current == Symbols.RoundBracketOpen)
{
var name = FlushBuffer();
var type = name.GetTypeFromName();
return type == CssTokenType.Function ? NewFunction(name) : UrlStart(name);
}
else
{
Back();
return NewIdent(FlushBuffer());
}
current = GetNext();
}
}
示例12: IdentRest
/// <summary>
/// 4.4.10. Ident-rest state
/// </summary>
CssToken IdentRest(Char current)
{
while (true)
{
if (current.IsName())
_stringBuffer.Append(current);
else if (IsValidEscape(current))
{
current = _src.Next;
_stringBuffer.Append(ConsumeEscape(current));
}
else if (current == '(')
{
if (_stringBuffer.ToString().Equals("url", StringComparison.OrdinalIgnoreCase))
{
_stringBuffer.Clear();
return UrlStart(_src.Next);
}
return CssKeywordToken.Function(FlushBuffer());
}
//false could be replaced with a transform whitespace flag, which is set to true if in SVG transform mode.
//else if (false && Specification.IsSpaceCharacter(current))
// InstantSwitch(TransformFunctionWhitespace);
else
{
_src.Back();
return CssKeywordToken.Ident(FlushBuffer());
}
current = _src.Next;
}
}