PageRenderTime 89ms CodeModel.GetById 80ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/App_Code/Extensions/CodeFormatter/MshFormat.cs

#
C# | 56 lines | 36 code | 5 blank | 15 comment | 0 complexity | 429a64aa2307963cf2abb390259b5731 MD5 | raw file
 1namespace CodeFormatter
 2{
 3    /// <summary>
 4    /// Generates color-coded HTML 4.01 from MSH (code name Monad) source code.
 5    /// </summary>
 6    public class MshFormat : CodeFormat
 7    {
 8        #region Properties
 9
10        /// <summary>
11        ///     Regular expression string to match single line comments (#).
12        /// </summary>
13        protected override string CommentRegEx
14        {
15            get
16            {
17                return @"#.*?(?=\r|\n)";
18            }
19        }
20
21        /// <summary>
22        ///     The list of MSH keywords.
23        /// </summary>
24        protected override string Keywords
25        {
26            get
27            {
28                return "function filter global script local private if else elseif for foreach in while switch continue break return default param begin process end throw trap";
29            }
30        }
31
32        /// <summary>
33        ///     Use preprocessors property to hilight operators.
34        /// </summary>
35        protected override string Preprocessors
36        {
37            get
38            {
39                return "-band -bor -match -notmatch -like -notlike -eq -ne -gt -ge -lt -le -is -imatch -inotmatch -ilike -inotlike -ieq -ine -igt -ige -ilt -ile";
40            }
41        }
42
43        /// <summary>
44        ///     Regular expression string to match string and character literals.
45        /// </summary>
46        protected override string StringRegEx
47        {
48            get
49            {
50                return @"@?""""|@?"".*?(?!\\).""|''|'.*?(?!\\).'";
51            }
52        }
53
54        #endregion
55    }
56}