[pull] master from mruby:master#156
Merged
pull[bot] merged 42 commits intosysfce2:masterfrom Dec 11, 2025
Merged
Conversation
add minimal line number decoration to prompts to help track position within multi-line code blocks. format is 'N>' for initial line and 'N*' for continuation lines. line counter resets after each complete evaluation for clarity and minimal visual noise. example: 1> def foo 2* x = 1 3* end => :foo 1> 1 + 1 => 2 Co-authored-by: Claude <noreply@anthropic.com>
syntax errors now show:
- line:column format with relative line numbers (matching prompt)
- source line from user input
- caret indicator pointing to error position
example:
1> x = @@@
line 1:6: syntax error, unexpected invalid token
x = @@@
^
multi-line example:
1> class Foo
2* def bar
3* x = @@@
line 3:6: syntax error, unexpected invalid token
x = @@@
^
Co-authored-by: Claude <noreply@anthropic.com>
runtime errors now distinguish between: - errors in current input: show relative line number - errors from previously defined methods: show method context examples: 1> a.foo line 1: undefined method 'a' for Object (NoMethodError) 1> def foo 2* bar 3* end 1> foo (mirb):in foo: undefined method 'bar' for Object (NoMethodError) this provides better context since method name is more useful than line number for errors in previously defined code Co-authored-by: Claude <noreply@anthropic.com>
…election addresses #6626 where users building portable binaries need explicit control over readline detection instead of auto-detection. MRUBY_MIRB_READLINE values: auto (default) - auto-detect: try readline, then edit, then linenoise readline, gnu - force GNU readline only edit, libedit - force libedit only linenoise - force linenoise only none, off, false, disabled - use plain input mode (no readline) close #6626 Co-authored-by: Claude <noreply@anthropic.com>
implements context-aware tab completion for mirb supporting all readline variants (GNU readline, libedit, linenoise) with graceful degradation when no readline library is available. completion features: - method names on objects (e.g., "hello".re<Tab> completes to reverse, replace) - local variables from compiler context - global variables via Ruby introspection - constants and class names - Ruby keywords architecture: - core completion engine is library-agnostic - thin adapters for readline/libedit and linenoise - context detection based on cursor position analysis - safe receiver evaluation with exception handling - proper word break characters so "String.new" works correctly implementation adds: - mirb_completion.h: interface definitions and data structures - mirb_completion.c: complete implementation (~670 lines) - mirb.c: integration with setup/cleanup calls Co-authored-by: Claude <noreply@anthropic.com>
fixed a bug where tab completion on complex expressions like "d.new(1).a" would corrupt local variables, causing them to become nil. the root cause was that evaluating complex receiver expressions during tab completion ran mrb_vm_run() without proper stack management (stack_keep) and environment adjustment that mirb's main REPL loop performs. this corrupted the local variable storage. the fix restricts tab completion to only evaluate simple receiver expressions (variable/constant names without operators or method calls). complex expressions are skipped for completion. this means: - works: d.<tab> completes methods of variable d - works: String.<tab> completes methods of constant String - skipped: d.new(1).<tab> provides no completion this is a reasonable trade-off that prevents the corruption bug while still supporting the most common completion scenarios. also updated mirb_eval_receiver() to use the compiler context for proper local variable resolution, with argument order matching mrb_parse_string. Co-authored-by: Claude <noreply@anthropic.com>
added parentheses to all `to_enum` and `super` calls where the return value is used (returned, assigned, or passed to another method). this makes the code style consistent with the guideline that method calls should use parentheses when their return values are consumed. changes: - return to_enum :symbol -> return to_enum(:symbol) - return to_enum :symbol, arg -> return to_enum(:symbol, arg) - super message, name -> super(message, name) affected files: 10error.rb, array.rb, enum.rb, hash.rb, kernel.rb, numeric.rb, range.rb Co-authored-by: Claude <noreply@anthropic.com>
added parentheses to all to_enum calls where the return value is used. Co-authored-by: Claude <noreply@anthropic.com>
added parentheses to to_enum call where the return value is used, explicitly specifying :each for readability. Co-authored-by: Claude <noreply@anthropic.com>
added parentheses to all to_enum calls where the return value is used. Co-authored-by: Claude <noreply@anthropic.com>
added parentheses to all to_enum calls where the return value is used. Co-authored-by: Claude <noreply@anthropic.com>
added parentheses to all to_enum calls where the return value is used. Co-authored-by: Claude <noreply@anthropic.com>
added parentheses to to_enum call where the return value is used, explicitly specifying :each for readability. Co-authored-by: Claude <noreply@anthropic.com>
added parentheses to to_enum call where the return value is used. Co-authored-by: Claude <noreply@anthropic.com>
added parentheses to all to_enum calls where the return value is used. Co-authored-by: Claude <noreply@anthropic.com>
added parentheses to to_enum call where the return value is used. Co-authored-by: Claude <noreply@anthropic.com>
added parentheses to block.call where the return value is used. Co-authored-by: Claude <noreply@anthropic.com>
added parentheses to block.call calls where the return value is used. Co-authored-by: Claude <noreply@anthropic.com>
added parentheses to block.call where the return value is used. Co-authored-by: Claude <noreply@anthropic.com>
added parentheses to block.call where the return value is used. Co-authored-by: Claude <noreply@anthropic.com>
added parentheses to Math.hypot and Math.atan2 calls where the return value is used. Co-authored-by: Claude <noreply@anthropic.com>
added parentheses to respond_to? call where the return value is used. Co-authored-by: Claude <noreply@anthropic.com>
changed block spacing from {|param| to {|param| (space before brace)
for consistency with the most common pattern in the codebase.
Co-authored-by: Claude <noreply@anthropic.com>
changed block spacing from { |param| to {|param| for consistency.
Co-authored-by: Claude <noreply@anthropic.com>
changed block spacing from method{ to method { for consistency.
Co-authored-by: Claude <noreply@anthropic.com>
changed block spacing from method{ to method { for consistency.
Co-authored-by: Claude <noreply@anthropic.com>
changed block spacing from method{ to method { for consistency.
Co-authored-by: Claude <noreply@anthropic.com>
changed block spacing from method{ to method { for consistency.
Co-authored-by: Claude <noreply@anthropic.com>
changed block spacing from method{ to method { for consistency.
Co-authored-by: Claude <noreply@anthropic.com>
changed block spacing from { | to {| for consistency.
Co-authored-by: Claude <noreply@anthropic.com>
changed block spacing from { | to {| for consistency.
Co-authored-by: Claude <noreply@anthropic.com>
changed block spacing from { | to {| for consistency.
Co-authored-by: Claude <noreply@anthropic.com>
changed block spacing from method{ to method { for consistency.
Co-authored-by: Claude <noreply@anthropic.com>
changed block spacing from { | to {| for consistency.
Co-authored-by: Claude <noreply@anthropic.com>
changed block spacing from { | to {| for consistency.
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
- mruby-bin-config - mruby-bin-debugger - mruby-bin-mrbc - mruby-bin-mruby - mruby-bin-strip Co-authored-by: Claude <noreply@anthropic.com>
- automatically indent continuation lines based on block depth - detect block-opening keywords (def, class, if, do, etc.) and braces - use ANSI escape sequences to fix indentation for: - block-closing keywords (end, }) - mid-block keywords (else, elsif, rescue, ensure, when) - only active for interactive TTY input with ANSI support - requires GNU readline (not available with linenoise) Co-authored-by: Claude <noreply@anthropic.com>
Add ANSI color support to mirb for better visual distinction:
- green prompts (both ready '>' and continuation '*')
- red error messages (syntax errors, runtime errors, warnings)
- bold result indicator ('=>')
Colors are automatically disabled when:
- output is not a TTY
- TERM is unset or "dumb"
- NO_COLOR environment variable is set
Co-authored-by: Claude <noreply@anthropic.com>
Remove readline/linenoise dependency and implement custom multi-line editor with: - Terminal raw mode handling (POSIX termios) - Multi-line buffer with cursor navigation - Auto-indentation for Ruby blocks - Auto-dedentation when typing 'end' or '}' - Natural terminal scrolling behavior - Emacs-style keybindings (Ctrl+A/E/K/U/W/Y, Alt+B/F/D) This eliminates GPL licensing concerns from readline while providing better multi-line editing than the previous single-line implementation. The MRUBY_MIRB_READLINE environment variable is no longer supported as readline integration has been completely removed; ref #6626 Co-authored-by: Claude <noreply@anthropic.com>
…6671 Headers in mrbgems are now categorized into three types: - src/*.h: gem internal only - include/*.h: inter-gem use (visible to dependent gems) - include/export/*.h: external API (exported via mruby-config --cflags) This prevents internal headers like *_hal.h from being exposed to external users while maintaining inter-gem header accessibility. Co-authored-by: Claude <noreply@anthropic.com>
Simplify the header path to be consistent with mruby/time.h. The ext/ subdirectory was unnecessary. Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )