Последняя активность 1748996129

note: untested as of 6/2/2025

grammar.js Исходник Playground
1/**
2 * @file Nova grammar
3 * @author nouveau
4 */
5
6module.exports = grammar({
7 name: "nova",
8
9 rules: {
10 program: $ => repeat($.rule),
11
12 rule: $ => seq(
13 '|',
14 repeat($.rule_lhs),
15 '|',
16 optional('\n'),
17 repeat($.rule_rhs)
18 ),
19
20 rule_lhs: $ => seq(
21 $.stack,
22 optional($.anticonsumption_suffix),
23 optional('\n')
24 ),
25
26 rule_rhs: $ => seq(
27 $.stack,
28 optional('\n')
29 ),
30
31 stack: $ => seq(
32 $.stack_label,
33 repeat(choice($.variable, $.term)),
34 ),
35
36 stack_label: $ => seq(
37 ':',
38 choice($.port, repeat($.label)),
39 ':'
40 ),
41
42 variable: $ => seq('$', $.term),
43 port: $ => seq('@', $.label),
44 label: $ => /[^\n\r\t |:?@]+/,
45 term: $ => /[^\n\r\t |:]+/,
46 anticonsumption_suffix: $ => '?',
47 }
48});
49