Example #1
0
        private void AddParsedFileToCollection <T>(Dictionary <string, NamedContent <T> > collection,
                                                   string fileName, string fileSource, T content)
            where T : AstNode
        {
            NamedContent <T>       namedContent = new NamedContent <T>(fileName, content);
            NamedContent <AstNode> baseContent  = new NamedContent <AstNode>(fileName, content);
            string existingName;

            lock (_mutex)
            {
                if (!collection.ContainsKey(namedContent.Name))
                {
                    collection.Add(namedContent.Name, namedContent);
                    _parsedFiles.Add(fileName, baseContent);
                    return;
                }
                else
                {
                    existingName = collection[namedContent.Name].FileName;
                }
            }
            string   message  = "File '" + fileName + "' has the same name as '" + existingName + "'";
            Location location = new Location(fileName, fileSource, 0);

            throw new DuplicateFileNameException(message, location);
        }
Example #2
0
        public void AddError(string fileName, Exception exception)
        {
            NamedContent <Exception> namedError = new NamedContent <Exception>(fileName, exception);

            lock (_mutex)
                _errors.Add(namedError.FileName, namedError);
        }
Example #3
0
        public void AddParsedFile(string fileName, string fileSource, AstNode parseTree)
        {
            NamedContent <AstNode> namedParseTree = new NamedContent <AstNode>(fileName, parseTree);
            UnitNode unit = parseTree as UnitNode;

            if (unit != null)
            {
                AddParsedFileToCollection(_units, fileName, fileSource, unit);
            }
            else
            {
                AddParsedFileToCollection(_projects, fileName, fileSource, parseTree);
            }
        }