Skip to content
Snippets Groups Projects
Commit d25f0e2b authored by dgelessus's avatar dgelessus
Browse files

Fix dollars not being quoted in :trace output

parent bab1f6ae
No related branches found
No related tags found
No related merge requests found
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` prob ``` prob
:help :trace :help :trace
``` ```
%% Output %% Output
``` ```
:trace :trace
``` ```
Display all states and transitions in the current trace. Display all states and transitions in the current trace.
Each state has an index, which can be passed to the `:goto` command to go to that state. Each state has an index, which can be passed to the `:goto` command to go to that state.
The first state (index -1) is always the root state. All other states are reached from the root state by following (previously executed) transitions. The first state (index -1) is always the root state. All other states are reached from the root state by following (previously executed) transitions.
:trace :trace
Display all states and transitions in the current trace. Display all states and transitions in the current trace.
Each state has an index, which can be passed to the `:goto` command to go to that state. Each state has an index, which can be passed to the `:goto` command to go to that state.
The first state (index -1) is always the root state. All other states are reached from the root state by following (previously executed) transitions. The first state (index -1) is always the root state. All other states are reached from the root state by following (previously executed) transitions.
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` prob ``` prob
:help :goto :help :goto
``` ```
%% Output %% Output
``` ```
:goto INDEX :goto INDEX
``` ```
Go to the state with the specified index in the current trace. Go to the state with the specified index in the current trace.
Use the `:trace` command to view the current trace and the indices of its states. Index -1 refers to the root state and is always available. Use the `:trace` command to view the current trace and the indices of its states. Index -1 refers to the root state and is always available.
Going backwards in the current trace does *not* discard any parts of the trace, so it is possible to go forward again afterwards. However, executing an operation in a state *will* discard any parts of the trace after that state (and replace them with the destination state of the executed transition). Going backwards in the current trace does *not* discard any parts of the trace, so it is possible to go forward again afterwards. However, executing an operation in a state *will* discard any parts of the trace after that state (and replace them with the destination state of the executed transition).
:goto INDEX :goto INDEX
Go to the state with the specified index in the current trace. Go to the state with the specified index in the current trace.
Use the `:trace` command to view the current trace and the indices of its states. Index -1 refers to the root state and is always available. Use the `:trace` command to view the current trace and the indices of its states. Index -1 refers to the root state and is always available.
Going backwards in the current trace does *not* discard any parts of the trace, so it is possible to go forward again afterwards. However, executing an operation in a state *will* discard any parts of the trace after that state (and replace them with the destination state of the executed transition). Going backwards in the current trace does *not* discard any parts of the trace, so it is possible to go forward again afterwards. However, executing an operation in a state *will* discard any parts of the trace after that state (and replace them with the destination state of the executed transition).
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` prob ``` prob
:trace :trace
``` ```
%% Output %% Output
* -1: Root state **(current)** * -1: Root state **(current)**
-1: Root state (current) -1: Root state (current)
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` prob ``` prob
:init :init
``` ```
%% Output %% Output
Machine initialised using operation 0: $initialise_machine() Machine initialised using operation 0: $initialise_machine()
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` prob ``` prob
:trace :trace
``` ```
%% Output %% Output
* -1: Root state * -1: Root state
* 0: $initialise_machine **(current)** * 0: `$initialise_machine` **(current)**
-1: Root state -1: Root state
0: $initialise_machine (current) 0: $initialise_machine (current)
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` prob ``` prob
:goto -1 :goto -1
``` ```
%% Output %% Output
Changed to state with index -1 Changed to state with index -1
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` prob ``` prob
:trace :trace
``` ```
%% Output %% Output
* -1: Root state **(current)** * -1: Root state **(current)**
* 0: $initialise_machine * 0: `$initialise_machine`
-1: Root state (current) -1: Root state (current)
0: $initialise_machine 0: $initialise_machine
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Indices out of bounds are not accepted. Indices out of bounds are not accepted.
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` prob ``` prob
:goto -2 :goto -2
``` ```
%% Output %% Output
:goto: Invalid trace index -2, must be in -1..0 :goto: Invalid trace index -2, must be in -1..0
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` prob ``` prob
:goto 1 :goto 1
``` ```
%% Output %% Output
:goto: Invalid trace index 1, must be in -1..0 :goto: Invalid trace index 1, must be in -1..0
......
...@@ -65,8 +65,9 @@ public final class TraceCommand implements Command { ...@@ -65,8 +65,9 @@ public final class TraceCommand implements Command {
sbPlain.append(transition); sbPlain.append(transition);
sbMarkdown.append("\n* "); sbMarkdown.append("\n* ");
sbMarkdown.append(i); sbMarkdown.append(i);
sbMarkdown.append(": "); sbMarkdown.append(": `");
sbMarkdown.append(transition); sbMarkdown.append(transition);
sbMarkdown.append('`');
if (trace.getCurrent().getIndex() == i) { if (trace.getCurrent().getIndex() == i) {
sbPlain.append(" (current)"); sbPlain.append(" (current)");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment