Age | Commit message (Collapse) | Author |
|
(https://github.com/ruby/irb/pull/576)
* Simplify each_top_level_statement, reduce instance vars
* Update lib/irb/ruby-lex.rb
Co-authored-by: Stan Lo <[email protected]>
* Remove unused ltype from TestRubyLex#check_state response
* Remove unnecessary const path of TerminateLineInput
* Combine duplicated code state check into method
---------
https://github.com/ruby/irb/commit/172453cec4
Co-authored-by: Stan Lo <[email protected]>
|
|
(https://github.com/ruby/irb/pull/583)
1. Make `RubyLex#set_input` simply assign the input block. This matches
the behavior of `RubyLex#set_prompt`.
2. Merge `RubyLex#set_input`'s IO configuration logic with `#set_auto_indent`
into `#configure_io`.
|
|
(https://github.com/ruby/irb/pull/555)
* Remove all Ruby 2.6 support
* Drop Ruby 2.6 specific testing conditions
* Only run Ruby 2.7+ on CI
* Bump Ruby requirement to 2.7+
https://github.com/ruby/irb/commit/3f714b616c
|
|
Some background for this refactor:
1. Through a RubyLex instance's lifetime, the context passed to its methods
should be the same.
Given that `Context` is only initialised in `Irb#initialize`,
this should be true.
2. When `RubyLex` is initialised, the context object should be accessible.
This is also true in all 3 of `RubyLex.new`'s invocations.
With the above observations, we should be able to store the context in `RubyLex`
as an instance variable. And doing so will make `RubyLex`'s instance methods
easier to use and maintain.
https://github.com/ruby/irb/commit/5c8d3df2df
|
|
methods
(https://github.com/ruby/irb/pull/502)
* Remove unnecessary parameter defaults
These methods are always called with tokens specified. So their default
`@tokens` value is never used and is misleading.
* Remove unnecessary context default
* Require tokens for `RubyLex#check_state`
|
|
https://github.com/ruby/irb/commit/cef125850d
|
|
https://github.com/ruby/irb/commit/07fae94862
|
|
(https://github.com/ruby/irb/pull/504)
* Simplify `RubyLex#set_prompt`
It's optional argument is never used by any caller.
* Remove the optional `p` argument from `RubyLex#set_input`
The argument is only used in a test case, which can be easily replaced by
a block argument.
|
|
(https://github.com/ruby/irb/pull/386)
* fix prompt and code mismatch
* Add test for prompt and code mismatch bug
https://github.com/ruby/irb/commit/a5765d8177
Co-authored-by: Stan Lo <[email protected]>
|
|
(https://github.com/ruby/irb/pull/350)
Simplify part of regex ``[_a-zA-Z0-9]`` with equivalent shorthand ``\w``.
Replace case-when with match ``$1`` or default value ``?"``, making intention more clear.
|
|
https://github.com/ruby/irb/commit/b7973dd2d2
|
|
https://github.com/ruby/irb/commit/f65ec49684
|
|
(https://github.com/ruby/irb/pull/449)
* Seamlessly integrate a few debug commands
* Improve the break command support
* Utilize skip_src option if available
* Add step and delete commands
* Write end-to-end tests for each debugger command
* Add documentation
* Add backtrace, info, catch commands
https://github.com/ruby/irb/commit/976100c1c2
|
|
(https://github.com/ruby/irb/pull/426)
* Allow non-identifier aliases
* Move the configuration to IRB.conf
* Avoid abusing method lookup for symbol aliases
* Add more alias tests
* A small optimization
* Assume non-nil Context
* Load IRB.conf earlier
https://github.com/ruby/irb/commit/e23db5132e
|
|
(https://github.com/ruby/irb/pull/427)
* Make sure `RubyLex#set_input`'s context is always present in tests
In real-world scenarios, the context should always be non-nil:
https://github.com/ruby/irb/blob/master/lib/irb.rb#L489
So we should make sure our test setup reflects that.
* Make context a required keyword
Since in practice, `set_input`'s context should always be non-nil, its
parameters should reflect that.
And since `RubyLex#check_state` is only called by `#lex` and
`#set_input`, both of which now always require context, we can assume
its context should be non-nil too.
https://github.com/ruby/irb/commit/1aeeb86203
|
|
(https://github.com/ruby/irb/pull/397)
* Use local_variables for colorize, code_block_open check, nesting_level and assignment_expression check
* Check if expression is an assignment BEFORE evaluating it. evaluate might define new localvars and change result of assignment_expression?
* Add local_variables dependent code test
* pend local variable dependent test on truffleruby
code_block_open is not working on truffleruby
* Always pass context to RubyLex#lex
* Rename local_variable_assign_code generator method name
* Add assignment expression truncate test
* Add Context#local_variables and make generate_local_variables_assign_code more simple
* Update lib/irb/input-method.rb
Co-authored-by: Stan Lo <[email protected]>
* Add a comment why assignment expression check should be done before evaluate
https://github.com/ruby/irb/commit/c8b3877281
Co-authored-by: Stan Lo <[email protected]>
Co-authored-by: Takashi Kokubun <[email protected]>
|
|
(https://github.com/ruby/irb/pull/390)
* Fix backtick method def method call handled as backtick open
* Fix handling heredoc in check_string_literal
* Sort result of lexer.parse by pos in ruby<2.7. It's not sorted when the given code includes heredoc.
* Update lib/irb/ruby-lex.rb
Co-authored-by: Stan Lo <[email protected]>
* Update lib/irb/ruby-lex.rb
Co-authored-by: Stan Lo <[email protected]>
* Add check_string_literal test for heredoc code that does not end with newline
https://github.com/ruby/irb/commit/44bc712460
Co-authored-by: Stan Lo <[email protected]>
|
|
They were added in https://github.com/ruby/irb/commit/b34f26a0dd3b589e6fc321a6248d173682c9202f
https://github.com/ruby/irb/commit/0e760d2674
|
|
https://github.com/ruby/irb/commit/daffb8bfe5
|
|
https://github.com/ruby/irb/commit/0db0a8ddc5
|
|
https://github.com/ruby/irb/commit/45b539af39
|
|
Changed to use `#pos` `#event` `#tok` `#state` since using Lexer::Elem#[0~4] now gives a warning.
see: https://github.com/ruby/ruby/commit/8944009be7418614ce7d4077807ac2b60d4d5d85
https://github.com/ruby/reline/commit/9adbb9af32
|
|
Use in_keyword_case_scope?
Return fast
https://github.com/ruby/irb/commit/8acc7f8dc7
|
|
Fix bug infinite loop when pasting multilines fo code in Ruby 2.6.
This is not reproduced in Ruby 2.7.
Changes added in https://github.com/ruby/irb/pull/242/files#diff-612b926e42ed78aed1a889ac1944f7d22229b3a489cc08f837a7f75eca3d3399R155 are also reflected in Ruby 2.6.
https://github.com/ruby/irb/commit/0a77f75bf0
|
|
Instead of accessing the struct as an array, access it via methods. There are other places inside of this file already using this API (for example https://github.com/ruby/ruby/blob/e0a5c3d2b71dfad038d7562fdd33f02ffd79232d/lib/irb/ruby-lex.rb#L829-L830).
This commit moves all struct array-ish calls to use their method calls instead. It is also ~1.23 faster accessing values via a method instead of as an array according to this microbenchmark:
```ruby
Elem = Struct.new(:pos, :event, :tok, :state, :message) do
def initialize(pos, event, tok, state, message = nil)
super(pos, event, tok, State.new(state), message)
end
# ...
def to_a
a = super
a.pop unless a.empty?
a
end
end
class ElemClass
attr_accessor :pos, :event, :tok, :state, :message
def initialize(pos, event, tok, state, message = nil)
@pos = pos
@event = event
@tok = tok
@state = State.new(state)
@message = message
end
def to_a
if @message
[@pos, @event, @tok, @state, @message]
else
[@pos, @event, @tok, @state]
end
end
end
# stub state class creation for now
class State; def initialize(val); end; end
```
```ruby
Benchmark.ips do |x|
x.report("struct") { struct[1] }
x.report("class ") { from_class.event }
x.compare!
end; nil
```
```
Warming up --------------------------------------
struct 1.624M i/100ms
class 1.958M i/100ms
Calculating -------------------------------------
struct 17.139M (± 2.6%) i/s - 86.077M in 5.025801s
class 21.104M (± 3.4%) i/s - 105.709M in 5.015193s
Comparison:
class : 21103826.3 i/s
struct: 17139201.5 i/s - 1.23x (± 0.00) slower
```
Notes:
Merged: https://github.com/ruby/ruby/pull/5093
|
|
From Reidline to Reline
Update description used in take_corresponding_syntax_to_kw_do and is_the_in_correspond_to_a_for methods
Use possessive noun correctly
Second element
https://github.com/ruby/irb/commit/4fa9714d6f
|
|
Use first method instead of square brackets to support 2.5 and 2.6 versions
Use tokens
Clear check_newline_depth_difference
https://github.com/ruby/irb/commit/6fec2a5d46
|
|
https://github.com/ruby/irb/commit/0aa2425883
|
|
Support int that follow on symbeg in IRB
https://github.com/ruby/irb/commit/90cb27b1bd
|
|
This fixes at least an issue where irb will incorrectly assume
code opens a heredoc when it does not, such as this code:
```ruby
s1 = 'testing'
s2 = 'this'
s2 <<s1
p s1
s1
```
Ruby parses the `s2 <<s1` as `s2.<<(s1)`, not as a heredoc, because
`s2` is a local variable in scope. irb was using ripper without
letting ripper know that `s2` was a local variable, so ripper would
lex it as a heredoc instead of a method call.
Fix the situation by prepending a line at line 0 with all local
variable definitions in scope whenever lexing. This fixes the
heredoc issue, and potentially other issues that depend on whether
an identifier is a local variable or not.
Fixes [Bug #17530]
https://github.com/ruby/irb/commit/4ed2187f76
|
|
https://github.com/ruby/irb/commit/783a0569e8
|
|
https://github.com/ruby/irb/commit/bc1b1d8bc3
|
|
https://github.com/ruby/irb/commit/d9f8abc17e
|
|
Fixes [Bug #14824]
https://github.com/ruby/irb/commit/63414f8465
|
|
https://github.com/ruby/irb/commit/7aed8fe3b1
|
|
* using the appropriciate exception instead of `break` so that the session
can be continue after the `irb_source` and `irb_load` commands
* suppress extra new line due to one more `#prompt` call
https://github.com/ruby/irb/commit/bdefaa7cfd
|
|
https://github.com/ruby/irb/commit/e7c68e74a0
|
|
https://github.com/ruby/irb/commit/47c83ea724
|
|
https://github.com/ruby/irb/commit/fc3e1d9e0c
|
|
https://github.com/ruby/irb/commit/cef474a76a
|
|
For example, the broken code "%www" will result in only one error token.
https://github.com/ruby/irb/commit/9fa39a7cf3
|
|
ref. https://github.com/ruby/reline/pull/242
https://github.com/ruby/irb/commit/54f90cb6c9
|
|
Use the start token as the indentation criteria so that it works properly in
heredoc.
ref. https://github.com/ruby/reline/pull/242
https://github.com/ruby/irb/commit/9704808dfd
|
|
This fixes ruby/irb#158.
https://github.com/ruby/irb/commit/964643400b
|
|
This closes ruby/irb#132.
https://github.com/ruby/irb/commit/43456dcf5e
|
|
https://github.com/ruby/irb/commit/8b83fbef69
|
|
Co-authored-by: manga_osyo <[email protected]>
Co-authored-by: ima1zumi <[email protected]>
https://github.com/ruby/irb/commit/c59a9be82f
https://github.com/ruby/reline/commit/a7922da16b
|
|
https://github.com/ruby/irb/commit/26fd1a75cf
|
|
https://github.com/ruby/irb/commit/f3c8edad2a
|
|
https://github.com/ruby/irb/commit/babb122a48
https://github.com/ruby/reline/commit/e6dbcb3b42
|