public PftConditionString(PftParser.ConditionStringContext node)
            : base(node)
        {
            var context = node.stringTest();

            Left = PftNonGrouped.DispatchContext(context.left);
            Children.Add(Left);
            Op    = context.op.Text;
            Right = PftNonGrouped.DispatchContext(context.right);
            Children.Add(Right);
        }
Exemple #2
0
        public PftConditionString(PftParser.ConditionStringContext node)
            : base(node)
        {
            // ReSharper disable CanBeReplacedWithTryCastAndCheckForNull
            PftParser.StringTestContext test = node.stringTest();

            if (test is PftParser.StringTestDirectContext)
            {
                Equals        = ((PftParser.StringTestDirectContext)test).EQUALS() != null;
                Field         = new PftFieldReference(((PftParser.StringTestDirectContext)test).left);
                Unconditional = new PftUnconditionalLiteral(((PftParser.StringTestDirectContext)test).right);
            }
            else if (test is PftParser.StringTestReverseContext)
            {
                Equals        = ((PftParser.StringTestReverseContext)test).EQUALS() != null;
                Field         = new PftFieldReference(((PftParser.StringTestReverseContext)test).right);
                Unconditional = new PftUnconditionalLiteral(((PftParser.StringTestReverseContext)test).left);
            }
            else
            {
                throw new ArgumentException();
            }
            // ReSharper restore CanBeReplacedWithTryCastAndCheckForNull
        }