mirror of
https://codeberg.org/ProgramSnail/tree-sitter-lang.git
synced 2026-01-25 13:07:09 +00:00
minor fixes, changes, required for usage
This commit is contained in:
parent
39f31b901d
commit
df305457c8
2 changed files with 8 additions and 8 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
Test
|
Test
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
#! lang
|
#!/usr/bin/env lang
|
||||||
|
|
||||||
:: module; // import module to current namespace
|
:: module; // import module to current namespace
|
||||||
|
|
||||||
|
|
|
||||||
14
grammar.js
14
grammar.js
|
|
@ -82,8 +82,8 @@ module.exports = grammar({
|
||||||
case: $ => seq(
|
case: $ => seq(
|
||||||
choice(':=', '=:'),
|
choice(':=', '=:'),
|
||||||
$._expression,
|
$._expression,
|
||||||
optional(seq(choice('??', 'if'), $._expression)),
|
optional(seq(choice('??', 'if'), field('condition', $._expression))),
|
||||||
optional(seq($._do, $._expression)),
|
optional(field('expression', seq($._do, $._expression))),
|
||||||
),
|
),
|
||||||
|
|
||||||
match: $ => seq(
|
match: $ => seq(
|
||||||
|
|
@ -108,11 +108,11 @@ module.exports = grammar({
|
||||||
loop: $ => seq(
|
loop: $ => seq(
|
||||||
choice('@', 'for'),
|
choice('@', 'for'),
|
||||||
optional(choice(
|
optional(choice(
|
||||||
field('condition', $._expression),
|
$._expression,
|
||||||
seq(field('variable', $._expression), ':', field('interval', $._expression)),
|
seq($._expression, ':', $._expression),
|
||||||
)),
|
)),
|
||||||
$._do,
|
$._do,
|
||||||
field('expression', $._expression),
|
$._expression,
|
||||||
),
|
),
|
||||||
|
|
||||||
// --- operators
|
// --- operators
|
||||||
|
|
@ -134,7 +134,7 @@ module.exports = grammar({
|
||||||
|
|
||||||
// --- modifiers
|
// --- modifiers
|
||||||
|
|
||||||
return: $ => seq(choice('return', 'bring'), field('value', $._expression)),
|
return: $ => seq(choice('return', 'bring'), $._expression),
|
||||||
|
|
||||||
name_definition: $ => seq(
|
name_definition: $ => seq(
|
||||||
$._var_let,
|
$._var_let,
|
||||||
|
|
@ -164,7 +164,7 @@ module.exports = grammar({
|
||||||
),
|
),
|
||||||
|
|
||||||
constructor: $ => seq(
|
constructor: $ => seq(
|
||||||
$.type,
|
field('type', $.type),
|
||||||
repeat1(seq(optional($.annotation_identifier), $._scoped_expression)),
|
repeat1(seq(optional($.annotation_identifier), $._scoped_expression)),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue