Example #1
0
        private void ProcessRulesetInstruction(DssCompilerContext context, RulesetInstruction rulesetInstruction)
        {
            var ruleset = new Ruleset()
            {
                Selector = new RuleSelector(rulesetInstruction.Selector.SelectorType, rulesetInstruction.Selector.Identifier)
            };

            foreach (var instruction in rulesetInstruction.Instructions)
            {
                if (instruction is PropertyInstruction propertyInstruction)
                {
                    ProcessPropertyInstruction(context, ruleset, propertyInstruction);
                }
            }
            context.Stylesheet.AddRuleset(ruleset);
        }
Example #2
0
        public Stylesheet Compile(DssInstructions dssInstructions)
        {
            var context = new DssCompilerContext()
            {
                Instructions = dssInstructions,
                Stylesheet   = new Stylesheet(),
            };

            foreach (var instruction in dssInstructions)
            {
                if (instruction is RulesetInstruction rulesetInstruction)
                {
                    ProcessRulesetInstruction(context, rulesetInstruction);
                }
            }

            return(context.Stylesheet);
        }
Example #3
0
        private void ProcessPropertyInstruction(DssCompilerContext context, Ruleset ruleset, PropertyInstruction propertyInstruction)
        {
            var propertySetterInfo = new PropertySetterInfo(propertyInstruction.Identifier, expressionExecutor.GetValues(propertyInstruction.Value.Values), 0, null);

            ruleset.PropertySetters.Add(propertySetterInfo);
        }