/// <summary>
        /// Load a specific syntax file
        /// </summary>
        /// <param name="File">File name</param>
        /// <returns>SyntaxDefinition object</returns>
        public SyntaxDefinition Load(string File)
        {
            styleLookup = new Hashtable();
            spanDefinitionLookup = new Hashtable();
            syntaxDefinition = new SyntaxDefinition();

            var xmlDocument = new XmlDocument();
            xmlDocument.Load(File);
            ReadLanguageDefinition(xmlDocument);

            return syntaxDefinition;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="File"></param>
        /// <param name="Separators"></param>
        /// <returns></returns>
        public SyntaxDefinition Load(string File, string Separators)
        {
            styleLookup = new Hashtable();
            spanDefinitionLookup = new Hashtable();
            syntaxDefinition = new SyntaxDefinition {Separators = Separators};

            var xmlDocument = new XmlDocument();
            xmlDocument.Load(File);
            ReadLanguageDefinition(xmlDocument);

            if (syntaxDefinition.mainSpanDefinition == null)
            {
                throw new Exception("no main block found in syntax");
            }

            return syntaxDefinition;
        }
        /// <summary>
        /// Load a specific syntax from an xml string
        /// </summary>
        /// <param name="XML"></param>
        /// <returns></returns>
        public SyntaxDefinition LoadXML(string XML)
        {
            styleLookup = new Hashtable();
            spanDefinitionLookup = new Hashtable();
            syntaxDefinition = new SyntaxDefinition();

            var xmlDocument = new XmlDocument();
            xmlDocument.LoadXml(XML);
            ReadLanguageDefinition(xmlDocument);

            if (syntaxDefinition.mainSpanDefinition == null)
            {
                throw new Exception("no main block found in syntax");
            }

            return syntaxDefinition;
        }
Example #4
0
 public void MergeByMainBlock(SyntaxDefinition Target)
 {
     SpanDefinition[] spanDefinitions = SpanDefinitions;
     foreach (SpanDefinition bt in spanDefinitions)
     {
         bt.childSpanDefinitions.Insert(0, Target.mainSpanDefinition);
     }
 }
Example #5
0
 public void MergeByChildBlocks(SyntaxDefinition Target)
 {
     SpanDefinition[] spanDefinitions = SpanDefinitions;
     foreach (SpanDefinition bt in spanDefinitions)
     {
         for (int i = Target.mainSpanDefinition.childSpanDefinitions.Count - 1; i >= 0; i--)
         {
             SpanDefinition child = Target.mainSpanDefinition.childSpanDefinitions[i];
             bt.childSpanDefinitions.Insert(0, child);
         }
     }
 }