Skip to content

Commit

Permalink
Added image definition
Browse files Browse the repository at this point in the history
  • Loading branch information
ekazbaraite authored and jkbz64 committed Jan 10, 2025
1 parent 51b237a commit 8219ff5
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
25 changes: 24 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ module.exports = grammar({
$.data_source_definition,
$.event_definition,
$.dataset_definition,
$.stream_definition
$.stream_definition,
$.image_definition
])
],

Expand Down Expand Up @@ -1441,6 +1442,27 @@ module.exports = grammar({
$._terminator
),

image_tuning: ($) =>
choice(
seq(kw("BGCOLOR"), $._expression),
seq(kw("FGCOLOR"), $._expression),
kw("CONVERT-3D-COLORS"),
seq(kw("TOOLTIP"), $.identifier),
seq(kw("STRETCH-TO-FIT"), optional(kw("RETAIN-SHAPE"))),
kw("TRANSPARENT")
),

image_definition: ($) =>
seq(
choice(kw("DEFINE"), kw("DEF")),
optional($.access_tuning),
kw("IMAGE"),
field("name", $.identifier),
choice($.size_phrase, $.image_phrase, seq(kw("LIKE"), $.identifier)),
repeat($.image_tuning),
$._terminator
),

run_tuning: ($) =>
choice(
kw("PERSISTENT"),
Expand Down Expand Up @@ -1583,6 +1605,7 @@ module.exports = grammar({
$.prompt_for_statement,
$.dataset_definition,
$.button_definition,
$.image_definition,
$.run_statement,
$.enum_statement,
$.abl_statement
Expand Down
16 changes: 16 additions & 0 deletions test/corpus/basic.txt
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,22 @@ DEFINE BUFFER x-table FOR table.
(identifier)
(identifier)))

================================================================================
IMAGE DEFINITION statement
================================================================================

DEFINE IMAGE myImage SIZE 5 BY 5 CONVERT-3D-COLORS.

--------------------------------------------------------------------------------

(source_code
(image_definition
name: (identifier)
(size_phrase
width: (number_literal)
height: (number_literal))
(image_tuning)))

================================================================================
QUERY DEFINITION statement
================================================================================
Expand Down

0 comments on commit 8219ff5

Please sign in to comment.