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