Skip to content

Commit

Permalink
parser: improve stream_definition
Browse files Browse the repository at this point in the history
Fixes #94
  • Loading branch information
jkbz64 committed Oct 14, 2024
1 parent 4273fa9 commit 8587b1f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
9 changes: 6 additions & 3 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ module.exports = grammar({
$.property_definition,
$.data_source_definition,
$.event_definition,
$.dataset_definition
$.dataset_definition,
$.stream_definition
])
],

Expand Down Expand Up @@ -684,7 +685,8 @@ module.exports = grammar({
$.variable_definition,
$.query_definition,
$.buffer_definition,
$.data_source_definition
$.data_source_definition,
$.stream_definition
)
)
),
Expand Down Expand Up @@ -781,8 +783,9 @@ module.exports = grammar({
stream_definition: ($) =>
seq(
choice(kw("DEFINE"), kw("DEF")),
repeat(choice($.scope_tuning, $.access_tuning, $.serialization_tuning)),
kw("STREAM"),
$.identifier,
field("name", $.identifier),
$._terminator
),

Expand Down
12 changes: 8 additions & 4 deletions test/corpus/basic.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1354,14 +1354,14 @@ OUTPUT TO VALUE(out).
OUTPUT CLOSE.
INPUT CLOSE.

DEFINE STREAM i.
DEFINE GLOBAL SHARED STREAM i.
INPUT STREAM i FROM VALUE(in).
INPUT CLOSE.

INPUT STREAM-HANDLE hi FROM VALUE(in).
INPUT CLOSE.

DEFINE STREAM o.
DEFINE NEW SHARED STREAM o.
OUTPUT STREAM o TO "CLIPBOARD".
OUTPUT CLOSE.

Expand All @@ -1386,7 +1386,9 @@ OUTPUT CLOSE.
(output_close_statement)
(input_close_statement)
(stream_definition
(identifier))
(scope_tuning)
(scope_tuning)
name: (identifier))
(input_stream_statement
source: (identifier)
target: (function_call
Expand All @@ -1404,7 +1406,9 @@ OUTPUT CLOSE.
(identifier)))))
(input_close_statement)
(stream_definition
(identifier))
(scope_tuning)
(scope_tuning)
name: (identifier))
(output_stream_statement
source: (identifier)
target: (string_literal))
Expand Down

0 comments on commit 8587b1f

Please sign in to comment.