public AutoClickerParser SetUp(string input)
        {
            AntlrInputStream inputStream = new AntlrInputStream(input);

            AutoClickerLexer  lexer             = new AutoClickerLexer(inputStream);
            CommonTokenStream commonTokenStream = new CommonTokenStream(lexer);
            AutoClickerParser parser            = new AutoClickerParser(commonTokenStream);

            return(parser);
        }
예제 #2
0
        /// <summary>
        /// Parses the specified input.
        /// </summary>
        /// <param name="input">The input.</param>
        /// <returns></returns>
        public static List <Instruction> Parse(string input, GlobalData globalData = null)
        {
            AntlrInputStream inputStream = new AntlrInputStream(input);

            AutoClickerLexer  lexer             = new AutoClickerLexer(inputStream);
            CommonTokenStream commonTokenStream = new CommonTokenStream(lexer);
            AutoClickerParser parser            = new AutoClickerParser(commonTokenStream);

            AutoClickerParser.InstructionsContext context = parser.instructions();
            AutoClickerInstructionsVisitor        visitor = new AutoClickerInstructionsVisitor();

            List <Instruction> instructions = visitor.Visit(context);

            if (globalData != null)
            {
                foreach (var instruction in instructions)
                {
                    instruction.GlobalData = globalData;
                }
            }

            return(instructions);
        }