use of org.eclipse.titan.designer.AST.ASN1.values.RelativeObjectIdentifier_Value in project titan.EclipsePlug-ins by eclipse.
the class ObjectIdentifierComponent method checkDefdValueOID.
/**
* Checks the defined value form in an OID component.
*
* @param timestamp the timestamp of the actual compilation cycle.
* @param refChain the reference chain used to detect cyclic references.
* @param state the state of checking.
*
* @param the new state after this check was done.
*/
private oidState_type checkDefdValueOID(final CompilationTimeStamp timestamp, final IReferenceChain refChain, final oidState_type state) {
final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
final IValue value = definedValue.getValueRefdLast(timestamp, referenceChain);
referenceChain.release();
if (value.getIsErroneous(timestamp)) {
return oidState_type.LATER;
}
switch(value.getValuetype()) {
case INTEGER_VALUE:
final ObjectIdentifierComponent temp = new ObjectIdentifierComponent(null, definedValue);
temp.setFullNameParent(this);
temp.setMyScope(myScope);
return temp.checkNumberFormOID(timestamp, state);
case OBJECTID_VALUE:
if (!oidState_type.START.equals(state)) {
definedValue.getLocation().reportSemanticError("INTEGER or RELATIVE-OID value was expected");
}
((ObjectIdentifier_Value) value).checkOID(timestamp, refChain);
return oidState_type.LATER;
case RELATIVEOBJECTIDENTIFIER_VALUE:
switch(state) {
case ITU_REC:
return oidState_type.LATER;
case LATER:
return oidState_type.LATER;
default:
definedValue.getLocation().reportSemanticError(MessageFormat.format("RELATIVE-OID value cannot be used as the {0} component of an OBJECTIDENTIFIER value", oidState_type.START.equals(state) ? "first" : "second"));
return oidState_type.LATER;
}
case REFERENCED_VALUE:
{
final Reference reference = ((Referenced_Value) value).getReference();
final Assignment assignment = reference.getRefdAssignment(timestamp, false);
final IType type = assignment.getType(timestamp).getTypeRefdLast(timestamp);
if (type.getTypetype() == Type_type.TYPE_INTEGER) {
// FIXME implement handling of the variable form
} else {
definedValue.getLocation().reportSemanticError("INTEGER variable was expected");
}
return oidState_type.LATER;
}
default:
if (oidState_type.START.equals(state)) {
definedValue.getLocation().reportSemanticError("INTEGER or OBJECT IDENTIFIER value was expected for the first component");
} else {
definedValue.getLocation().reportSemanticError("INTEGER or RELATIVE-OID value was expected");
}
return oidState_type.LATER;
}
}
use of org.eclipse.titan.designer.AST.ASN1.values.RelativeObjectIdentifier_Value in project titan.EclipsePlug-ins by eclipse.
the class ObjectIdentifierComponent method checkDefdValueROID.
/**
* Checks the defined value form in an ROID component.
*
* @param timestamp the timestamp of the actual compilation cycle.
* @param refChain the reference chain used to detect cyclic references.
*
* @param the new state after this check was done.
*/
private void checkDefdValueROID(final CompilationTimeStamp timestamp, final IReferenceChain refChain) {
final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
final IValue value = definedValue.getValueRefdLast(timestamp, referenceChain);
referenceChain.release();
if (value.getIsErroneous(timestamp)) {
return;
}
switch(value.getValuetype()) {
case INTEGER_VALUE:
final ObjectIdentifierComponent temp = new ObjectIdentifierComponent(null, definedValue);
temp.setFullNameParent(this);
temp.setMyScope(myScope);
temp.checkNumberFormROID(timestamp);
break;
case RELATIVEOBJECTIDENTIFIER_VALUE:
((RelativeObjectIdentifier_Value) value).checkROID(timestamp, referenceChain);
break;
default:
definedValue.getLocation().reportSemanticError("INTEGER or RELATIVE-OID value was expected");
break;
}
}
Aggregations