Search in sources :

Example 16 with Undefined_LowerIdentifier_Value

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

the class ObjectID_Type method checkThisValue.

@Override
public /**
 * {@inheritDoc}
 */
boolean checkThisValue(final CompilationTimeStamp timestamp, final IValue value, final Assignment lhs, final ValueCheckingOptions valueCheckingOptions) {
    value.setIsErroneous(false);
    final boolean selfReference = super.checkThisValue(timestamp, value, lhs, valueCheckingOptions);
    IValue last = value.getValueRefdLast(timestamp, valueCheckingOptions.expected_value, null);
    if (last == null || last.getIsErroneous(timestamp)) {
        return selfReference;
    }
    // already handled ones
    switch(value.getValuetype()) {
        case OMIT_VALUE:
        case REFERENCED_VALUE:
            return selfReference;
        case UNDEFINED_LOWERIDENTIFIER_VALUE:
            if (Value_type.REFERENCED_VALUE.equals(last.getValuetype())) {
                return selfReference;
            }
            break;
        default:
            break;
    }
    if (Value_type.UNDEFINED_BLOCK.equals(last.getValuetype())) {
        last = last.setValuetype(timestamp, Value_type.OBJECTID_VALUE);
    }
    if (last.getIsErroneous(timestamp)) {
        return selfReference;
    }
    switch(last.getValuetype()) {
        case OBJECTID_VALUE:
            final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
            ((ObjectIdentifier_Value) last).checkOID(timestamp, referenceChain);
            referenceChain.release();
            break;
        case EXPRESSION_VALUE:
        case MACRO_VALUE:
            // already checked
            break;
        default:
            if (value.isAsn()) {
                value.getLocation().reportSemanticError(OBJIDVALUEEXPECTED1);
            } else {
                value.getLocation().reportSemanticError(OBJIDVALUEEXPECTED2);
            }
            value.setIsErroneous(true);
    }
    if (valueCheckingOptions.sub_check) {
        // there is no parent type to check
        if (subType != null) {
            subType.checkThisValue(timestamp, last);
        }
    }
    value.setLastTimeChecked(timestamp);
    return selfReference;
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain) ObjectIdentifier_Value(org.eclipse.titan.designer.AST.TTCN3.values.ObjectIdentifier_Value)

Example 17 with Undefined_LowerIdentifier_Value

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

the class ASN1_Integer_Type method checkThisValueRef.

@Override
public /**
 * {@inheritDoc}
 */
IValue checkThisValueRef(final CompilationTimeStamp timestamp, final IValue value) {
    if (Value_type.UNDEFINED_LOWERIDENTIFIER_VALUE.equals(value.getValuetype())) {
        if (value.isAsn()) {
            if (null == lastTimeChecked) {
                check(timestamp);
            }
            if (null != namedNumbers && namedNumbers.hasNamedValueWithName(((Undefined_LowerIdentifier_Value) value).getIdentifier())) {
                final IValue tempValue = value.setValuetype(timestamp, Value_type.NAMED_INTEGER_VALUE);
                tempValue.setMyGovernor(this);
                return tempValue;
            }
        }
    }
    return super.checkThisValueRef(timestamp, value);
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) Undefined_LowerIdentifier_Value(org.eclipse.titan.designer.AST.TTCN3.values.Undefined_LowerIdentifier_Value)

Example 18 with Undefined_LowerIdentifier_Value

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

the class ASN1_Set_Type method checkThisValue.

@Override
public /**
 * {@inheritDoc}
 */
