Beispiel #1
0
        internal static List <IOperationProvider> ConfigureFromJObject(JObject rawConfiguration)
        {
            IReadOnlyList <string> ifToken               = rawConfiguration.ArrayAsStrings("if");
            IReadOnlyList <string> elseToken             = rawConfiguration.ArrayAsStrings("else");
            IReadOnlyList <string> elseIfToken           = rawConfiguration.ArrayAsStrings("elseif");
            IReadOnlyList <string> actionableIfToken     = rawConfiguration.ArrayAsStrings("actionableIf");
            IReadOnlyList <string> actionableElseToken   = rawConfiguration.ArrayAsStrings("actionableElse");
            IReadOnlyList <string> actionableElseIfToken = rawConfiguration.ArrayAsStrings("actionableElseif");
            IReadOnlyList <string> actionsToken          = rawConfiguration.ArrayAsStrings("actions");
            IReadOnlyList <string> endIfToken            = rawConfiguration.ArrayAsStrings("endif");
            string id          = rawConfiguration.ToString("id");
            bool   trim        = rawConfiguration.ToBool("trim");
            bool   wholeLine   = rawConfiguration.ToBool("wholeLine");
            bool   onByDefault = rawConfiguration.ToBool("onByDefault");

            string             evaluatorName = rawConfiguration.ToString("evaluator");
            ConditionEvaluator evaluator     = EvaluatorSelector.Select(evaluatorName);

            ConditionalTokens tokenVariants = new ConditionalTokens
            {
                IfTokens               = ifToken.TokenConfigs(),
                ElseTokens             = elseToken.TokenConfigs(),
                ElseIfTokens           = elseIfToken.TokenConfigs(),
                EndIfTokens            = endIfToken.TokenConfigs(),
                ActionableElseIfTokens = actionableElseIfToken.TokenConfigs(),
                ActionableElseTokens   = actionableElseToken.TokenConfigs(),
                ActionableIfTokens     = actionableIfToken.TokenConfigs(),
                ActionableOperations   = actionsToken
            };

            return(new List <IOperationProvider>()
            {
                new Conditional(tokenVariants, wholeLine, trim, evaluator, id, onByDefault)
            });
        }
Beispiel #2
0
        public IEnumerable <IOperationProvider> Process(IComponentManager componentManager, JObject rawConfiguration, IDirectory templateRoot, IVariableCollection variables, IParameterSet parameters)
        {
            IReadOnlyList <string> ifToken               = rawConfiguration.ArrayAsStrings("if");
            IReadOnlyList <string> elseToken             = rawConfiguration.ArrayAsStrings("else");
            IReadOnlyList <string> elseIfToken           = rawConfiguration.ArrayAsStrings("elseif");
            IReadOnlyList <string> actionableIfToken     = rawConfiguration.ArrayAsStrings("actionableIf");
            IReadOnlyList <string> actionableElseToken   = rawConfiguration.ArrayAsStrings("actionableElse");
            IReadOnlyList <string> actionableElseIfToken = rawConfiguration.ArrayAsStrings("actionableElseif");
            IReadOnlyList <string> actionsToken          = rawConfiguration.ArrayAsStrings("actions");
            IReadOnlyList <string> endIfToken            = rawConfiguration.ArrayAsStrings("endif");
            string id        = rawConfiguration.ToString("id");
            bool   trim      = rawConfiguration.ToBool("trim");
            bool   wholeLine = rawConfiguration.ToBool("wholeLine");

            string             evaluatorName = rawConfiguration.ToString("evaluator");
            ConditionEvaluator evaluator     = EvaluatorSelector.Select(evaluatorName);

            ConditionalTokens tokenVariants = new ConditionalTokens
            {
                IfTokens               = ifToken,
                ElseTokens             = elseToken,
                ElseIfTokens           = elseIfToken,
                EndIfTokens            = endIfToken,
                ActionableElseIfTokens = actionableElseIfToken,
                ActionableElseTokens   = actionableElseToken,
                ActionableIfTokens     = actionableIfToken,
                ActionableOperations   = actionsToken
            };

            yield return(new Conditional(tokenVariants, wholeLine, trim, evaluator, id));
        }
