Search in sources :

Example 36 with Omit_Value

use of org.eclipse.titan.designer.AST.TTCN3.values.Omit_Value in project titan.EclipsePlug-ins by eclipse.

the class Integer_Type method checkThisValueLimit.

/**
 * Checks if a given value is a valid integer limit.
 * <p>
 * The special float values infinity and -infinity are valid integer range limits too.
 *
 * @param timestamp the time stamp of the actual semantic check cycle.
 * @param value the value to be checked
 * @param expectedValue the kind of the value to be expected
 * @param incompleteAllowed true if an incomplete value can be accepted at the given location, false otherwise
 * @param omitAllowed true if the omit value can be accepted at the given location, false otherwise
 * @param subCheck true if the subtypes should also be checked.
 * @param implicitOmit true if the implicit omit optional attribute was set for the value, false otherwise
 */
public void checkThisValueLimit(final CompilationTimeStamp timestamp, final IValue value, final Expected_Value_type expectedValue, final boolean incompleteAllowed, final boolean omitAllowed, final boolean subCheck, final boolean implicitOmit) {
    super.checkThisValue(timestamp, value, null, new ValueCheckingOptions(expectedValue, incompleteAllowed, omitAllowed, subCheck, implicitOmit, false));
    final IValue last = value.getValueRefdLast(timestamp, expectedValue, null);
    if (last == null || last.getIsErroneous(timestamp)) {
        return;
    }
    // already handled ones
    switch(value.getValuetype()) {
        case OMIT_VALUE:
        case REFERENCED_VALUE:
            return;
        case UNDEFINED_LOWERIDENTIFIER_VALUE:
            if (Value_type.REFERENCED_VALUE.equals(last.getValuetype())) {
                return;
            }
            break;
        default:
            break;
    }
    switch(last.getValuetype()) {
        case INTEGER_VALUE:
            break;
        case REAL_VALUE:
            {
                final Real_Value real = (Real_Value) last;
                if (!real.isNegativeInfinity() && !real.isPositiveInfinity()) {
                    value.getLocation().reportSemanticError(INTEGERVALUEEXPECTED);
                    value.setIsErroneous(true);
                }
                break;
            }
        case EXPRESSION_VALUE:
        case MACRO_VALUE:
            // already checked
            break;
        default:
            value.getLocation().reportSemanticError(INTEGERVALUEEXPECTED);
            value.setIsErroneous(true);
    }
    if (subCheck) {
        // there is no parent type to check
        if (subType != null) {
            subType.checkThisValue(timestamp, last);
        }
    }
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) Real_Value(org.eclipse.titan.designer.AST.TTCN3.values.Real_Value)

Aggregations

IValue (org.eclipse.titan.designer.AST.IValue)33 IType (org.eclipse.titan.designer.AST.IType)15 Identifier (org.eclipse.titan.designer.AST.Identifier)13 CompField (org.eclipse.titan.designer.AST.TTCN3.types.CompField)8 Omit_Value (org.eclipse.titan.designer.AST.TTCN3.values.Omit_Value)7 BridgingNamedNode (org.eclipse.titan.designer.AST.BridgingNamedNode)6 FieldSubReference (org.eclipse.titan.designer.AST.FieldSubReference)6 ISubReference (org.eclipse.titan.designer.AST.ISubReference)6 NamedValue (org.eclipse.titan.designer.AST.TTCN3.values.NamedValue)6 Value (org.eclipse.titan.designer.AST.Value)6 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)5 HashMap (java.util.HashMap)4 ASN1_Sequence_Type (org.eclipse.titan.designer.AST.ASN1.types.ASN1_Sequence_Type)4 SequenceOf_Value (org.eclipse.titan.designer.AST.TTCN3.values.SequenceOf_Value)4 Type (org.eclipse.titan.designer.AST.Type)4 ASN1_Set_Type (org.eclipse.titan.designer.AST.ASN1.types.ASN1_Set_Type)3 Assignment (org.eclipse.titan.designer.AST.Assignment)3 ReferenceChain (org.eclipse.titan.designer.AST.ReferenceChain)3 Sequence_Value (org.eclipse.titan.designer.AST.TTCN3.values.Sequence_Value)3 IASN1Type (org.eclipse.titan.designer.AST.ASN1.IASN1Type)2