예제 #1
0
 public void Empty()
 {
     StringSet ss = new StringSet(new string[] { "" });
     Assert.AreEqual(1, ss.Count);
     ss = new StringSet((string[])null);
     Assert.AreEqual(0, ss.Count);
 }
예제 #2
0
        public void Enumerate()
        {
            StringSet ss = new StringSet();

            int i = 0;
            foreach (string s in ss)
            {
                i++;
                Console.WriteLine(s);
            }
            Assert.AreEqual(0, i);

            ss.Add("bloo");
            ss.Add("foo");
            ss.Add("bar");
            foreach (string s in ss)
            {
                i++;
                Console.WriteLine(s);
            }
            Assert.AreEqual(3, i);
            string[] arr = ss.GetStrings();
            Array.Sort(arr);
            Assert.AreEqual("bar", arr[0]);
            Assert.AreEqual("bloo", arr[1]);
            Assert.AreEqual("foo", arr[2]);
            Assert.AreEqual(3, arr.Length);
        }
예제 #3
0
 public void ShouldRemoveAndContainsReturnFalse()
 {
     var stringSet = new StringSet();
     stringSet.Add("Test");
     Assert.IsTrue(stringSet.Contains("Test"));
     stringSet.Remove("Test");
     Assert.IsFalse(stringSet.Contains("Test"));
 }
예제 #4
0
 public void ShouldCount()
 {
     var stringSet = new StringSet();
     stringSet.Add("Test");
     stringSet.Add("Test");
     stringSet.Add("Test");
     Assert.AreEqual(3, stringSet.Count);
     
 }
예제 #5
0
 public void ShouldClearTheSet()
 {
     var stringSet = new StringSet();
     stringSet.Add("Test");
     stringSet.Add("Test");
     stringSet.Add("Test");
     stringSet.Clear();
     Assert.AreEqual(0, stringSet.Count);
     
 }
예제 #6
0
 public void ShouldEnumerate()
 {
     var stringSet = new StringSet();
     stringSet.Add("Test");
     stringSet.Add("Test");
     stringSet.Add("Test");
     foreach (var test in stringSet)
     {
         Assert.IsTrue(stringSet.Contains(test));
     }
 }
예제 #7
0
        public void ShouldUnionTwoSet()
        {
            var set1 = new StringSet();
            var set2 = new StringSet();
            set1.Add("Test1");
            set2.Add("Test2");


            StringSet union = set1.Union(set2);

            Assert.AreEqual(2, union.Count);

            Assert.IsTrue( union.Contains("Test1"));
            Assert.IsTrue( union.Contains("Test2"));
        }
예제 #8
0
        public void Add()
        {
            StringSet ss = new StringSet();
            ss.Add("foo");
            ss.Add("foo");
            ss.Add("bar");
            Assert.IsTrue(ss["foo"]);
            Assert.AreEqual(2, ss.Count);
            Assert.AreEqual("foo\r\nbar\r\n", ss.ToString());
            ss.Remove("bar");
            Assert.AreEqual(1, ss.Count);
            Assert.IsFalse(ss["fool"]);

            ss = new StringSet(new string[] { "foo", "bar"});
            ss.Add(new StringSet("baz"));
            Assert.AreEqual(3, ss.Count);
        }
예제 #9
0
        public void ShouldIntersect()
        {
            var set1 = new StringSet();
            var set2 = new StringSet();
            set1.Add("Test1");
            set1.Add("Common1");
            set1.Add("Common2");
            set2.Add("Common1");
            set2.Add("Common2");
            set2.Add("Test2");


            StringSet intersect = set1.Intersect(set2);

            Assert.AreEqual(2, intersect.Count);

            Assert.IsTrue(intersect.Contains("Common1"));
            Assert.IsTrue(intersect.Contains("Common2"));
            
        }
예제 #10
0
 internal static StringSet ComputeGroupedExpectedSetForState(Grammar grammar, ParserState state)
 {
     var terms = new TerminalSet();
       terms.UnionWith(state.ExpectedTerminals);
       var result = new StringSet();
       //Eliminate no-report terminals
       foreach(var group in grammar.TermReportGroups)
     if (group.GroupType == TermReportGroupType.DoNotReport)
     terms.ExceptWith(group.Terminals);
       //Add normal and operator groups
       foreach(var group in grammar.TermReportGroups)
     if((group.GroupType == TermReportGroupType.Normal || group.GroupType == TermReportGroupType.Operator) &&
      terms.Overlaps(group.Terminals)) {
       result.Add(group.Alias);
       terms.ExceptWith(group.Terminals);
     }
       //Add remaining terminals "as is"
       foreach(var terminal in terms)
     result.Add(terminal.ErrorAlias);
       return result;
 }
예제 #11
0
        public void Merge()
        {
            StringSet ss = new StringSet();
            ss.Add("foo");
            StringSet so = new StringSet();
            so.Add("bar");
            so.Add("baz");
            ss.Add(so);
            Assert.AreEqual(3, ss.Count);

            so = new StringSet();
            so.Add("boo");
            so.Add("baz");
            ss.Add(so);
            Assert.AreEqual(4, ss.Count);

            ss.Remove(so);
            Assert.AreEqual(2, ss.Count);
            Assert.IsTrue(ss["foo"]);
            Assert.IsTrue(ss["bar"]);
            Assert.IsFalse(ss["boo"]);
            Assert.IsFalse(ss["baz"]);
            Assert.IsFalse(ss["bloo"]);
        }
예제 #12
0
 /// <summary>
 /// Add a single feature to the node.
 /// Does not fire OnFeatures, since this should mostly be used by
 /// things that are not querying externally.
 /// </summary>
 /// <param name="feature">The feature URI to add</param>
 public void AddFeature(string feature)
 {
     if (Features == null)
         Features = new StringSet();
     
     Features.Add(feature);
 }
예제 #13
0
 /// <summary>
 /// Add all of the features from the specified set.
 /// </summary>
 /// <param name="features"></param>
 public void AddFeatures(StringSet features)
 {
     if (features != null)
     {
         if (Features == null)
             Features = new StringSet(features);
         else
             Features.Add(features);
     }
     DoCallbacks(m_featureCallbacks);
 }
예제 #14
0
 public void Create()
 {
     StringSet ss = new StringSet();
     Assert.AreEqual(0, ss.Count);
     Assert.AreEqual("", ss.ToString());
 }
예제 #15
0
    static void Main()
    {
        StringSet ss = new StringSet();

        // Check the interface methods first.
        ISet <string> s = ss;

        checkThat(s.Count == 0, "is initially empty");
        checkThat(!s.Contains("key"), "doesn't contain inexistent element");
        checkThat(!s.Remove("key"), "returns false when removing inexistent element");

        checkThat(s.Add("key"), "returns true when adding a new element");
        checkThat(!s.Add("key"), "returns false when adding an existing element");
        checkThat(s.Contains("key"), "contains the just added element");
        checkThat(s.Remove("key"), "returns true when removing an existing element");
        checkThat(s.Count == 0, "is empty again");

        checkThat(s.Add("key1"), "Add(key1) returns true");
        checkThat(s.Add("key2"), "Add(key2) returns true");
        checkThat(s.Add("key3"), "Add(key3) returns true");

        // Also check a different interface, providing a different Add() (sic!).
        ICollection <string> coll = ss;

        coll.Add("key");
        checkThat(ss.Count == 4, "contains 4 elements");

        // Now use object-specific methods, mimicking HashSet<>.
        string val;

        checkThat(ss.TryGetValue("key1", out val), "could retrieve existing item");
        checkThat(val.Equals("key1"), "value was returned correctly by TryGetValue()");
        checkThat(!ss.TryGetValue("no-such-key", out val), "couldn't retrieve inexistent item");
        checkThat(val == null, "value was reset after failed TryGetValue()");

        IList <string> list = new List <string>();

        foreach (string str in ss)
        {
            list.Add(str);
        }
        checkThat(list.Count == 4, "copy contains 4 elements");

        ss.Clear();
        checkThat(ss.Count == 0, "is empty after Clear()");

        // Check set-theoretic methods.
        checkThat(new StringSet().SetEquals(new StringSet()), "SetEquals() works for empty sets");
        checkThat(new StringSet {
            "foo"
        }.SetEquals(new StringSet {
            "foo"
        }), "SetEquals() works for non-empty sets");
        checkThat(!new StringSet {
            "foo"
        }.SetEquals(new[] { "bar" }), "SetEquals() doesn't always return true");

        ss = new StringSet {
            "foo", "bar", "baz"
        };
        ss.ExceptWith(new[] { "baz", "quux" });
        checkThat(ss.SetEquals(new[] { "foo", "bar" }), "ExceptWith works");

        ss = new StringSet {
            "foo", "bar", "baz"
        };
        ss.IntersectWith(new[] { "baz", "quux" });
        checkThat(ss.SetEquals(new[] { "baz" }), "IntersectWith works");

        checkThat(ss.IsProperSubsetOf(new[] { "bar", "baz" }), "IsProperSubsetOf works");
        checkThat(!ss.IsProperSubsetOf(new[] { "baz" }), "!IsProperSubsetOf works");
        checkThat(ss.IsSubsetOf(new[] { "bar", "baz" }), "IsSubsetOf works");
        checkThat(!ss.IsSubsetOf(new[] { "bar" }), "!IsSubsetOf works");

        ss = new StringSet {
            "foo", "bar", "baz"
        };
        checkThat(ss.IsProperSupersetOf(new[] { "bar" }), "IsProperSupersetOf works");
        checkThat(!ss.IsProperSupersetOf(new[] { "quux" }), "IsProperSupersetOf works");
        checkThat(ss.IsSupersetOf(new[] { "foo", "bar", "baz" }), "IsProperSupersetOf works");
        checkThat(!ss.IsSupersetOf(new[] { "foo", "bar", "baz", "quux" }), "IsProperSupersetOf works");

        checkThat(ss.Overlaps(new[] { "foo" }), "Overlaps works");
        checkThat(!ss.Overlaps(new[] { "moo" }), "!Overlaps works");

        ss.SymmetricExceptWith(new[] { "baz", "quux" });
        checkThat(ss.SetEquals(new[] { "foo", "bar", "quux" }), "SymmetricExceptWith works");

        ss = new StringSet {
            "foo", "bar", "baz"
        };
        ss.UnionWith(new[] { "baz", "quux" });
        checkThat(ss.SetEquals(new[] { "foo", "bar", "baz", "quux" }), "UnionWith works");
    }