Beispiel #3
0
        public static List <IOperationProvider> GenerateConditionalSetup(string token, ConditionalKeywords keywords, ConditionalOperationOptions options)
        {
            string             uncommentOperationId     = $"Uncomment (line): {token} -> ()";
            string             reduceCommentOperationId = $"Reduce comment (line): ({token}{token}) -> ({token})";
            IOperationProvider uncomment     = new Replacement(token, string.Empty, uncommentOperationId);
            IOperationProvider reduceComment = new Replacement($"{token}{token}", token, reduceCommentOperationId);

            ConditionalTokens conditionalTokens = new ConditionalTokens
            {
                IfTokens               = new[] { $"{token}{keywords.KeywordPrefix}{keywords.IfKeyword}" },
                ElseTokens             = new[] { $"{token}{keywords.KeywordPrefix}{keywords.ElseKeyword}" },
                ElseIfTokens           = new[] { $"{token}{keywords.KeywordPrefix}{keywords.ElseIfKeyword}" },
                EndIfTokens            = new[] { $"{token}{keywords.KeywordPrefix}{keywords.EndIfKeyword}", $"{token}{token}{keywords.KeywordPrefix}{keywords.EndIfKeyword}" },
                ActionableIfTokens     = new[] { $"{token}{token}{keywords.KeywordPrefix}{keywords.IfKeyword}" },
                ActionableElseTokens   = new[] { $"{token}{token}{keywords.KeywordPrefix}{keywords.ElseKeyword}" },
                ActionableElseIfTokens = new[] { $"{token}{token}{keywords.KeywordPrefix}{keywords.ElseIfKeyword}" },
                ActionableOperations   = new[] { uncommentOperationId, reduceCommentOperationId }
            };

            ConditionEvaluator evaluator   = EvaluatorSelector.Select(options.EvaluatorType);
            IOperationProvider conditional = new Conditional(conditionalTokens, options.WholeLine, options.TrimWhitespace, evaluator, options.Id);

            return(new List <IOperationProvider>()
            {
                conditional,
                reduceComment,
                uncomment
            });
        }
