예제 #1
0
        public void UpdateModule(string filename, string srcText, bool verbose)
        {
            filename = normalizePath(filename);
            DModule ast;

            try
            {
                ast = DParser.ParseString(srcText, false, true, _taskTokens);
            }
            catch (Exception ex)
            {
                ast = new DModule {
                    ParseErrors = new System.Collections.ObjectModel.ReadOnlyCollection <ParserError>(
                        new List <ParserError> {
                        new ParserError(false, ex.Message + "\n\n" + ex.StackTrace, DTokens.Invariant, CodeLocation.Empty)
                    })
                };                            //WTF
            }
            if (string.IsNullOrEmpty(ast.ModuleName))
            {
                ast.ModuleName = Path.GetFileNameWithoutExtension(filename);
            }
            ast.FileName = filename;

            _modules [filename] = ast;
            GlobalParseCache.AddOrUpdateModule(ast);

            _editorData.ParseCache = null;

            _sources[filename] = srcText;
            //MessageBox.Show("UpdateModule(" + filename + ")");
            //throw new NotImplementedException();
            _activityCounter++;
        }
예제 #2
0
        public void UpdateModule(string filename, string srcText, bool verbose)
        {
            DModule ast;

            try
            {
                ast = DParser.ParseString(srcText, false);
            }
            catch (Exception ex)
            {
                ast = new DModule {
                    ParseErrors = new System.Collections.ObjectModel.ReadOnlyCollection <ParserError>(
                        new List <ParserError> {
                        new ParserError(false, ex.Message + "\n\n" + ex.StackTrace, DTokens.Invariant, CodeLocation.Empty)
                    })
                };                            //WTF
            }
            if (string.IsNullOrEmpty(ast.ModuleName))
            {
                ast.ModuleName = Path.GetFileNameWithoutExtension(filename);
            }
            ast.FileName = filename;

            //GlobalParseCache.RemoveModule(filename);
            GlobalParseCache.AddOrUpdateModule(ast);
            ConditionalCompilationFlags cflags = new ConditionalCompilationFlags(_editorData);

            //GlobalParseCache.UfcsCache.CacheModuleMethods(ast, ResolutionContext.Create(_parseCacheList, cflags, null, null));

            _modules[filename] = ast;
            _sources[filename] = srcText;
            //MessageBox.Show("UpdateModule(" + filename + ")");
            //throw new NotImplementedException();
        }
예제 #3
0
        static DModule ParseFile(Uri uri, string code)
        {
            var module = DParser.ParseString(code);

            module.FileName = uri.AbsolutePath;
            GlobalParseCache.AddOrUpdateModule(module);
            return(module);
        }