diff options
Diffstat (limited to 'js/puzzle-dungeon/parser.js')
-rw-r--r-- | js/puzzle-dungeon/parser.js | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/js/puzzle-dungeon/parser.js b/js/puzzle-dungeon/parser.js index ec7f33f..f962677 100644 --- a/js/puzzle-dungeon/parser.js +++ b/js/puzzle-dungeon/parser.js @@ -1,10 +1,9 @@ -export function parseCommands(input) { - const commands = input.split('\n').map(cmd => cmd.trim()).filter(cmd => cmd.length > 0); - return commands.map(command => { - const parts = command.split(' '); - return { - command: parts[0], - args: parts.slice(1) - }; +// parser.js +import { handleCommand } from './commandHandler.js'; + +export function parseCommands(commands) { + const commandList = commands.trim().split('\n'); + commandList.forEach(command => { + handleCommand(command.trim()); }); } |