예제 #16
0
 public void ShouldAddStringAndContainsReturnTrue()
 {
     var stringSet = new StringSet();
     stringSet.Add("Test");
     Assert.IsTrue(stringSet.Contains("Test"));
 }
예제 #17
0
        private static void addPackagesAndDependacies(CopyError copyError, PackageSet set, StringSet packageNames, PackageList all)
        {
            foreach (var packageName in packageNames)
            {
                Package package;
                if (all.TryGetValue(packageName, out package))
                {
                    set.Add(package);

                    addPackagesAndDependacies(copyError, set, package.Dependencies, all);
                }
                else
                {
                    copyError.AddError(new CopyError.Error
                    {
                        title   = "Package not found!",
                        message = string.Format("Could not find package with name '{0}'", packageName),
                    });
                }
            }
        }
예제 #18
0
        /* Function: Start_ApplyProperties
         * A helper function that is used only by <Start()> to combine a <ConfigFileCommentType's> properties into <commentTypes> and
         * its keywords into <singularKeywords> and <pluralKeywords>.  Assumes entries were already created for all of them by
         * <Start_CreateType()>.  Returns whether it was able to do so without causing an error.
         */
        private bool Start_ApplyProperties(ConfigFileCommentType configFileCommentType, Path sourceFile,
                                           StringSet ignoredKeywords, Errors.ErrorList errorList)
        {
            CommentType commentType = commentTypes[configFileCommentType.Name];
            bool        success     = true;


            // Display names

            if (configFileCommentType.DisplayNameFromLocale != null)
            {
                commentType.DisplayName = Locale.Get("NaturalDocs.Engine", configFileCommentType.DisplayNameFromLocale);
            }
            else if (configFileCommentType.DisplayName != null)
            {
                commentType.DisplayName = configFileCommentType.DisplayName;
            }

            if (configFileCommentType.PluralDisplayNameFromLocale != null)
            {
                commentType.PluralDisplayName = Locale.Get("NaturalDocs.Engine", configFileCommentType.PluralDisplayNameFromLocale);
            }
            else if (configFileCommentType.PluralDisplayName != null)
            {
                commentType.PluralDisplayName = configFileCommentType.PluralDisplayName;
            }


            // Other properties

            if (configFileCommentType.SimpleIdentifier != null)
            {
                commentType.SimpleIdentifier = configFileCommentType.SimpleIdentifier;
            }

            if (configFileCommentType.Index != null)
            {
                commentType.Index = (CommentType.IndexValue)configFileCommentType.Index;

                if (commentType.Index == CommentType.IndexValue.IndexWith)
                {
                    CommentType indexWithCommentType = commentTypes[configFileCommentType.IndexWith];

                    if (indexWithCommentType == null)
                    {
                        errorList.Add(
                            Locale.Get("NaturalDocs.Engine", "Comments.txt.IndexWithCommentTypeDoesntExist(name)", configFileCommentType.IndexWith),
                            sourceFile, configFileCommentType.LineNumber
                            );

                        success = false;
                    }

                    else
                    {
                        commentType.IndexWith = indexWithCommentType.ID;
                    }
                }
            }

            if (configFileCommentType.Scope != null)
            {
                commentType.Scope = (CommentType.ScopeValue)configFileCommentType.Scope;
            }
            if (configFileCommentType.Flags.AllConfigurationProperties != 0)
            {
                commentType.Flags.AllConfigurationProperties = configFileCommentType.Flags.AllConfigurationProperties;
            }
            if (configFileCommentType.BreakLists != null)
            {
                commentType.BreakLists = (bool)configFileCommentType.BreakLists;
            }


            // Keywords

            List <string> keywords = configFileCommentType.Keywords;

            for (int i = 0; i < keywords.Count; i += 2)
            {
                if (keywords[i] != null && !ignoredKeywords.Contains(keywords[i]))
                {
                    singularKeywords.Add(keywords[i], commentType);
                    pluralKeywords.Remove(keywords[i]);
                }
                if (keywords[i + 1] != null && !ignoredKeywords.Contains(keywords[i + 1]))
                {
                    singularKeywords.Remove(keywords[i + 1]);
                    pluralKeywords.Add(keywords[i + 1], commentType);
                }
            }


            return(success);
        }
예제 #19
0
        // Group: Saving Functions
        // __________________________________________________________________________


        /* Function: Save
         * Saves the current computed languages into <Languages.nd>.  Throws an exception if unsuccessful.
         */
        public void Save(Path filename, IDObjects.Manager <Language> languages,
                         StringTable <Language> aliases, StringTable <Language> extensions,
                         SortedStringTable <Language> shebangStrings, StringSet ignoredExtensions)
        {
            BinaryFile file = new BinaryFile();

            file.OpenForWriting(filename);

            try
            {
                // [String: Language Name]
                // [Int32: ID]
                // [Byte: Type]
                // [String: Simple Identifier]
                // [Byte: Enum Values]
                // [Byte: Case Sensitive (1 or 0)]
                // [String: Member Operator Symbol]
                // [String: Line Extender Symbol]
                // [String: Line Comment Symbol] [] ... [String: null]
                // [String: Opening Block Comment Symbol] [String: Closing Block Comment Symbo] [] [] ... [String: null]
                // [String: Opening Javadoc Line Comment Symbol] [String: Remainder Javadoc Line Comment Symbol [] ... [String: null]
                // [String: Opening Javadoc Block Comment Symbol] [String: Closing Javadoc Block Comment Symbol] [] [] ... [String: null]
                // [String: XML Line Comment Symbol] [] ... [String: null]

                // [Int32: Comment Type ID]
                // [Byte: Include Line Breaks (0 or 1)]
                // [String: Prototype Ender Symbol] [] ... [String: null]
                // ...
                // [Int32: 0]

                // ...
                // [String: null]

                foreach (Language language in languages)
                {
                    file.WriteString(language.Name);
                    file.WriteInt32(language.ID);
                    file.WriteByte((byte)language.Type);
                    file.WriteString(language.SimpleIdentifier);
                    file.WriteByte((byte)language.EnumValue);
                    file.WriteByte((byte)(language.CaseSensitive ? 1 : 0));
                    file.WriteString(language.MemberOperator);
                    file.WriteString(language.LineExtender);

                    WriteStringArray(file, language.LineCommentStrings);
                    WriteStringArray(file, language.BlockCommentStringPairs);
                    WriteStringArray(file, language.JavadocLineCommentStringPairs);
                    WriteStringArray(file, language.JavadocBlockCommentStringPairs);
                    WriteStringArray(file, language.XMLLineCommentStrings);

                    int[] commentTypes = language.GetCommentTypesWithPrototypeEnders();
                    if (commentTypes != null)
                    {
                        foreach (int commentType in commentTypes)
                        {
                            PrototypeEnders prototypeEnders = language.GetPrototypeEnders(commentType);

                            file.WriteInt32(commentType);
                            file.WriteByte((byte)(prototypeEnders.IncludeLineBreaks ? 1 : 0));
                            WriteStringArray(file, prototypeEnders.Symbols);
                        }
                    }
                    file.WriteInt32(0);
                }

                file.WriteString(null);


                // [String: Alias] [Int32: Language ID] [] [] ... [String: Null]

                foreach (KeyValuePair <string, Language> pair in aliases)
                {
                    file.WriteString(pair.Key);
                    file.WriteInt32(pair.Value.ID);
                }

                file.WriteString(null);


                // [String: Extension] [Int32: Language ID] [] [] ... [String: Null]

                foreach (KeyValuePair <string, Language> pair in extensions)
                {
                    file.WriteString(pair.Key);
                    file.WriteInt32(pair.Value.ID);
                }

                file.WriteString(null);


                // [String: Shebang String] [Int32: Language ID] [] [] ... [String: Null]

                foreach (KeyValuePair <string, Language> pair in shebangStrings)
                {
                    file.WriteString(pair.Key);
                    file.WriteInt32(pair.Value.ID);
                }

                file.WriteString(null);


                // [String: Ignored Extension] [] ... [String: Null]

                foreach (string ignoredExtension in ignoredExtensions)
                {
                    file.WriteString(ignoredExtension);
                }

                file.WriteString(null);
            }

            finally
            {
                file.Close();
            }
        }
예제 #20
0
        public static IObjectModel Resolve(LambdaExpression selector, ScopeParameterDictionary scopeParameters, StringSet scopeTables)
        {
            SelectorResolver resolver = new SelectorResolver(scopeParameters, scopeTables);

            return(resolver.Visit(selector));
        }
