Ejemplo n.º 1
0
        internal override HxlLangElement ConvertToElement()
        {
            // TODO Default var names
            HxlForElement e = (HxlForElement)this.OwnerDocument.CreateElement("c:for");

            e.Var = this.Var;
            e.To  = Expression.Parse(this.Value);
            return(e);
        }
Ejemplo n.º 2
0
        public IEnumerable <string> Start(HxlForElement e)
        {
            yield return(EmitVarLoopStatus(e));

            // TODO Expression.ToString() not currently correct, and implicit conversion is probably required on text
            yield return(string.Format("for (var {0} = {1}; {0} <= {2}; {0} += {3}) {{",
                                       e.Var,
                                       e.From.ToString().Trim('\''),
                                       e.To.ToString().Trim('\''),
                                       e.Step.ToString().Trim('\'')));

            yield return(EmitVarLoopStatusCurrent(e));
        }
Ejemplo n.º 3
0
 void IHxlLanguageVisitor.Visit(HxlForElement element)
 {
     VisitFor(element);
 }
Ejemplo n.º 4
0
 protected virtual void VisitFor(HxlForElement element)
 {
     DefaultVisit(element);
 }
Ejemplo n.º 5
0
        public IEnumerable <string> End(HxlForElement e)
        {
            yield return(EmitVarLoopStatusIncrement(e));

            yield return("}");
        }