boolean checkThisValue(final CompilationTimeStamp timestamp, final IValue value, final Assignment lhs, final ValueCheckingOptions valueCheckingOptions) {
    if (getIsErroneous(timestamp)) {
        return false;
    }
    boolean selfReference = super.checkThisValue(timestamp, value, lhs, valueCheckingOptions);
    IValue last = value.getValueRefdLast(timestamp, valueCheckingOptions.expected_value, null);
    if (last == null || last.getIsErroneous(timestamp)) {
        return selfReference;
    }
    // already handled ones
    switch(value.getValuetype()) {
        case OMIT_VALUE:
        case REFERENCED_VALUE:
            return selfReference;
        case UNDEFINED_LOWERIDENTIFIER_VALUE:
            if (Value_type.REFERENCED_VALUE.equals(last.getValuetype())) {
                return selfReference;
            }
            break;
        default:
            break;
    }
    switch(last.getValuetype()) {
        case SEQUENCE_VALUE:
            last = last.setValuetype(timestamp, Value_type.SET_VALUE);
            if (last.isAsn()) {
                selfReference = checkThisValueSet(timestamp, (Set_Value) last, lhs, valueCheckingOptions.expected_value, false, valueCheckingOptions.implicit_omit, valueCheckingOptions.str_elem);
            } else {
                selfReference = checkThisValueSet(timestamp, (Set_Value) last, lhs, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed, valueCheckingOptions.implicit_omit, valueCheckingOptions.str_elem);
            }
            break;
        case SEQUENCEOF_VALUE:
            if (((SequenceOf_Value) last).isIndexed()) {
                value.getLocation().reportSemanticError(MessageFormat.format("Indexed assignment notation cannot be used for SET type `{0}''", getFullName()));
                value.setIsErroneous(true);
            } else {
                final SequenceOf_Value temporalValue = (SequenceOf_Value) last;
                if (temporalValue.getNofComponents() == 0) {
                    if (getNofComponents(timestamp) == 0) {
                        last = last.setValuetype(timestamp, Value_type.SET_VALUE);
                    } else {
                        value.getLocation().reportSemanticError(MessageFormat.format(NONEMPTYEXPECTED, getFullName()));
                        value.setIsErroneous(true);
                    }
                } else {
                    value.getLocation().reportSemanticError(MessageFormat.format(last.isAsn() ? VALUELISTNOTATIONERRORASN1 : VALUELISTNOTATIONERRORTTCN3, getFullName()));
                    value.setIsErroneous(true);
                }
            }
            break;
        case SET_VALUE:
            if (last.isAsn()) {
                selfReference = checkThisValueSet(timestamp, (Set_Value) last, lhs, valueCheckingOptions.expected_value, false, valueCheckingOptions.implicit_omit, valueCheckingOptions.str_elem);
            } else {
                selfReference = checkThisValueSet(timestamp, (Set_Value) last, lhs, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed, valueCheckingOptions.implicit_omit, valueCheckingOptions.str_elem);
            }
            break;
        case UNDEFINED_BLOCK:
            last = last.setValuetype(timestamp, Value_type.SET_VALUE);
            selfReference = checkThisValueSet(timestamp, (Set_Value) last, lhs, valueCheckingOptions.expected_value, false, valueCheckingOptions.implicit_omit, valueCheckingOptions.str_elem);
            break;
        case EXPRESSION_VALUE:
        case MACRO_VALUE:
            // already checked
            break;
        default:
            value.getLocation().reportSemanticError(MessageFormat.format(last.isAsn() ? SETVALUEXPECTEDASN1 : SETVALUEXPECTEDTTCN3, getFullName()));
            value.setIsErroneous(true);
    }
    value.setLastTimeChecked(timestamp);
    return selfReference;
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) SequenceOf_Value(org.eclipse.titan.designer.AST.TTCN3.values.SequenceOf_Value) Set_Value(org.eclipse.titan.designer.AST.TTCN3.values.Set_Value)

Example 19 with Undefined_LowerIdentifier_Value

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

the class Open_Type method checkThisValue.

// FIXME add tests
@Override
public /**
 * {@inheritDoc}
 */
boolean checkThisValue(final CompilationTimeStamp timestamp, final IValue value, final Assignment lhs, final ValueCheckingOptions valueCheckingOptions) {
    if (getIsErroneous(timestamp)) {
        return false;
    }
    boolean selfReference = super.checkThisValue(timestamp, value, lhs, valueCheckingOptions);
    IValue last = value.getValueRefdLast(timestamp, valueCheckingOptions.expected_value, null);
    if (null == last || last.getIsErroneous(timestamp)) {
        return selfReference;
    }
    // already handled ones
    switch(value.getValuetype()) {
        case OMIT_VALUE:
        case REFERENCED_VALUE:
            return selfReference;
        case UNDEFINED_LOWERIDENTIFIER_VALUE:
            if (Value_type.REFERENCED_VALUE.equals(last.getValuetype())) {
                return selfReference;
            }
            break;
        default:
            break;
    }
    this.check(timestamp);
    switch(last.getValuetype()) {
        case SEQUENCE_VALUE:
            if (value.isAsn()) {
                value.getLocation().reportSemanticError(MessageFormat.format(CHOICEEXPECTED, getFullName()));
                value.setIsErroneous(true);
            } else {
                last = last.setValuetype(timestamp, Value_type.CHOICE_VALUE);
                if (!last.getIsErroneous(timestamp)) {
                    selfReference = checkThisValueChoice(timestamp, (Choice_Value) last, lhs, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed, valueCheckingOptions.str_elem);
                }
            }
            break;
        case CHOICE_VALUE:
            selfReference = checkThisValueChoice(timestamp, (Choice_Value) last, lhs, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed, valueCheckingOptions.str_elem);
            break;
        default:
            if (value.isAsn()) {
                value.getLocation().reportSemanticError(MessageFormat.format(CHOICEEXPECTED, getFullName()));
            } else {
                value.getLocation().reportSemanticError(MessageFormat.format(UNIONEXPECTED, getFullName()));
            }
            value.setIsErroneous(true);
    }
    value.setLastTimeChecked(timestamp);
    return selfReference;
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) Choice_Value(org.eclipse.titan.designer.AST.TTCN3.values.Choice_Value)

