Skip to content

Commit

Permalink
Merge branch 'issue_1244' into 'master'
Browse files Browse the repository at this point in the history
Unparsing: add config for ObjectDecl and NoTypeObjectRenamingDecl

Closes #1281

See merge request eng/libadalang/libadalang!1553
  • Loading branch information
joaopsazevedo committed Feb 26, 2024
2 parents 619caf2 + 9a3592f commit 1ee8643
Show file tree
Hide file tree
Showing 38 changed files with 1,843 additions and 2 deletions.
180 changes: 180 additions & 0 deletions extensions/default_unparsing_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,169 @@
"whitespace"
]
},
"NoTypeObjectRenamingDecl": {
"node": {
"kind": "align",
"width": 2,
"contents": {
"kind": "group",
"document": [
[
{
"kind": "recurse_field",
"field": "f_ids"
},
{
"kind": "recurse_field",
"field": "f_has_aliased"
},
{
"kind": "recurse_field",
"field": "f_has_constant"
},
{
"kind": "recurse_field",
"field": "f_mode"
},
{
"kind": "recurse_field",
"field": "f_type_expr"
},
{
"kind": "recurse_field",
"field": "f_default_expr"
},
{
"kind": "recurse_field",
"field": "f_renaming_clause"
},
{
"kind": "recurse_field",
"field": "f_aspects"
},
{
"kind": "text",
"text": ";"
}
]
]
}
}
},
"ObjectDecl": {
"node": {
"kind": "group",
"document": [
{
"kind": "group",
"document": [
{
"kind": "group",
"document": {
"kind": "recurse_field",
"field": "f_ids"
}
},
"whitespace",
{
"kind": "text",
"text": ":"
},
{
"kind": "align",
"width": 2,
"contents": [
"line",
{
"kind": "group",
"document": [
{
"kind": "recurse_field",
"field": "f_has_aliased"
},
{
"kind": "recurse_field",
"field": "f_has_constant"
},
{
"kind": "recurse_field",
"field": "f_mode"
},
{
"kind": "recurse_field",
"field": "f_type_expr"
}
]
}
]
}
],
"id": "name_and_type"
},
{
"kind": "ifBreak",
"breakContents": {
"kind": "align",
"width": 4,
"contents": {
"kind": "group",
"document": [
{
"kind": "recurse_field",
"field": "f_default_expr"
},
{
"kind": "recurse_field",
"field": "f_renaming_clause"
},
{
"kind": "recurse_field",
"field": "f_aspects"
}
]
}
},
"flatContents": {
"kind": "align",
"width": 2,
"contents": {
"kind": "group",
"document": [
{
"kind": "recurse_field",
"field": "f_default_expr"
},
{
"kind": "recurse_field",
"field": "f_renaming_clause"
},
{
"kind": "recurse_field",
"field": "f_aspects"
}
]
}
},
"groupId": "name_and_type"
},
{
"kind": "text",
"text": ";"
}
]
},
"fields": {
"f_default_expr": [
"whitespace",
{
"kind": "text",
"text": ":="
},
"line",
"recurse"
]
}
},
"OrdinaryFixedPointDef": {
"node": {
"kind": "group",
Expand Down Expand Up @@ -930,6 +1093,23 @@
}
}
},
"RenamingClause": {
"node": {
"kind": "group",
"document": [
"whitespace",
{
"kind": "text",
"text": "renames"
},
"line",
{
"kind": "recurse_field",
"field": "f_renamed_object"
}
]
}
},
"ReturnStmt": {
"node": {
"kind": "align",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"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": 0,
"kind": "text",
"text": "Fooooooooooooooooooooooooooooooooo"
},
{
"id": 5,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 4,
"kind": "list",
"list": [
{
"id": 1,
"kind": "text",
"text": " renames"
},
{
"id": 2,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 3,
"kind": "text",
"text": "Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar"
}
]
},
"break": false,
"expandedStates": null
}
},
{
"id": 6,
"kind": "text",
"text": ";"
}
]
},
"break": false,
"expandedStates": null
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fooooooooooooooooooooooooooooooooo renames Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fooooooooooooooooooooooooooooooooo renames
Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
driver: unparser
rule: object_decl
description: |
Base test case for a long `NoTypeObjectRenamingDecl`. Test that a line break
is added after the `rename` keyword.
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"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": 0,
"kind": "text",
"text": "Foo"
},
{
"id": 5,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 4,
"kind": "list",
"list": [
{
"id": 1,
"kind": "text",
"text": " renames"
},
{
"id": 2,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 3,
"kind": "text",
"text": "Bar"
}
]
},
"break": false,
"expandedStates": null
}
},
{
"id": 6,
"kind": "text",
"text": ";"
}
]
},
"break": false,
"expandedStates": null
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Foo renames
Bar;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Foo renames Bar;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
driver: unparser
rule: no_type_object_renaming_decl
description: |
Base test case for a short `NoTypeObjectRenamingDecl`.
Loading

0 comments on commit 1ee8643

Please sign in to comment.