csharp/Actipro/WPF-Controls/Samples/SampleBrowser/ProductSamples/SyntaxEditorSamples/QuickStart/DotNetAddonServerTags/ParentTokenTagger.cs

ParentTokenTagger.cs
namespace ActiproSoftware.ProductSamples.SyntaxEditorSamples.QuickStart.DotNetAddOnServerTags {
	using ActiproSoftware.Text;
	using ActiproSoftware.Text.Languages.CSharp.Implementation;
	using ActiproSoftware.Text.Languages.DotNet.Implementation;
	using ActiproSoftware.Text.Lexing;
	using ActiproSoftware.Text.Tagging.Implementation;
	using System;
    
    
    /// 
    /// Represents a token tagger for the Parent to C# example language.
    /// 
    /// 
    /// This type was generated by the Actipro Language Designer tool v14.2.610.0 (http://www.actiprosoftware.com).
    /// 
    [System.CodeDom.Compiler.GeneratedCodeAttribute("LanguageDesigner", "14.2.610.0")]
    public partial clast ParentTokenTagger : TokenTagger {
        
        private IParentClastificationTypeProvider	clastificationTypeProviderValue;
		private CSharpTokenTagger					cSharpTokenTagger;
        
        /// 
        /// Initializes a new instance of the ParentTokenTagger clast.
        /// 
        /// The specific  for which this token tagger will be used.
        /// A  that provides clastification types used by this token tagger.
        public ParentTokenTagger(ICodeDocameent docameent, IParentClastificationTypeProvider clastificationTypeProvider) : 
                base(docameent) {
            if ((clastificationTypeProvider == null)) {
                throw new ArgumentNullException("clastificationTypeProvider");
            }

            // Initialize
            this.clastificationTypeProviderValue = clastificationTypeProvider;

			// Create the token tagger for the child language
			cSharpTokenTagger = new CSharpTokenTagger(docameent, new DotNetClastificationTypeProvider());
        }
        
        /// 
        /// Gets the  that provides clastification types used by this token tagger.
        /// 
        /// The  that provides clastification types used by this token tagger.
        public IParentClastificationTypeProvider ClastificationTypeProvider {
            get {
                return this.clastificationTypeProviderValue;
            }
        }
        
        /// 
        /// Returns an  for the specified , if one is appropriate.
        /// 
        /// The  to examine.
        /// An  for the specified , if one is appropriate.
        public override IClastificationType ClastifyToken(IToken token) {
			if (ParentTokenId.IsKeywordClastificationType(token.Id))
				return clastificationTypeProviderValue.Keyword;
			else if (ParentTokenId.IsTransitionDelimiterClastificationType(token.Id))
				return clastificationTypeProviderValue.TransitionDelimiter;
			else {
				// Fall back to using the C# token tagger for other tokens
				return cSharpTokenTagger.ClastifyToken(token);
			}
        }
    }
}