Пример #1
0
        private static Grammar.Module Load(string fileName)
        {
            using (var lexer = new PsiLexer(fileName))
            {
                var parser = new PsiParser(lexer);

                var success = parser.Parse();

                if (success)
                {
                    return(parser.Result);
                }
                Console.WriteLine("Line: {0}", lexer.yylloc.StartLine);
                return(null);
            }
        }
Пример #2
0
 protected static Module Load(string source)
 {
     using (var lexer = new PsiLexer(new StringReader(source), "???"))
     {
         var parser  = new PsiParser(lexer);
         var success = parser.Parse();
         if (success)
         {
             return(parser.Result);
         }
         else
         {
             return(null);
         }
     }
 }