• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ITextProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ITextProvider的典型用法代码示例。如果您正苦于以下问题:C# ITextProvider类的具体用法?C# ITextProvider怎么用?C# ITextProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ITextProvider类属于命名空间,在下文中一共展示了ITextProvider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Parse

        public override bool Parse(IItemFactory itemFactory, ITextProvider text, ITokenStream stream)
        {
            if (stream.Current.Type == TokenType.LessThan)
            {
                OpenTag = Children.AddCurrentAndAdvance(stream, SassClassifierType.XmlDocumentationTag);
                if (stream.Current.Type == TokenType.Identifier)
                {
                    Name = Children.AddCurrentAndAdvance(stream, SassClassifierType.XmlDocumentationTag);

                    while (!IsTagTerminator(stream.Current.Type))
                    {
                        var attribute = itemFactory.CreateSpecific<XmlAttribute>(this, text, stream);
                        if (!attribute.Parse(itemFactory, text, stream))
                            break;

                        Children.Add(attribute);
                        _Attributes.Add(attribute);
                        OnAttributeParsed(attribute, text);
                    }
                }

                if (stream.Current.Type == TokenType.Slash)
                    CloseSlash = Children.AddCurrentAndAdvance(stream, SassClassifierType.XmlDocumentationTag);

                if (stream.Current.Type == TokenType.GreaterThan)
                    CloseTag = Children.AddCurrentAndAdvance(stream, SassClassifierType.XmlDocumentationTag);
            }

            return Children.Count > 0;
        }
开发者ID:profet23,项目名称:SassyStudio,代码行数:30,代码来源:XmlDocumentationTag.cs


示例2: Parse

        public override bool Parse(IItemFactory itemFactory, ITextProvider text, ITokenStream stream)
        {
            if (stream.Current.Type == TokenType.String || stream.Current.Type == TokenType.BadString)
                Value = Children.AddCurrentAndAdvance(stream, SassClassifierType.String);

            return Children.Count > 0;
        }
开发者ID:profet23,项目名称:SassyStudio,代码行数:7,代码来源:StringValue.cs


示例3: Parse

        public override bool Parse(IItemFactory itemFactory, ITextProvider text, ITokenStream stream)
        {
            if (ParseSelectorToken(itemFactory, text, stream))
                ParseCombinator(itemFactory, text, stream);

            return Children.Count > 0;
        }
开发者ID:profet23,项目名称:SassyStudio,代码行数:7,代码来源:SimpleSelector.cs


示例4: Parse

        public override bool Parse(IItemFactory itemFactory, ITextProvider text, ITokenStream stream)
        {
            if (AtRule.IsRule(text, stream, "each"))
            {
                ParseRule(itemFactory, text, stream);
                while (!IsListTerminator(stream.Current.Type))
                {
                    var item = itemFactory.CreateSpecific<ListItem>(this, text, stream);
                    if (item != null && item.Parse(itemFactory, text, stream))
                    {
                        _Items.Add(item);
                        Children.Add(item);
                    }
                    else
                    {
                        // bad news bears
                        Children.AddCurrentAndAdvance(stream);
                    }
                }

                ParseBody(itemFactory, text, stream);
            }

            return Children.Count > 0;
        }
开发者ID:profet23,项目名称:SassyStudio,代码行数:25,代码来源:EachLoopDirective.cs


示例5: ParseImport

        protected override void ParseImport(IItemFactory itemFactory, ITextProvider text, ITokenStream stream)
        {
            if (stream.Current.Type == TokenType.String || stream.Current.Type == TokenType.BadString)
            {
                Filename = itemFactory.CreateSpecificParsed<StringValue>(this, text, stream);
                if (Filename != null)
                    Children.Add(Filename);
            }
            else if (UrlItem.IsUrl(text, stream.Current))
            {
                var url = new UrlItem();
                if (url.Parse(itemFactory, text, stream))
                {
                    Url = url;
                    Children.Add(url);
                }
            }

            while (!IsTerminator(stream.Current.Type))
            {
                var query = new MediaQuery();
                if (!query.Parse(itemFactory, text, stream))
                    break;

                _MediaQueries.Add(query);
                Children.Add(query);
            }
        }
开发者ID:profet23,项目名称:SassyStudio,代码行数:28,代码来源:CssImportDirective.cs


