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

added optional storage of constructor names and datatype names while serializing to JSON. Wired this through the different webservers as well #1862

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

jurgenvinju
Copy link
Member

@jurgenvinju jurgenvinju commented Sep 12, 2023

This adds explicitConstructorNames and explicitDataType as keyword parameters to the JSON readers and writers. An constructor foo(bar(), what()) will be printed as such when explicitConstructorNames=true:

{
   _constructor = "foo",
   lhs = { 
      _constructor = "bar"
   },
   rhs = {
      _constructor = "what"
   }
}

This facilitates mapping syntax trees to JSON.

…serializing to JSON. Wired this through the different webservers as well
@codecov
Copy link

codecov bot commented Sep 12, 2023

Codecov Report

Attention: Patch coverage is 57.31707% with 35 lines in your changes missing coverage. Please review.

Project coverage is 49%. Comparing base (edfb516) to head (6996898).
Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
...pl/library/lang/json/internal/JsonValueReader.java 65% 4 Missing and 12 partials ⚠️
src/org/rascalmpl/library/util/TermREPL.java 0% 5 Missing ⚠️
src/org/rascalmpl/library/util/Webserver.java 0% 5 Missing ⚠️
src/org/rascalmpl/repl/REPLContentServer.java 0% 5 Missing ⚠️
src/org/rascalmpl/library/lang/json/IO.java 75% 2 Missing ⚠️
...pl/library/lang/json/internal/JsonValueWriter.java 83% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##              main   #1862    +/-   ##
========================================
  Coverage       49%     49%            
- Complexity    6315    6334    +19     
========================================
  Files          664     665     +1     
  Lines        59584   59687   +103     
  Branches      8640    8670    +30     
========================================
+ Hits         29496   29626   +130     
+ Misses       27877   27824    -53     
- Partials      2211    2237    +26     

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


🚨 Try these New Features:

@jurgenvinju
Copy link
Member Author

this requires some tests to be added. other than that it seems to do the job.

@jurgenvinju jurgenvinju marked this pull request as ready for review November 23, 2024 13:40
@jurgenvinju
Copy link
Member Author

@DavyLandman There is another later PR on JSON IO about embedded parsers/unparsers for string values in JSON. This one precedes that one so let's merge this one first. This current feature can be essential for applications/frameworks such as salix that need to unambiguously communicate syntax trees to and from the web clients.

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.

1 participant