From 551613765c9e60e2221ac920d2756b949e68f373 Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Fri, 12 May 2023 11:37:44 +0100 Subject: Move reading and writing of tokens into a separate package to prepare for other input and output formats --- main/command.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'main/command.go') diff --git a/main/command.go b/main/command.go index 63cc3b8..ef48596 100644 --- a/main/command.go +++ b/main/command.go @@ -13,12 +13,13 @@ type Command interface { type PrintValueCommand struct {} func (cmd PrintValueCommand) exec(state *ProgramState) { - pathValues, err := walk.Compound(state.path) + err := state.out.Write(walk.WalkItem { + Path: state.path, + Value: state.value, + }) if err != nil { - panic("Tried to convert invalid atoms to values") + panic("Error while outputting") } - path := walk.PathFromWalkValues(pathValues) - state.out.Print(path, state.value) state.pc++ } func (cmd PrintValueCommand) String() string { -- cgit v1.2.3