示例6: LineBreaksAfterPosition

        /// <summary>
        /// Determines number of line breaks after position
        /// </summary>
        public static int LineBreaksAfterPosition(ITextProvider textProvider, int position) {
            int count = 0;

            for (int i = position; i < textProvider.Length; i++) {
                char ch = textProvider[i];

                if (!Char.IsWhiteSpace(ch))
                    return count;

                if (ch == '\r') {
                    if (i < textProvider.Length - 1 && textProvider[i + 1] == '\n') {
                        i++;
                    }

                    count++;
                } else if (ch == '\n') {
                    if (i < textProvider.Length - 1 && textProvider[i + 1] == '\r') {
                        i++;
                    }

                    count++;
                }
            }

            return count;
        }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:29,代码来源:Whitespace.cs


示例7: TextChangeEventArgs

 public TextChangeEventArgs(int start, int oldLength, int newLength, ITextProvider oldText, ITextProvider newText) {
     Start = start;
     OldLength = oldLength;
     NewLength = newLength;
     OldText = oldText;
     NewText = newText;
 }
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:7,代码来源:TextChangeArgs.cs


示例8: ResolvePath

        public static string ResolvePath(StringValue item, ITextProvider text, DirectoryInfo currentDirectory)
        {
            var relativePath = text.GetText(item.Start, item.Length).Trim('\'', '"');
            var segments = relativePath.Split('/');
            if (segments.Length == 0)
                return null;

            var path = currentDirectory.FullName;
            for (int i = 0; i < (segments.Length - 1); i++)
                path = Path.Combine(path, segments[i]);

            var directory = new DirectoryInfo(Path.GetFullPath(path));
            if (!directory.Exists)
                return null;

            var filename = segments[segments.Length - 1];
            if (string.IsNullOrEmpty(Path.GetExtension(filename)))
                filename += ".scss";

            var files = directory.GetFiles("*" + filename);

            var comparer = StringComparer.OrdinalIgnoreCase;
            return files.Where(x => comparer.Equals(x.Name, filename) || comparer.Equals(x.Name, "_" + filename))
                .Select(x => x.FullName)
                .FirstOrDefault();
        }
开发者ID:profet23,项目名称:SassyStudio,代码行数:26,代码来源:ImportResolver.cs


示例9: TextChange

        public TextChange(int start, int oldLength, int newLength, ITextProvider oldText, ITextProvider newText)
            : this() {
            this.Combine(new TextChange(start, oldLength, newLength));

            OldText = oldText;
            NewText = newText;
        }
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:7,代码来源:textchange.cs


示例10: Parse

        public override bool Parse(IItemFactory itemFactory, ITextProvider text, ITokenStream stream)
        {
            if (stream.Current.Type == TokenType.XmlDocumentationComment)
            {
                Opening = Children.AddCurrentAndAdvance(stream, SassClassifierType.XmlDocumentationTag);

                // look for <reference
                if (stream.Current.Type == TokenType.LessThan)
                {
                    var tag = itemFactory.CreateSpecific<XmlDocumentationTag>(this, text, stream);
                    if (tag.Parse(itemFactory, text, stream))
                    {
                        Tag = tag;
                        Children.Add(tag);
                    }
                    else
                    {
                        Children.AddCurrentAndAdvance(stream, SassClassifierType.XmlDocumentationComment);
                    }
                }
                else
                {
                    while (!IsCommentTerminator(stream.Current.Type))
                    {
                        Children.AddCurrentAndAdvance(stream, SassClassifierType.XmlDocumentationComment);
                    }
                }

                //if (stream.Current.Type == TokenType.NewLine)
                //    NewLine = Children.AddCurrentAndAdvance(stream);
            }

            return Children.Count > 0;
        }
开发者ID:profet23,项目名称:SassyStudio,代码行数:34,代码来源:XmlDocumentationComment.cs


