Search in sources :

Example 1 with ObjectIdentifier_Value

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

the class Undefined_Block_Value method parseBlockObjectIdentifierValue.

private ObjectIdentifier_Value parseBlockObjectIdentifierValue() {
    final Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(mBlock);
    if (null == parser) {
        return null;
    }
    final ObjectIdentifier_Value value = parser.pr_special_ObjectIdentifierValue().value;
    final List<SyntacticErrorStorage> errors = parser.getErrorStorage();
    if (null != errors && !errors.isEmpty()) {
        isErroneous = true;
        for (int i = 0; i < errors.size(); i++) {
            ParserMarkerSupport.createOnTheFlyMixedMarker((IFile) mBlock.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
        }
        return null;
    }
    return value;
}
Also used : Asn1Parser(org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser) SyntacticErrorStorage(org.eclipse.titan.common.parsers.SyntacticErrorStorage) ObjectIdentifier_Value(org.eclipse.titan.designer.AST.TTCN3.values.ObjectIdentifier_Value)

Example 2 with ObjectIdentifier_Value

use of org.eclipse.titan.designer.AST.TTCN3.values.ObjectIdentifier_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)

Aggregations

ObjectIdentifier_Value (org.eclipse.titan.designer.AST.TTCN3.values.ObjectIdentifier_Value)2 SyntacticErrorStorage (org.eclipse.titan.common.parsers.SyntacticErrorStorage)1 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)1 IValue (org.eclipse.titan.designer.AST.IValue)1 Asn1Parser (org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser)1