inform7.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. contains: [
  27. {
  28. className: 'string',
  29. begin: '"',
  30. end: '"',
  31. relevance: 0,
  32. contains: [
  33. {
  34. className: 'subst',
  35. begin: START_BRACKET,
  36. end: END_BRACKET
  37. }
  38. ]
  39. },
  40. {
  41. className: 'section',
  42. begin: /^(Volume|Book|Part|Chapter|Section|Table)\b/,
  43. end: '$'
  44. },
  45. {
  46. // Rule definition
  47. // This is here for relevance.
  48. begin: /^(Check|Carry out|Report|Instead of|To|Rule|When|Before|After)\b/,
  49. end: ':',
  50. contains: [
  51. {
  52. // Rule name
  53. begin: '\\(This',
  54. end: '\\)'
  55. }
  56. ]
  57. },
  58. {
  59. className: 'comment',
  60. begin: START_BRACKET,
  61. end: END_BRACKET,
  62. contains: [ 'self' ]
  63. }
  64. ]
  65. };
  66. }
  67. export { inform7 as default };