示例11: Parse

        public override bool Parse(IItemFactory itemFactory, ITextProvider text, ITokenStream stream)
        {
            while (!IsSelectorTerminator(stream.Current.Type))
            {
                var selector = itemFactory.CreateSpecific<SelectorGroup>(this, text, stream);
                if (!selector.Parse(itemFactory, text, stream))
                    break;

                _Selectors.Add(selector);
                Children.Add(selector);

                if (stream.Current.Type == TokenType.Comma)
                    Children.AddCurrentAndAdvance(stream, SassClassifierType.Punctuation);
            }

            if (stream.Current.Type == TokenType.OpenCurlyBrace)
            {
                var block = itemFactory.CreateSpecific<RuleBlock>(this, text, stream);
                if (block.Parse(itemFactory, text, stream))
                {
                    Block = block;
                    Children.Add(block);
                }
            }

            return Children.Count > 0;
        }
开发者ID:profet23,项目名称:SassyStudio,代码行数:27,代码来源:RuleSet.cs


示例12: Parse

        public override bool Parse(IItemFactory itemFactory, ITextProvider text, ITokenStream stream)
        {
            if (AtRule.IsRule(text, stream, "extend"))
            {
                Rule = AtRule.CreateParsed(itemFactory, text, stream);
                if (Rule != null)
                    Children.Add(Rule);

                var selector = itemFactory.CreateSpecific<SelectorGroup>(this, text, stream);
                if (selector.Parse(itemFactory, text, stream))
                {
                    Selector = selector;
                    Children.Add(selector);
                }

                if (stream.Current.Type == TokenType.Bang)
                {
                    var modifier = new OptionalModifier();
                    if (modifier.Parse(itemFactory, text, stream))
                    {
                        Modifier = modifier;
                        Children.Add(modifier);
                    }
                }

                if (stream.Current.Type == TokenType.Semicolon)
                    Semicolon = Children.AddCurrentAndAdvance(stream, SassClassifierType.Punctuation);
            }

            return Children.Count > 0;
        }
开发者ID:profet23,项目名称:SassyStudio,代码行数:31,代码来源:ExtendDirective.cs


示例13: IsSelfClosing

        /// <summary>
        /// Determines if element is a self-closing element (i.e. like &lt;br /&gt;
        /// </summary>
        /// <param name="textProvider">Text provider</param>
        /// <param name="prefixRange">Text range of the element prefix</param>
        /// <param name="nameRange">Text range of the element name</param>
        /// <returns>True if element is a self-closing element.</returns>
        public bool IsSelfClosing(ITextProvider textProvider, ITextRange prefixRange, ITextRange nameRange) {
            if (nameRange.Length == 0)
                return false;

            string name = textProvider.GetText(nameRange);
            if (name[0] == '!')
                return true; // bang tags are always self-closing

            if (prefixRange.Length == 0)
                return _defaultProvider.IsSelfClosing(textProvider, nameRange);

            string prefix = textProvider.GetText(prefixRange);

            IHtmlClosureProvider provider; ;
            _providers.TryGetValue(prefix, out provider);

            var textRangeProvider = provider as IHtmlClosureProviderTextRange;
            if (textRangeProvider != null)
                return textRangeProvider.IsSelfClosing(textProvider, nameRange);

            if (provider != null)
                return provider.IsSelfClosing(name);

            return false;
        }
开发者ID:Microsoft,项目名称:RTVS,代码行数:32,代码来源:ElementClosureProvider.cs


示例14: Parse

        public override bool Parse(IItemFactory itemFactory, ITextProvider text, ITokenStream stream)
        {
            if (stream.Current.Type == TokenType.Identifier && IsModifier(text.GetText(stream.Current.Start, stream.Current.Length)))
                Modifier = Children.AddCurrentAndAdvance(stream);

            ParseItem mediaType;
            if (itemFactory.TryCreateParsedOrDefault(this, text, stream, out mediaType))
            {
                MediaType = mediaType;
                Children.Add(mediaType);
            }

            while (!IsTerminator(text, stream))
            {
                var expression = itemFactory.CreateSpecific<MediaQueryExpression>(this, text, stream);
                if (expression.Parse(itemFactory, text, stream))
                {
                    _Expressions.Add(expression);
                    Children.Add(expression);
                }
                else
                {
                    Children.AddCurrentAndAdvance(stream);
                }
            }

            if (stream.Current.Type == TokenType.Comma)
                Comma = Children.AddCurrentAndAdvance(stream, SassClassifierType.Punctuation);

            return Children.Count > 0;
        }
开发者ID:profet23,项目名称:SassyStudio,代码行数:31,代码来源:MediaQuery.cs


