Skip to content

v1.0.0

Choose a tag to compare

@pt-main pt-main released this 17 Jun 17:43
· 25 commits to main since this release
652cbd8

Added

  • Context support
    Added ProcessStringWithCtx and ProcessBytesWithCtx methods, and WithContext builder option. The event loops now check ctx.Done() to support cancellation (timeouts, HTTP request termination, etc.).

  • Generic command handlers
    Command signature changed from func([]interface{}) error to core.CommandType[E, N any] func(*E, N) error. Handlers now receive concrete engine and node types, eliminating type assertions and improving safety and readability.

  • Automatic bytecode index shift
    NewCommandByte now accepts autoBytecodeIdxShift flag. When true, the engine automatically increments the instruction pointer after command execution. This simplifies linear instructions while keeping full control for jumps.

  • Colored output for errors and logs
    Integrated tap/color – all error messages and logs are now color‑coded. Color can be enabled globally via WithColors() in the builder.

  • Initial unit tests
    Added tests for Generator, byte Parser1, and Lexer. More coverage will follow in future releases.

  • Comprehensive documentation
    README fully rewritten with quick‑start examples for both engine types, API reference, production usage tips, and reserved scope keys.

  • Context‑aware processing
    ProcessStringWithCtx and ProcessBytesWithCtx allow explicit context passing.

Changed

  • Event system refactored
    All event handlers now accept *core.Events as a second argument, giving access to scope and context directly inside the handler.

  • EngineUniversal simplified
    Opcode counter moved to a plain opcode_counter field instead of the nested another struct.

  • Error reporting improved
    Errors now include command number, bytecode index, and original source line with color formatting for quick debugging.

  • Thread safety
    Added mutexes to ByteEngine and StringEngine to ensure correct behaviour under concurrent access (command registration + execution).

Fixed

  • Fixed negative index handling in Shifter (now correctly bounds‑checked).
  • Fixed panic when command handler missing – now returns a clear error.
  • Fixed data races in scope access (mutexes added in generator and logger).

Removed

  • Removed deprecated engine.Converts – no longer needed due to generics.
  • Removed unused type conversion utilities.