当前位置: 首页>>代码示例>>C#>>正文


C# SyntaxWriter.WriteMessage方法代码示例

本文整理汇总了C#中SyntaxWriter.WriteMessage方法的典型用法代码示例。如果您正苦于以下问题:C# SyntaxWriter.WriteMessage方法的具体用法?C# SyntaxWriter.WriteMessage怎么用?C# SyntaxWriter.WriteMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SyntaxWriter的用法示例。


在下文中一共展示了SyntaxWriter.WriteMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteOperatorSyntax


//.........这里部分代码省略.........
                    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;
                    case "Assign":
                        identifier = "=";
                        break;
                    // unrecognized operator
                    default:
                        identifier = null;
                        break;
                }
            }
            if(identifier == null)
            {
                writer.WriteMessage("UnsupportedOperator_" + Language);
            }
            else
            {
                if(isStatic)
                {
                    writer.WriteKeyword("static");
                    writer.WriteString(" ");
                }

                writer.WriteKeyword("let");
                writer.WriteString(" ");
                writer.WriteKeyword("inline");
                writer.WriteKeyword(" ");

                writer.WriteString("(");
                writer.WriteIdentifier(identifier);
                writer.WriteString(")");

                WriteParameters(reflection, writer);
                writer.WriteString(" : ");
                WriteReturnValue(reflection, writer);

            }
        }
开发者ID:julianhaslinger,项目名称:SHFB,代码行数:101,代码来源:FSharpDeclarationSyntax.cs

示例2: WriteCastSyntax

 /// <inheritdoc />
 public override void WriteCastSyntax(XPathNavigator reflection, SyntaxWriter writer)
 {
     writer.WriteMessage("UnsupportedCast_" + Language);
 }
开发者ID:julianhaslinger,项目名称:SHFB,代码行数:5,代码来源:FSharpDeclarationSyntax.cs

示例3: WriteMethodSyntax

        /// <inheritdoc />
        public override void WriteMethodSyntax(XPathNavigator reflection, SyntaxWriter writer)
        {
            bool isSpecialName = (bool)reflection.Evaluate(apiIsSpecialExpression);

            if(isSpecialName)
            {
                writer.WriteMessage("UnsupportedOperator_" + Language);
            }
            else
            {
                WriteNormalMethodSyntax(reflection, writer);
            }
        }
开发者ID:armin-bauer,项目名称:SHFB,代码行数:14,代码来源:JSharpDeclarationSyntax.cs

示例4: WriteOperatorSyntax


//.........这里部分代码省略.........
                    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 "Exponent":
                        identifier = "^";
                        break;
                    case "Modulus":
                        identifier = "Mod";
                        break;
                    case "IntegerDivision":
                        identifier = @"\";
                        break;
                    // binary logical operators
                    case "BitwiseAnd":
                        identifier = "And";
                        break;
                    case "BitwiseOr":
                        identifier = "Or";
                        break;
                    case "ExclusiveOr":
                        identifier = "Xor";
                        break;
                    // bit-array operators
                    case "OnesComplement":
                        identifier = "~";
                        break;
                    case "LeftShift":
                        identifier = "<<";
                        break;
                    case "RightShift":
                        identifier = ">>";
                        break;
                    // concatenation
                    case "Concatenate":
                        identifier = "&";
                        break;
                    // casting operators
                    case "Implicit":
                    case "Explicit":
                        identifier = "CType";
                        break;
                    case "Assign":
                        identifier = "=";
                        break;
                    // didn't recognize an operator
                    default:
                        identifier = null;
                        break;
                }
            }
            if(identifier == null)
            {
                writer.WriteMessage("UnsupportedOperator_" + Language);
                return;
            }

            WriteProcedureModifiers(reflection, writer);

            if(name == "Implicit")
            {
                writer.WriteKeyword("Widening");
                writer.WriteString(" ");
            }
            else if(name == "Explicit")
            {
                writer.WriteKeyword("Narrowing");
                writer.WriteString(" ");
            }

            writer.WriteKeyword("Operator");
            writer.WriteString(" ");
            writer.WriteIdentifier(identifier);
            WriteParameters(reflection, writer);
            writer.WriteString(" ");
            writer.WriteKeyword("As");
            writer.WriteString(" ");
            WriteTypeReference(type, writer);
        }
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:101,代码来源:VisualBasicDeclarationSyntax.cs

示例5: WriteOperatorSyntax


//.........这里部分代码省略.........
                        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;
                }
            }

        }
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:101,代码来源:VisualBasicUsageSyntax.cs

示例6: WriteConstructorSyntax

        /// <inheritdoc />
        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);

        }
开发者ID:armin-bauer,项目名称:SHFB,代码行数:23,代码来源:JSharpDeclarationSyntax.cs

