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);
         }
     }
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 10
0
 public void MergeByMainBlock(SyntaxDefinition Target)
 {
     SpanDefinition[] spanDefinitions = SpanDefinitions;
     foreach (SpanDefinition bt in spanDefinitions)
     {
         bt.childSpanDefinitions.Insert(0, Target.mainSpanDefinition);
     }
 }
Ejemplo n.º 11
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);
         }
     }
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Default spanDefinition constructor
 /// </summary>
 public SpanDefinition(SyntaxDefinition parent) : this()
 {
     Parent = parent;
     Parent.ChangeVersion();
 }