Skip to content

Commit

Permalink
Merge branch 'issue_1292' into 'master'
Browse files Browse the repository at this point in the history
Unparsing: add config for GenericSubpDecl

Closes #1292

See merge request eng/libadalang/libadalang!1557
  • Loading branch information
joaopsazevedo committed Feb 29, 2024
2 parents 9a16f76 + f13511b commit 210e57d
Show file tree
Hide file tree
Showing 9 changed files with 1,524 additions and 0 deletions.
108 changes: 108 additions & 0 deletions extensions/default_unparsing_config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"node_configs": {
"AdaNodeList": {
"sep": [
"recurse",
"line"
]
},
"ArrayTypeDef": {
"node": {
"kind": "group",
Expand Down Expand Up @@ -235,6 +241,52 @@
"line"
]
},
"ConcreteFormalSubpDecl": {
"node": {
"kind": "align",
"width": 2,
"contents": {
"kind": "group",
"document": [
{
"kind": "text",
"text": "with"
},
"line",
{
"kind": "recurse_field",
"field": "f_overriding"
},
{
"kind": "recurse_field",
"field": "f_subp_spec"
},
{
"kind": "recurse_field",
"field": "f_default_expr"
},
{
"kind": "align",
"width": 2,
"contents": {
"kind": "recurse_field",
"field": "f_aspects"
}
},
{
"kind": "text",
"text": ";"
}
]
}
},
"fields": {
"f_default_expr": [
"whitespace",
"recurse"
]
}
},
"ConcreteTypeDecl": {
"node": {
"kind": "align",
Expand Down Expand Up @@ -454,6 +506,62 @@
]
}
},
"GenericFormalPart": {
"node": {
"kind": "group",
"document": [
{
"kind": "text",
"text": "generic"
},
{
"kind": "indent",
"contents": [
"hardline",
{
"kind": "group",
"break": true,
"document": {
"kind": "recurse_field",
"field": "f_decls"
}
}
]
}
]
}
},
"GenericFormalSubpDecl": {
"node": {
"kind": "group",
"document": [
{
"kind": "recurse_field",
"field": "f_decl"
}
]
}
},
"GenericSubpDecl": {
"node": {
"kind": "group",
"document": [
{
"kind": "recurse_field",
"field": "f_formal_part"
},
"hardline",
{
"kind": "recurse_field",
"field": "f_subp_decl"
},
{
"kind": "text",
"text": ";"
}
]
}
},
"IfStmt": {
"node": {
"kind": "group",
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
generic
function Perform_Comparison_Check
(Comparing_Value : Foo_Bar_Baz;
Rule_Value : Foo_Bar_Baz;
Logic_Operator : Unbounded_String)
return Boolean;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
generic
function Perform_Comparison_Check
(Comparing_Value : Foo_Bar_Baz;
Rule_Value : Foo_Bar_Baz;
Logic_Operator : Unbounded_String) return Boolean;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
driver: unparser
rule: generic_decl
description: |
Test that there is no line break between the keywords `generic` and
`function`.
control:
- [
XFAIL,
"True",
"https://gitlab.adacore-it.com/eng/libadalang/langkit/-/issues/760",
]

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
generic
type Foo_Bar_Baz is private;
with function ">" (Left_Left_Left_Left_Left : Foo_Bar_Baz; Right_Right_Right_Right_Right : Foo_Bar_Baz) return Boolean is <>;
function Perform_Comparison_Check
(Comparing_Value : Foo_Bar_Baz;
Rule_Value : Foo_Bar_Baz;
Logic_Operator : Unbounded_String)
return Boolean;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
generic
type Foo_Bar_Baz is private;
with
function ">"
(Left_Left_Left_Left_Left : Foo_Bar_Baz;
Right_Right_Right_Right_Right : Foo_Bar_Baz) return Boolean is <>;
function Perform_Comparison_Check
(Comparing_Value : Foo_Bar_Baz;
Rule_Value : Foo_Bar_Baz;
Logic_Operator : Unbounded_String) return Boolean;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
driver: unparser
rule: generic_decl
description: |
Test that each generic formal declaration is in its own line.

0 comments on commit 210e57d

Please sign in to comment.