GetSyntaxMode() публичный статический Метод

public static GetSyntaxMode ( TextDocument doc, string mimeType ) : Mono.TextEditor.Highlighting.SyntaxMode
doc TextDocument
mimeType string
Результат Mono.TextEditor.Highlighting.SyntaxMode
Пример #1
0
        public static SyntaxMode Read(XmlReader reader)
        {
            SyntaxMode    result         = new SyntaxMode();
            List <Match>  matches        = new List <Match> ();
            List <Span>   spanList       = new List <Span> ();
            List <Marker> prevMarkerList = new List <Marker> ();

            XmlReadHelper.ReadList(reader, Node, delegate() {
                switch (reader.LocalName)
                {
                case Node:
                    string extends = reader.GetAttribute("extends");
                    if (!String.IsNullOrEmpty(extends))
                    {
                        result = (SyntaxMode)SyntaxModeService.GetSyntaxMode(extends).MemberwiseClone();
                    }
                    result.Name     = reader.GetAttribute("name");
                    result.MimeType = reader.GetAttribute(MimeTypesAttribute);
                    if (!String.IsNullOrEmpty(reader.GetAttribute("ignorecase")))
                    {
                        result.IgnoreCase = Boolean.Parse(reader.GetAttribute("ignorecase"));
                    }
                    return(true);

                case Rule.Node:
                    result.rules.Add(Rule.Read(result, reader, result.IgnoreCase));
                    return(true);
                }
                return(result.ReadNode(reader, matches, spanList, prevMarkerList));
            });
            result.spans      = spanList.ToArray();
            result.prevMarker = prevMarkerList.ToArray();
            result.matches    = matches.ToArray();
            return(result);
        }
Пример #2
0
        static SyntaxModeService()
        {
            StartUpdateThread();
            LoadStylesAndModes(typeof(SyntaxModeService).Assembly);
            SyntaxModeService.GetSyntaxMode("text/x-csharp").AddSemanticRule("Comment", new HighlightUrlSemanticRule("comment"));
            SyntaxModeService.GetSyntaxMode("text/x-csharp").AddSemanticRule("XmlDocumentation", new HighlightUrlSemanticRule("comment"));
            SyntaxModeService.GetSyntaxMode("text/x-csharp").AddSemanticRule("String", new HighlightUrlSemanticRule("string"));

            InstallSyntaxMode("text/x-jay", new JaySyntaxMode());
        }
Пример #3
0
        public override Rule GetRule(TextDocument document, string name)
        {
            if (name == null || name == "<root>")
            {
                return(this);
            }
            if (name.StartsWith("mode:", StringComparison.Ordinal))
            {
                return(SyntaxModeService.GetSyntaxMode(document, name.Substring("mode:".Length)));
            }

            foreach (Rule rule in rules)
            {
                if (rule.Name == name)
                {
                    return(rule);
                }
            }
            return(this);
        }
Пример #4
0
        public override Rule GetRule(string name)
        {
            if (name == null || name == "<root>")
            {
                return(this);
            }
            if (name.StartsWith("mode:"))
            {
                return(SyntaxModeService.GetSyntaxMode(name.Substring("mode:".Length)));
            }

            foreach (Rule rule in rules)
            {
                if (rule.Name == name)
                {
                    return(rule);
                }
            }
            return(this);
        }