Example 20 with Undefined_LowerIdentifier_Value

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

the class ASN1_Choice_Type method checkThisValue.

@Override
public /**
 * {@inheritDoc}
 */
boolean checkThisValue(final CompilationTimeStamp timestamp, final IValue value, final Assignment lhs, final ValueCheckingOptions valueCheckingOptions) {
    if (getIsErroneous(timestamp)) {
        return false;
    }
    boolean selfReference = super.checkThisValue(timestamp, value, lhs, valueCheckingOptions);
    IValue last = value.getValueRefdLast(timestamp, valueCheckingOptions.expected_value, null);
    if (last == null || last.getIsErroneous(timestamp)) {
        return selfReference;
    }
    // already handled ones
    switch(value.getValuetype()) {
        case OMIT_VALUE:
        case REFERENCED_VALUE:
            return selfReference;
        case UNDEFINED_LOWERIDENTIFIER_VALUE:
            if (Value_type.REFERENCED_VALUE.equals(last.getValuetype())) {
                return selfReference;
            }
            break;
        default:
            break;
    }
    switch(last.getValuetype()) {
        case SEQUENCE_VALUE:
            if (value.isAsn()) {
                value.getLocation().reportSemanticError(MessageFormat.format(CHOICEEXPECTED, getFullName()));
                value.setIsErroneous(true);
            } else {
                last = last.setValuetype(timestamp, Value_type.CHOICE_VALUE);
                if (!last.getIsErroneous(timestamp)) {
                    selfReference = checkThisValueChoice(timestamp, (Choice_Value) last, lhs, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed);
                }
            }
            break;
        case CHOICE_VALUE:
            selfReference = checkThisValueChoice(timestamp, (Choice_Value) last, lhs, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed);
            break;
        case EXPRESSION_VALUE:
        case MACRO_VALUE:
            // already checked
            break;
        default:
            if (value.isAsn()) {
                value.getLocation().reportSemanticError(MessageFormat.format(CHOICEEXPECTED, getFullName()));
                value.setIsErroneous(true);
            } else {
                value.getLocation().reportSemanticError(MessageFormat.format(UNIONEXPECTED, getFullName()));
                value.setIsErroneous(true);
            }
            value.setIsErroneous(true);
    }
    value.setLastTimeChecked(timestamp);
    return selfReference;
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) Choice_Value(org.eclipse.titan.designer.AST.TTCN3.values.Choice_Value)

Aggregations

IValue (org.eclipse.titan.designer.AST.IValue)25 Undefined_LowerIdentifier_Value (org.eclipse.titan.designer.AST.TTCN3.values.Undefined_LowerIdentifier_Value)9 Identifier (org.eclipse.titan.designer.AST.Identifier)7 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)6 IType (org.eclipse.titan.designer.AST.IType)5 Integer_Value (org.eclipse.titan.designer.AST.TTCN3.values.Integer_Value)5 SequenceOf_Value (org.eclipse.titan.designer.AST.TTCN3.values.SequenceOf_Value)5 Scope (org.eclipse.titan.designer.AST.Scope)4 ReferenceChain (org.eclipse.titan.designer.AST.ReferenceChain)3 SpecificValue_Template (org.eclipse.titan.designer.AST.TTCN3.templates.SpecificValue_Template)3 Referenced_Value (org.eclipse.titan.designer.AST.TTCN3.values.Referenced_Value)3 Sequence_Value (org.eclipse.titan.designer.AST.TTCN3.values.Sequence_Value)3 Named_Integer_Value (org.eclipse.titan.designer.AST.ASN1.values.Named_Integer_Value)2 Undefined_Block_Value (org.eclipse.titan.designer.AST.ASN1.values.Undefined_Block_Value)2 ArraySubReference (org.eclipse.titan.designer.AST.ArraySubReference)2 Type_type (org.eclipse.titan.designer.AST.IType.Type_type)2 ValueCheckingOptions (org.eclipse.titan.designer.AST.IType.ValueCheckingOptions)2 Module (org.eclipse.titan.designer.AST.Module)2 Reference (org.eclipse.titan.designer.AST.Reference)2 Def_Function (org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Function)2