本文整理汇总了C#中ProtoCore.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ProtoCore.ToString方法的具体用法?C# ProtoCore.ToString怎么用?C# ProtoCore.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProtoCore
的用法示例。
在下文中一共展示了ProtoCore.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Associative_DecoratedIdentifier
void Associative_DecoratedIdentifier(out ProtoCore.AST.AssociativeAST.AssociativeNode node) {
node = null;
if (IsLocallyTypedVariable()) {
Expect(1);
if (IsKeyWord(t.val, true))
{
errors.SemErr(t.line, t.col, String.Format(Resources.keywordCantBeUsedAsIdentifier, t.val));
}
var typedVar = new ProtoCore.AST.AssociativeAST.TypedIdentifierNode();
typedVar.Name = typedVar.Value = t.val;
NodeUtils.SetNodeLocation(typedVar, t);
Expect(47);
Expect(40);
typedVar.IsLocal = true;
Expect(1);
int type = core.TypeSystem.GetType(t.val);
if (type == ProtoCore.DSASM.Constants.kInvalidIndex)
{
var unknownType = new ProtoCore.Type();
unknownType.UID = ProtoCore.DSASM.Constants.kInvalidIndex;
unknownType.Name = t.val;
typedVar.datatype = unknownType;
}
else
{
typedVar.datatype = core.TypeSystem.BuildTypeObject(type, 0);
}
if (la.kind == 10) {
var datatype = typedVar.datatype;
Get();
Expect(11);
datatype.rank = 1;
if (la.kind == 10 || la.kind == 24) {
if (la.kind == 24) {
Get();
Expect(10);
Expect(11);
datatype.rank = ProtoCore.DSASM.Constants.nDimensionArrayRank;
} else {
while (la.kind == 10) {
Get();
Expect(11);
datatype.rank++;
}
}
}
typedVar.datatype = datatype;
}
node = typedVar;
} else if (IsLocalVariable()) {
Expect(1);
if (IsKeyWord(t.val, true))
{
errors.SemErr(t.line, t.col, String.Format(Resources.keywordCantBeUsedAsIdentifier, t.val));
}
var identNode = new ProtoCore.AST.AssociativeAST.IdentifierNode();
identNode.Name = identNode.Value = t.val;
NodeUtils.SetNodeLocation(identNode, t);
Expect(47);
Expect(40);
identNode.IsLocal = true;
node = identNode;
} else if (IsTypedVariable()) {
Expect(1);
if (IsKeyWord(t.val, true))
{
errors.SemErr(t.line, t.col, String.Format(Resources.keywordCantBeUsedAsIdentifier, t.val));
}
var typedVar = new ProtoCore.AST.AssociativeAST.TypedIdentifierNode();
typedVar.Name = typedVar.Value = t.val;
NodeUtils.SetNodeLocation(typedVar, t);
Expect(47);
string strIdent = string.Empty;
int type = ProtoCore.DSASM.Constants.kInvalidIndex;
if (IsIdentList()) {
TypedIdentifierList(out node);
strIdent = node.ToString();
} else if (la.kind == 1) {
Get();
strIdent = t.val;
} else SynErr(91);
type = core.TypeSystem.GetType(strIdent);
typedVar.TypeAlias = strIdent;
if (type == ProtoCore.DSASM.Constants.kInvalidIndex)
{
var unknownType = new ProtoCore.Type();
unknownType.UID = ProtoCore.DSASM.Constants.kInvalidIndex;
unknownType.Name = strIdent;
typedVar.datatype = unknownType;
}
else
{
typedVar.datatype = core.TypeSystem.BuildTypeObject(type, 0);
//.........这里部分代码省略.........
示例2: GetIdentifierStringUntilFirstParenthesis
/// <summary>
/// Retrieves the string format of the identifier list from left to right, leaving out any symbols after the last identifier.
/// Given: A.B()
/// Return: "A.B"
/// Given: A.B.C()[0]
/// Return: "A.B.C"
/// Given: A.B().C
/// Return: "A.B"
/// Given: A.B[0].C
/// Return: "A.B[0].C"
/// </summary>
/// <param name="identList"></param>
/// <returns></returns>
public static string GetIdentifierStringUntilFirstParenthesis(ProtoCore.AST.AssociativeAST.IdentifierListNode identList)
{
Validity.Assert(null != identList);
string identListString = identList.ToString();
int removeIndex = identListString.IndexOf('(');
if (removeIndex > 0)
{
identListString = identListString.Remove(removeIndex);
}
return identListString;
}
示例3: GetResolvedClassName
/// <summary>
/// Traverses the identifierlist argument until class name resolution succeeds or fails.
/// </summary>
/// <param name="classTable"></param>
/// <param name="identList"></param>
/// <returns></returns>
public static string[] GetResolvedClassName(ProtoCore.DSASM.ClassTable classTable, ProtoCore.AST.AssociativeAST.IdentifierListNode identList)
{
string identString = GetIdentifierStringUntilFirstParenthesis(identList);
string[] classNames = classTable.GetAllMatchingClasses(ProtoCore.Utils.CoreUtils.GetIdentifierStringUntilFirstParenthesis(identList));
// Failed to find the first time
// Attempt to remove identifiers in the identifierlist until we find a class or not
while (0 == classNames.Length)
{
// Move to the left node
AssociativeNode leftNode = identList.LeftNode;
if (leftNode is IdentifierListNode)
{
identList = leftNode as IdentifierListNode;
string identListString = identList.ToString();
classNames = classTable.GetAllMatchingClasses(ProtoCore.Utils.CoreUtils.GetIdentifierStringUntilFirstParenthesis(identList));
}
else
{
break;
}
}
return classNames;
}