Beispiel #4
0
        public void EvaluateConfig(IEngineEnvironmentSettings environmentSettings, IVariableCollection vars, IMacroConfig rawConfig, IParameterSet parameters, ParameterSetter setter)
        {
            EvaluateMacroConfig config = rawConfig as EvaluateMacroConfig;

            if (config == null)
            {
                throw new InvalidCastException("Couldn't cast the rawConfig as EvaluateMacroConfig");
            }

            ConditionEvaluator evaluator = EvaluatorSelector.Select(config.Evaluator);

            byte[]          data   = Encoding.UTF8.GetBytes(config.Value);
            int             len    = data.Length;
            int             pos    = 0;
            IProcessorState state  = new GlobalRunSpec.ProcessorState(environmentSettings, vars, data, Encoding.UTF8);
            bool            result = evaluator(state, ref len, ref pos, out bool faulted);

            Parameter p = new Parameter
            {
                IsVariable = true,
                Name       = config.VariableName
            };

            setter(p, result.ToString());
        }
        public static List <IOperationProvider> XmlConditionalSetup(string evaluatorType, bool wholeLine, bool trimWhiteSpace, string id)
        {
            // This is the operationId (flag) for the balanced nesting.
            string commentFixingOperationId = "Fix pseudo comments (XML)";

            // This is not an operationId (flag), it does not toggle the operation.
            // But conditional doesn't care, it takes the flags its given and sets them as appropriate.
            // It lets BalancedNesting know it's been reset.
            string commentFixingResetId = "Reset pseudo comment fixer (XML)";

            IOperationProvider balancedComments = new BalancedNesting("<!--", "-->", "-- >", commentFixingOperationId, commentFixingResetId);

            ConditionalTokens tokens = new ConditionalTokens
            {
                EndIfTokens            = new[] { "#endif", "<!--#endif" },
                ActionableIfTokens     = new[] { "<!--#if" },
                ActionableElseTokens   = new[] { "#else", "<!--#else" },
                ActionableElseIfTokens = new[] { "#elseif", "<!--#elseif" },
                ActionableOperations   = new[] { commentFixingOperationId, commentFixingResetId }
            };

            ConditionEvaluator evaluator   = EvaluatorSelector.Select(evaluatorType);
            IOperationProvider conditional = new Conditional(tokens, wholeLine, trimWhiteSpace, evaluator, id);

            return(new List <IOperationProvider>()
            {
                conditional,
                balancedComments
            });
        }
        public static List <IOperationProvider> RemLineCommentConditionalSetup(String evaluatorType, bool wholeLine, bool trimWhiteSpace, string id)
        {
            string             uncommentOperationId     = "Replacement (rem line): (rem) -> ()";
            string             reduceCommentOperationId = "Uncomment (rem line): (rem rem) -> (rem)";
            IOperationProvider uncomment     = new Replacement("rem", string.Empty, uncommentOperationId);
            IOperationProvider reduceComment = new Replacement("rem rem", "rem", reduceCommentOperationId);

            ConditionalTokens tokens = new ConditionalTokens
            {
                IfTokens               = new[] { "rem #if" },
                ElseTokens             = new[] { "rem #else" },
                ElseIfTokens           = new[] { "rem #elseif" },
                EndIfTokens            = new[] { "rem #endif", "rem rem #endif" },
                ActionableIfTokens     = new[] { "rem rem #if" },
                ActionableElseIfTokens = new[] { "rem rem #elseif" },
                ActionableElseTokens   = new[] { "rem rem #else" },
                ActionableOperations   = new[] { uncommentOperationId, reduceCommentOperationId }
            };

            ConditionEvaluator evaluator   = EvaluatorSelector.Select(evaluatorType);
            IOperationProvider conditional = new Conditional(tokens, wholeLine, trimWhiteSpace, evaluator, id);

            return(new List <IOperationProvider>()
            {
                conditional,
                reduceComment,
                uncomment
            });
        }
        public static List <IOperationProvider> CStyleLineCommentsConditionalSetup(string evaluatorType, bool wholeLine, bool trimWhiteSpace, string id)
        {
            string uncommentOperationId      = "Uncomment (C style): (//) -> ()";
            string reduceCommentsOperationId = "Reduce comment (C style): (////) -> (//)";

            // temporary - one time test
            IOperationProvider uncomment     = new Replacement("//", string.Empty, uncommentOperationId);
            IOperationProvider reduceComment = new Replacement("////", "//", reduceCommentsOperationId);

            ConditionalTokens tokens = new ConditionalTokens
            {
                IfTokens               = new[] { "//#if" },
                ElseTokens             = new[] { "//#else" },
                ElseIfTokens           = new[] { "//#elseif" },
                EndIfTokens            = new[] { "//#endif" },
                ActionableIfTokens     = new[] { "////#if" },
                ActionableElseIfTokens = new[] { "////#elseif" },
                ActionableElseTokens   = new[] { "////#else" },
                ActionableOperations   = new[] { uncommentOperationId, reduceCommentsOperationId }
            };

            ConditionEvaluator evaluator   = EvaluatorSelector.Select(evaluatorType);
            IOperationProvider conditional = new Conditional(tokens, wholeLine, trimWhiteSpace, evaluator, id);

            return(new List <IOperationProvider>()
            {
                conditional,
                reduceComment,
                uncomment
            });
        }
