PageRenderTime 40ms CodeModel.GetById 15ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
  1. namespace 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. /// <summary>
  10. /// Regular expression string to match single line comments (#).
  11. /// </summary>
  12. protected override string CommentRegEx
  13. {
  14. get
  15. {
  16. return @"#.*?(?=\r|\n)";
  17. }
  18. }
  19. /// <summary>
  20. /// The list of MSH keywords.
  21. /// </summary>
  22. protected override string Keywords
  23. {
  24. get
  25. {
  26. 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";
  27. }
  28. }
  29. /// <summary>
  30. /// Use preprocessors property to hilight operators.
  31. /// </summary>
  32. protected override string Preprocessors
  33. {
  34. get
  35. {
  36. return "-band -bor -match -notmatch -like -notlike -eq -ne -gt -ge -lt -le -is -imatch -inotmatch -ilike -inotlike -ieq -ine -igt -ige -ilt -ile";
  37. }
  38. }
  39. /// <summary>
  40. /// Regular expression string to match string and character literals.
  41. /// </summary>
  42. protected override string StringRegEx
  43. {
  44. get
  45. {
  46. return @"@?""""|@?"".*?(?!\\).""|''|'.*?(?!\\).'";
  47. }
  48. }
  49. #endregion
  50. }
  51. }