Пример #1
0
 protected override void Dispose(bool disposing)
 {
     if (disposing && !IsDisposed)
     {
         if (m_patr != null)
         {
             m_patr.Dispose();
             m_patr = null;
         }
     }
     base.Dispose(disposing);
 }
Пример #2
0
        protected PatrParser CreateAndSetupTestParser()
        {
            PatrParser parser = null;

            try
            {
                parser = new PatrParser {
                    CommentChar = '|', CodePage = Encoding.UTF8.CodePage
                };
                Assert.NotNull(parser);
                parser.LoadGrammarFile(GrammarFileName);
                parser.LoadLexiconFile(LexiconFileName, 1);

                return(parser);
            }
            catch (Exception)
            {
                if (parser != null)
                {
                    parser.Dispose();
                }
                throw;
            }
        }