Beispiel #8
0
        public void EvaluateConfig(IEngineEnvironmentSettings environmentSettings, IVariableCollection vars, IMacroConfig rawConfig, IParameterSet parameters, ParameterSetter setter)
        {
            SwitchMacroConfig config = rawConfig as SwitchMacroConfig;

            if (config == null)
            {
                throw new InvalidCastException("Couldn't cast the rawConfig as SwitchMacroConfig");
            }

            ConditionEvaluator evaluator = EvaluatorSelector.Select(config.Evaluator, Cpp2StyleEvaluatorDefinition.Evaluate);
            string             result    = string.Empty; // default if no condition assigns a value

            foreach (KeyValuePair <string, string> switchInfo in config.Switches)
            {
                string condition = switchInfo.Key;
                string value     = switchInfo.Value;

                if (string.IsNullOrEmpty(condition))
                {   // no condition, this is the default.
                    result = value;
                    break;
                }
                else
                {
                    byte[]          conditionBytes = Encoding.UTF8.GetBytes(condition);
                    int             length         = conditionBytes.Length;
                    int             position       = 0;
                    IProcessorState state          = new GlobalRunSpec.ProcessorState(environmentSettings, vars, conditionBytes, Encoding.UTF8);

                    if (evaluator(state, ref length, ref position, out bool faulted))
                    {
                        result = value;
                        break;
                    }
                }
            }

            Parameter p;

            if (parameters.TryGetParameterDefinition(config.VariableName, out ITemplateParameter existingParam))
            {
                // If there is an existing parameter with this name, it must be reused so it can be referenced by name
                // for other processing, for example: if the parameter had value forms defined for creating variants.
                // When the param already exists, use its definition, but set IsVariable = true for consistency.
                p            = (Parameter)existingParam;
                p.IsVariable = true;
            }
            else
            {
                p = new Parameter
                {
                    IsVariable = true,
                    Name       = config.VariableName
                };
            }

            vars[config.VariableName] = result.ToString();
            setter(p, result.ToString());
        }
Beispiel #9
0
        public void EvaluateConfig(IEngineEnvironmentSettings environmentSettings, IVariableCollection vars, IMacroConfig rawConfig, IParameterSet parameters, ParameterSetter setter)
        {
            SwitchMacroConfig config = rawConfig as SwitchMacroConfig;

            if (config == null)
            {
                throw new InvalidCastException("Couldn't cast the rawConfig as SwitchMacroConfig");
            }

            ConditionEvaluator evaluator = EvaluatorSelector.Select(config.Evaluator, Cpp2StyleEvaluatorDefinition.Evaluate);
            string             result    = string.Empty; // default if no condition assigns a value

            foreach (KeyValuePair <string, string> switchInfo in config.Switches)
            {
                string condition = switchInfo.Key;
                string value     = switchInfo.Value;

                if (string.IsNullOrEmpty(condition))
                {   // no condition, this is the default.
                    result = value;
                    break;
                }
                else
                {
                    byte[]          conditionBytes = Encoding.UTF8.GetBytes(condition);
                    int             length         = conditionBytes.Length;
                    int             position       = 0;
                    IProcessorState state          = new GlobalRunSpec.ProcessorState(environmentSettings, vars, conditionBytes, Encoding.UTF8);

                    if (evaluator(state, ref length, ref position, out bool faulted))
                    {
                        result = value;
                        break;
                    }
                }
            }

            Parameter p = new Parameter
            {
                IsVariable = true,
                Name       = config.VariableName,
                DataType   = config.DataType
            };

            vars[config.VariableName] = result.ToString();
            setter(p, result.ToString());
        }
