예제 #1
0
 public PftFieldPresence(PftParser.ConditionFieldContext node)
     : base(node)
 {
     PftParser.FieldPresenseContext context = node.fieldPresense();
     if (context.P() != null)
     {
         MustPresent = true;
     }
     Field = new PftFieldReference(context.fieldReference());
 }
예제 #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
        }