languages.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. 'use strict';
  2. exports.ada = { LINE_REGEX: /^--.*/ };
  3. exports.apl = { LINE_REGEX: /^⍝.*/ };
  4. exports.applescript = {
  5. BLOCK_OPEN_REGEX: /^\(\*/,
  6. BLOCK_CLOSE_REGEX: /^\*\)/
  7. };
  8. exports.csharp = {
  9. LINE_REGEX: /^\/\/.*/
  10. };
  11. exports.haskell = {
  12. BLOCK_OPEN_REGEX: /^\{-/,
  13. BLOCK_CLOSE_REGEX: /^-\}/,
  14. LINE_REGEX: /^--.*/
  15. };
  16. exports.html = {
  17. BLOCK_OPEN_REGEX: /^\n*<!--(?!-?>)/,
  18. BLOCK_CLOSE_REGEX: /^(?<!(?:<!-))-->/,
  19. BLOCK_CLOSE_LOOSE_REGEX: /^(?<!(?:<!-))--\s*>/,
  20. BLOCK_CLOSE_STRICT_NEWLINE_REGEX: /^(?<!(?:<!-))-->(\s*\n+|\n*)/,
  21. BLOCK_CLOSE_STRICT_LOOSE_REGEX: /^(?<!(?:<!-))--\s*>(\s*\n+|\n*)/
  22. };
  23. exports.javascript = {
  24. BLOCK_OPEN_REGEX: /^\/\*\*?(!?)/,
  25. BLOCK_CLOSE_REGEX: /^\*\/(\n?)/,
  26. LINE_REGEX: /^\/\/(!?).*/
  27. };
  28. exports.lua = {
  29. BLOCK_OPEN_REGEX: /^--\[\[/,
  30. BLOCK_CLOSE_REGEX: /^\]\]/,
  31. LINE_REGEX: /^--.*/
  32. };
  33. exports.matlab = {
  34. BLOCK_OPEN_REGEX: /^%{/,
  35. BLOCK_CLOSE_REGEX: /^%}/,
  36. LINE_REGEX: /^%.*/
  37. };
  38. exports.perl = {
  39. LINE_REGEX: /^#.*/
  40. };
  41. exports.php = {
  42. ...exports.javascript,
  43. LINE_REGEX: /^(#|\/\/).*?(?=\?>|\n)/
  44. };
  45. exports.python = {
  46. BLOCK_OPEN_REGEX: /^"""/,
  47. BLOCK_CLOSE_REGEX: /^"""/,
  48. LINE_REGEX: /^#.*/
  49. };
  50. exports.ruby = {
  51. BLOCK_OPEN_REGEX: /^=begin/,
  52. BLOCK_CLOSE_REGEX: /^=end/,
  53. LINE_REGEX: /^#.*/
  54. };
  55. exports.shebang = exports.hashbang = {
  56. LINE_REGEX: /^#!.*/
  57. };
  58. exports.c = exports.javascript;
  59. exports.csharp = exports.javascript;
  60. exports.css = exports.javascript;
  61. exports.java = exports.javascript;
  62. exports.js = exports.javascript;
  63. exports.less = exports.javascript;
  64. exports.pascal = exports.applescript;
  65. exports.ocaml = exports.applescript;
  66. exports.sass = exports.javascript;
  67. exports.sql = exports.ada;
  68. exports.swift = exports.javascript;
  69. exports.ts = exports.javascript;
  70. exports.typscript = exports.javascript;
  71. exports.xml = exports.html;