UNPKG

1.64 kBJavaScriptView Raw
1/*
2Language: Inform 7
3Author: Bruno Dias <bruno.r.dias@gmail.com>
4Description: Language definition for Inform 7, a DSL for writing parser interactive fiction.
5Website: http://inform7.com
6*/
7
8function 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 },
28 contains: [
29 {
30 className: 'string',
31 begin: '"',
32 end: '"',
33 relevance: 0,
34 contains: [
35 {
36 className: 'subst',
37 begin: START_BRACKET,
38 end: END_BRACKET
39 }
40 ]
41 },
42 {
43 className: 'section',
44 begin: /^(Volume|Book|Part|Chapter|Section|Table)\b/,
45 end: '$'
46 },
47 {
48 // Rule definition
49 // This is here for relevance.
50 begin: /^(Check|Carry out|Report|Instead of|To|Rule|When|Before|After)\b/,
51 end: ':',
52 contains: [
53 {
54 // Rule name
55 begin: '\\(This',
56 end: '\\)'
57 }
58 ]
59 },
60 {
61 className: 'comment',
62 begin: START_BRACKET,
63 end: END_BRACKET,
64 contains: ['self']
65 }
66 ]
67 };
68}
69
70export { inform7 as default };