Beispiel #1
0
        public override Node Evaluate(Env env)
        {
            var value = Regex.Replace(Value, @"@\{([\w-]+)\}",
                        m =>
                          {
                            var v = new Variable('@' + m.Groups[1].Value) {Index = Index + m.Index}.Evaluate(env);
                            return v is TextNode ? (v as TextNode).Value : v.ToCSS(env);
                          });

              return new Quoted(value, Quote, Escaped) {Index = Index};
        }
Beispiel #2
0
        public override Node Evaluate(Env env)
        {
            var value = Regex.Replace(Value, @"@\{([\w-]+)\}",
                          m =>
                          {
                              var v = new Variable('@' + m.Groups[1].Value) 
                                    { Location = new NodeLocation(Location.Index + m.Index, Location.Source, Location.FileName) }
                                    .Evaluate(env);
                              return v is TextNode ? (v as TextNode).Value : v.ToCSS(env);
                          });

            return new Quoted(value, Quote, Escaped).ReducedFrom<Quoted>(this);
        }
Beispiel #3
0
        public override Node Evaluate(Env env)
        {
            var name = Name;
            if (name.StartsWith("@@"))
            {
                var v = new Variable(name.Substring(1)).Evaluate(env);
                name = '@' + (v is TextNode ? (v as TextNode).Value : v.ToCSS(env));
            }

            var variable = env.FindVariable(name);

            if (variable)
                return variable.Value.Evaluate(env);

            throw new ParsingException("variable " + name + " is undefined", Index);
        }
Beispiel #4
0
        public override Node Evaluate(Env env)
        {
            var name = Name;
            if (name.StartsWith("@@"))
            {
                var v = new Variable(name.Substring(1)).Evaluate(env);
                name = '@' + (v is TextNode ? (v as TextNode).Value : v.ToCSS(env));
            }

            if (env.IsEvaluatingVariable(name)) {
                throw new ParsingException("Recursive variable definition for " + name, Location);
            }

            var variable = env.FindVariable(name);

            if (variable) {
                return variable.Value.Evaluate(env.CreateVariableEvaluationEnv(name));
            }

            throw new ParsingException("variable " + name + " is undefined", Location);
        }