#region COPYRIGHT
//
//     THIS IS GENERATED BY TEMPLATE
//     
//     AUTHOR  :     ROYE
//     DATE       :     2010
//
//     COPYRIGHT (C) 2010, TIANXIAHOTEL TECHNOLOGIES CO., LTD. ALL RIGHTS RESERVED.
//
#endregion

using System;
using System.Collections.Generic;
using System.Text;

namespace System.Text.Template
{
    public class VelocityConfig : TemplateConfig
    {
        public VelocityConfig()
        {
            AddToken(TemplateTokenType.ForEach, @"#(foreach|{foreach})\s*\((?<iterator>[a-z_][a-z0-9_]*)\s+in\s+(?<expression>.*?)\s*\)", true);
            AddToken(TemplateTokenType.While, @"#(while|{while})\s*\((?<expression>.*?)\s*\)", true);
            AddToken(TemplateTokenType.EndBlock, @"#(end|{end})", true);
            AddToken(TemplateTokenType.If, @"#(if|{if})\s*\((?<expression>.*?)\s*\)", true);
            AddToken(TemplateTokenType.Set, @"#(set|{set})\s*\((?<variable>[a-z_][a-z0-9_]*)\s*=(?<expression>.*?)\s*\)", true);
            AddToken(TemplateTokenType.ElseIf, @"#(elseif|{elseif})\s*\((?<expression>.*?)\s*\)", true);
            AddToken(TemplateTokenType.Else, @"#(else|{else})", true);
            AddToken(TemplateTokenType.Expression, @"\${(?<expression>.*?)}", false);
            AddToken(TemplateTokenType.Expression, @"\$(?<expression>[a-zA-Z_][a-zA-Z0-9_\.@]*?)(?![a-zA-Z0-9_\.@])", false);
        }
    }
}
