inform7.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. Language: Inform 7
  3. Author: Bruno Dias <bruno.r.dias@gmail.com>
  4. Description: Language definition for Inform 7, a DSL for writing parser interactive fiction.
  5. Website: http://inform7.com
  6. */
  7. function inform7(hljs) {
  8. const START_BRACKET = '\\[';
  9. const END_BRACKET = '\\]';
  10. return {
  11. name: 'Inform 7',
  12. aliases: ['i7'],
  13. case_insensitive: true,
  14. keywords: {
  15. // Some keywords more or less unique to I7, for relevance.
  16. keyword:
  17. // kind:
  18. 'thing room person man woman animal container ' +
  19. 'supporter backdrop door ' +
  20. // characteristic:
  21. 'scenery open closed locked inside gender ' +
  22. // verb:
  23. 'is are say understand ' +
  24. // misc keyword:
  25. 'kind of rule'
  26. },
  27. contains: [
  28. {
  29. className: 'string',
  30. begin: '"',
  31. end: '"',
  32. relevance: 0,
  33. contains: [
  34. {
  35. className: 'subst',
  36. begin: START_BRACKET,
  37. end: END_BRACKET
  38. }
  39. ]
  40. },
  41. {
  42. className: 'section',
  43. begin: /^(Volume|Book|Part|Chapter|Section|Table)\b/,
  44. end: '$'
  45. },
  46. {
  47. // Rule definition
  48. // This is here for relevance.
  49. begin: /^(Check|Carry out|Report|Instead of|To|Rule|When|Before|After)\b/,
  50. end: ':',
  51. contains: [
  52. {
  53. // Rule name
  54. begin: '\\(This',
  55. end: '\\)'
  56. }
  57. ]
  58. },
  59. {
  60. className: 'comment',
  61. begin: START_BRACKET,
  62. end: END_BRACKET,
  63. contains: ['self']
  64. }
  65. ]
  66. };
  67. }
  68. module.exports = inform7;