ParsingParams is an class that holds parsing parameters (parameters that controls how file is to be parsed). At this moment they are namespace renaming rules only.
Exemplo n.º 1
0
		/// <summary>
		/// Compare() is to be used to help with implementation of IComparer for sorting operations.
		/// </summary>
		public static int Compare(ParsingParams xPrams, ParsingParams yPrams)
		{
			if (xPrams == null && yPrams == null)
				return 0;

			int retval =  xPrams == null ? -1 : (yPrams == null ? 1 : 0); 
			
			if (retval == 0)
			{
				string[][] xNames = xPrams.RenameNamespaceMap;
				string[][] yNames = yPrams.RenameNamespaceMap;
				retval = Comparer.Default.Compare(xNames.Length, yNames.Length);
				if (retval == 0)
				{
					for (int i = 0; i < xNames.Length && retval == 0; i++)
					{
						retval = Comparer.Default.Compare(xNames[i].Length, yNames[i].Length);
						if (retval == 0)
						{
							for (int j = 0; j < xNames[i].Length; j++)
							{
								retval = Comparer.Default.Compare(xNames[i][j], yNames[i][j]);
							}
						}
					}
				}
			}
			return retval;
		}
Exemplo n.º 2
0
        /// <summary>
        /// Compare() is to be used to help with implementation of IComparer for sorting operations.
        /// </summary>
        public static int Compare(ParsingParams xPrams, ParsingParams yPrams)
        {
            if (xPrams == null && yPrams == null)
            {
                return(0);
            }

            int retval = xPrams == null ? -1 : (yPrams == null ? 1 : 0);

            if (retval == 0)
            {
                string[][] xNames = xPrams.RenameNamespaceMap;
                string[][] yNames = yPrams.RenameNamespaceMap;
                retval = System.Collections.Comparer.Default.Compare(xNames.Length, yNames.Length);
                if (retval == 0)
                {
                    for (int i = 0; i < xNames.Length && retval == 0; i++)
                    {
                        retval = System.Collections.Comparer.Default.Compare(xNames[i].Length, yNames[i].Length);
                        if (retval == 0)
                        {
                            for (int j = 0; j < xNames[i].Length; j++)
                            {
                                retval = System.Collections.Comparer.Default.Compare(xNames[i][j], yNames[i][j]);
                            }
                        }
                    }
                }
            }
            return(retval);
        }
Exemplo n.º 3
0
 public FileParser(string fileName, ParsingParams prams, bool process, bool imported, string[] searchDirs)
 {
     this.imported   = imported;
     this.prams      = prams;
     this.searchDirs = searchDirs;
     this.fileName   = ResolveFile(fileName, searchDirs);
     if (process)
     {
         ProcessFile();
     }
 }
Exemplo n.º 4
0
        public FileParser(string fileName, ParsingParams prams, bool process, bool imported, string[] searchDirs, bool throwOnError)
        {
            if (searchDirs == null)
            {
                searchDirs = new string[0];
            }

            FileParser._throwOnError = throwOnError;
            this.imported            = imported;
            this.prams      = prams;
            this.fileName   = ResolveFile(fileName, searchDirs);
            this.searchDirs = Utils.RemovePathDuplicates(Utils.Concat(searchDirs, Path.GetDirectoryName(this.fileName)));
            if (process)
            {
                ProcessFile();
            }
        }
Exemplo n.º 5
0
        public int Compare(FileParser x, FileParser y)
        {
            if (x == null && y == null)
            {
                return(0);
            }

            int retval = x == null ? -1 : (y == null ? 1 : 0);

            if (retval == 0)
            {
                retval = string.Compare(x.fileName, y.fileName, true);
                if (retval == 0)
                {
                    retval = ParsingParams.Compare(x.prams, y.prams);
                }
            }

            return(retval);
        }
Exemplo n.º 6
0
        int IComparer.Compare(object x, object y)
        {
            if (x == null && y == null)
            {
                return(0);
            }

            int retval = x == null ? -1 : (y == null ? 1 : 0);

            if (retval == 0)
            {
                FileParser xParser = (FileParser)x;
                FileParser yParser = (FileParser)y;
                retval = string.Compare(xParser.fileName, yParser.fileName, true);
                if (retval == 0)
                {
                    retval = ParsingParams.Compare(xParser.prams, yParser.prams);
                }
            }

            return(retval);
        }
Exemplo n.º 7
0
		public FileParser(string fileName, ParsingParams prams, bool process, bool imported, string[] searchDirs)
		{
			this.imported = imported;
			this.prams = prams;
			this.searchDirs = searchDirs;
			this.fileName = ResolveFile(fileName, searchDirs);
			if (process)
				ProcessFile();
		}