File code/Commands.php

class Tlf\Lexer\Commands

Version 2 attempt at making an easily extensible command system
See source code at /code/Commands.php

Constants

Properties

Methods

  • public function __construct(protected \Tlf\Lexer $lexer)

  • public function can_run(string $command_name): bool

  • public function run(string $command, array $args, object $directive, string $isn, array $directiveList) Execute a simple command thats defined inside our switch/case

  • public function run_stack_move_to_front(string $command, array $args, object $directive, string $isn, array $directiveList) Move the current directive to the start of the named stack. This directive must already be in the named stack.

  • public function run_previous_obj_set(string $command, array $args, object $directive, string $isn, array $directiveList) Get the previous 'key', which MUST be an object, and set object->property = value on that object.

  • public function run_previous_ast_push(string $command, array $args, object $directive, string $isn, array $directiveList) Get the previous 'key', which MUST be an an AST object, and append value to the named array property. i.e. object->property[] = value on that object.

  • public function run_buffer_trim(string $command, array $args, object $directive, string $isn, array $directiveList) Trim whitespace from around the buffer. Does not modify the token state, except for the actual buffer.