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. Category: gaming
  7. */
  8. function inform7(hljs) {
  9. const START_BRACKET = '\\[';
  10. const END_BRACKET = '\\]';
  11. return {
  12. name: 'Inform 7',
  13. aliases: [ 'i7' ],
  14. case_insensitive: true,
  15. keywords: {
  16. // Some keywords more or less unique to I7, for relevance.
  17. keyword:
  18. // kind:
  19. 'thing room person man woman animal container '
  20. + 'supporter backdrop door '
  21. // characteristic:
  22. + 'scenery open closed locked inside gender '
  23. // verb:
  24. + 'is are say understand '
  25. // misc keyword:
  26. + 'kind of rule' },
  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. export { inform7 as default };