Skip to content

Commit

Permalink
feat: expose fields in task parameter, output and intercycle annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotfontaine committed Sep 29, 2024
1 parent 8dc746f commit 9aa123c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
26 changes: 19 additions & 7 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ module.exports = grammar({
seq(
field("brackets_open", "[["),
optional(field("name", $.nametag)),
repeat($.task_parameter),
repeat(field("parameter", $.task_parameter)),
field("brackets_close", "]]"),
$._line_return,
optional(repeat(choice($.setting, $._line_return))),
Expand Down Expand Up @@ -251,8 +251,16 @@ module.exports = grammar({
token.immediate("<"),
optional(
choice(
seq($.nametag, repeat(seq(token.immediate(","), $.nametag))),
seq($.nametag, optional(seq(token.immediate("="), $.nametag))),
seq(
field("name", $.nametag),
repeat(seq(token.immediate(","), field("name", $.nametag))),
),
seq(
field("name", $.nametag),
optional(
seq(token.immediate("="), field("selection", $.nametag)),
),
),
),
),
token.immediate(">"),
Expand All @@ -261,14 +269,18 @@ module.exports = grammar({
task_output: ($) =>
choice(
seq(
seq(token.immediate(":"), $.nametag),
optional(token.immediate("?")),
seq(token.immediate(":"), field("name", $.nametag)),
optional(field("optional_annotation", token.immediate("?"))),
),
token.immediate("?"),
field("optional_annotation", token.immediate("?")),
),

intercycle_annotation: ($) =>
seq(token.immediate("["), optional($.recurrence), token.immediate("]")),
seq(
token.immediate("["),
optional(field("recurrence", $.recurrence)),
token.immediate("]"),
),

setting: ($) =>
seq(
Expand Down
2 changes: 1 addition & 1 deletion test/corpus/satellite-short.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ satellite short
(graph_task
name: (nametag)
intercycle: (intercycle_annotation
(recurrence)))
recurrence: (recurrence)))
(graph_arrow)
(graph_task
name: (nametag))
Expand Down

0 comments on commit 9aa123c

Please sign in to comment.