本文整理汇总了C#中Microsoft.Ddue.Tools.SyntaxWriter.WriteMessage方法的典型用法代码示例。如果您正苦于以下问题:C# SyntaxWriter.WriteMessage方法的具体用法?C# SyntaxWriter.WriteMessage怎么用?C# SyntaxWriter.WriteMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Ddue.Tools.SyntaxWriter
的用法示例。
在下文中一共展示了SyntaxWriter.WriteMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteConstructorSyntax
public override void WriteConstructorSyntax (XPathNavigator reflection, SyntaxWriter writer) {
bool isStatic = (bool)reflection.Evaluate(apiIsStaticExpression);
if (isStatic) {
writer.WriteMessage("UnsupportedStaticConstructor_" + Language);
} else {
if (IsUnsupportedUnsafe(reflection, writer)) return;
XPathNavigator declaringType = reflection.SelectSingleNode(apiContainingTypeExpression);
WriteAttributeList(reflection, writer);
WriteAccessModifier(reflection, writer);
writer.WriteKeyword("function");
writer.WriteString(" ");
WriteTypeReference(declaringType, writer);
WriteParameterList(reflection, writer);
}
}
示例2: IsUnsupported
/// <summary>
/// Determines whether the feature is unsupported by this language.
/// </summary>
/// <param name="reflection"></param>
/// <param name="writer"></param>
/// <returns></returns>
private bool IsUnsupported(XPathNavigator reflection, SyntaxWriter writer) {
if (IsUnsupportedGeneric(reflection, writer)) {
return true;
}
if (IsUnsupportedExplicit(reflection, writer)) {
return true;
}
if (IsUnsupportedUnsafe(reflection, writer)) {
return true;
}
if (HasAttribute(reflection, "System.NonScriptableAttribute")) {
writer.WriteMessage("UnsupportedType_ScriptSharp");
return true;
}
return false;
}
示例3: IsUnsupportedUnsafe
protected virtual bool IsUnsupportedUnsafe(XPathNavigator reflection, SyntaxWriter writer)
{
bool isUnsafe = (bool) reflection.Evaluate(apiIsUnsafeExpression);
if (isUnsafe) {
writer.WriteMessage("UnsupportedUnsafe_" + Language);
}
return(isUnsafe);
}
示例4: IsUnsupportedVarargs
protected virtual bool IsUnsupportedVarargs(XPathNavigator reflection, SyntaxWriter writer)
{
bool isVarargs = (bool) reflection.Evaluate(apiIsVarargsExpression);
if(isVarargs)
writer.WriteMessage("UnsupportedVarargs_" + Language);
return (isVarargs);
}
示例5: WriteOperatorSyntax
// operator: done
public override void WriteOperatorSyntax (XPathNavigator reflection, SyntaxWriter writer) {
string name = (string) reflection.Evaluate(apiNameExpression);
string identifier = null;
bool evalulate = (bool)reflection.Evaluate(apiIsUdtReturnExpression);
if (!(bool)reflection.Evaluate(apiIsUdtReturnExpression))
{
switch (name)
{
// unary math operators
case "UnaryPlus":
identifier = "+";
break;
case "UnaryNegation":
identifier = "-";
break;
case "Increment":
identifier = "++";
break;
case "Decrement":
identifier = "--";
break;
// unary logical operators
case "LogicalNot":
identifier = "!";
break;
case "True":
identifier = "true";
break;
case "False":
identifier = "false";
break;
// binary comparison operators
case "Equality":
identifier = "==";
break;
case "Inequality":
identifier = "!=";
break;
case "LessThan":
identifier = "<";
break;
case "GreaterThan":
identifier = ">";
break;
case "LessThanOrEqual":
identifier = "<=";
break;
case "GreaterThanOrEqual":
identifier = ">=";
break;
// binary math operators
case "Addition":
identifier = "+";
break;
case "Subtraction":
identifier = "-";
break;
case "Multiply":
identifier = "*";
break;
case "Division":
identifier = "/";
break;
case "Modulus":
identifier = "%";
break;
// binary logical operators
case "BitwiseAnd":
identifier = "&";
break;
case "BitwiseOr":
identifier = "|";
break;
case "ExclusiveOr":
identifier = "^";
break;
// bit-array operators
case "OnesComplement":
identifier = "~";
break;
case "LeftShift":
identifier = "<<";
break;
case "RightShift":
identifier = ">>";
break;
case "Assign":
identifier = "=";
break;
// unrecognized operator
default:
identifier = null;
break;
}
}
if (identifier == null) {
writer.WriteMessage("UnsupportedOperator_" + Language);
//.........这里部分代码省略.........
示例6: WriteMethodSyntax
public override void WriteMethodSyntax (XPathNavigator reflection, SyntaxWriter writer) {
bool isSpecialName = (bool) reflection.Evaluate(apiIsSpecialExpression);
if (isSpecialName) {
writer.WriteMessage("UnsupportedOperator_" + Language);
} else {
WriteNormalMethodSyntax(reflection, writer);
}
}
示例7: WriteConstructorSyntax
public override void WriteConstructorSyntax (XPathNavigator reflection, SyntaxWriter writer) {
if (IsUnsupportedUnsafe(reflection, writer)) return;
string name = (string) reflection.Evaluate(apiContainingTypeNameExpression);
bool isStatic = (bool) reflection.Evaluate(apiIsStaticExpression);
if (isStatic) {
// no static constructors in Java
writer.WriteMessage("UnsupportedStaticConstructor_" + Language);
return;
}
WriteAttributes(reflection, writer);
WriteVisibility(reflection, writer);
writer.WriteString(" ");
writer.WriteIdentifier(name);
WriteMethodParameters(reflection, writer);
}
示例8: WriteOperatorSyntax
//.........这里部分代码省略.........
break;
case "Modulus":
identifier = "Mod";
type = 2;
break;
case "IntegerDivision":
identifier = @"\";
type = 2;
break;
// binary logical operators
case "BitwiseAnd":
identifier = "And";
type = 2;
break;
case "BitwiseOr":
identifier = "Or";
type = 2;
break;
case "ExclusiveOr":
identifier = "Xor";
type = 2;
break;
// bit-array operators
case "OnesComplement":
identifier = "~";
type = -1;
break;
case "LeftShift":
identifier = "<<";
type = 2;
break;
case "RightShift":
identifier = ">>";
type = 2;
break;
// concatenation
case "Concatenate":
identifier = "&";
type = 2;
break;
case "Assign":
identifier = "=";
type = 2;
break;
// didn't recognize an operator
default:
identifier = null;
type = 0;
break;
}
}
if (identifier == null) {
writer.WriteMessage("UnsupportedOperator_" + Language);
} else {
XPathNodeIterator parameters = reflection.Select(apiParametersExpression);
if (parameters.Count != Math.Abs(type)) {
writer.WriteMessage("UnsupportedOperator_" + Language);
return;
} //throw new InvalidOperationException("An operator has the wrong number of parameters.");
WriteParameterDeclarations(reflection, writer);
ParameterDeclaration("returnValue", returnType, writer);
writer.WriteLine();
writer.WriteParameter("returnValue");
writer.WriteString(" = ");
switch (type) {
case -1:
writer.WriteIdentifier(identifier);
parameters.MoveNext();
writer.WriteParameter((string)parameters.Current.Evaluate(parameterNameExpression));
break;
case +1:
parameters.MoveNext();
writer.WriteParameter((string)parameters.Current.Evaluate(parameterNameExpression));
writer.WriteIdentifier(identifier);
break;
case 2:
writer.WriteString("(");
// parameter 1
parameters.MoveNext();
writer.WriteParameter((string)parameters.Current.Evaluate(parameterNameExpression));
writer.WriteString(" ");
writer.WriteIdentifier(identifier);
writer.WriteString(" ");
// parameter 2
parameters.MoveNext();
writer.WriteParameter((string)parameters.Current.Evaluate(parameterNameExpression));
writer.WriteString(")");
break;
}
}
}
示例9: WriteOperatorSyntax
public override void WriteOperatorSyntax(XPathNavigator reflection, SyntaxWriter writer)
{
string name = (string)reflection.Evaluate(apiNameExpression);
string identifier;
bool isStatic = (bool)reflection.Evaluate(apiIsStaticExpression);
switch (name)
{
// unary math operators
case "UnaryPlus":
identifier = "+";
break;
case "UnaryNegation":
identifier = "-";
break;
case "Increment":
identifier = "++";
break;
case "Decrement":
identifier = "--";
break;
// unary logical operators
case "LogicalNot":
identifier = "not";
break;
case "True":
identifier = "true";
break;
case "False":
identifier = "false";
break;
// binary comparison operators
case "Equality":
identifier = "=";
break;
case "Inequality":
identifier = "<>";
break;
case "LessThan":
identifier = "<";
break;
case "GreaterThan":
identifier = ">";
break;
case "LessThanOrEqual":
identifier = "<=";
break;
case "GreaterThanOrEqual":
identifier = ">=";
break;
// binary math operators
case "Addition":
identifier = "+";
break;
case "Subtraction":
identifier = "-";
break;
case "Multiply":
identifier = "*";
break;
case "Division":
identifier = "/";
break;
case "Modulus":
identifier = "%";
break;
// binary logical operators
case "BitwiseAnd":
identifier = "&&&";
break;
case "BitwiseOr":
identifier = "|||";
break;
case "ExclusiveOr":
identifier = "^^^";
break;
// bit-array operators
case "OnesComplement":
identifier = null; // No F# equiv.
break;
case "LeftShift":
identifier = "<<<";
break;
case "RightShift":
identifier = ">>>";
break;
// unrecognized operator
default:
identifier = null;
break;
}
if (identifier == null)
{
writer.WriteMessage("UnsupportedOperator_" + Language);
}
else
{
if (isStatic)
{
//.........这里部分代码省略.........
示例10: WriteOperatorSyntax
/// <summary>
/// Operator syntax is unsupported
/// </summary>
/// <param name="reflection">The reflection information</param>
/// <param name="writer">The syntax writer to which it is written</param>
public override void WriteOperatorSyntax(XPathNavigator reflection,
SyntaxWriter writer)
{
writer.WriteMessage("UnsupportedOperator_" + this.Language);
}
示例11: WriteEventSyntax
/// <summary>
/// Write out event syntax
/// </summary>
/// <param name="reflection">The reflection information</param>
/// <param name="writer">The syntax writer to which it is written</param>
public override void WriteEventSyntax(XPathNavigator reflection,
SyntaxWriter writer)
{
if(!this.IsUnsupported(reflection, writer))
{
if(reflection.Select(
SyntaxGeneratorTemplate.apiParametersExpression).Count > 0)
writer.WriteMessage("UnsupportedIndex_" + this.Language);
else
{
string identifier = ReadMemberName(reflection);
writer.WriteKeyword("function");
writer.WriteString(" add_");
writer.WriteIdentifier(identifier);
writer.WriteString("(");
writer.WriteParameter("value");
writer.WriteString(");");
writer.WriteLine();
writer.WriteKeyword("function");
writer.WriteString(" remove_");
writer.WriteIdentifier(identifier);
writer.WriteString("(");
writer.WriteParameter("value");
writer.WriteString(");");
}
}
}
示例12: WriteEventSyntax
public override void WriteEventSyntax(XPathNavigator reflection, SyntaxWriter writer) {
if (IsUnsupported(reflection, writer)) return;
if (reflection.Select(apiParametersExpression).Count > 0) {
writer.WriteMessage("UnsupportedIndex_" + Language);
return;
}
string memberName = ReadMemberName(reflection);
writer.WriteKeyword("function");
writer.WriteString(" add_");
writer.WriteIdentifier(memberName);
writer.WriteString("(");
writer.WriteParameter("value");
writer.WriteString(");");
writer.WriteLine();
writer.WriteKeyword("function");
writer.WriteString(" remove_");
writer.WriteIdentifier(memberName);
writer.WriteString("(");
writer.WriteParameter("value");
writer.WriteString(");");
}
示例13: WriteDelegateSyntax
public override void WriteDelegateSyntax (XPathNavigator reflection, SyntaxWriter writer) {
if (IsUnsupportedGeneric(reflection, writer)) return;
writer.WriteMessage("UnsupportedDelegate_" + Language);
}
示例14: WritePropertySyntax
public override void WritePropertySyntax (XPathNavigator reflection, SyntaxWriter writer) {
if (IsUnsupportedUnsafe(reflection, writer)) return;
if (IsUnsupportedExplicit(reflection, writer)) return;
if (reflection.Select(apiParametersExpression).Count > 0) {
writer.WriteMessage("UnsupportedIndex_" + Language);
return;
}
string name = (string)reflection.Evaluate(apiNameExpression);
bool isGettable = (bool)reflection.Evaluate(apiIsReadPropertyExpression);
bool isSettable = (bool)reflection.Evaluate(apiIsWritePropertyExpression);
XPathNavigator type = reflection.SelectSingleNode(apiReturnTypeExpression);
if (isGettable) {
WriteAttributeList(reflection, writer);
string getVisibility = (string)reflection.Evaluate(apiGetVisibilityExpression);
if (!String.IsNullOrEmpty(getVisibility))
{
WriteVisibility(getVisibility, writer);
writer.WriteString(" ");
}
WriteProcedureModifiers(reflection, writer);
writer.WriteKeyword("function get");
writer.WriteString(" ");
writer.WriteIdentifier(name);
writer.WriteString(" () : ");
WriteTypeReference(type, writer);
writer.WriteLine();
}
if (isSettable) {
WriteAttributeList(reflection, writer);
string setVisibility = (string)reflection.Evaluate(apiSetVisibilityExpression);
if (!String.IsNullOrEmpty(setVisibility))
{
WriteVisibility(setVisibility, writer);
writer.WriteString(" ");
}
WriteProcedureModifiers(reflection, writer);
writer.WriteKeyword("function set");
writer.WriteString(" ");
writer.WriteIdentifier(name);
writer.WriteString(" (");
writer.WriteParameter("value");
writer.WriteString(" : ");
WriteTypeReference(type, writer);
writer.WriteString(")");
}
}
示例15: IsUnsupportedGeneric
protected virtual bool IsUnsupportedGeneric (XPathNavigator reflection, SyntaxWriter writer) {
bool isGeneric = (bool) reflection.Evaluate(apiIsGenericExpression);
if (isGeneric) {
writer.WriteMessage("UnsupportedGeneric_" + Language);
}
return(isGeneric);
}