예제 #21
0
        internal void Read(EndianBinaryReader reader)
        {
            long boneIdsOffset       = reader.ReadOffset();
            long boneMatricesOffset  = reader.ReadOffset();
            long boneNamesOffset     = reader.ReadOffset();
            long exDataOffset        = reader.ReadOffset();
            int  boneCount           = reader.ReadInt32();
            long boneParentIdsOffset = reader.ReadOffset();

            reader.SkipNulls(2 * sizeof(uint));

            reader.ReadAtOffset(boneIdsOffset, () =>
            {
                Bones.Capacity = boneCount;

                for (int i = 0; i < boneCount; i++)
                {
                    uint id = reader.ReadUInt32();
                    Bones.Add(new BoneInfo {
                        Id = id, IsEx = (id & 0x8000) != 0
                    });
                }
            });

            reader.ReadAtOffset(boneMatricesOffset, () =>
            {
                foreach (var bone in Bones)
                {
                    bone.InverseBindPoseMatrix = reader.ReadMatrix4x4();
                }
            });

            reader.ReadAtOffset(boneNamesOffset, () =>
            {
                foreach (var bone in Bones)
                {
                    bone.Name = reader.ReadStringOffset(StringBinaryFormat.NullTerminated);
                }
            });

            reader.ReadAtOffset(exDataOffset, () =>
            {
                int osageNameCount = reader.ReadInt32();
                int osageBoneCount = reader.ReadInt32();
                reader.SkipNulls(sizeof(uint));
                long osageBonesOffset        = reader.ReadOffset();
                long osageNamesOffset        = reader.ReadOffset();
                long blocksOffset            = reader.ReadOffset();
                int stringCount              = reader.ReadInt32();
                long stringsOffset           = reader.ReadOffset();
                long osageSiblingInfosOffset = reader.ReadOffset();
                int clothCount = reader.ReadInt32();

                reader.SkipNulls(7 * reader.AddressSpace.GetByteSize());

                var stringSet  = new StringSet(reader, stringsOffset, stringCount);
                var osageBones = new List <OsageBone>(osageBoneCount);

                reader.ReadAtOffset(osageBonesOffset, () =>
                {
                    for (int i = 0; i < osageBoneCount; i++)
                    {
                        var osageBone = new OsageBone();
                        osageBone.Read(reader, stringSet);
                        osageBones.Add(osageBone);
                    }
                });

                reader.ReadAtOffset(blocksOffset, () =>
                {
                    while (true)
                    {
                        string blockSignature = reader.ReadStringOffset(StringBinaryFormat.NullTerminated);
                        long blockOffset      = reader.ReadOffset();

                        if (blockOffset == 0)
                        {
                            break;
                        }

                        reader.ReadAtOffset(blockOffset, () =>
                        {
                            if (!BlockFactory.TryGetValue(blockSignature, out var blockConstructor))
                            {
                                Debug.WriteLine("Skin.Read(): Unimplemented block ({0}) at 0x{1:X}", blockSignature, blockOffset);
                                return;
                            }

                            var block = blockConstructor();
                            block.Read(reader, stringSet);

                            if (block is OsageBlock osageNode)
                            {
                                for (int i = 0; i < osageNode.Count; i++)
                                {
                                    osageNode.Bones.Add(osageBones[osageNode.StartIndex + i]);
                                }
                            }

                            Blocks.Add(block);
                        });
                    }
                });

                reader.ReadAtOffset(osageSiblingInfosOffset, () =>
                {
                    while (true)
                    {
                        string boneName = stringSet.ReadString(reader);

                        if (boneName == null)
                        {
                            break;
                        }

                        string siblingName    = stringSet.ReadString(reader);
                        float siblingDistance = reader.ReadSingle();

                        var osageBone = osageBones.FirstOrDefault(x => x.Name.Equals(boneName));

                        if (osageBone == null)
                        {
                            continue;
                        }

                        osageBone.SiblingName     = siblingName;
                        osageBone.SiblingDistance = siblingDistance;
                    }
                });
            });

            reader.ReadAtOffset(boneParentIdsOffset, () =>
            {
                foreach (var bone in Bones)
                {
                    uint parentId = reader.ReadUInt32();

                    if (parentId != 0xFFFFFFFF)
                    {
                        bone.Parent = Bones.FirstOrDefault(x => x.Id == parentId);
                    }
                }
            });
        }
예제 #22
0
 SelectorResolver(ScopeParameterDictionary scopeParameters, StringSet scopeTables)
 {
     this._scopeParameters = scopeParameters;
     this._scopeTables     = scopeTables;
 }