示例15: LineBreaksBeforePosition

        /// <summary>
        /// Determines number of line breaks before position
        /// </summary>
        public static int LineBreaksBeforePosition(ITextProvider textProvider, int position) {
            int count = 0;

            if (position > 0) {
                for (int i = position - 1; i >= 0; i--) {
                    char ch = textProvider[i];

                    if (!Char.IsWhiteSpace(ch))
                        return count;

                    if (ch == '\r') {
                        if (i > 0 && textProvider[i - 1] == '\n') {
                            i--;
                        }

                        count++;
                    } else if (ch == '\n') {
                        if (i > 0 && textProvider[i - 1] == '\r') {
                            i--;
                        }

                        count++;
                    }
                }
            }

            return count;
        }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:31,代码来源:Whitespace.cs


示例16: value_TextChanged

 private void value_TextChanged(ITextProvider sender, string oldText, string newText)
 {
     double celsius = 0;
     double.TryParse(value.Text, out celsius);
     double fahrenheit = celsius * 9 / 5 + 32;
     result.Text = fahrenheit.ToString();
 }
开发者ID:Ju2ender,项目名称:csharp-e,代码行数:7,代码来源:TutorialRootBlock.cs


示例17: IsValidModifier

        public static bool IsValidModifier(ITextProvider text, Token token, string name)
        {
            if (token.Type == TokenType.Identifier)
                return text.CompareOrdinal(token.Start, name);

            return false;
        }
开发者ID:profet23,项目名称:SassyStudio,代码行数:7,代码来源:BangModifier.cs


示例18: GetName

        public string GetName(ITextProvider text)
        {
            if (IsValid)
                return text.GetText(Name.Start, Name.Length);

            return null;
        }
开发者ID:profet23,项目名称:SassyStudio,代码行数:7,代码来源:UserFunctionDefinition.cs


示例19: Parse

        public override bool Parse(IItemFactory itemFactory, ITextProvider text, ITokenStream stream)
        {
            if ((IsConditionalDirective(text, stream) || IsConditionalContinuationDirective(text, stream)))
            {
                ParseRule(itemFactory, text, stream);

                while (!IsConditionTerminator(stream.Current.Type))
                {
                    ParseItem item;
                    if (itemFactory.TryCreateParsedOrDefault(this, text, stream, out item))
                    {
                        Children.Add(item);
                        ConditionStatements.Add(item);
                    }
                    else
                    {
                        Children.AddCurrentAndAdvance(stream);
                    }
                }

                ParseBody(itemFactory, text, stream);

                while (IsConditionalContinuationDirective(text, stream))
                {
                    var subsequentConditional = itemFactory.CreateSpecific<ConditionalControlDirective>(this, text, stream);
                    if (!subsequentConditional.Parse(itemFactory, text, stream))
                        break;

                    ElseStatements.Add(subsequentConditional);
                    Children.Add(subsequentConditional);
                }
            }

            return Children.Count > 0;
        }
开发者ID:profet23,项目名称:SassyStudio,代码行数:35,代码来源:ConditionalControlDirective.cs


示例20: Parse

        public override bool Parse(IItemFactory itemFactory, ITextProvider text, ITokenStream stream)
        {
            if (AtRule.IsRule(text, stream, "media"))
            {
                Rule = AtRule.CreateParsed(itemFactory, text, stream);
                if (Rule != null)
                    Children.Add(Rule);

                while (!IsTerminator(stream.Current.Type))
                {
                    var query = itemFactory.CreateSpecific<MediaQuery>(this, text, stream);
                    if (query.Parse(itemFactory, text, stream))
                    {
                        _Queries.Add(query);
                        Children.Add(query);
                    }
                    else
                    {
                        Children.AddCurrentAndAdvance(stream);
                    }
                }

                var block = itemFactory.CreateSpecific<MediaQueryBlock>(this, text, stream);
                if (block.Parse(itemFactory, text, stream))
                {
                    Body = block;
                    Children.Add(block);
                }
            }

            return Children.Count > 0;
        }
开发者ID:profet23,项目名称:SassyStudio,代码行数:32,代码来源:MediaQueryDirective.cs



注:本文中的ITextProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ITextRange类代码示例发布时间:2022-05-24
下一篇:
C# ITextPointer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap