Skip to content

Commit

Permalink
Merge branch 'gnatformat-issue_54' into 'master'
Browse files Browse the repository at this point in the history
Add QuantifiedExpr config

See merge request eng/libadalang/libadalang!1722
  • Loading branch information
joaopsazevedo committed Aug 1, 2024
2 parents 01c9f10 + 00f2689 commit c8ef0d8
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
33 changes: 33 additions & 0 deletions extensions/default_unparsing_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4835,6 +4835,39 @@
]
}
},
"QuantifiedExpr": {
"node": {
"kind": "group",
"document": {
"kind": "innerRoot",
"contents": [
{
"kind": "text",
"text": "for"
},
"whitespace",
{
"kind": "recurse_field",
"field": "f_quantifier"
},
{
"kind": "recurse_field",
"field": "f_loop_spec"
},
"line",
{
"kind": "text",
"text": "=>"
},
"whitespace",
{
"kind": "recurse_field",
"field": "f_expr"
}
]
}
}
},
"QualExpr": {
"node": {
"kind": "group",
Expand Down
7 changes: 7 additions & 0 deletions testsuite/tests/unparsing/quantified_expr/input.ada
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if (for some Change of Value.contentChanges => Change > 80)
or else (for all Change of Value.contentChanges
=> Change.text.Character_Length)
then
-- Don't dump very long changes to avoid stack overflow
Self.Output.Put ("<some big change>", Ok);
end if;
7 changes: 7 additions & 0 deletions testsuite/tests/unparsing/quantified_expr/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if (for some Change of Value.contentChanges => Change > 80)
or else (for all Change of Value.contentChanges
=> Change.text.Character_Length)
then
-- Don't dump very long changes to avoid stack overflow
Self.Output.Put ("<some big change>", Ok);
end if;
6 changes: 6 additions & 0 deletions testsuite/tests/unparsing/quantified_expr/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
driver: unparser
rule: stmt
description: |
This test checks that `QuantifiedExpr` nodes:
- do not line break is they fit in the line
- line breaks before the `=>` token if they don't fit in the line

0 comments on commit c8ef0d8

Please sign in to comment.