예제 #23
0
        /* Function: Start
         *
         * Loads and combines the two versions of <Languages.txt>, returning whether it was successful.  If there were any errors
         * they will be added to errorList.
         *
         * Dependencies:
         *
         *		- <Config.Manager> and <CommentTypes.Manager> must be started before using the rest of the class.
         */
        public bool Start(Errors.ErrorList errorList)
        {
            List <ConfigFileLanguage> systemLanguageList;
            List <ConfigFileLanguage> projectLanguageList;
            List <string>             ignoredSystemExtensions;
            List <string>             ignoredProjectExtensions;

            List <Language> binaryLanguages;
            List <KeyValuePair <string, int> > binaryAliases;
            List <KeyValuePair <string, int> > binaryExtensions;
            List <KeyValuePair <string, int> > binaryShebangStrings;
            List <string> binaryIgnoredExtensions;

            // The return value, which is whether we were able to successfully load and parse the system Languages.txt, and if
            // it exists, the project Languages.txt.  The project Languages.txt not existing is not a failure.
            bool success = true;

            // Whether anything has changed since the last run, as determined by Languages.nd.  If Languages.nd doesn't exist
            // or is corrupt, we have to assume something changed.
            bool changed = false;


            // First add all the predefined languages, since they may be subclassed.

            foreach (Language language in predefinedLanguages)
            {
                languages.Add(language);
            }


            // We need the ID numbers to stay consistent between runs, so we create all the languages from the binary file
            // next.  We'll worry about comparing their attributes with the text files and seeing if any were added or deleted later.

            Languages_nd languagesNDParser = new Languages_nd(this);

            // Don't bother going through the effort if we're rebuilding everything anyway.
            if (EngineInstance.Config.ReparseEverything == true)
            {
                binaryLanguages         = new List <Language>();
                binaryAliases           = new List <KeyValuePair <string, int> >();
                binaryExtensions        = new List <KeyValuePair <string, int> >();
                binaryShebangStrings    = new List <KeyValuePair <string, int> >();
                binaryIgnoredExtensions = new List <string>();

                changed = true;
            }

            else if (languagesNDParser.Load(EngineInstance.Config.WorkingDataFolder + "/Languages.nd", out binaryLanguages,
                                            out binaryAliases, out binaryExtensions, out binaryShebangStrings, out binaryIgnoredExtensions) == false)
            {
                changed = true;
                // Even though it failed, LoadBinaryFiles will still have created valid empty objects for them.
            }

            else             // LoadBinaryFile succeeded
            {
                // We use a try block so if anything screwy happens, like two languages having the same ID number and thus
                // causing an exception when added, we can continue as if the binary file didn't parse at all.
                try
                {
                    foreach (Language binaryLanguage in binaryLanguages)
                    {
                        // We don't add the binary language itself because we only want those for comparison purposes.  We otherwise
                        // want the languages to be at their default values because the Languages.txt versions will only set some
                        // attributes, not all.

                        // Check for predefined languages of the same name.  If any of the binary languages' IDs collide with the
                        // predefined languages' ones, it will be taken care of by the exception handler.
                        Language existingLanguage = languages[binaryLanguage.Name];

                        if (existingLanguage == null)
                        {
                            Language newLanguage = new Language(this, binaryLanguage.Name);
                            newLanguage.ID           = binaryLanguage.ID;
                            newLanguage.InBinaryFile = true;

                            languages.Add(newLanguage);
                        }
                        else
                        {
                            existingLanguage.InBinaryFile = true;
                        }
                    }
                }
                catch
                {
                    languages.Clear();
                    changed = true;

                    foreach (Language predefinedLanguage in predefinedLanguages)
                    {
                        languages.Add(predefinedLanguage);
                    }

                    // Clear them since they may be used later in this function.
                    binaryLanguages.Clear();
                    binaryAliases.Clear();
                    binaryExtensions.Clear();
                    binaryShebangStrings.Clear();
                    binaryIgnoredExtensions.Clear();

                    // Otherwise ignore the exception and continue.
                }
            }


            Path systemFile  = EngineInstance.Config.SystemConfigFolder + "/Languages.txt";
            Path projectFile = EngineInstance.Config.ProjectConfigFolder + "/Languages.txt";

            Languages_txt languagesTxtParser = new Languages_txt();


            // Load the files.

            if (!languagesTxtParser.Load(systemFile, out systemLanguageList, out ignoredSystemExtensions, errorList))
            {
                success = false;
                // Continue anyway because we want to show errors from both files.
            }

            if (System.IO.File.Exists(projectFile))
            {
                if (!languagesTxtParser.Load(projectFile, out projectLanguageList, out ignoredProjectExtensions, errorList))
                {
                    success = false;
                }
            }
            else
            {
                // The project file not existing is not an error condition.  Fill in the variables with empty structures.
                projectLanguageList      = new List <ConfigFileLanguage>();
                ignoredProjectExtensions = new List <string>();
            }

            if (success == false)
            {
                return(false);
            }


            // Combine the ignored extensions.

            StringSet ignoredExtensions = new StringSet(KeySettingsForExtensions);

            foreach (string extension in ignoredSystemExtensions)
            {
                ignoredExtensions.Add(extension);
            }

            foreach (string extension in ignoredProjectExtensions)
            {
                ignoredExtensions.Add(extension);
            }


            // Add the languages.  We don't need to do separate passes for standard entries and alter entries because alter
            // entries should only appear in the project file and only apply to types in the system file.  Anything else is either an
            // error (system file can't alter a project entry) or would have been simplified out by LoadFile (a file with an alter
            // entry applying to a language in the same file.)  Start_AddLanguage() also prevents inappropriate properties from
            // being set on languages, like Line Comment on one with full language support.

            foreach (ConfigFileLanguage configFileLanguage in systemLanguageList)
            {
                if (!Start_AddLanguage(configFileLanguage, systemFile, true, ignoredExtensions, errorList))
                {
                    success = false;
                }
            }

            foreach (ConfigFileLanguage configFileLanguage in projectLanguageList)
            {
                if (!Start_AddLanguage(configFileLanguage, projectFile, false, ignoredExtensions, errorList))
                {
                    success = false;
                }
            }

            if (success == false)
            {
                return(false);
            }


            // Now that everything's in languages we can delete the ones that weren't in the config files, such as predefined
            // languages that were removed or languages that were in the binary file from the last run but were deleted.  We
            // have to put them on a list and delete them in a second pass because deleting them while iterating through would
            // screw up the iterator.

            List <string> deletedLanguageNames = new List <string>();

            foreach (Language language in languages)
            {
                if (language.InConfigFiles == false)
                {
                    deletedLanguageNames.Add(language.Name);

                    // Check this flag so we don't set it to changed if we're deleting a predefined language that wasn't in the binary
                    // file.
                    if (language.InBinaryFile == true)
                    {
                        changed = true;
                    }
                }
            }

            foreach (string deletedLanguageName in deletedLanguageNames)
            {
                languages.Remove(deletedLanguageName);
            }


            // Everything is okay at this point.  Save the files again to reformat them.  If the project file didn't exist, saving it
            // with the empty structures will create it.

            Start_FixCapitalization(systemLanguageList);
            Start_FixCapitalization(projectLanguageList);

            if (!languagesTxtParser.Save(projectFile, projectLanguageList, ignoredProjectExtensions, errorList, true, false))
            {
                success = false;
            }
            ;

            if (!languagesTxtParser.Save(systemFile, systemLanguageList, ignoredSystemExtensions, errorList, false, true))
            {
                success = false;
            }
            ;


            // Generate alternate comment styles.  We don't want these included in the config files but we do want them in the
            // binary files in case the generation method changes in a future version.

            foreach (Language language in languages)
            {
                if (language.Type == Language.LanguageType.BasicSupport)
                {
                    language.GenerateJavadocCommentStrings();
                    language.GenerateXMLCommentStrings();
                }
            }


            // Compare the structures with the binary ones to see if anything changed.

            if (binaryLanguages.Count != languages.Count ||
                binaryAliases.Count != aliases.Count ||
                binaryExtensions.Count != extensions.Count ||
                binaryShebangStrings.Count != shebangStrings.Count ||
                binaryIgnoredExtensions.Count != ignoredExtensions.Count)
            {
                changed = true;
            }
            else if (changed == false)
            {
                // Do a detailed comparison now.

                foreach (Language binaryLanguage in binaryLanguages)
                {
                    Language language = languages[binaryLanguage.Name];

                    if (language == null || binaryLanguage != language)
                    {
                        changed = true;
                        break;
                    }
                }

                if (changed == false)
                {
                    foreach (string binaryIgnoredExtension in binaryIgnoredExtensions)
                    {
                        if (ignoredExtensions.Contains(binaryIgnoredExtension) == false)
                        {
                            changed = true;
                            break;
                        }
                    }
                }

                if (changed == false)
                {
                    foreach (KeyValuePair <string, int> binaryAliasPair in binaryAliases)
                    {
                        // We can use ID instead of Name because we know they match now.
                        if (aliases.ContainsKey(binaryAliasPair.Key) == false ||
                            aliases[binaryAliasPair.Key].ID != binaryAliasPair.Value)
                        {
                            changed = true;
                            break;
                        }
                    }
                }

                if (changed == false)
                {
                    foreach (KeyValuePair <string, int> binaryExtensionPair in binaryExtensions)
                    {
                        // We can use ID instead of Name because we know they match now.
                        if (extensions.ContainsKey(binaryExtensionPair.Key) == false ||
                            extensions[binaryExtensionPair.Key].ID != binaryExtensionPair.Value)
                        {
                            changed = true;
                            break;
                        }
                    }
                }

                if (changed == false)
                {
                    foreach (KeyValuePair <string, int> binaryShebangStringPair in binaryShebangStrings)
                    {
                        // We can use ID instead of Name because we know they match now.
                        if (shebangStrings.ContainsKey(binaryShebangStringPair.Key) == false ||
                            shebangStrings[binaryShebangStringPair.Key].ID != binaryShebangStringPair.Value)
                        {
                            changed = true;
                            break;
                        }
                    }
                }
            }


            languagesNDParser.Save(EngineInstance.Config.WorkingDataFolder + "/Languages.nd",
                                   languages, aliases, extensions, shebangStrings, ignoredExtensions);


            if (success == true && changed == true)
            {
                EngineInstance.Config.ReparseEverything = true;
            }

            return(success);
        }
예제 #24
0
        /* Function: Start_AddLanguage
         * A helper function that is used only by <Start()> to add a <ConfigFileLanguage> into <languages>.
         * Returns whether it was able to do so without any errors.
         */
        private bool Start_AddLanguage(ConfigFileLanguage configFileLanguage, Path sourceFile, bool isSystemFile,
                                       StringSet ignoredExtensions, Errors.ErrorList errorList)
        {
            bool success = true;


            // Validate or create the language.

            if (configFileLanguage.AlterLanguage == true)
            {
                // If altering a language that doesn't exist at all, at least not in the config files...
                if (languages.Contains(configFileLanguage.Name) == false ||
                    languages[configFileLanguage.Name].InConfigFiles == false)
                {
                    errorList.Add(
                        Locale.Get("NaturalDocs.Engine", "Languages.txt.AlteredLanguageDoesntExist(name)", configFileLanguage.Name),
                        sourceFile, configFileLanguage.LineNumber
                        );

                    success = false;
                }
            }

            else             // define language, not alter
            {
                // Error if defining a language that already exists in the config files.  Having it exist otherwise is fine.
                if (languages.Contains(configFileLanguage.Name))
                {
                    if (languages[configFileLanguage.Name].InConfigFiles == true)
                    {
                        errorList.Add(
                            Locale.Get("NaturalDocs.Engine", "Languages.txt.LanguageAlreadyExists(name)", configFileLanguage.Name),
                            sourceFile, configFileLanguage.LineNumber
                            );

                        success = false;
                    }
                }
                else
                {
                    Language newLanguage = new Language(this, configFileLanguage.Name);
                    languages.Add(newLanguage);
                }

                if (isSystemFile)
                {
                    languages[configFileLanguage.Name].InSystemFile = true;
                }
                else
                {
                    languages[configFileLanguage.Name].InProjectFile = true;
                }
            }

            if (success == false)
            {
                return(false);
            }


            // Apply the properties.

            Language language = languages[configFileLanguage.Name];

            if (configFileLanguage.SimpleIdentifier != null)
            {
                language.SimpleIdentifier = configFileLanguage.SimpleIdentifier;
            }

            if (configFileLanguage.LineCommentStrings != null)
            {
                if (language.Type != Language.LanguageType.BasicSupport)
                {
                    Start_CantDefinePropertyError(configFileLanguage, language.Type, sourceFile, "Line Comment", errorList);
                    success = false;
                }
                else
                {
                    language.LineCommentStrings = configFileLanguage.LineCommentStrings;
                }
            }

            if (configFileLanguage.BlockCommentStringPairs != null)
            {
                if (language.Type != Language.LanguageType.BasicSupport)
                {
                    Start_CantDefinePropertyError(configFileLanguage, language.Type, sourceFile, "Block Comment", errorList);
                    success = false;
                }
                else
                {
                    language.BlockCommentStringPairs = configFileLanguage.BlockCommentStringPairs;
                }
            }

            if (configFileLanguage.MemberOperator != null)
            {
                if (language.Type != Language.LanguageType.BasicSupport && language.Type != Language.LanguageType.TextFile)
                {
                    Start_CantDefinePropertyError(configFileLanguage, language.Type, sourceFile, "Member Operator", errorList);
                    success = false;
                }
                else
                {
                    language.MemberOperator = configFileLanguage.MemberOperator;
                }
            }

            if (configFileLanguage.LineExtender != null)
            {
                if (language.Type != Language.LanguageType.BasicSupport)
                {
                    Start_CantDefinePropertyError(configFileLanguage, language.Type, sourceFile, "Line Extender", errorList);
                    success = false;
                }
                else
                {
                    language.LineExtender = configFileLanguage.LineExtender;
                }
            }

            if (configFileLanguage.EnumValue != null)
            {
                if (language.Type != Language.LanguageType.BasicSupport && language.Type != Language.LanguageType.TextFile)
                {
                    Start_CantDefinePropertyError(configFileLanguage, language.Type, sourceFile, "Enum Value", errorList);
                    success = false;
                }
                else
                {
                    language.EnumValue = (Language.EnumValues)configFileLanguage.EnumValue;
                }
            }

            if (configFileLanguage.CaseSensitive != null)
            {
                if (language.Type != Language.LanguageType.BasicSupport && language.Type != Language.LanguageType.TextFile)
                {
                    Start_CantDefinePropertyError(configFileLanguage, language.Type, sourceFile, "Case Sensitive", errorList);
                    success = false;
                }
                else
                {
                    language.CaseSensitive = (bool)configFileLanguage.CaseSensitive;
                }
            }

            string[] commentTypeNamesWithPrototypeEnders = configFileLanguage.GetCommentTypeNamesWithPrototypeEnders();

            if (commentTypeNamesWithPrototypeEnders != null)
            {
                if (language.Type != Language.LanguageType.BasicSupport)
                {
                    Start_CantDefinePropertyError(configFileLanguage, language.Type, sourceFile, "Prototype Enders", errorList);
                    success = false;
                }
                else
                {
                    foreach (string commentTypeName in commentTypeNamesWithPrototypeEnders)
                    {
                        CommentTypes.CommentType commentType = EngineInstance.CommentTypes.FromName(commentTypeName);

                        if (commentType == null)
                        {
                            errorList.Add(
                                Locale.Get("NaturalDocs.Engine", "Languages.txt.PrototypeEnderCommentTypeDoesntExist(name)", commentTypeName),
                                sourceFile, configFileLanguage.LineNumber
                                );

                            success = false;
                        }
                        else
                        {
                            string[]        prototypeEnderStrings = configFileLanguage.GetPrototypeEnderStrings(commentTypeName);
                            PrototypeEnders prototypeEnders       = new PrototypeEnders(prototypeEnderStrings);
                            language.SetPrototypeEnders(commentType.ID, prototypeEnders);
                        }
                    }
                }
            }


            // Apply the aliases, extensions, and shebang strings.

            if (configFileLanguage.Aliases != null)
            {
                // If using Replace Aliases, find all existing aliases pointing to this language and remove them.
                if (configFileLanguage.AlterLanguage == true && configFileLanguage.AddAliases == false)
                {
                    List <string> removedAliases = new List <string>();

                    foreach (KeyValuePair <string, Language> pair in aliases)
                    {
                        if ((object)pair.Value == (object)language)
                        {
                            removedAliases.Add(pair.Key);
                        }
                    }

                    foreach (string removedAlias in removedAliases)
                    {
                        aliases.Remove(removedAlias);
                    }
                }

                // Add new aliases.
                foreach (string alias in configFileLanguage.Aliases)
                {
                    aliases[alias] = language;
                }
            }

            if (configFileLanguage.Extensions != null)
            {
                // If using Replace Extensions, find all existing extensions pointing to this language and remove them.
                if (configFileLanguage.AlterLanguage == true && configFileLanguage.AddExtensions == false)
                {
                    List <string> removedExtensions = new List <string>();

                    foreach (KeyValuePair <string, Language> pair in extensions)
                    {
                        if ((object)pair.Value == (object)language)
                        {
                            removedExtensions.Add(pair.Key);
                        }
                    }

                    foreach (string removedExtension in removedExtensions)
                    {
                        extensions.Remove(removedExtension);
                    }
                }

                // Add new extensions.
                foreach (string extension in configFileLanguage.Extensions)
                {
                    if (ignoredExtensions.Contains(extension) == false)
                    {
                        extensions[extension] = language;
                    }
                }
            }

            if (configFileLanguage.ShebangStrings != null)
            {
                // If using Replace Shebang Strings, find all existing shebang strings pointing to this language and remove them.
                if (configFileLanguage.AlterLanguage == true && configFileLanguage.AddShebangStrings == false)
                {
                    List <string> removedShebangStrings = new List <string>();

                    foreach (KeyValuePair <string, Language> pair in shebangStrings)
                    {
                        if ((object)pair.Value == (object)language)
                        {
                            removedShebangStrings.Add(pair.Key);
                        }
                    }

                    foreach (string removedShebangString in removedShebangStrings)
                    {
                        shebangStrings.Remove(removedShebangString);
                    }
                }

                // Add new shebang strings.
                foreach (string shebangString in configFileLanguage.ShebangStrings)
                {
                    shebangStrings[shebangString] = language;
                }
            }


            return(success);
        }
 internal abstract void WriteBody(EndianBinaryWriter writer, StringSet stringSet, BinaryFormat format);