Beispiel #10
0
        // Nice to have: Generalize this type of setup similarly to Line, Block, & Custom
        public static List <IOperationProvider> MSBuildConditionalSetup(string evaluatorType, bool wholeLine, bool trimWhiteSpace, string id)
        {
            ConditionEvaluator evaluator   = EvaluatorSelector.Select(evaluatorType);
            IOperationProvider conditional = new InlineMarkupConditional(
                new MarkupTokens("<", "</", ">", "/>", "Condition=\"", "\""),
                wholeLine,
                trimWhiteSpace,
                evaluator,
                "$({0})",
                id
                );

            return(new List <IOperationProvider>()
            {
                conditional
            });
        }
Beispiel #11
0
        public void EvaluateConfig(IEngineEnvironmentSettings environmentSettings, IVariableCollection vars, IMacroConfig rawConfig, IParameterSet parameters, ParameterSetter setter)
        {
            EvaluateMacroConfig config = rawConfig as EvaluateMacroConfig;

            if (config == null)
            {
                throw new InvalidCastException("Couldn't cast the rawConfig as EvaluateMacroConfig");
            }

            ConditionEvaluator evaluator = EvaluatorSelector.Select(config.Evaluator, Cpp2StyleEvaluatorDefinition.Evaluate);

            byte[]          data   = Encoding.UTF8.GetBytes(config.Value);
            int             len    = data.Length;
            int             pos    = 0;
            IProcessorState state  = new GlobalRunSpec.ProcessorState(environmentSettings, vars, data, Encoding.UTF8);
            bool            result = evaluator(state, ref len, ref pos, out bool faulted);

            Parameter p;

            if (parameters.TryGetParameterDefinition(config.VariableName, out ITemplateParameter existingParam))
            {
                // If there is an existing parameter with this name, it must be reused so it can be referenced by name
                // for other processing, for example: if the parameter had value forms defined for creating variants.
                // When the param already exists, use its definition, but set IsVariable = true for consistency.
                p            = (Parameter)existingParam;
                p.IsVariable = true;

                if (string.IsNullOrEmpty(p.DataType))
                {
                    p.DataType = config.DataType;
                }
            }
            else
            {
                p = new Parameter
                {
                    IsVariable = true,
                    Name       = config.VariableName,
                    DataType   = config.DataType
                };
            }

            vars[config.VariableName] = result.ToString();
            setter(p, result.ToString());
        }
Beispiel #12
0
        // Nice to have: Generalize this type of setup similarly to Line, Block, & Custom
        public static List <IOperationProvider> CStyleNoCommentsConditionalSetup(string evaluatorType, bool wholeLine, bool trimWhiteSpace, string id)
        {
            ConditionalKeywords defaultKeywords = new ConditionalKeywords();

            List <ITokenConfig> ifTokens     = new List <ITokenConfig>();
            List <ITokenConfig> elseifTokens = new List <ITokenConfig>();
            List <ITokenConfig> elseTokens   = new List <ITokenConfig>();
            List <ITokenConfig> endifTokens  = new List <ITokenConfig>();

            foreach (string ifKeyword in defaultKeywords.IfKeywords)
            {
                ifTokens.Add($"{defaultKeywords.KeywordPrefix}{ifKeyword}".TokenConfig());
            }

            foreach (string elseifKeyword in defaultKeywords.ElseIfKeywords)
            {
                elseifTokens.Add($"{defaultKeywords.KeywordPrefix}{elseifKeyword}".TokenConfig());
            }

            foreach (string elseKeyword in defaultKeywords.ElseKeywords)
            {
                elseTokens.Add($"{defaultKeywords.KeywordPrefix}{elseKeyword}".TokenConfig());
            }

            foreach (string endifKeyword in defaultKeywords.EndIfKeywords)
            {
                endifTokens.Add($"{defaultKeywords.KeywordPrefix}{endifKeyword}".TokenConfig());
            }

            ConditionalTokens tokens = new ConditionalTokens
            {
                IfTokens     = ifTokens,
                ElseTokens   = elseTokens,
                ElseIfTokens = elseifTokens,
                EndIfTokens  = endifTokens
            };

            ConditionEvaluator evaluator   = EvaluatorSelector.Select(evaluatorType);
            IOperationProvider conditional = new Conditional(tokens, wholeLine, trimWhiteSpace, evaluator, id, true);

            return(new List <IOperationProvider>()
            {
                conditional
            });
        }
