internal ConditionalExpression CreateClassCondition(CodeElementsParser.ClassConditionContext context)
        {
            SyntaxProperty<bool> invertResult = null;
            if (context.NOT() != null)
            {
                invertResult = new SyntaxProperty<bool>(
                    true,
                    ParseTreeUtils.GetFirstToken(context.NOT()));
            }

            ClassCondition classCondition = null;
            if(context.characterClassNameReference() != null)
            {
                classCondition = new ClassCondition(
                    CreateIdentifier(context.identifier()),
                    CobolWordsBuilder.CreateCharacterClassNameReference(context.characterClassNameReference()),
                    invertResult);
            }
            else
            {
                DataItemContentType contentTypeEnum = DataItemContentType.Numeric;
                if(context.dataItemContentType().ALPHABETIC() != null)
                {
                    contentTypeEnum = DataItemContentType.Alphabetic;
                }
                else if (context.dataItemContentType().ALPHABETIC_LOWER() != null)
                {
                    contentTypeEnum = DataItemContentType.AlphabeticLower;
                }
                else if (context.dataItemContentType().ALPHABETIC_UPPER() != null)
                {
                    contentTypeEnum = DataItemContentType.AlphabeticUpper;
                }
                else if (context.dataItemContentType().DBCS() != null)
                {
                    contentTypeEnum = DataItemContentType.DBCS;
                }
                else if (context.dataItemContentType().KANJI() != null)
                {
                    contentTypeEnum = DataItemContentType.Kanji;
                }
                SyntaxProperty<DataItemContentType> dataItemContentType = new SyntaxProperty<DataItemContentType>(
                    contentTypeEnum,
                    ParseTreeUtils.GetFirstToken(context.dataItemContentType()));

                classCondition = new ClassCondition(
                    CreateIdentifier(context.identifier()),
                    dataItemContentType,
                    invertResult);
            }

            return classCondition;
        }
示例#2
0
 public virtual bool Visit(ClassCondition classCondition)
 {
     return(true);
 }