Closed bendisposto closed 11 months ago
The parser supports label pragmas (see attached model). ProB UI does not show these labels and the API does not provide a "nice" way to access the labels.
I think this code will fetch the assertion label, but is obviously very ugly:
StateSpace stateSpace = api.b_load("WP.mch"); ModelElementList<Assertion> assertions = ((ClassicalBMachine) stateSpace.getMainComponent()).getAssertions(); Assertion assertion = assertions.get(0); assertion.getPredicate().getAst().getPParseUnit(); if (pParseUnit instanceof APredicateParseUnit) { PPredicate predicate = ((APredicateParseUnit) pParseUnit).getPredicate(); if (predicate instanceof ALabelPredicate) { System.out.println(((ALabelPredicate) predicate).getName()); } }
WP.mch.zip
It would be nice to have a method e.g. getLabel in Assertion, Invariant, ... and be able to see them in the UI
getLabel
step 1: https://github.com/hhu-stups/prob2_kernel/commit/ee22384124d3ed3edfe7b53200170477c58085c0
step 2: https://github.com/hhu-stups/prob2_ui/commit/23a682c1edea4ee57a7a187a1477b5a0233573e4
NB: ProB2 UI has shown the labels in state view tooltips since November 2020
The parser supports label pragmas (see attached model). ProB UI does not show these labels and the API does not provide a "nice" way to access the labels.
I think this code will fetch the assertion label, but is obviously very ugly:
WP.mch.zip
It would be nice to have a method e.g.
getLabel
in Assertion, Invariant, ... and be able to see them in the UI