Beispiel #13
0
        // Nice to have: Generalize this type of setup similarly to Line, Block, & Custom
        public static List <IOperationProvider> CStyleNoCommentsConditionalSetup(string evaluatorType, bool wholeLine, bool trimWhiteSpace, string id)
        {
            ConditionalTokens tokens = new ConditionalTokens
            {
                IfTokens     = new[] { "#if".TokenConfig() },
                ElseTokens   = new[] { "#else".TokenConfig() },
                ElseIfTokens = new[] { "#elseif".TokenConfig() },
                EndIfTokens  = new[] { "#endif".TokenConfig() }
            };

            ConditionEvaluator evaluator   = EvaluatorSelector.Select(evaluatorType);
            IOperationProvider conditional = new Conditional(tokens, wholeLine, trimWhiteSpace, evaluator, id, true);

            return(new List <IOperationProvider>()
            {
                conditional
            });
        }
Beispiel #14
0
        public void Evaluate(string variableName, IVariableCollection vars, JObject def, IParameterSet parameters, ParameterSetter setter)
        {
            string             evaluatorName = def.ToString("evaluator");
            ConditionEvaluator evaluator     = EvaluatorSelector.Select(evaluatorName);

            byte[]          data  = Encoding.UTF8.GetBytes(def.ToString("action"));
            int             len   = data.Length;
            int             pos   = 0;
            IProcessorState state = new GlobalRunSpec.ProcessorState(vars, data, Encoding.UTF8);
            bool            res   = evaluator(state, ref len, ref pos);

            Parameter p = new Parameter
            {
                IsVariable = true,
                Name       = variableName
            };

            setter(p, res.ToString());
        }
        public static List <IOperationProvider> GenerateConditionalSetup(string startToken, string endToken, string pseudoEndToken, ConditionalKeywords keywords, ConditionalOperationOptions options)
        {
            ConditionEvaluator evaluator = EvaluatorSelector.Select(options.EvaluatorType);

            ConditionalTokens tokens = new ConditionalTokens
            {
                EndIfTokens            = new[] { $"{keywords.KeywordPrefix}{keywords.EndIfKeyword}".TokenConfig(), $"{startToken}{keywords.KeywordPrefix}{keywords.EndIfKeyword}".TokenConfig() },
                ActionableIfTokens     = new[] { $"{startToken}{keywords.KeywordPrefix}{keywords.IfKeyword}".TokenConfig() },
                ActionableElseTokens   = new[] { $"{keywords.KeywordPrefix}{keywords.ElseKeyword}".TokenConfig(), $"{startToken}{keywords.KeywordPrefix}{keywords.ElseKeyword}".TokenConfig() },
                ActionableElseIfTokens = new[] { $"{keywords.KeywordPrefix}{keywords.ElseIfKeyword}".TokenConfig(), $"{startToken}{keywords.KeywordPrefix}{keywords.ElseIfKeyword}".TokenConfig() },
            };

            if (!string.IsNullOrWhiteSpace(pseudoEndToken))
            {
                Guid   operationIdGuid       = new Guid();
                string commentFixOperationId = $"Fix pseudo tokens ({pseudoEndToken} {operationIdGuid})";
                string commentFixResetId     = $"Reset pseudo token fixer ({pseudoEndToken} {operationIdGuid})";

                tokens.ActionableOperations = new[] { commentFixOperationId, commentFixResetId };

                IOperationProvider balancedComments = new BalancedNesting(startToken.TokenConfig(), endToken.TokenConfig(), pseudoEndToken.TokenConfig(), commentFixOperationId, commentFixResetId, options.OnByDefault);
                IOperationProvider conditional      = new Conditional(tokens, options.WholeLine, options.TrimWhitespace, evaluator, options.Id, options.OnByDefault);

                return(new List <IOperationProvider>()
                {
                    conditional,
                    balancedComments
                });
            }
            else
            {
                IOperationProvider conditional = new Conditional(tokens, options.WholeLine, options.TrimWhitespace, evaluator, options.Id, options.OnByDefault);
                return(new List <IOperationProvider>()
                {
                    conditional
                });
            }
        }
