Ejemplo n.º 1
0
        /// <summary>
        /// Interprets and highlight the given string as C# code
        /// and return the resulting FormattedCode instance.
        /// </summary>
        /// <param name="csharpCode">A string read as C# code.
        /// This parameter must not be null.</param>
        /// <returns>A FormattedCode instance containing data
        /// to highlight the text with basic syntax coloring.</returns>
        public FormattedCode Format(string csharpCode)
        {
            UiExceptionHelper.CheckNotNull(csharpCode, "csharpCode");

            _info      = FormattedCode.NewCodeInfo();
            csharpCode = PreProcess(csharpCode);
            Parse(csharpCode);

            return(CSCode);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Interprets and highlight the given string as C# code
        /// and return the resulting FormattedCode instance.
        /// </summary>
        /// <param name="csharpCode">A string read as C# code.
        /// This parameter must not be null.</param>
        /// <returns>A FormattedCode instance containing data
        /// to highlight the text with basic syntax coloring.</returns>
        public FormattedCode Format(string csharpCode)
        {
            UiExceptionHelper.CheckNotNull(csharpCode, "csharpCode");

            _info = FormattedCode.NewCodeInfo();
            csharpCode = PreProcess(csharpCode);
            Parse(csharpCode);

            return (CSCode);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Appends data in token at the end of output.
        /// </summary>
        /// <param name="token">Token to be merged with output.</param>
        /// <param name="output">Target location.</param>
        private void _flushToken(ClassifiedToken token, FormattedCode.CodeInfo output)
        {
            if (token == null)
                return;

            output.IndexArray.Add(token.IndexStart);
            output.TagArray.Add((byte)token.Tag);

            return;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Builds a new instance of CSharpCodeFormatter.
        /// </summary>
        public CSharpCodeFormatter()
        {
            _info = FormattedCode.NewCodeInfo();

            return;
        }
Ejemplo n.º 5
0
 public InternalFormattedCode(FormattedCode.CodeInfo info)
 {
     _codeInfo = info;
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Builds a new instance of CSharpCodeFormatter.
        /// </summary>
        public CSharpCodeFormatter()
        {
            _info = FormattedCode.NewCodeInfo();

            return;
        }