本文整理汇总了C#中ParseTree.GetAnnotation方法的典型用法代码示例。如果您正苦于以下问题:C# ParseTree.GetAnnotation方法的具体用法?C# ParseTree.GetAnnotation怎么用?C# ParseTree.GetAnnotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParseTree
的用法示例。
在下文中一共展示了ParseTree.GetAnnotation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TranslateFunctionDefinition
protected override void TranslateFunctionDefinition(List<string> output, ParseTree.FunctionDefinition functionDef)
{
output.Add(this.CurrentTabIndention);
string returnType = "void*";
Annotation returnTypeAnnotation = functionDef.GetAnnotation("type");
if (returnTypeAnnotation != null)
{
returnType = this.CPlatform.GetTypeStringFromAnnotation(new AnnotatedType(returnTypeAnnotation), false, true);
}
output.Add(returnType);
output.Add(" ");
output.Add("v_" + functionDef.NameToken.Value);
output.Add("(");
for (int i = 0; i < functionDef.ArgNames.Length; ++i)
{
if (i > 0) output.Add(", ");
if (functionDef.ArgAnnotations[i] == null)
{
output.Add("object ");
}
else
{
string argType = functionDef.ArgAnnotations[i].GetSingleArgAsString(null);
string type = this.CPlatform.GetTypeStringFromAnnotation(functionDef.ArgAnnotations[i].FirstToken, argType, false, true);
output.Add(type);
output.Add(" ");
}
output.Add("v_" + functionDef.ArgNames[i].Value);
}
output.Add(")");
output.Add(this.NL);
output.Add(this.CurrentTabIndention);
output.Add("{");
output.Add(this.NL);
this.CurrentIndention++;
Executable[] code = functionDef.Code;
if (functionDef.GetAnnotation("omitReturn") != null)
{
Executable[] newCode = new Executable[code.Length - 1];
Array.Copy(code, newCode, newCode.Length);
code = newCode;
}
this.Translate(output, code);
this.CurrentIndention--;
output.Add(this.CurrentTabIndention);
output.Add("}");
//*/
output.Add(this.NL);
}
示例2: TranslateFunctionDefinition
protected override void TranslateFunctionDefinition(List<string> output, ParseTree.FunctionDefinition functionDef)
{
Annotation returnType = functionDef.GetAnnotation("type");
string type = returnType == null ? "Object" : this.JavaPlatform.GetTypeStringFromString(returnType.GetSingleArgAsString(null), false, false);
output.Add(this.CurrentTabIndention);
output.Add("public static ");
output.Add(type);
output.Add(" v_");
output.Add(functionDef.NameToken.Value);
output.Add("(");
for (int i = 0; i < functionDef.ArgNames.Length; ++i)
{
if (i > 0) {
output.Add(", ");
}
Annotation annotation = functionDef.ArgAnnotations[i];
string argType = annotation == null ? "Object" : annotation.GetSingleArgAsString(null);
output.Add(this.JavaPlatform.GetTypeStringFromString(argType, false, false));
output.Add(" v_");
output.Add(functionDef.ArgNames[i].Value);
}
output.Add(") {");
output.Add(this.NL);
this.CurrentIndention++;
Executable[] code = functionDef.Code;
if (functionDef.GetAnnotation("omitReturn") != null)
{
Executable[] newCode = new Executable[code.Length - 1];
Array.Copy(code, newCode, newCode.Length);
code = newCode;
}
this.Translate(output, code);
this.CurrentIndention--;
output.Add(this.CurrentTabIndention);
output.Add("}");
output.Add(this.NL);
}