예제 #26
0
        /* Function: Start
         *
         * Loads and combines the two versions of <Comments.txt>, returning whether it was successful.  If there were any errors
         * they will be added to errorList.
         *
         * Dependencies:
         *
         *		- <Config.Manager> must be started before this class can start.
         */
        public bool Start(Errors.ErrorList errorList)
        {
            List <ConfigFileCommentType> systemCommentTypeList;
            List <ConfigFileCommentType> projectCommentTypeList;
            List <string> ignoredSystemKeywords;
            List <string> ignoredProjectKeywords;
            List <string> systemTags;
            List <string> projectTags;

            List <CommentType> binaryCommentTypes;
            List <Tag>         binaryTags;
            List <KeyValuePair <string, int> > binarySingularKeywords;
            List <KeyValuePair <string, int> > binaryPluralKeywords;
            List <string> binaryIgnoredKeywords;

            // The return value, which is whether we were able to successfully load and parse the system Comments.txt, and if it exists,
            // the project Comments.txt.  The project Comments.txt not existing is not a failure.
            bool success = true;

            // Whether anything has changed since the last run, as determined by Comments.nd.  If Comments.nd doesn't exist or is corrupt,
            // we have to assume something changed.
            bool changed = false;

            Comments_nd commentsNDParser = new Comments_nd();


            // We need the ID numbers to stay consistent between runs, so we need to create all the comment types and tags from the
            // binary file first.  We'll worry about comparing their attributes and seeing if any were added or deleted later.

            if (EngineInstance.Config.ReparseEverything == true)
            {
                binaryCommentTypes     = new List <CommentType>();
                binaryTags             = new List <Tag>();
                binarySingularKeywords = new List <KeyValuePair <string, int> >();
                binaryPluralKeywords   = new List <KeyValuePair <string, int> >();
                binaryIgnoredKeywords  = new List <string>();

                changed = true;
            }

            else if (commentsNDParser.Load(EngineInstance.Config.WorkingDataFolder + "/Comments.nd", out binaryCommentTypes, out binaryTags,
                                           out binarySingularKeywords, out binaryPluralKeywords, out binaryIgnoredKeywords) == false)
            {
                changed = true;
                // Even though it failed, LoadBinaryFile will still create valid empty objects for the variables.
            }

            else             // Load binary file succeeded
            {
                // We use a try block so if anything screwy happens, like two things having the same ID number and thus causing
                // an exception when added, we can continue as if the binary file didn't parse at all.
                try
                {
                    foreach (CommentType binaryCommentType in binaryCommentTypes)
                    {
                        // We don't add the binary comment type itself because we only want those for comparison purposes.  We want
                        // the types in commentTypes to be at their default values because the Comments.txt versions will only set some attributes,
                        // not all, and we don't want the unset attributes influenced by the binary versions.
                        CommentType newCommentType = new CommentType(binaryCommentType.Name);
                        newCommentType.ID = binaryCommentType.ID;
                        newCommentType.Flags.InBinaryFile = true;

                        commentTypes.Add(newCommentType);
                    }

                    foreach (Tag binaryTag in binaryTags)
                    {
                        Tag newTag = new Tag(binaryTag.Name);
                        newTag.ID           = binaryTag.ID;
                        newTag.InBinaryFile = true;

                        tags.Add(newTag);
                    }
                }
                catch
                {
                    commentTypes.Clear();
                    tags.Clear();
                    changed = true;

                    // Clear them since they may be used later in this function.
                    binaryCommentTypes.Clear();
                    binarySingularKeywords.Clear();
                    binaryPluralKeywords.Clear();
                    binaryIgnoredKeywords.Clear();

                    // Otherwise ignore the exception and continue.
                }
            }


            Path systemFile     = EngineInstance.Config.SystemConfigFolder + "/Comments.txt";
            Path projectFile    = EngineInstance.Config.ProjectConfigFolder + "/Comments.txt";
            Path oldProjectFile = EngineInstance.Config.ProjectConfigFolder + "/Topics.txt";

            Comments_txt commentsTxtParser = new Comments_txt();


            // Load the files.

            if (!commentsTxtParser.Load(systemFile, out systemCommentTypeList, out ignoredSystemKeywords, out systemTags, errorList))
            {
                success = false;
                // Continue anyway because we want to show errors from both files.
            }

            if (System.IO.File.Exists(projectFile))
            {
                if (!commentsTxtParser.Load(projectFile, out projectCommentTypeList, out ignoredProjectKeywords, out projectTags, errorList))
                {
                    success = false;
                }
            }
            else if (System.IO.File.Exists(oldProjectFile))
            {
                if (!commentsTxtParser.Load(oldProjectFile, out projectCommentTypeList, out ignoredProjectKeywords, out projectTags, errorList))
                {
                    success = false;
                }
            }
            else
            {
                // The project file not existing is not an error condition.  Fill in the variables with empty structures.
                projectCommentTypeList = new List <ConfigFileCommentType>();
                ignoredProjectKeywords = new List <string>();
                projectTags            = new List <string>();
            }

            if (success == false)
            {
                return(false);
            }


            // Combine the ignored keywords.

            StringSet ignoredKeywords = new StringSet(KeySettingsForKeywords);

            foreach (string keyword in ignoredSystemKeywords)
            {
                if (keyword != null)
                {
                    ignoredKeywords.Add(keyword);
                }
            }

            foreach (string keyword in ignoredProjectKeywords)
            {
                if (keyword != null)
                {
                    ignoredKeywords.Add(keyword);
                }
            }


            // Combine the tags

            foreach (string tagName in systemTags)
            {
                Tag tag = tags[tagName];

                if (tag == null)
                {
                    tag = new Tag(tagName);
                    tag.InSystemFile = true;
                    tags.Add(tag);
                }
                else
                {
                    tag.InSystemFile = true;

                    // In case it changed since the binary version.
                    tag.FixNameCapitalization(tagName);
                }
            }

            foreach (string tagName in projectTags)
            {
                Tag tag = tags[tagName];

                if (tag == null)
                {
                    tag = new Tag(tagName);
                    tag.InProjectFile = true;
                    tags.Add(tag);
                }
                else
                {
                    tag.InProjectFile = true;
                    tag.FixNameCapitalization(tagName);
                }
            }


            // All the comment types have to exist in IDObjects.Manager before the properties are set because Index With will need their
            // IDs.  This pass only creates the types that were not already created by the binary file.

            // We don't need to do separate passes for standard entries and alter entries because alter entries should only appear
            // in the project file and only apply to types in the system file.  Anything else is either an error (system file can't alter a
            // project entry) or would have been simplified out by LoadFile (a file with an alter entry applying to a type in the same
            // file.)

            foreach (ConfigFileCommentType commentType in systemCommentTypeList)
            {
                if (!Start_CreateType(commentType, systemFile, true, errorList))
                {
                    success = false;
                }
            }

            foreach (ConfigFileCommentType commentType in projectCommentTypeList)
            {
                if (!Start_CreateType(commentType, projectFile, false, errorList))
                {
                    success = false;
                }
            }

            // Need to exit early because Start_ApplyProperties assumes all the types were created correctly.
            if (success == false)
            {
                return(false);
            }


            // Now that everything's in commentTypes we can delete the ones that aren't in the text files, meaning they were in
            // the binary file from the last run but were deleted since then.  We have to put them on a list and delete them in a
            // second pass because deleting them while iterating through would screw up the iterator.

            List <int> deletedIDs = new List <int>();

            foreach (CommentType commentType in commentTypes)
            {
                if (commentType.Flags.InConfigFiles == false)
                {
                    deletedIDs.Add(commentType.ID);
                    changed = true;
                }
            }

            foreach (int deletedID in deletedIDs)
            {
                commentTypes.Remove(deletedID);
            }


            // Delete the tags that weren't in the text files as well.

            deletedIDs.Clear();

            foreach (Tag tag in tags)
            {
                if (tag.InConfigFiles == false)
                {
                    deletedIDs.Add(tag.ID);
                    changed = true;
                }
            }

            foreach (int deletedID in deletedIDs)
            {
                tags.Remove(deletedID);
            }


            // Fill in the properties

            foreach (ConfigFileCommentType commentType in systemCommentTypeList)
            {
                if (!Start_ApplyProperties(commentType, systemFile, ignoredKeywords, errorList))
                {
                    success = false;
                }
            }

            foreach (ConfigFileCommentType commentType in projectCommentTypeList)
            {
                if (!Start_ApplyProperties(commentType, projectFile, ignoredKeywords, errorList))
                {
                    success = false;
                }
            }

            if (success == false)
            {
                return(false);
            }


            // Make sure there are no circular dependencies in Index With.

            foreach (CommentType commentType in commentTypes)
            {
                if (commentType.Index == CommentType.IndexValue.IndexWith)
                {
                    IDObjects.NumberSet ids         = new IDObjects.NumberSet();
                    CommentType         currentType = commentType;

                    do
                    {
                        ids.Add(currentType.ID);

                        if (ids.Contains(currentType.IndexWith))
                        {
                            // Start the dependency message on the repeated comment type, not on the one the loop started with because
                            // it could go A > B > C > B, in which case reporting A is irrelevant.

                            int         repeatedID    = currentType.IndexWith;
                            CommentType iterator      = commentTypes[repeatedID];
                            string      repeatMessage = iterator.Name;

                            // We want the error message to be on the repeated type only if that's the only one: A > A.  Otherwise we
                            // want it to be the second to last one: C in A > B > C > B.
                            CommentType errorMessageTarget = currentType;

                            for (;;)
                            {
                                iterator       = commentTypes[iterator.IndexWith];
                                repeatMessage += " > " + iterator.Name;

                                if (iterator.ID == repeatedID)
                                {
                                    break;
                                }

                                errorMessageTarget = iterator;
                            }

                            Path errorMessageFile;
                            List <ConfigFileCommentType> searchList;

                            if (errorMessageTarget.Flags.InProjectFile)
                            {
                                errorMessageFile = projectFile;
                                searchList       = projectCommentTypeList;
                            }
                            else
                            {
                                errorMessageFile = systemFile;
                                searchList       = systemCommentTypeList;
                            }

                            int    errorMessageLineNumber   = 0;
                            string lcErrorMessageTargetName = errorMessageTarget.Name.ToLower();

                            foreach (ConfigFileCommentType searchListType in searchList)
                            {
                                if (searchListType.Name.ToLower() == lcErrorMessageTargetName)
                                {
                                    errorMessageLineNumber = searchListType.LineNumber;
                                    break;
                                }
                            }

                            errorList.Add(
                                Locale.Get("NaturalDocs.Engine", "Comments.txt.CircularDependencyInIndexWith(list)", repeatMessage),
                                errorMessageFile, errorMessageLineNumber
                                );

                            return(false);
                        }

                        currentType = commentTypes[currentType.IndexWith];
                    }while (currentType.Index == CommentType.IndexValue.IndexWith);
                }
            }


            // Simplify Index With.  So A > B > C becomes A > C.  Also A > B = no indexing becomes A = no indexing.

            foreach (CommentType commentType in commentTypes)
            {
                if (commentType.Index == CommentType.IndexValue.IndexWith)
                {
                    CommentType targetCommentType = commentTypes[commentType.IndexWith];

                    while (targetCommentType.Index == CommentType.IndexValue.IndexWith)
                    {
                        targetCommentType = commentTypes[targetCommentType.IndexWith];
                    }

                    if (targetCommentType.Index == CommentType.IndexValue.No)
                    {
                        commentType.Index = CommentType.IndexValue.No;
                    }
                    else
                    {
                        commentType.IndexWith = targetCommentType.ID;
                    }
                }
            }


            // Everything is okay at this point.  Save the files again to reformat them.  If the project file didn't exist, saving it
            // with the empty structures we created will create it.

            Start_FixCapitalization(systemCommentTypeList);
            Start_FixCapitalization(projectCommentTypeList);

            if (!commentsTxtParser.Save(projectFile, projectCommentTypeList, ignoredProjectKeywords, projectTags, errorList, true, false))
            {
                success = false;
            }
            ;

            if (!commentsTxtParser.Save(systemFile, systemCommentTypeList, ignoredSystemKeywords, systemTags, errorList, false, true))
            {
                success = false;
            }
            ;


            // Compare the structures with the binary ones to see if anything changed.

            if (changed == false)
            {
                // First an easy comparison.

                if (binaryCommentTypes.Count != commentTypes.Count ||
                    binaryTags.Count != tags.Count ||
                    binaryIgnoredKeywords.Count != ignoredKeywords.Count ||
                    singularKeywords.Count != binarySingularKeywords.Count ||
                    pluralKeywords.Count != binaryPluralKeywords.Count)
                {
                    changed = true;
                }
            }

            if (changed == false)
            {
                // Next a detailed comparison if necessary.

                foreach (CommentType binaryCommentType in binaryCommentTypes)
                {
                    CommentType commentType = commentTypes[binaryCommentType.ID];

                    if (commentType == null || binaryCommentType != commentType)
                    {
                        changed = true;
                        break;
                    }
                }

                if (changed == false)
                {
                    foreach (Tag binaryTag in binaryTags)
                    {
                        Tag tag = tags[binaryTag.ID];

                        if (tag == null || binaryTag != tag)
                        {
                            changed = true;
                            break;
                        }
                    }
                }

                if (changed == false)
                {
                    foreach (string binaryIgnoredKeyword in binaryIgnoredKeywords)
                    {
                        if (!ignoredKeywords.Contains(binaryIgnoredKeyword))
                        {
                            changed = true;
                            break;
                        }
                    }
                }

                if (changed == false)
                {
                    foreach (KeyValuePair <string, int> binarySingularKeywordPair in binarySingularKeywords)
                    {
                        // We can use ID instead of Name because we know they match now.
                        if (singularKeywords.ContainsKey(binarySingularKeywordPair.Key) == false ||
                            singularKeywords[binarySingularKeywordPair.Key].ID != binarySingularKeywordPair.Value)
                        {
                            changed = true;
                            break;
                        }
                    }
                }

                if (changed == false)
                {
                    foreach (KeyValuePair <string, int> binaryPluralKeywordPair in binaryPluralKeywords)
                    {
                        // We can use ID instead of Name because we know they match now.
                        if (pluralKeywords.ContainsKey(binaryPluralKeywordPair.Key) == false ||
                            pluralKeywords[binaryPluralKeywordPair.Key].ID != binaryPluralKeywordPair.Value)
                        {
                            changed = true;
                            break;
                        }
                    }
                }
            }


            commentsNDParser.Save(EngineInstance.Config.WorkingDataFolder + "/Comments.nd",
                                  commentTypes, tags, singularKeywords, pluralKeywords, ignoredKeywords);

            if (success == true && changed == true)
            {
                EngineInstance.Config.ReparseEverything = true;
            }

            groupCommentTypeID = IDFromKeyword("group");

            return(success);
        }
