本文整理汇总了C#中Module.isValueDeclared方法的典型用法代码示例。如果您正苦于以下问题:C# Module.isValueDeclared方法的具体用法?C# Module.isValueDeclared怎么用?C# Module.isValueDeclared使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Module
的用法示例。
在下文中一共展示了Module.isValueDeclared方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: handleCase5
// 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");
}
示例2: handleCase1
// 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");
}