PageRenderTime 9ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
C# | 58 lines | 24 code | 5 blank | 29 comment | 0 complexity | 6b401f9132d74b5639e495718b51d35d MD5 | raw file
 1#region Copyright © 2001-2003 Jean-Claude Manoli [jc@manoli.net]
 2
 3/*
 4 * This software is provided 'as-is', without any express or implied warranty.
 5 * In no event will the author(s) be held liable for any damages arising from
 6 * the use of this software.
 7 * 
 8 * Permission is granted to anyone to use this software for any purpose,
 9 * including commercial applications, and to alter it and redistribute it
10 * freely, subject to the following restrictions:
11 * 
12 *   1. The origin of this software must not be misrepresented; you must not
13 *      claim that you wrote the original software. If you use this software
14 *      in a product, an acknowledgment in the product documentation would be
15 *      appreciated but is not required.
16 * 
17 *   2. Altered source versions must be plainly marked as such, and must not
18 *      be misrepresented as being the original software.
19 * 
20 *   3. This notice may not be removed or altered from any source distribution.
21 */
22#endregion
23
24namespace CodeFormatter
25{
26    /// <summary>
27    /// Provides a base class for formatting languages similar to C.
28    /// </summary>
29    public abstract class CLikeFormat : CodeFormat
30    {
31        #region Properties
32
33        /// <summary>
34        ///     Regular expression string to match single line and multi-line 
35        ///     comments (// and /* */).
36        /// </summary>
37        protected override string CommentRegEx
38        {
39            get
40            {
41                return @"/\*.*?\*/|//.*?(?=\r|\n)";
42            }
43        }
44
45        /// <summary>
46        ///     Regular expression string to match string and character literals.
47        /// </summary>
48        protected override string StringRegEx
49        {
50            get
51            {
52                return @"@?""""|@?"".*?(?!\\).""|''|'.*?(?!\\).'";
53            }
54        }
55
56        #endregion
57    }
58}