예제 #1
0
        public static void BindingAction3Success()
        {
            var userState = new RumorParserState();

            userState.LinkAction("foobar",
                                 ValueType.Boolean,
                                 ValueType.Number,
                                 ValueType.String
                                 );

            var state = new ParserState(
                "foobar(true or false, 4 + 4, \"hello\")", 4, userState
                );

            var result = Compiler.BindingAction()(state);

            Assert.AreEqual(
                new BindingActionNode("foobar",
                                      new BooleanLiteral(true),
                                      new NumberLiteral(8),
                                      new StringLiteral("hello")
                                      ),
                result
                );
        }
예제 #2
0
        public static void BindingAction0Success()
        {
            var userState = new RumorParserState();

            userState.LinkAction("foobar");

            var state = new ParserState(
                "foobar()", 4, userState
                );

            var result = Compiler.BindingAction()(state);

            Assert.AreEqual(new BindingActionNode("foobar"), result);
        }
예제 #3
0
        public static void BindingAction1Success()
        {
            var userState = new RumorParserState();

            userState.LinkAction("foobar",
                                 ValueType.Boolean
                                 );

            var state = new ParserState(
                "foobar(true or false)", 4, userState
                );

            var result = Compiler.BindingAction()(state);

            Assert.AreEqual(
                new BindingActionNode("foobar",
                                      new BooleanLiteral(true)
                                      ),
                result
                );
        }