Beispiel #16
0
        public static List <IOperationProvider> GenerateConditionalSetup(string token, ConditionalKeywords keywords, ConditionalOperationOptions options)
        {
            string             uncommentOperationId     = $"Uncomment (line): {token} -> ()";
            string             reduceCommentOperationId = $"Reduce comment (line): ({token}{token}) -> ({token})";
            IOperationProvider uncomment     = new Replacement(token.TokenConfig(), string.Empty, uncommentOperationId, options.OnByDefault);
            IOperationProvider reduceComment = new Replacement($"{token}{token}".TokenConfig(), token, reduceCommentOperationId, options.OnByDefault);

            List <ITokenConfig> ifTokens           = new List <ITokenConfig>();
            List <ITokenConfig> actionableIfTokens = new List <ITokenConfig>();

            foreach (string ifKeyword in keywords.IfKeywords)
            {
                ifTokens.Add($"{token}{keywords.KeywordPrefix}{ifKeyword}".TokenConfig());
                actionableIfTokens.Add($"{token}{token}{keywords.KeywordPrefix}{ifKeyword}".TokenConfig());
            }

            List <ITokenConfig> elseTokens           = new List <ITokenConfig>();
            List <ITokenConfig> actionableElseTokens = new List <ITokenConfig>();

            foreach (string elseKeyword in keywords.ElseKeywords)
            {
                elseTokens.Add($"{token}{keywords.KeywordPrefix}{elseKeyword}".TokenConfig());
                actionableElseTokens.Add($"{token}{token}{keywords.KeywordPrefix}{elseKeyword}".TokenConfig());
            }

            List <ITokenConfig> elseIfTokens         = new List <ITokenConfig>();
            List <ITokenConfig> actionalElseIfTokens = new List <ITokenConfig>();

            foreach (string elseIfKeyword in keywords.ElseIfKeywords)
            {
                elseIfTokens.Add($"{token}{keywords.KeywordPrefix}{elseIfKeyword}".TokenConfig());
                actionalElseIfTokens.Add($"{token}{token}{keywords.KeywordPrefix}{elseIfKeyword}".TokenConfig());
            }

            List <ITokenConfig> endIfTokens = new List <ITokenConfig>();

            foreach (string endIfKeyword in keywords.EndIfKeywords)
            {
                endIfTokens.Add($"{token}{keywords.KeywordPrefix}{endIfKeyword}".TokenConfig());
                endIfTokens.Add($"{token}{token}{keywords.KeywordPrefix}{endIfKeyword}".TokenConfig());
            }

            ConditionalTokens conditionalTokens = new ConditionalTokens
            {
                IfTokens               = ifTokens,
                ElseTokens             = elseTokens,
                ElseIfTokens           = elseIfTokens,
                EndIfTokens            = endIfTokens,
                ActionableIfTokens     = actionableIfTokens,
                ActionableElseTokens   = actionableElseTokens,
                ActionableElseIfTokens = actionalElseIfTokens,
                ActionableOperations   = new[] { uncommentOperationId, reduceCommentOperationId }
            };

            ConditionEvaluator evaluator   = EvaluatorSelector.Select(options.EvaluatorType);
            IOperationProvider conditional = new Conditional(conditionalTokens, options.WholeLine, options.TrimWhitespace, evaluator, options.Id, options.OnByDefault);

            return(new List <IOperationProvider>()
            {
                conditional,
                reduceComment,
                uncomment
            });
        }