Example #1
0
        public void Test()
        {
            string            source  = "split.gs";
            ITokenSource      lexer   = new DialogicLexer(new AntlrInputStream(source));
            CommonTokenStream tokens  = new CommonTokenStream(lexer);
            DialogicParser    parser  = new DialogicParser(tokens);
            ParserRuleContext context = parser.script();

            Visit(context);
            String tree = context.ToStringTree(parser);

            printPrettyLispTree(tree);
        }
Example #2
0
        protected static List <Chat> Parse(string[] lines)
        {
            HandleDefaultCommand(lines, "SAY");
            var            ais    = new AntlrInputStream(String.Join("\n", lines));
            DialogicParser parser = CreateParser(ais);

            parser.ErrorHandler = new BailErrorStrategy();
            ParserRuleContext prc = parser.script();
            ChatParser        cp  = new ChatParser();

            cp.Visit(prc);
            PrintLispTree(parser, prc);
            Console.WriteLine(cp);
            return(cp.chats);
        }