Skip to content

Commit

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

Closes #1362

See merge request eng/libadalang/libadalang!1617
  • Loading branch information
CKMonika committed Apr 15, 2024
2 parents eb20151 + 659b6c0 commit 60459a6
Show file tree
Hide file tree
Showing 17 changed files with 453 additions and 0 deletions.
29 changes: 29 additions & 0 deletions extensions/default_unparsing_config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
{
"node_configs": {
"AbortStmt": {
"node": {
"kind": "group",
"document": [
{
"kind": "text",
"text": "abort"
},
{
"kind": "recurse_field",
"field": "f_names"
},
{
"kind": "text",
"text": ";"
}
]
},
"fields": {
"f_names": {
"kind": "align",
"width": 2,
"contents": [
"line",
"recurse"
]
}
}
},
"AcceptStmt": {
"node": {
"kind": "group",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"id": 11,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 10,
"kind": "list",
"list": [
{
"id": 0,
"kind": "text",
"text": "abort"
},
{
"id": 8,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 7,
"kind": "list",
"list": [
{
"id": 1,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 2,
"kind": "text",
"text": "T1111111111111111111111111111111111111111111,"
},
{
"id": 3,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 4,
"kind": "text",
"text": "T22222222222222222222,"
},
{
"id": 5,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 6,
"kind": "text",
"text": "T333333333333333333"
}
]
}
}
},
{
"id": 9,
"kind": "text",
"text": ";"
}
]
},
"break": false,
"expandedStates": null
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
abort T1111111111111111111111111111111111111111111, T22222222222222222222,T333333333333333333;
4 changes: 4 additions & 0 deletions testsuite/tests/unparsing/abort_stmt/long_with_list/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
abort
T1111111111111111111111111111111111111111111,
T22222222222222222222,
T333333333333333333;
9 changes: 9 additions & 0 deletions testsuite/tests/unparsing/abort_stmt/long_with_list/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
description: |
This test checks the formatting of an abort statement
with a long list of task names.
It is expected the declaration breaks after `abort`
keyword and the list is broken and all its elements be
indented.
driver: unparser
rule: abort_stmt
147 changes: 147 additions & 0 deletions testsuite/tests/unparsing/abort_stmt/one_task/doc-baseline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{
"id": 18,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 17,
"kind": "list",
"list": [
{
"id": 0,
"kind": "text",
"text": "abort"
},
{
"id": 15,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 14,
"kind": "list",
"list": [
{
"id": 1,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 13,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "innerRoot"
},
"alignContents": {
"id": 12,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 11,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 10,
"kind": "list",
"list": [
{
"id": 2,
"kind": "text",
"text": "T_Array"
},
{
"id": 3,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 4,
"kind": "text",
"text": "("
},
{
"id": 8,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 7,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 6,
"kind": "list",
"list": [
{
"id": 5,
"kind": "text",
"text": "N"
}
]
}
}
},
"break": false,
"expandedStates": null
}
},
{
"id": 9,
"kind": "text",
"text": ")"
}
]
},
"break": false,
"expandedStates": null
}
}
}
}
}
}
]
}
}
},
{
"id": 16,
"kind": "text",
"text": ";"
}
]
},
"break": false,
"expandedStates": null
}
}
1 change: 1 addition & 0 deletions testsuite/tests/unparsing/abort_stmt/one_task/input.ada
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
abort T_Array(N);
1 change: 1 addition & 0 deletions testsuite/tests/unparsing/abort_stmt/one_task/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
abort T_Array (N);
7 changes: 7 additions & 0 deletions testsuite/tests/unparsing/abort_stmt/one_task/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
description: |
This test checks the formatting of an abort statement
with an array element as task name.
It is expected the declaration stays on a single line.
driver: unparser
rule: abort_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": "abort"
},
{
"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": "TaaaaaaaaaaaaaaaassssssssssssssssssskLooooooongNaaaaaaaaaaaaaaaaaaaaaaame"
}
]
}
}
},
{
"id": 5,
"kind": "text",
"text": ";"
}
]
},
"break": false,
"expandedStates": null
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
abort TaaaaaaaaaaaaaaaassssssssssssssssssskLooooooongNaaaaaaaaaaaaaaaaaaaaaaame;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
abort
TaaaaaaaaaaaaaaaassssssssssssssssssskLooooooongNaaaaaaaaaaaaaaaaaaaaaaame;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
description: |
This test checks the formatting of an abort statement
with a long task name.
It is expected the declaration breaks after `abort`
keyword and the new line be indented.
driver: unparser
rule: abort_stmt
Loading

0 comments on commit 60459a6

Please sign in to comment.