Skip to content

Commit

Permalink
Merge branch 'mku/delay_stmt' into 'master'
Browse files Browse the repository at this point in the history
Add DelayStmt config

Closes #1369

See merge request eng/libadalang/libadalang!1624
  • Loading branch information
CKMonika committed Apr 17, 2024
2 parents 5e102bc + 1fea00b commit 70a549f
Show file tree
Hide file tree
Showing 17 changed files with 298 additions and 0 deletions.
30 changes: 30 additions & 0 deletions extensions/default_unparsing_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,36 @@
"line"
]
},
"DelayStmt": {
"node": {
"kind": "group",
"document": [
{
"kind": "text",
"text": "delay"
},
{
"kind": "recurse_field",
"field": "f_has_until"
},
{
"kind": "align",
"width": 2,
"contents": [
"line",
{
"kind": "recurse_field",
"field": "f_expr"
}
]
},
{
"kind": "text",
"text": ";"
}
]
}
},
"DeltaAggregate": {
"kind": "group",
"document": [
Expand Down
58 changes: 58 additions & 0 deletions testsuite/tests/unparsing/delay_stmt/has_until/doc-baseline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"id": 7,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 6,
"kind": "list",
"list": [
{
"id": 0,
"kind": "text",
"text": "delay until"
},
{
"id": 4,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 3,
"kind": "list",
"list": [
{
"id": 1,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 2,
"kind": "text",
"text": "12"
}
]
}
}
},
{
"id": 5,
"kind": "text",
"text": ";"
}
]
},
"break": false,
"expandedStates": null
}
}
1 change: 1 addition & 0 deletions testsuite/tests/unparsing/delay_stmt/has_until/input.ada
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
delay until 12;
1 change: 1 addition & 0 deletions testsuite/tests/unparsing/delay_stmt/has_until/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
delay until 12;
6 changes: 6 additions & 0 deletions testsuite/tests/unparsing/delay_stmt/has_until/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
description: |
This test checks the formatting of a delay statement.
It is expected the statement stays on a single line.
driver: unparser
rule: delay_stmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"id": 7,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 6,
"kind": "list",
"list": [
{
"id": 0,
"kind": "text",
"text": "delay until"
},
{
"id": 4,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 3,
"kind": "list",
"list": [
{
"id": 1,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 2,
"kind": "text",
"text": "veeeeeeeeeeeeeeeeeeeeeryLooooooooooooooooooooongDeeeeeeeeeeeeeeeeeeeelVaaaaaaaaaaaaal"
}
]
}
}
},
{
"id": 5,
"kind": "text",
"text": ";"
}
]
},
"break": false,
"expandedStates": null
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
delay until veeeeeeeeeeeeeeeeeeeeeryLooooooooooooooooooooongDeeeeeeeeeeeeeeeeeeeelVaaaaaaaaaaaaal;
2 changes: 2 additions & 0 deletions testsuite/tests/unparsing/delay_stmt/long_has_until/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
delay until
veeeeeeeeeeeeeeeeeeeeeryLooooooooooooooooooooongDeeeeeeeeeeeeeeeeeeeelVaaaaaaaaaaaaal;
7 changes: 7 additions & 0 deletions testsuite/tests/unparsing/delay_stmt/long_has_until/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
description: |
This test checks the formatting of a delay statement.
It is expected the statement breaks after `until` keyword
and the new line be indented.
driver: unparser
rule: delay_stmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"id": 7,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 6,
"kind": "list",
"list": [
{
"id": 0,
"kind": "text",
"text": "delay"
},
{
"id": 4,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 3,
"kind": "list",
"list": [
{
"id": 1,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 2,
"kind": "text",
"text": "veeeeeeeeeeeeeeeeeeeeeryLooooooooooooooooooooongDeeeeeeeeeeeeeeeeeeeelVaaaaaaaaaaaaal"
}
]
}
}
},
{
"id": 5,
"kind": "text",
"text": ";"
}
]
},
"break": false,
"expandedStates": null
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
delay veeeeeeeeeeeeeeeeeeeeeryLooooooooooooooooooooongDeeeeeeeeeeeeeeeeeeeelVaaaaaaaaaaaaal;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
delay
veeeeeeeeeeeeeeeeeeeeeryLooooooooooooooooooooongDeeeeeeeeeeeeeeeeeeeelVaaaaaaaaaaaaal;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
description: |
This test checks the formatting of a delay statement.
It is expected the statement breaks after `delay` keyword
and the new line be indented.
driver: unparser
rule: delay_stmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"id": 7,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 6,
"kind": "list",
"list": [
{
"id": 0,
"kind": "text",
"text": "delay"
},
{
"id": 4,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 3,
"kind": "list",
"list": [
{
"id": 1,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 2,
"kind": "text",
"text": "Del"
}
]
}
}
},
{
"id": 5,
"kind": "text",
"text": ";"
}
]
},
"break": false,
"expandedStates": null
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
delay Del;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
delay Del;
6 changes: 6 additions & 0 deletions testsuite/tests/unparsing/delay_stmt/without_until/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
description: |
This test checks the formatting of a delay statement.
It is expected the statement stays on a single line.
driver: unparser
rule: delay_stmt

0 comments on commit 70a549f

Please sign in to comment.