public void MergeByMainBlock(SyntaxDefinition Target)
 {
     SpanDefinition[] spanDefinitions = SpanDefinitions;
     foreach (SpanDefinition bt in spanDefinitions)
     {
         bt.childSpanDefinitions.Insert(0, Target.mainSpanDefinition);
     }
 }
        /// <summary>
        /// Load a specific language 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>
        public SyntaxDefinitionList()
        {
            languages = new List <SyntaxDefinition>();

            string[] files = Directory.GetFiles(".", "*.syn");
            foreach (string file in files)
            {
                var loader = new SyntaxDefinitionLoader();
                SyntaxDefinition syntax = loader.Load(file);
                languages.Add(syntax);
            }
        }
 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);
         }
     }
 }
Exemple #5
0
        /// <summary>
        /// Load a specific language 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;
        }
Exemple #7
0
        /// <summary>
        /// Load a specific language 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);
        }
Exemple #8
0
        /// <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 language 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;
        }
 public void MergeByMainBlock(SyntaxDefinition Target)
 {
     SpanDefinition[] spanDefinitions = SpanDefinitions;
     foreach (SpanDefinition bt in spanDefinitions)
     {
         bt.childSpanDefinitions.Insert(0, Target.mainSpanDefinition);
     }
 }
 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);
         }
     }
 }
 /// <summary>
 /// Default spanDefinition constructor
 /// </summary>
 public SpanDefinition(SyntaxDefinition parent) : this()
 {
     Parent = parent;
     Parent.ChangeVersion();
 }