本文整理汇总了C#中ExCSS.Model.TextBlocks.Block类的典型用法代码示例。如果您正苦于以下问题:C# Block类的具体用法?C# Block怎么用?C# Block使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Block类属于ExCSS.Model.TextBlocks命名空间,在下文中一共展示了Block类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ParseDocumentFunction
private bool ParseDocumentFunction(Block token)
{
SetParsingContext(ParsingContext.AfterDocumentFunction);
if (token.GrammarSegment != GrammarSegment.String) return false;
CastRuleSet<DocumentRule>().Conditions.Add(Tuple.Create(DocumentFunction.RegExp, ((StringBlock)token).Value));
return true;
}
开发者ID:GroM,项目名称:ExCSS,代码行数:8,代码来源:Parser.Blocks.cs
示例2: ParseCharacterSet
private bool ParseCharacterSet(Block token)
{
SetParsingContext(ParsingContext.AfterInstruction);
if (token.GrammarSegment != GrammarSegment.String)
{
return ParsePostInstruction(token);
}
CastRuleSet<CharacterSetRule>().Encoding = ((StringBlock)token).Value;
return true;
}
开发者ID:GroM,项目名称:ExCSS,代码行数:13,代码来源:Parser.Blocks.cs
示例3: ParseCondition
private bool ParseCondition(Block token)
{
switch (token.GrammarSegment)
{
case GrammarSegment.CurlyBraceOpen:
CastRuleSet<SupportsRule>().Condition = _buffer.ToString();
SetParsingContext(ParsingContext.DataBlock);
break;
default:
_buffer.Append(token);
break;
}
return true;
}
开发者ID:GroM,项目名称:ExCSS,代码行数:16,代码来源:Parser.Blocks.cs
示例4: ParseDocumentFunctions
private bool ParseDocumentFunctions(Block token)
{
if (token.GrammarSegment == GrammarSegment.Comma)
{
SetParsingContext(ParsingContext.BeforeDocumentFunction);
return true;
}
if (token.GrammarSegment == GrammarSegment.CurlyBraceOpen)
{
SetParsingContext(ParsingContext.DataBlock);
return true;
}
SetParsingContext(ParsingContext.DataBlock);
return false;
}
开发者ID:GroM,项目名称:ExCSS,代码行数:17,代码来源:Parser.Blocks.cs
示例5: ParseDeclaration
private bool ParseDeclaration(Block token)
{
if (token.GrammarSegment == GrammarSegment.CurlyBracketClose)
{
FinalizeProperty();
SetParsingContext(CurrentRule is KeyframeRule ? ParsingContext.KeyframesData : ParsingContext.DataBlock);
return FinalizeRule();
}
if (token.GrammarSegment != GrammarSegment.Ident)
{
return false;
}
AddProperty(new Property(((SymbolBlock)token).Value));
SetParsingContext(ParsingContext.AfterProperty);
return true;
}
开发者ID:GroM,项目名称:ExCSS,代码行数:18,代码来源:Parser.Blocks.cs
示例6: ParseSelector
private bool ParseSelector(Block token)
{
switch (token.GrammarSegment)
{
case GrammarSegment.CurlyBraceOpen:
{
var rule = CurrentRule as ISupportsSelector;
if (rule != null)
{
rule.Selector = _selectorFactory.GetSelector();
}
SetParsingContext(CurrentRule is StyleRule
? ParsingContext.InDeclaration
: ParsingContext.DataBlock);
}
break;
case GrammarSegment.CurlyBracketClose:
return false;
default:
_selectorFactory.Apply(token);
break;
}
return true;
}
开发者ID:GroM,项目名称:ExCSS,代码行数:29,代码来源:Parser.Blocks.cs
示例7: ParseSingleValue
private bool ParseSingleValue(Block token)
{
switch (token.GrammarSegment)
{
case GrammarSegment.Dimension: // "3px"
return AddTerm(new PrimitiveTerm(((UnitBlock)token).Unit, ((UnitBlock)token).Value));
case GrammarSegment.Hash:// "#ffffff"
return ParseSingleValueHexColor(((SymbolBlock)token).Value);
case GrammarSegment.Delimiter: // "#"
return ParseValueDelimiter((DelimiterBlock)token);
case GrammarSegment.Ident: // "auto"
return ParseSingleValueIdent((SymbolBlock)token);
case GrammarSegment.String:// "'some value'"
return AddTerm(new PrimitiveTerm(UnitType.String, ((StringBlock)token).Value));
case GrammarSegment.Url:// "url('http://....')"
return AddTerm(new PrimitiveTerm(UnitType.Uri, ((StringBlock)token).Value));
case GrammarSegment.Percentage: // "10%"
return AddTerm(new PrimitiveTerm(UnitType.Percentage, ((UnitBlock)token).Value));
case GrammarSegment.Number: // "123"
return AddTerm(new PrimitiveTerm(UnitType.Number, ((NumericBlock)token).Value));
case GrammarSegment.Whitespace: // " "
_terms.AddSeparator(GrammarSegment.Whitespace);
SetParsingContext(ParsingContext.InValueList);
return true;
case GrammarSegment.Function: // rgba(...)
_functionBuffers.Push(new FunctionBuffer(((SymbolBlock)token).Value));
SetParsingContext(ParsingContext.InFunction);
return true;
case GrammarSegment.Comma: // ","
_terms.AddSeparator(GrammarSegment.Comma);
SetParsingContext(ParsingContext.InValuePool);
return true;
case GrammarSegment.Colon: // ":"
_terms.AddSeparator(GrammarSegment.Colon);
return true;
case GrammarSegment.Semicolon: // ";"
case GrammarSegment.CurlyBracketClose: // "}"
return ParsePostValue(token);
case GrammarSegment.ParenClose: // ")"
SetParsingContext(ParsingContext.AfterValue);
return true;
default:
return false;
}
}
开发者ID:GroM,项目名称:ExCSS,代码行数:59,代码来源:Parser.Blocks.cs
示例8: ParseKeyframesData
private bool ParseKeyframesData(Block token)
{
if (token.GrammarSegment == GrammarSegment.CurlyBracketClose)
{
SetParsingContext(ParsingContext.DataBlock);
return FinalizeRule();
}
_buffer = new StringBuilder();
return ParseKeyframeText(token);
}
开发者ID:GroM,项目名称:ExCSS,代码行数:12,代码来源:Parser.Blocks.cs
示例9: ParsePreKeyframesData
private bool ParsePreKeyframesData(Block token)
{
if (token.GrammarSegment != GrammarSegment.CurlyBraceOpen)
{
return false;
}
SetParsingContext(ParsingContext.BeforeKeyframesData);
return true;
}
开发者ID:GroM,项目名称:ExCSS,代码行数:10,代码来源:Parser.Blocks.cs
示例10: ParseValueFunction
private bool ParseValueFunction(Block token)
{
switch (token.GrammarSegment)
{
case GrammarSegment.ParenClose:
{
var functionBuffer = _functionBuffers.Pop().Done();
if (_functionBuffers.Any()) return AddTerm(functionBuffer);
SetParsingContext(ParsingContext.InSingleValue);
return AddTerm(functionBuffer);
}
case GrammarSegment.Whitespace:
{
if (!_functionBuffers.Any()) return AddTerm(new Whitespace());
var functionBuffer = _functionBuffers.Peek();
var lastTerm = functionBuffer.TermList.LastOrDefault();
if (lastTerm is Comma || lastTerm is Whitespace)
return true;
return AddTerm(new Whitespace());
}
case GrammarSegment.Comma:
return AddTerm(new Comma());
case GrammarSegment.Delimiter:
return AddTerm(new EqualSign());
default:
return ParseSingleValue(token);
}
}
开发者ID:GroM,项目名称:ExCSS,代码行数:35,代码来源:Parser.Blocks.cs
示例11: ParseValuePool
private bool ParseValuePool(Block token)
{
if (token.GrammarSegment == GrammarSegment.Semicolon || token.GrammarSegment == GrammarSegment.CurlyBracketClose)
{
ParsePostValue(token);
}
else
{
SetParsingContext(ParsingContext.InSingleValue);
return ParseSingleValue(token);
}
return false;
}
开发者ID:GroM,项目名称:ExCSS,代码行数:14,代码来源:Parser.Blocks.cs
示例12: ParseKeyframesName
private bool ParseKeyframesName(Block token)
{
//SetParsingContext(ParsingContext.BeforeKeyframesData);
if (token.GrammarSegment == GrammarSegment.Ident)
{
CastRuleSet<KeyframesRule>().Identifier = ((SymbolBlock)token).Value;
return true;
}
if (token.GrammarSegment == GrammarSegment.CurlyBraceOpen)
{
SetParsingContext(ParsingContext.KeyframesData);
return true;
}
return false;
}
开发者ID:GroM,项目名称:ExCSS,代码行数:18,代码来源:Parser.Blocks.cs
示例13: ParseValue
private bool ParseValue(Block token)
{
switch (token.GrammarSegment)
{
case GrammarSegment.Semicolon:
SetParsingContext(ParsingContext.InDeclaration);
break;
case GrammarSegment.CurlyBracketClose:
ParseDeclaration(token);
break;
default:
SetParsingContext(ParsingContext.InSingleValue);
return ParseSingleValue(token);
}
return false;
}
开发者ID:GroM,项目名称:ExCSS,代码行数:19,代码来源:Parser.Blocks.cs
示例14: ParsePageSelector
private bool ParsePageSelector(Block token)
{
if (token.GrammarSegment == GrammarSegment.Colon || token.GrammarSegment == GrammarSegment.Whitespace)
{
return true;
}
if (token.GrammarSegment == GrammarSegment.Ident)
{
CastRuleSet<PageRule>().Selector = new SimpleSelector(token.ToString());
return true;
}
if (token.GrammarSegment == GrammarSegment.CurlyBraceOpen)
{
SetParsingContext(ParsingContext.InDeclaration);
return true;
}
return false;
}
开发者ID:GroM,项目名称:ExCSS,代码行数:21,代码来源:Parser.Blocks.cs
示例15: ParseSymbol
private bool ParseSymbol(Block token)
{
if (token.GrammarSegment == GrammarSegment.AtRule)
{
var value = ((SymbolBlock)token).Value;
switch (value)
{
case RuleTypes.Media:
{
AddRuleSet(new MediaRule());
SetParsingContext(ParsingContext.InMediaList);
break;
}
case RuleTypes.Page:
{
AddRuleSet(new PageRule());
//SetParsingContext(ParsingContext.InSelector);
SetParsingContext(ParsingContext.BeforePageSelector);
break;
}
case RuleTypes.Import:
{
AddRuleSet(new ImportRule());
SetParsingContext(ParsingContext.BeforeImport);
break;
}
case RuleTypes.FontFace:
{
AddRuleSet(new FontFaceRule());
//SetParsingContext(ParsingContext.InDeclaration);
SetParsingContext(ParsingContext.BeforeFontFace);
break;
}
case RuleTypes.CharacterSet:
{
AddRuleSet(new CharacterSetRule());
SetParsingContext(ParsingContext.BeforeCharset);
break;
}
case RuleTypes.Namespace:
{
AddRuleSet(new NamespaceRule());
SetParsingContext(ParsingContext.BeforeNamespacePrefix);
break;
}
case RuleTypes.Supports:
{
_buffer = new StringBuilder();
AddRuleSet(new SupportsRule());
SetParsingContext(ParsingContext.InCondition);
break;
}
case BrowserPrefixes.Microsoft + RuleTypes.Keyframes:
case BrowserPrefixes.Mozilla + RuleTypes.Keyframes:
case BrowserPrefixes.Opera + RuleTypes.Keyframes:
case BrowserPrefixes.Webkit + RuleTypes.Keyframes:
case RuleTypes.Keyframes:
{
AddRuleSet(new KeyframesRule(value));
SetParsingContext(ParsingContext.BeforeKeyframesName);
break;
}
case RuleTypes.Document:
{
AddRuleSet(new DocumentRule());
SetParsingContext(ParsingContext.BeforeDocumentFunction);
break;
}
default:
{
_buffer = new StringBuilder();
AddRuleSet(new GenericRule());
SetParsingContext(ParsingContext.InUnknown);
ParseUnknown(token);
break;
}
}
return true;
}
if (token.GrammarSegment == GrammarSegment.CurlyBracketClose)
{
return FinalizeRule();
}
if (token.GrammarSegment == GrammarSegment.Semicolon)
{
return true;
}
AddRuleSet(new StyleRule());
SetParsingContext(ParsingContext.InSelector);
ParseSelector(token);
return true;
}
开发者ID:GroM,项目名称:ExCSS,代码行数:95,代码来源:Parser.Blocks.cs
示例16: ParseNamespace
private bool ParseNamespace(Block token)
{
SetParsingContext(ParsingContext.AfterInstruction);
if (token.GrammarSegment != GrammarSegment.String)
{
return ParsePostInstruction(token);
}
CastRuleSet<NamespaceRule>().Uri = ((StringBlock)token).Value;
return true;
}
开发者ID:GroM,项目名称:ExCSS,代码行数:13,代码来源:Parser.Blocks.cs
示例17: ParseMediaValue
private bool ParseMediaValue(Block token)
{
switch (token.GrammarSegment)
{
case GrammarSegment.CurlyBraceOpen:
case GrammarSegment.Semicolon:
{
var container = CurrentRule as ISupportsMedia;
var medium = _buffer.ToString();
if (container != null)
{
container.Media.AppendMedium(medium);
}
if (CurrentRule is ImportRule)
{
return ParsePostInstruction(token);
}
SetParsingContext(ParsingContext.DataBlock);
return token.GrammarSegment == GrammarSegment.CurlyBraceOpen;
}
case GrammarSegment.Comma:
{
var container = CurrentRule as ISupportsMedia;
if (container != null)
{
container.Media.AppendMedium(_buffer.ToString());
}
_buffer.Clear();
return true;
}
case GrammarSegment.Whitespace:
{
_buffer.Append(' ');
return true;
}
default:
{
_buffer.Append(token);
return true;
}
}
}
开发者ID:GroM,项目名称:ExCSS,代码行数:47,代码来源:Parser.Blocks.cs
示例18: ParseMediaList
private bool ParseMediaList(Block token)
{
if (token.GrammarSegment == GrammarSegment.Semicolon)
{
FinalizeRule();
SetParsingContext(ParsingContext.DataBlock);
return true;
}
_buffer = new StringBuilder();
SetParsingContext(ParsingContext.InMediaValue);
return ParseMediaValue(token);
}
开发者ID:GroM,项目名称:ExCSS,代码行数:13,代码来源:Parser.Blocks.cs
示例19: ParseLeadingPrefix
private bool ParseLeadingPrefix(Block token)
{
if (token.GrammarSegment == GrammarSegment.Ident)
{
CastRuleSet<NamespaceRule>().Prefix = ((SymbolBlock)token).Value;
SetParsingContext(ParsingContext.AfterNamespacePrefix);
return true;
}
if (token.GrammarSegment == GrammarSegment.String || token.GrammarSegment == GrammarSegment.Url)
{
CastRuleSet<NamespaceRule>().Uri = ((StringBlock)token).Value;
return true;
}
SetParsingContext(ParsingContext.AfterInstruction);
return ParsePostInstruction(token);
}
开发者ID:GroM,项目名称:ExCSS,代码行数:20,代码来源:Parser.Blocks.cs
示例20: ParseKeyframeText
private bool ParseKeyframeText(Block token)
{
if (token.GrammarSegment == GrammarSegment.CurlyBraceOpen)
{
_frame = null;
SetParsingContext(ParsingContext.InDeclaration);
return true;
}
if (token.GrammarSegment == GrammarSegment.CurlyBracketClose)
{
ParseKeyframesData(token);
return false;
}
if (token.GrammarSegment == GrammarSegment.Comma)
{
return true;
}
if (_frame == null)
{
_frame = new KeyframeRule();
_frame.AddValue(token.ToString());
CastRuleSet<KeyframesRule>().Declarations.Add(_frame);
_activeRuleSets.Push(_frame);
}
else
{
_frame.AddValue(token.ToString());
}
return true;
}
开发者ID:GroM,项目名称:ExCSS,代码行数:35,代码来源:Parser.Blocks.cs
注:本文中的ExCSS.Model.TextBlocks.Block类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论