Skip to content

Conversation

jurgenvinju
Copy link
Member

@jurgenvinju jurgenvinju commented Aug 14, 2025

Rascal is a pretty big language so this pushes the new toBox and format and layoutDiff functions to the max.

  • For now the goal is to formulate toBox rules such that the formatter produces beautiful layout, and
  • We identify bugs and efficiency issues in toBox, format and layoutDiff for later fixing.

Copy link

codecov bot commented Aug 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47%. Comparing base (6cfa756) to head (a7ad1a3).

Additional details and impacted files
@@           Coverage Diff           @@
##              main   #2346   +/-   ##
=======================================
  Coverage       47%     47%           
- Complexity    6626    6627    +1     
=======================================
  Files          783     783           
  Lines        64703   64698    -5     
  Branches      9688    9683    -5     
=======================================
+ Hits         30724   30732    +8     
+ Misses       31580   31562   -18     
- Partials      2399    2404    +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jurgenvinju jurgenvinju changed the base branch from main to hifi-tree-diff August 14, 2025 10:53
@jurgenvinju jurgenvinju self-assigned this Aug 14, 2025
@jurgenvinju jurgenvinju changed the title experiment: rascal formatted based on Box and layoutDiff experiment: rascal formatter based on Box and layoutDiff Aug 14, 2025
Base automatically changed from hifi-tree-diff to main August 14, 2025 11:37
@toinehartman
Copy link
Member

In the spirit of eat your own dog food, I gave it a spin

rascal>formatRascalFile(|file:///c:/Users/toine/swat/projects/Rascal/rascal/src/org/rascalmpl/library/lang/rascal/format/Rascal.rsc|);
|TODO:///|: ParseError(|file:///c:/Users/toine/swat/projects/Rascal/rascal/src/org/rascalmpl/library/lang/rascal/format/Rascal.rsc|(2734,1,<67,73>,<67,74>))

The error is not in the original file:

rascal>parse(#start[Module], |file:///c:/Users/toine/swat/projects/Rascal/rascal/src/org/rascalmpl/library/lang/rascal/format/Rascal.rsc|);
start[Module]: (start[Module]) `@license{
Copyright (c) 2022, NWO-I Centrum Wiskunde & Informatica (CWI)
All rights reserved.
...

I did not investigate further, but it might very well be introduced by our toBox rules.

Copy link
Member

@toinehartman toinehartman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Really cool to test declarative formatting on a mature languge.

I think finding a formatting for Rascal that's commonly agreed on might be controversial...

…oxes to _H, _V, etc. to avoid infinite recursions. This allows for removal of 50% of the brackets in Box expressions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants