Skip to content

Commit

Permalink
* Fixed recognition around records.
Browse files Browse the repository at this point in the history
* Added more unit tests.
  • Loading branch information
DobromirM committed Nov 3, 2021
1 parent bde97fc commit ce1ae41
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ private static SpacingBuilder createSpaceBuilder(CodeStyleSettings settings) {

builder.before(ReconTypes.SEP).spaces(0);
builder.before(ReconTypes.SLOTS).blankLines(0);
builder.between(ReconTypes.SLOTS, ReconTypes.RECORD).lineBreakInCode();

builder.after(ReconTypes.OPEN_BRACK).spaces(0);
builder.before(ReconTypes.OPEN_BRACK).spaces(0);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/swim/language/Recon.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ empty_slot ::= blockItem whiteSpace* COL

block ::= whiteSpace* slots whiteSpace*

record ::= OPEN_CRL_BRACK block? whiteSpace* CLOSE_CRL_BRACK
record ::= whiteSpace* OPEN_CRL_BRACK block? whiteSpace* CLOSE_CRL_BRACK

whiteSpace ::= NL | SP
2 changes: 2 additions & 0 deletions src/test/java/ReconCodeFormattingTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public void testFormatting() {
tests.add("attr-after-slot-expand.recon");
tests.add("attr-collapse.recon");
tests.add("attr-expand.recon");
tests.add("attr-record-no-change.recon");
tests.add("attr-spaces-between.recon");
tests.add("cellular-collapse.recon");
tests.add("cellular-expand.recon");
Expand All @@ -21,6 +22,7 @@ public void testFormatting() {
tests.add("comment-collapse.recon");
tests.add("extant-slots.recon");
tests.add("operations-collapse.recon");
tests.add("record-after-literal.recon");
tests.add("rosa-expand.recon");
tests.add("slot-after-attr-collapse.recon");
tests.add("slots-collapse-extant.recon");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@atr() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@atr() {
}
3 changes: 3 additions & 0 deletions src/test/testData/formatting/input/record-after-literal.recon
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1{

}

0 comments on commit ce1ae41

Please sign in to comment.