Example #1
0
        void expr(out Expression exp)
        {
            exp = new Expression();
            char? sep = null;
            Term trm = null;

            term(out trm);
            exp.Terms.Add(trm);
            while (StartOf(10))
            {
                if (la.kind == 27 || la.kind == 44)
                {
                    if (la.kind == 44)
                    {
                        Get();
                        sep = '/';
                    }
                    else
                    {
                        Get();
                        sep = ',';
                    }
                }
                term(out trm);
                if (sep.HasValue) { trm.Seperator = sep.Value; }
                exp.Terms.Add(trm);
                sep = null;

            }
        }
Example #2
0
        static string Render(Expression exp)
        {
            StringBuilder txt = new StringBuilder();

            bool first = true;
            foreach (Term t in exp.Terms)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    txt.AppendFormat("{0} ", t.Seperator.HasValue ? t.Seperator.Value.ToString() : "");
                }
                txt.AppendFormat("<span class=\"term\">{0}</span>", Render(t));
            }

            return txt.ToString();
        }