Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve astprinter #2847

Merged
merged 2 commits into from
Aug 15, 2024
Merged

Improve astprinter #2847

merged 2 commits into from
Aug 15, 2024

Conversation

privat
Copy link
Member

@privat privat commented Aug 15, 2024

The module astprinter is used to print AST in order to debug synthetic statements and expressions.
It was quite limited.

This PR extends it to most Nit expressions and statements. The missing ones will be addressed in futures PR.

The PR also add a simple nit test program syntax_expr.nit that exhibits many syntactic constructions. It is used to test the astprinter through a test tool test_astprinter that (pretty?)-print given programs.

Copy link

github-actions bot commented Aug 15, 2024

Test Results

    67 files     338 suites   17m 27s ⏱️
14 187 tests 13 644 ✅ 543 💤 0 ❌
14 586 runs  14 026 ✅ 560 💤 0 ❌

Results for commit ca41660.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@dullin dullin left a comment

Choose a reason for hiding this comment

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

  • In a if expression block, the else is always printed even if not present.
  • Magic number 3 for number of lines to make more explicit.

src/astprinter.nit Outdated Show resolved Hide resolved
src/astprinter.nit Outdated Show resolved Hide resolved
src/astprinter.nit Show resolved Hide resolved
tests/sav/test_astprinter_args1.res Outdated Show resolved Hide resolved
tests/syntax_expr.nit Show resolved Hide resolved
@privat privat merged commit e361242 into nitlang:master Aug 15, 2024
21 checks passed
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