コード例 #1
0
ファイル: fileparser.cs プロジェクト: KillerGoldFisch/GCharp
        /// <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;
        }
コード例 #2
0
ファイル: fileparser.cs プロジェクト: KillerGoldFisch/GCharp
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="statement">'Import' statement from the script file to be parsed</param>
        public ScriptInfo(string statement)
        {
            RegexFind(statement, @"\w*,?", ref fileName);
            fileName = fileName.Trim(" ,".ToCharArray());

            string rename = "";
            foreach (string match in RegexGetMatches(statement, @"rename_namespace\s*\(\s* \w+ \s* , \s* \w+ \s*\)", null))
            {
                if (match.Length > 0)
                {
                    rename = match.Replace("rename_namespace","").Trim("()".ToCharArray());
                    if (parseParams == null)
                        parseParams = new ParsingParams();

                    parseParams.AddRenameNamespaceMap(rename.Split(",".ToCharArray()));
                }
            }
        }
コード例 #3
0
ファイル: fileparser.cs プロジェクト: KillerGoldFisch/GCharp
 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();
 }