-
Notifications
You must be signed in to change notification settings - Fork 159
Factor out CTermShow class for simpler node printing #4808
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
Conversation
…inter, adapt tests and uses
This comment was marked as outdated.
This comment was marked as outdated.
Related: #4808 This is part of an effort to refactor the `[APRProof|KCFG]Show` (and `Viewer`) heirarchy to allow more control in how states are rendered. This refactoring makse future refactorings simpler, and can be merged standalone as being feature-preserving.
This comment was marked as outdated.
This comment was marked as outdated.
…ss-level attributes
…TermShow.show_constraints
I have one more refactoring in mind, which should eliminate the need for eth Once that refactoring s in, our display heirarchy should be significantly simplified. |
I see two issues that I think should be addressed when refactoring these classes.
|
|
0734e45
into
develop
- Switches to using `CTermShow` for controlling node printing: runtimeverification/k#4808 --------- Co-authored-by: devops <[email protected]> Co-authored-by: Freeman <[email protected]> Co-authored-by: Everett Hildenbrandt <[email protected]>
- Includes update to how to build an `APRProofShow` so that it doesn't need a `KPrint` anymore, just a `KDefinition`. runtimeverification/k#4808 --------- Co-authored-by: devops <[email protected]> Co-authored-by: Everett Hildenbrandt <[email protected]>
These are some improvements to printing that we can implement now that we have merged changes upstream runtimeverification/k#4808. - Improves the printing of spans in the TUI viewer to actually print the file name and line that it's referring to. - Passes the entire `DisplayOpts` to the `KMIRAPRNodePrinter`, because why not? - Omits printing the `<currentBody>` cell by default in TUI and shower, but enables turning it back on with `--no-omit-current-body` option to both. - Saves off the `SMIRInfo` in the `proof_dir` when we have it available in `prove-rs`, so that it can be used for printing sourcemap information in the show/view commands (like current function name and span). --------- Co-authored-by: devops <[email protected]> Co-authored-by: Jost Berthold <[email protected]>
Update `kframework` to `7.1.257`. * Includes update according to runtimeverification/k#4808 --------- Co-authored-by: devops <[email protected]> Co-authored-by: Tamás Tóth <[email protected]>
Update `kriscv` to version `0.1.82`. * Includes update according to runtimeverification/k#4808 --------- Co-authored-by: devops <[email protected]> Co-authored-by: Tamás Tóth <[email protected]>
Blocked on: #4819This is a refactoring to how our display of nodes/KCFGs works, ideally to make it easier to thread options through to them. We're specifically trying to capture all the common options for how
CTerm
should be displayed in one place, and remove those options from other places. This came about as I was trying to implement some asks from the KMIR team on changing the display in the TUI viewer, and realized that currently all the options are threaded through in different ways and controlled at different points.This is a breaking change in pyk API, and so corresponding changes into downstream repos will need to be added to the update-deps PRs.
Another big change that happens here: the
kcfg
directory no longer needs aKPrint
because we use akast.pretty.PrettyPrinter
directly instead. Before, it was usingKPrint.pretty_print
, which was just constructing aPrettyPrinter
then using it. So we skip the intermediate class. That means that several classes which took in aKPrint
now just take in aKDefinition
.Changes in particular:
CTermShow
is introduced, which enables printing outCTerm
using aPrettyPrinter
, viaCTermShow.show_config
,CTermShow.show_constraints
andCTermShow.show
. It takes several options controlling how printing can occur, including:extra_unparsing_modules
,patch_symbol_table
,unalias
, andsort_ac_collections
: all the same asPrettyPrinter
.minimize
: collapse unused cell-variables into...
, and the recursively collapse the...
as much as possible in the configuration.break_cell_collections
: enable line-breaking collections (List
,Set
,Map
) which are stored directly in cells, as usually you want one item printer per line in this case.omit_labels
: a set of labels to always replace occurrences of with...
, so they do not get printed.NodePrinter
(andAPRProofNodePrinter
) now take aCTermShow
instead of aKPrint
, which also means they don't take the options controlling printing directly (likeminimize
). These options must be set when building tehCTermShow
that is passed in for theNodePrinter
to use.KCFGShow
(andAPRProofShow
) now take aKDefinition
instead of aKPrint
and build aPrettyPrinter
directly. This means that theNodePrinter
(and thusCTermShow
) is responsible for setting options related to node printing likesort_collections
ahead of time.KCFGViewer
(andAPRProofViewer
) are now taking directly aKDefinition
instead of aKPrint
, and similar to the*Show
counterparts offloading decisions about how to print items to how theCTermShow
is setup in the client application.CTermShow
ahead of time and passing it in), which provides an example of what's needed downstream. In particular, before we were mocking an entireKPrint
in the unit tests, but now we only need to mock aCTermShow
, which is much more compact. We rename the file frommock_kprint.py
tomock.py
, so it can be for all mocks.