コード例 #1
0
                public static FTL.AST.INode ParseWithIdentifier(
                    CharStream stream, FTL.AST.StringPrimitive identifier)
                {
                    if (MemberExpression.Peek(stream))
                    {
                        return(MemberExpression.Parse(stream, identifier));
                    }

                    if (CallExpression.Peek(stream))
                    {
                        return(CallExpression.Parse(stream, identifier));
                    }

                    return(new FTL.AST.Reference(identifier));
                }
コード例 #2
0
        public void CallExpressionTests()
        {
            var builtin = Builtin.Parse(NCS("FOO"));

            // good examples
            Assert.IsNotNull(CallExpression.Parse(NCS("()"), builtin));
            Assert.IsNotNull(CallExpression.Parse(NCS("(hello)"), builtin));
            Assert.IsNotNull(CallExpression.Parse(NCS("(hello, world)"), builtin));
            Assert.IsNotNull(CallExpression.Parse(NCS("(hello  ,  world)"), builtin));
            Assert.IsNotNull(CallExpression.Parse(NCS("(hello,world, 42)"), builtin));
            Assert.IsNotNull(CallExpression.Parse(NCS("(glen, 42, member[test], $ok, FOO(bar))"), builtin));

            // bad examples
            // should not be empty
            Throws(() => Argument.Parse(NCS("")));
        }