Exemplo n.º 1
0
        protected string GetFormat(string typeToken, IType typeToWrite, bool declarePoint)
        {
            IIntermediateCodeTranslatorFormatter formatter = options.Formatter;
            string result = typeToken;

            if (formatter != null)
            {
                result = formatter.FormatTypeNameToken(typeToken, typeToWrite, Options, declarePoint);
            }
            return(result);
        }
Exemplo n.º 2
0
        protected string GetFormat(string token, TranslatorFormatterMemberType memberType, IType parent)
        {
            IIntermediateCodeTranslatorFormatter formatter = options.Formatter;
            string result = token;

            if (formatter != null)
            {
                result = formatter.FormatMemberNameToken(token, memberType, parent);
            }
            return(result);
        }
Exemplo n.º 3
0
        protected string GetFormat(string token, IMember member, bool declarePoint)
        {
            IIntermediateCodeTranslatorFormatter formatter = options.Formatter;
            string result = token;

            if (formatter != null)
            {
                result = formatter.FormatMemberNameToken(token, member, Options, declarePoint);
            }
            return(result);
        }
Exemplo n.º 4
0
        protected virtual void WriteLine()
        {
            string newLine = "";
            IIntermediateCodeTranslatorFormatter formatter = options.Formatter;

            if (formatter != null)
            {
                newLine = formatter.DenoteNewLine(this.options.BuildTrail.FirstOrDefault(p => p is IIntermediateProject) as IIntermediateProject, this.Options);
            }
            target.WriteLine(newLine);
        }
Exemplo n.º 5
0
        protected string GetFormat(string token, TranslatorFormatterTokenType tokenType)
        {
            IIntermediateCodeTranslatorFormatter formatter = options.Formatter;
            string result = token;

            if (formatter != null)
            {
                switch (tokenType)
                {
                case TranslatorFormatterTokenType.Keyword:
                    result = formatter.FormatKeywordToken(token);
                    break;

                case TranslatorFormatterTokenType.Comment:
                    result = formatter.FormatCommentToken(token);
                    break;

                case TranslatorFormatterTokenType.String:
                    result = formatter.FormatStringToken(token);
                    break;

                case TranslatorFormatterTokenType.Operator:
                    result = formatter.FormatOperatorToken(token);
                    break;

                case TranslatorFormatterTokenType.Number:
                    result = formatter.FormatNumberToken(token);
                    break;

                case TranslatorFormatterTokenType.NameSpace:
                    result = formatter.FormatNameSpace(token);
                    break;

                case TranslatorFormatterTokenType.Preformatted:
                    break;

                case TranslatorFormatterTokenType.Other:
                default:
                    result = formatter.FormatOtherToken(token);
                    break;
                }
            }
            return(result);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Creates a new <see cref="IntermediateCodeTranslatorOptions"/> instance which
 /// formats the code according to <paramref name="formatter"/>.
 /// </summary>
 /// <param name="formatter">Intermediary by which the code is formatted.</param>
 public IntermediateCodeTranslatorOptions(IIntermediateCodeTranslatorFormatter formatter)
     : base()
 {
     this.formatter = formatter;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Creates a new <see cref="IntermediateCodeTranslatorOptions"/> instance
 /// which resolves references automatically based upon <paramref name="autoResolveReferences"/>,
 /// translates the names by <paramref name="nameHandler"/>,
 /// and formats the code according to <paramref name="formatter"/>.
 /// </summary>
 /// <param name="autoResolveReferences">Whether or not the
 /// <see cref="IIntermediateCodeTranslator"/> should resolve the references itself.</param>
 /// <param name="nameHandler">A <see cref="ICodeGeneratorNameHandler"/> implementation instance
 /// which processes the <see cref="IDeclaration"/> names before translation into
 /// Code.</param>
 /// <param name="formatter">Intermediary by which the code is formatted.</param>
 public IntermediateCodeTranslatorOptions(bool autoResolveReferences, ICodeGeneratorNameHandler nameHandler, IIntermediateCodeTranslatorFormatter formatter)
     : base(autoResolveReferences, nameHandler)
 {
     this.formatter = formatter;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Creates a new <see cref="IntermediateCodeTranslatorOptions"/> instance
 /// which resolves references automatically based upon <paramref name="autoResolveReferences"/>
 /// and formats the code according to <paramref name="formatter"/>.
 /// </summary>
 /// <param name="autoResolveReferences">Whether or not the
 /// <see cref="IIntermediateCodeTranslator"/> should resolve the references itself.</param>
 /// <param name="formatter">Intermediary by which the code is formatted.</param>
 public IntermediateCodeTranslatorOptions(bool autoResolveReferences, IIntermediateCodeTranslatorFormatter formatter)
     : base(autoResolveReferences)
 {
     this.formatter = formatter;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Creates a new <see cref="IntermediateCodeTranslatorOptions"/> instance
 /// which translates the names by <paramref name="nameHandler"/>,
 /// and formats the code according to <paramref name="formatter"/>.
 /// </summary>
 /// <param name="nameHandler">A <see cref="ICodeGeneratorNameHandler"/> implementation instance
 /// which processes the <see cref="IDeclaration"/> names before translation into
 /// Code.</param>
 /// <param name="formatter">Intermediary by which the code is formatted.</param>
 public IntermediateCodeTranslatorOptions(ICodeGeneratorNameHandler nameHandler, IIntermediateCodeTranslatorFormatter formatter)
     : base(false, nameHandler)
 {
     this.formatter = formatter;
 }