public IOperation GetOperation(Encoding encoding, IProcessorState processorState)
        {
            TokenTrie structureTrie      = new TokenTrie();
            TokenTrie closeConditionTrie = new TokenTrie();
            TokenTrie scanBackTrie       = new TokenTrie();

            IToken openOpenElementTokenBytes = Tokens.OpenOpenElementToken.ToToken(processorState.Encoding);

            scanBackTrie.AddToken(openOpenElementTokenBytes);
            int openOpenElementToken   = structureTrie.AddToken(openOpenElementTokenBytes);
            int openCloseElementToken  = structureTrie.AddToken(Tokens.OpenCloseElementToken.ToToken(processorState.Encoding));
            int closeCloseElementToken = structureTrie.AddToken(Tokens.CloseElementTagToken.ToToken(processorState.Encoding));

            int selfClosingElementEndToken = -1;

            if (Tokens.SelfClosingElementEndToken != null)
            {
                selfClosingElementEndToken = structureTrie.AddToken(Tokens.SelfClosingElementEndToken.ToToken(processorState.Encoding));
            }

            closeConditionTrie.AddToken(Tokens.CloseConditionExpression.ToToken(processorState.Encoding));
            MarkupTokenMapping mapping = new MarkupTokenMapping(
                openOpenElementToken,
                openCloseElementToken,
                closeCloseElementToken,
                selfClosingElementEndToken
                );

            IReadOnlyList <IToken> start = new[] { Tokens.OpenConditionExpression.ToToken(processorState.Encoding) };

            return(new Impl(this, start, structureTrie, closeConditionTrie, scanBackTrie, mapping, _id, _initialState));
        }
 public Impl(InlineMarkupConditional definition, IReadOnlyList <byte[]> tokens, TokenTrie structureTrie, TokenTrie closeConditionTrie, TokenTrie scanBackTrie, MarkupTokenMapping mapping, string id)
 {
     _definition         = definition;
     Id                  = id;
     Tokens              = tokens;
     _mapping            = mapping;
     _structureTrie      = structureTrie;
     _scanBackTrie       = scanBackTrie;
     _closeConditionTrie = closeConditionTrie;
 }
 public Impl(InlineMarkupConditional definition, IReadOnlyList <IToken> tokens, ITokenTrie structureTrie, ITokenTrie closeConditionTrie, ITokenTrie scanBackTrie, MarkupTokenMapping mapping, string id, bool initialState)
 {
     _definition         = definition;
     Id                  = id;
     Tokens              = tokens;
     _mapping            = mapping;
     _structureTrie      = structureTrie;
     _scanBackTrie       = scanBackTrie;
     _closeConditionTrie = closeConditionTrie;
     IsInitialStateOn    = string.IsNullOrEmpty(id) || initialState;
 }