Пример #1
0
        // TODO: make this happen in background then flip ptr to new list of templates/dictionaries?
        public virtual void LoadGroupFile(TemplateName prefix, string fileName)
        {
            string absoluteFileName = Path.Combine(fullyQualifiedRootDirName, fileName);
            //Console.WriteLine("load group file " + absoluteFileName);
            GroupParser parser = null;
            try
            {
                ANTLRFileStream fs = new ANTLRFileStream(absoluteFileName, encoding);
                GroupLexer lexer = new GroupLexer(fs);
                CommonTokenStream tokens = new CommonTokenStream(lexer);
                parser = new GroupParser(tokens);
                parser.group(this, prefix);
            }
            #if false
            catch (RecognitionException e)
            {
                if (e.Token.Type == TemplateLexer.EOF_TYPE)
                    ErrorManager.SyntaxError(ErrorType.SyntaxError, e, "premature EOF", absoluteFileName);
                else
                    ErrorManager.SyntaxError(ErrorType.SyntaxError, e, absoluteFileName);
            }
            #endif
            catch (Exception e)
            {
                if (ErrorManager.IsCriticalException(e))
                    throw;

                ErrorManager.IOError(null, ErrorType.CantLoadGroupFile, e, absoluteFileName);
            }
        }