예제 #27
0
        /* Function: TestFolder
         * Tests all the input files contained in this folder.  See <EngineInstanceManager.Start()> for how relative paths are handled.
         */
        public void TestFolder(Path testDataFolder, Path projectConfigFolder = default(Path))
        {
            TestList  allTests            = new TestList();
            StringSet expectedOutputFiles = new StringSet();

            engineInstanceManager = new EngineInstanceManager();
            engineInstanceManager.Start(testDataFolder, projectConfigFolder);

            // Store this so we can still use it for error messages after the engine is disposed of.
            Path inputFolder = engineInstanceManager.InputFolder;

            try
            {
                engineInstanceManager.Run();


                // Iterate through classes to build output files.

                using (Engine.CodeDB.Accessor accessor = EngineInstance.CodeDB.GetAccessor())
                {
                    // Class IDs should be assigned sequentially.  It's not an ideal way to do this though.
                    int classID = 1;
                    accessor.GetReadOnlyLock();

                    try
                    {
                        for (;;)
                        {
                            List <Topic> classTopics = accessor.GetTopicsInClass(classID, Delegates.NeverCancel);
                            ClassView.Merge(ref classTopics, engineInstanceManager.EngineInstance);

                            if (classTopics == null || classTopics.Count == 0)
                            {
                                break;
                            }

                            string testName       = classTopics[0].ClassString.Symbol.FormatWithSeparator(".");
                            Path   outputFilePath = Test.ActualOutputFileOf(testName, inputFolder);

                            Test test = Test.FromActualOutputFile(outputFilePath);
                            expectedOutputFiles.Add(test.ExpectedOutputFile);

                            try
                            {
                                test.SetActualOutput(OutputOf(classTopics));
                            }
                            catch (Exception e)
                            { test.TestException = e; }

                            test.Run();
                            allTests.Add(test);

                            classID++;
                        }
                    }
                    finally
                    { accessor.ReleaseLock(); }
                }


                // Now search for any expected output files that didn't have corresponding actual output files.

                string[] files = System.IO.Directory.GetFiles(inputFolder);

                foreach (string file in files)
                {
                    if (Test.IsExpectedOutputFile(file) && expectedOutputFiles.Contains(file) == false)
                    {
                        Test test = Test.FromExpectedOutputFile(file);
                        test.Run();
                        allTests.Add(test);

                        expectedOutputFiles.Add(file);
                    }
                }
            }

            finally
            {
                engineInstanceManager.Dispose();
                engineInstanceManager = null;
            }


            if (allTests.Count == 0)
            {
                Assert.Fail("There were no tests found in " + inputFolder);
            }
            else if (allTests.Passed == false)
            {
                Assert.Fail(allTests.BuildFailureMessage());
            }
        }
        public static void LoadPropertiesFromXmlStream(this IDictionary propertyBag, XmlReader reader)
        {
            while (reader.IsStartElement(PROPERTIES_ID) || reader.IsStartElement(PROPERTY_ID))
            {
                string key = null;
                string value = null;
                bool isEmpty;

                if (reader.IsStartElement(PROPERTIES_ID))
                {
                    key = reader.GetAttribute(KEY_ID);

                    string typeName = reader.GetAttribute(TYPE_ID);

                    IDictionary nestedPropertyBag;

                    if (String.IsNullOrEmpty(typeName))
                    {
                        nestedPropertyBag = new PropertyBag();
                    }
                    else
                    {
                        Type type = GetPropertyBagType(typeName);
                        nestedPropertyBag = (IDictionary)Activator.CreateInstance(type);
                    }

                    propertyBag[key] = nestedPropertyBag;
                    isEmpty = reader.IsEmptyElement;
                    reader.ReadStartElement(PROPERTIES_ID);
                    LoadPropertiesFromXmlStream(nestedPropertyBag, reader);
                    if (!isEmpty) { reader.ReadEndElement(); }
                }
                else
                {
                    key = reader.GetAttribute(KEY_ID);
                    value = reader.GetAttribute(VALUE_ID);
                    string typeName = reader.GetAttribute(TYPE_ID);
                    isEmpty = reader.IsEmptyElement;

                    if (typeName == STRING_SET_ID)
                    {
                        StringSet set = new StringSet();
                        propertyBag[key] = set;
                        LoadStringSet(set, reader);
                        if (!isEmpty) { reader.ReadEndElement(); }
                        continue;
                    }


                    reader.ReadStartElement(PROPERTY_ID);
                    Type propertyType = GetPropertyBagType(typeName);

                    if (typeName == "System.Version")
                    {
                        Version version;
                        bool succeeded = Version.TryParse(value, out version);
                        Debug.Assert(succeeded);
                        propertyBag[key] = version;
                        continue;
                    }

                    TypeConverter tc = TypeDescriptor.GetConverter(propertyType);
                    Debug.Assert(tc.CanConvertFrom(typeof(string)));

                    object propertyValue = tc.ConvertFromString(value);
                    propertyBag[key] = propertyValue;

                    Debug.Assert(isEmpty);
                }
            }
        }
