Skip to content

Commit

Permalink
Add snippet for for-loops on group arrays (#434)
Browse files Browse the repository at this point in the history
closes #432
  • Loading branch information
MarkusAmshove authored Nov 25, 2023
2 parents 2876b47 + 068d8c5 commit eeb4ce0
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ public class StatementSnippetProvider implements ISnippetProvider
COMPRESS ${1:'Text'} INTO ${2:#VAR} ${3:LEAVING NO}
""");

private static final NaturalSnippet FOREACH_GROUP = new NaturalSnippet("foreach-group")
.applicableWhen(f -> f.getType().canHaveBody())
.insertsText("""
#S-${1:ITERATOR} := *OCC(${2:GROUPARRAY}.${3:ISN})
FOR #I-${1} := 1 TO #S-${1}
MOVE BY NAME ${2}(#I-${1}) TO ${4:GROUP}
${0:IGNORE}
END-FOR
""");

private static final List<NaturalSnippet> snippets = List.of(
SUBROUTINE,
IF,
Expand All @@ -114,7 +125,8 @@ public class StatementSnippetProvider implements ISnippetProvider
SOURCE_HEADER,
RESIZE,
RESIZE_AND_RESET,
COMPRESS
COMPRESS,
FOREACH_GROUP
);

@Override
Expand Down

0 comments on commit eeb4ce0

Please sign in to comment.