2024-01-16 21:26:16 +08:00
|
|
|
/*
|
|
|
|
Language: Inform 7
|
|
|
|
Author: Bruno Dias <bruno.r.dias@gmail.com>
|
|
|
|
Description: Language definition for Inform 7, a DSL for writing parser interactive fiction.
|
|
|
|
Website: http://inform7.com
|
|
|
|
*/
|
|
|
|
|
|
|
|
function inform7(hljs) {
|
|
|
|
const START_BRACKET = '\\[';
|
|
|
|
const END_BRACKET = '\\]';
|
2023-12-18 13:12:25 +08:00
|
|
|
return {
|
2024-01-16 21:26:16 +08:00
|
|
|
name: 'Inform 7',
|
2023-12-18 13:12:25 +08:00
|
|
|
aliases: ['i7'],
|
|
|
|
case_insensitive: true,
|
|
|
|
keywords: {
|
|
|
|
// Some keywords more or less unique to I7, for relevance.
|
|
|
|
keyword:
|
|
|
|
// kind:
|
|
|
|
'thing room person man woman animal container ' +
|
|
|
|
'supporter backdrop door ' +
|
|
|
|
// characteristic:
|
|
|
|
'scenery open closed locked inside gender ' +
|
|
|
|
// verb:
|
|
|
|
'is are say understand ' +
|
|
|
|
// misc keyword:
|
|
|
|
'kind of rule'
|
|
|
|
},
|
|
|
|
contains: [
|
|
|
|
{
|
|
|
|
className: 'string',
|
2024-01-16 21:26:16 +08:00
|
|
|
begin: '"',
|
|
|
|
end: '"',
|
2023-12-18 13:12:25 +08:00
|
|
|
relevance: 0,
|
|
|
|
contains: [
|
|
|
|
{
|
|
|
|
className: 'subst',
|
2024-01-16 21:26:16 +08:00
|
|
|
begin: START_BRACKET,
|
|
|
|
end: END_BRACKET
|
2023-12-18 13:12:25 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
className: 'section',
|
|
|
|
begin: /^(Volume|Book|Part|Chapter|Section|Table)\b/,
|
|
|
|
end: '$'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// Rule definition
|
|
|
|
// This is here for relevance.
|
|
|
|
begin: /^(Check|Carry out|Report|Instead of|To|Rule|When|Before|After)\b/,
|
|
|
|
end: ':',
|
|
|
|
contains: [
|
|
|
|
{
|
2024-01-16 21:26:16 +08:00
|
|
|
// Rule name
|
|
|
|
begin: '\\(This',
|
|
|
|
end: '\\)'
|
2023-12-18 13:12:25 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
className: 'comment',
|
2024-01-16 21:26:16 +08:00
|
|
|
begin: START_BRACKET,
|
|
|
|
end: END_BRACKET,
|
2023-12-18 13:12:25 +08:00
|
|
|
contains: ['self']
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
2024-01-16 21:26:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = inform7;
|