// case 5 : id1 (id2) // is id2 reference to INT val -> label := id1, no:=INT of id2 List<ObjectIdentifierComponent> handleCase5(int Index, Module mod) { if (!mod.isValueDeclared(id2)) throw new SemanticErrorException("Error in line: " + tr2.Line + ", col:" + tr2.CharPositionInLine + ". Unknown identifier: " + id2); Asn1Value val = mod.GetValue(id2); if (val.m_TypeID == Asn1Value.TypeID.UNRESOLVED) return null; // not yet resolved. wait for next round if (val.m_TypeID == TypeID.INT) { int tmp = (int)((IntegerValue)val).Value; no = tmp; return null; } throw new SemanticErrorException("Error in line: " + tr2.Line + ", col:" + tr2.CharPositionInLine + ". Identifier: " + id2 + "does not resolve to INTEGER or RELATIVE-OID"); }
// case 1 : id1 // is id1 reserved word --> label:=id1, no = id1.value // if (INDEX==0) && id1 is value reference to OBJ-ID ->replace component with components of other OBJ-ID // is id1 reference to INTEGER --> no := INTEGER value // is id1 reference to REL_OBJ ID --> ? //default: id1 is unknown or reference wrong type List<ObjectIdentifierComponent> handleCase1(int Index, Module mod, ObjectIdentifierComponent prev) { int tmp; string prvLbl = null; if (prev != null) prvLbl = prev.label; if (YellowIDs.isYellowId(Index, id1, prvLbl, out tmp)) { no = tmp; label = id1; return null; } if (!mod.isValueDeclared(id1)) throw new SemanticErrorException("Error in line: " + tr1.Line + ", col:" + tr1.CharPositionInLine + ". Unknown identifier: " + id1); Asn1Value val = mod.GetValue(id1); if (val.m_TypeID == Asn1Value.TypeID.UNRESOLVED) return null; // not yet resolved. wait for next round if (val.m_TypeID == TypeID.INT) { tmp = (int)((IntegerValue)val).Value; no = tmp; return null; } if (val.m_TypeID == TypeID.OBJECT_IDENTIFIER) { if (Index == 0) { ObjectIdentifierValue obj = val as ObjectIdentifierValue; if (!obj.IsResolved()) return null; //wait until resolved return obj.m_components; } else throw new SemanticErrorException("Error in line: " + tr1.Line + ", col:" + tr1.CharPositionInLine + ". Identifier: " + id1 + "resolves to OBJECT IDENTIFIER but it is not the first item"); } if (val.m_TypeID == TypeID.REL_OBJ_ID) { throw new Exception("UNIMPLEMENTED FEATURE"); } throw new SemanticErrorException("Error in line: " + tr1.Line + ", col:" + tr1.CharPositionInLine + ". Identifier: " + id1 + "does not resolve to INTEGER or RELATIVE-OID"); }