예제 #29
0
        /* Function: Save
         * Saves the current computed comment types into <Comments.nd>.  Throws an exception if unsuccessful.
         */
        public void Save(Path filename, IDObjects.Manager <CommentType> commentTypes, IDObjects.Manager <Tag> tags,
                         StringTable <CommentType> singularKeywords, StringTable <CommentType> pluralKeywords,
                         StringSet ignoredKeywords)
        {
            BinaryFile file = new BinaryFile();

            file.OpenForWriting(filename);

            try
            {
                // [String: Tag Name]
                // [Int32: ID]
                // ...
                // [String: null]

                foreach (Tag tag in tags)
                {
                    file.WriteString(tag.Name);
                    file.WriteInt32(tag.ID);
                }

                file.WriteString(null);


                // [String: Comment Type Name]
                // [Int32: ID]
                // [String: Display Name]
                // [String: Plural Display Name]
                // [String: Simple Identifier]
                // [Byte: Index]
                // [Int32: Index With ID]?
                // [Byte: Scope]
                // [Byte: Break Lists]
                // [UInt16: Flags]
                // ...
                // [String: null]

                foreach (CommentType commentType in commentTypes)
                {
                    file.WriteString(commentType.Name);
                    file.WriteInt32(commentType.ID);
                    file.WriteString(commentType.DisplayName);
                    file.WriteString(commentType.PluralDisplayName);
                    file.WriteString(commentType.SimpleIdentifier);
                    file.WriteByte((byte)commentType.Index);

                    if (commentType.Index == CommentType.IndexValue.IndexWith)
                    {
                        file.WriteInt32(commentType.IndexWith);
                    }

                    file.WriteByte((byte)commentType.Scope);
                    file.WriteByte((byte)(commentType.BreakLists ? 1 : 0));
                    file.WriteUInt16((ushort)commentType.Flags.AllConfigurationProperties);
                }

                file.WriteString(null);


                // [String: Singular Keyword]
                // [Int32: Comment Type ID]
                // ...
                // [String: null]

                foreach (KeyValuePair <string, CommentType> pair in singularKeywords)
                {
                    file.WriteString(pair.Key);
                    file.WriteInt32(pair.Value.ID);
                }

                file.WriteString(null);


                // [String: Plural Keyword]
                // [Int32: Comment Type ID]
                // ...
                // [String: null]

                foreach (KeyValuePair <string, CommentType> pair in pluralKeywords)
                {
                    file.WriteString(pair.Key);
                    file.WriteInt32(pair.Value.ID);
                }

                file.WriteString(null);


                // [String: Ignored Keyword]
                // ...
                // [String: null]

                foreach (string keyword in ignoredKeywords)
                {
                    file.WriteString(keyword);
                }

                file.WriteString(null);
            }

            finally
            {
                file.Close();
            }
        }
예제 #30
0
 public void Operators()
 {
     StringSet ss = new StringSet();
     ss = ss + "bloo" + "bar";
     Assert.AreEqual(2, ss.Count);
     StringSet so = ss;
     Assert.AreEqual(ss, so);
     Assert.AreEqual(ss.GetHashCode(), so.GetHashCode());
     so = new StringSet(so);
     Assert.AreEqual(ss, so);
     Assert.AreEqual(ss.GetHashCode(), so.GetHashCode());
     so = ss - "bar";
     Assert.AreEqual(1, so.Count);
     Assert.AreNotEqual(ss, so);
     Assert.IsTrue(ss != so);
     Assert.AreNotEqual(ss.GetHashCode(), so.GetHashCode());
 }
        private static void SaveStringSet(XmlWriter writer, StringSet items, string key)
        {
            writer.WriteStartElement(PROPERTY_ID);
            writer.WriteAttributeString(KEY_ID, key);
            writer.WriteAttributeString(TYPE_ID, "StringSet");

            string[] sorted = new string[items.Count];
            items.CopyTo(sorted, 0);
            Array.Sort(sorted);

            foreach (string item in sorted)
            {
                writer.WriteStartElement(ITEM_ID);
                writer.WriteString(item);
                writer.WriteEndElement(); // Item
            }

            writer.WriteEndElement(); // Property
        }
예제 #32
0
 public QueryModel(ScopeParameterDictionary scopeParameters, StringSet scopeTables) : this(scopeParameters, scopeTables, false)
 {
 }
        private static void LoadStringSet(StringSet set, XmlReader reader)
        {
            reader.ReadStartElement(PROPERTY_ID);

            while (reader.IsStartElement(ITEM_ID))
            {
                string item;
                bool isEmptyItem;

                isEmptyItem = reader.IsEmptyElement;
                reader.ReadStartElement();
                item = reader.ReadString();
                set.Add(item);
                if (!isEmptyItem) reader.ReadEndElement();
            }
        }
 private static StringSet BuildApprovedFunctionsStringSet()
 {
     var result = new StringSet();
     result.Add("_TlgWrite");
     return result;
 }