示例7: WriteStructureSyntax

 /// <summary>
 /// Structure 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 WriteStructureSyntax(XPathNavigator reflection,
   SyntaxWriter writer)
 {
     if(!this.IsUnsupported(reflection, writer))
         writer.WriteMessage("UnsupportedStructure_" + this.Language);
 }
开发者ID:julianhaslinger,项目名称:SHFB,代码行数:11,代码来源:JavaScriptDeclarationSyntaxGenerator.cs

示例8: WriteClassSyntax

        /// <inheritdoc />
        public override void WriteClassSyntax(XPathNavigator reflection, SyntaxWriter writer)
        {
            bool isAbstract = (bool)reflection.Evaluate(apiIsAbstractTypeExpression);
            bool isSealed = (bool)reflection.Evaluate(apiIsSealedTypeExpression);

            if(isAbstract && isSealed)
                writer.WriteMessage("UnsupportedStaticClass_" + Language);
            else
                TypeDeclaration(reflection, writer);
        }
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:11,代码来源:VisualBasicUsageSyntax.cs

示例9: 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(");");
                }
            }
        }
开发者ID:julianhaslinger,项目名称:SHFB,代码行数:33,代码来源:JavaScriptDeclarationSyntaxGenerator.cs

示例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);
 }
开发者ID:julianhaslinger,项目名称:SHFB,代码行数:10,代码来源:JavaScriptDeclarationSyntaxGenerator.cs

示例11: IsUnsupported

        /// <summary>
        /// Check to see if the element is unsupported
        /// </summary>
        /// <param name="reflection">The reflection information</param>
        /// <param name="writer">The writer to which the "unsupported"
        /// message is written.</param>
        /// <returns>True if unsupported or false if it is supported</returns>
        private bool IsUnsupported(XPathNavigator reflection, SyntaxWriter writer)
        {
            if(base.IsUnsupportedGeneric(reflection, writer) ||
              base.IsUnsupportedExplicit(reflection, writer) ||
              base.IsUnsupportedUnsafe(reflection, writer))
                return true;

            if(HasAttribute(reflection, "System.NonScriptableAttribute"))
            {
                writer.WriteMessage("UnsupportedType_ScriptSharp");
                return true;
            }

            return false;
        }
开发者ID:julianhaslinger,项目名称:SHFB,代码行数:22,代码来源:JavaScriptDeclarationSyntaxGenerator.cs

示例12: WriteOperatorSyntax


//.........这里部分代码省略.........
                    break;
                // unary logical operators
                case "LogicalNot":
                    identifier = "!";
                    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;
                // others
                case "Comma":
                    identifier = ",";
                    break;
                case "MemberSelection":
                    identifier = "->";
                    break;
                case "AddressOf":
                    identifier = "&";
                    break;
                case "PointerDereference":
                    identifier = "*";
                    break;
                case "Assign":
                    identifier = "=";
                    break;
                // unrecognized operator
                default:
                    identifier = null;
                    break;
            }

            if(identifier == null)
            {
                writer.WriteMessage("UnsupportedOperator_" + Language);
            }
            else
            {

                WriteProcedureVisibility(reflection, writer);
                WritePrefixProcedureModifiers(reflection, writer);
                WriteReturnValue(reflection, writer);
                writer.WriteString(" ");
                writer.WriteKeyword("operator");
                writer.WriteString(" ");
                writer.WriteIdentifier(identifier);
                WriteMethodParameters(reflection, writer);
            }

        }
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:101,代码来源:ManagedCPlusPlusDeclarationSyntax.cs

示例13: WriteStructureSyntax

 /// <inheritdoc />
 public override void WriteStructureSyntax(XPathNavigator reflection, SyntaxWriter writer)
 {
     if(IsUnsupportedGeneric(reflection, writer))
         return;
     writer.WriteMessage("UnsupportedStructure_" + Language);
 }
开发者ID:armin-bauer,项目名称:SHFB,代码行数:7,代码来源:JScriptDeclarationSyntax.cs

示例14: WritePropertySyntax

        /// <inheritdoc />
        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)
            {
                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)
            {
                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(")");
            }

        }
开发者ID:armin-bauer,项目名称:SHFB,代码行数:60,代码来源:JScriptDeclarationSyntax.cs

示例15: WriteConstructorSyntax

        /// <inheritdoc />
        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);

                WriteAccessModifier(reflection, writer);
                writer.WriteKeyword("function");
                writer.WriteString(" ");
                WriteTypeReference(declaringType, writer);
                WriteParameterList(reflection, writer);
            }
        }
开发者ID:armin-bauer,项目名称:SHFB,代码行数:21,代码来源:JScriptDeclarationSyntax.cs


注:本文中的SyntaxWriter.WriteMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。