Skip to content

Commit

Permalink
Merge branch 'issue_1338' into 'master'
Browse files Browse the repository at this point in the history
Unparsing: add configuration for ExceptionDecl

Closes #1338

See merge request eng/libadalang/libadalang!1596
  • Loading branch information
joaopsazevedo committed Mar 27, 2024
2 parents 24507f6 + e14ec70 commit 3c58fd1
Show file tree
Hide file tree
Showing 17 changed files with 741 additions and 0 deletions.
59 changes: 59 additions & 0 deletions extensions/default_unparsing_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1402,6 +1402,65 @@
"recurse"
]
},
"ExceptionDecl": {
"node": {
"kind": "group",
"document": [
{
"kind": "group",
"document": [
{
"kind": "group",
"document": {
"kind": "align",
"width": 2,
"contents": {
"kind": "recurse_field",
"field": "f_ids"
}
}
},
"whitespace",
{
"kind": "text",
"text": ":"
},
"whitespace",
{
"kind": "text",
"text": "exception"
},
{
"kind": "recurse_field",
"field": "f_renames"
}
]
},
{
"kind": "recurse_field",
"field": "f_aspects"
},
{
"kind": "text",
"text": ";"
}
]
},
"fields": {
"f_renames": {
"kind": "align",
"width": 2,
"contents": "recurse"
},
"f_aspects": [
"line",
{
"kind": "group",
"document": "recurse"
}
]
}
},
"ExceptionHandler": {
"node": {
"kind": "group",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
{
"id": 24,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 23,
"kind": "list",
"list": [
{
"id": 11,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 10,
"kind": "list",
"list": [
{
"id": 2,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 1,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 0,
"kind": "text",
"text": "Baaaaaaaaaaaaaaaaaaaaar"
}
}
},
"break": false,
"expandedStates": null
}
},
{
"id": 3,
"kind": "text",
"text": " : exception"
},
{
"id": 9,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 8,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 7,
"kind": "list",
"list": [
{
"id": 4,
"kind": "text",
"text": " renames"
},
{
"id": 5,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 6,
"kind": "text",
"text": "Fooooooooooooooooooooooooooooooooooo"
}
]
},
"break": false,
"expandedStates": null
}
}
}
}
]
},
"break": false,
"expandedStates": null
}
},
{
"id": 12,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 21,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 20,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 19,
"kind": "list",
"list": [
{
"id": 13,
"kind": "text",
"text": "with"
},
{
"id": 18,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 17,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 16,
"kind": "list",
"list": [
{
"id": 14,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 15,
"kind": "text",
"text": "Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz"
}
]
},
"break": false,
"expandedStates": null
}
}
}
}
]
},
"break": false,
"expandedStates": null
}
},
"break": false,
"expandedStates": null
}
},
{
"id": 22,
"kind": "text",
"text": ";"
}
]
},
"break": false,
"expandedStates": null
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Baaaaaaaaaaaaaaaaaaaaar : exception renames Fooooooooooooooooooooooooooooooooooo
with Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Baaaaaaaaaaaaaaaaaaaaar : exception renames
Fooooooooooooooooooooooooooooooooooo
with
Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
driver: unparser
rule: exception_decl
description: |
Test the line break after the `renames` and `with` keywords.
Test the indentation of `f_renames` and `f_aspects`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
"id": 14,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 13,
"kind": "list",
"list": [
{
"id": 11,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 10,
"kind": "list",
"list": [
{
"id": 2,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 1,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 0,
"kind": "text",
"text": "Baaaaaaaaaaaaaaaaaaaaar"
}
}
},
"break": false,
"expandedStates": null
}
},
{
"id": 3,
"kind": "text",
"text": " : exception"
},
{
"id": 9,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 8,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 7,
"kind": "list",
"list": [
{
"id": 4,
"kind": "text",
"text": " renames"
},
{
"id": 5,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 6,
"kind": "text",
"text": "Foooooooooooooooooooooooooooooooooo"
}
]
},
"break": false,
"expandedStates": null
}
}
}
}
]
},
"break": false,
"expandedStates": null
}
},
{
"id": 12,
"kind": "text",
"text": ";"
}
]
},
"break": false,
"expandedStates": null
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Baaaaaaaaaaaaaaaaaaaaar : exception renames Foooooooooooooooooooooooooooooooooo;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Baaaaaaaaaaaaaaaaaaaaar : exception renames
Foooooooooooooooooooooooooooooooooo;
Loading

0 comments on commit 3c58fd1

Please sign in to comment.