예제 #35
0
 public void Null()
 {
     StringSet ss = new StringSet();
     ss.Add((string)null);
 }
예제 #36
0
            public StringSet GetAllFeatures(CapsManager caps)
            {
                if (caps == null)
                    throw new ArgumentNullException("caps");

                StringSet features = new StringSet();
                foreach (Presence p in m_all)
                {
                    StringSet f = GetFeatures(caps, p);
                    if (f != null)
                        features.Add(f);
                }
                return features;
            }
예제 #37
0
    private void CalculateTailFirsts()
    {
      foreach (Production prod in _data.Productions)
      {
        StringSet accumulatedFirsts = new StringSet();
        bool allNullable = true;

        for (int i = prod.LR0Items.Count - 1; i >= 0; i--)
        {
          LR0Item item = prod.LR0Items[i];
          if (i >= prod.LR0Items.Count - 2)
          {
            item.TailIsNullable = true;
            item.TailFirsts.Clear();
            continue;
          }
          GrammarTerm term = prod.RValues[item.Position + 1]; 
          NonTerminal ntElem = term as NonTerminal;
          if (ntElem == null || !ntElem.Nullable)
          { 
            accumulatedFirsts.Clear();
            allNullable = false;
            item.TailIsNullable = false;
            if (ntElem == null)
            {
              item.TailFirsts.Add(term.Key);
              accumulatedFirsts.Add(term.Key);
            }
            else
            {
              item.TailFirsts.AddRange(ntElem.Firsts); 
              accumulatedFirsts.AddRange(ntElem.Firsts);
            }
            continue;
          }
          accumulatedFirsts.AddRange(ntElem.Firsts);
          item.TailFirsts.AddRange(accumulatedFirsts);
          item.TailIsNullable = allNullable;
        }
      }
    }
예제 #38
0
 /// <summary>
 /// Clear all of the features from the
 /// </summary>
 public void ClearFeatures()
 {
     this.RemoveElems <DiscoFeature>();
     m_features = null;
 }
예제 #39
0
        public override JoinQueryResult ToJoinQueryResult(JoinType joinType, LambdaExpression conditionExpression, ScopeParameterDictionary scopeParameters, StringSet scopeTables, Func <string, string> tableAliasGenerator)
        {
            scopeParameters = scopeParameters.Clone(conditionExpression.Parameters.Last(), this.QueryModel.ResultModel);
            DbExpression          condition = GeneralExpressionParser.Parse(conditionExpression, scopeParameters, scopeTables);
            DbJoinTableExpression joinTable = new DbJoinTableExpression(joinType.AsDbJoinType(), this.QueryModel.FromTable.Table, condition);

            if (!this.QueryModel.IgnoreFilters)
            {
                joinTable.Condition = joinTable.Condition.And(this.QueryModel.ContextFilters).And(this.QueryModel.GlobalFilters);
            }

            JoinQueryResult result = new JoinQueryResult();

            result.ResultModel = this.QueryModel.ResultModel;
            result.JoinTable   = joinTable;

            return(result);
        }
예제 #40
0
 private void ValidateAll()
 {
   StringSet ntList = new StringSet();
   foreach (NonTerminal nt in _data.NonTerminals)
   {
     if (nt == _data.AugmentedRoot) continue;
     BnfExpressionData data = nt.Rule.Data;
     if (data.Count == 1 && data[0].Count == 1 && data[0][0] is NonTerminal)
       ntList.Add(nt.Name);
   }
   if (ntList.Count > 0)
   {
     AddError("Warning: Possible non-terminal duplication. The following non-terminals have rules containing a single non-terminal: \r\n {0}. \r\n" +
      "Consider merging two non-terminals; you may need to use 'nt1 = nt2;' instead of 'nt1.Rule=nt2'.");
   }
 }
예제 #41
0
 //Constructs the error message in situation when parser has no available action for current input.
 // override this method if you want to change this message
 public virtual string ConstructParserErrorMessage(ParsingContext context, StringSet expectedTerms) {
   return string.Format(Resources.ErrParserUnexpInput, expectedTerms.ToString(" "));
 }
예제 #42
0
        static QueryModel CreateQueryModel(RootQueryExpression rootQueryExp, ScopeParameterDictionary scopeParameters, StringSet scopeTables, Func <string, string> tableAliasGenerator)
        {
            Type entityType = rootQueryExp.ElementType;

            if (entityType.IsAbstract || entityType.IsInterface)
            {
                throw new ArgumentException("The type of input can not be abstract class or interface.");
            }

            QueryModel queryModel = new QueryModel(scopeParameters, scopeTables);

            TypeDescriptor typeDescriptor = EntityTypeContainer.GetDescriptor(entityType);

            DbTable dbTable = typeDescriptor.GenDbTable(rootQueryExp.ExplicitTable);
            string  alias   = null;

            if (tableAliasGenerator != null)
            {
                alias = tableAliasGenerator(dbTable.Name);
            }
            else
            {
                alias = queryModel.GenerateUniqueTableAlias(dbTable.Name);
            }

            queryModel.FromTable = CreateRootTable(dbTable, alias, rootQueryExp.Lock);

            DbTable            aliasTable = new DbTable(alias);
            ComplexObjectModel model      = typeDescriptor.GenObjectModel(aliasTable);

            model.DependentTable = queryModel.FromTable;

            queryModel.ResultModel = model;

            ParseFilters(queryModel, typeDescriptor.Definition.Filters, rootQueryExp.ContextFilters);

            return(queryModel);
        }
예제 #43
0
 private StringList GetCurrentExpectedSymbols()
 {
     BnfTermList inputElements = new BnfTermList();
       StringSet inputKeys = new StringSet();
       inputKeys.AddRange(_currentState.Actions.Keys);
       //First check all NonTerminals
       foreach (NonTerminal nt in Data.NonTerminals) {
     if (!inputKeys.Contains(nt.Key)) continue;
     //nt is one of our available inputs; check if it has an alias. If not, don't add it to element list;
     // and we have already all its "Firsts" keys in the list.
     // If yes, add nt to element list and remove
     // all its "fists" symbols from the list. These removed symbols will be represented by single nt alias.
     if (string.IsNullOrEmpty(nt.DisplayName))
       inputKeys.Remove(nt.Key);
     else {
       inputElements.Add(nt);
       foreach(string first in nt.Firsts)
     inputKeys.Remove(first);
     }
       }
       //Now terminals
       foreach (Terminal term in Data.Terminals) {
     if (inputKeys.Contains(term.Key))
       inputElements.Add(term);
       }
       StringList result = new StringList();
       foreach(BnfTerm term in inputElements)
     result.Add(string.IsNullOrEmpty(term.DisplayName)? term.Name : term.DisplayName);
       result.Sort();
       return result;
 }
예제 #44
0
 //Constructs the error message in situation when parser has no available action for current input.
 // override this method if you want to change this message
 public virtual string ConstructParserErrorMessage(ParsingContext context, StringSet expectedTerms)
 {
     if(expectedTerms.Count > 0)
     return string.Format(Resources.ErrSyntaxErrorExpected, expectedTerms.ToString(", "));
       else
     return Resources.ErrParserUnexpectedInput;
 }
예제 #45
0
        public void AddFeatures(DiscoFeature[] features)
        {
            if (Features == null)
                Features = new StringSet();

            // features may be null when used from outside.
            if (features != null)
            {
                foreach (DiscoFeature f in features)
                    Features.Add(f.Var);
            }

            DoCallbacks(m_featureCallbacks);
        }
예제 #46
0
 public RootQueryState(RootQueryExpression rootQueryExp, ScopeParameterDictionary scopeParameters, StringSet scopeTables, Func <string, string> tableAliasGenerator)
     : base(CreateQueryModel(rootQueryExp, scopeParameters, scopeTables, tableAliasGenerator))
 {
     this._rootQueryExp = rootQueryExp;
 }
예제 #47
0
 /// <summary>
 /// Clear out any features already in the list.
 /// </summary>
 public void ClearFeatures()
 {
     Features = null;
 }
 internal abstract void ReadBody(EndianBinaryReader reader, StringSet stringSet);
 private StringSet FilterBracesInExpectedSet(StringSet stateExpectedSet) {
   var result = new StringSet();
   result.UnionWith(stateExpectedSet);
   //Find what brace we expect
   var nextClosingBrace = string.Empty;
   if (OpenBraces.Count > 0) {
     var lastOpenBraceTerm = OpenBraces.Peek().KeyTerm;
     var nextClosingBraceTerm = lastOpenBraceTerm.IsPairFor as KeyTerm;
     if (nextClosingBraceTerm != null) 
       nextClosingBrace = nextClosingBraceTerm.Text; 
   }
   //Now check all closing braces in result set, and leave only nextClosingBrace
   foreach(var closingBrace in Language.GrammarData.ClosingBraces) {
     if (result.Contains(closingBrace) && closingBrace != nextClosingBrace)
       result.Remove(closingBrace); 
     
   }
   return result; 
 }
예제 #50
0
 public RootQueryState(RootQueryExpression rootQueryExp, ScopeParameterDictionary scopeParameters, StringSet scopeTables) : this(rootQueryExp, scopeParameters, scopeTables, null)
 {
 }