| Age | Commit message (Collapse) | Author |
|
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 <manga.osyo@gmail.com>
Co-authored-by: ima1zumi <mariimaizumi5@gmail.com>
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
|
|
https://github.com/ruby/irb/commit/ce373417f3
|
|
* Fixes #38
https://github.com/ruby/irb/commit/905fb8e52e
|
|
implementation-private APIs
* Fixes https://github.com/ruby/irb/issues/133
https://github.com/ruby/irb/commit/5eb3ef3293
|
|
https://github.com/ruby/irb/commit/2ff1295533
|
|
https://github.com/ruby/irb/commit/f1a775af47
|
|
https://github.com/ruby/irb/commit/8e3f81d428
|
|
https://github.com/ruby/irb/commit/826ae909c9
|
|
|
|
https://github.com/ruby/irb/commit/6de1341f5e
|
|
nobu-san reviewed,
https://github.com/ruby/irb/pull/106#pullrequestreview-423400033
> How about lexer = Ripper::Lexer.new(";\n#{code}", nil, 0)?
> Encoding pragma is effective only at the beginning.
> And the semicolon and newline will be skipped because the position is before
> the initial pos.
I employ the way.
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
https://github.com/ruby/irb/commit/e593cc65b7
|
|
https://github.com/ruby/irb/commit/443e90af80
|
|
https://github.com/ruby/irb/commit/6a457edbd1
|
|
https://github.com/ruby/irb/commit/dc59afe4f6
|
|
https://github.com/ruby/irb/commit/13572d8cdc
|
|
A closed brace in auto-indent shouldn't affect the next brace in the same line,
but it behaves like below:
p() {
}
It's a bug.
https://github.com/ruby/irb/commit/fbe59e344f
|
|
https://github.com/ruby/irb/issues/55
If we had put multiple open braces on a line the with no closing brace
spaces_of_nest array keeps getting '0' added to it. This means that when
we pop off of this array we are saying that we should be in position zero
for the next line. This is an issue because we don't always want to be
in position 0 after a closing brace.
Example:
```
[[[
]
]
]
```
In the above example the 'spaces_of_nest' array looks like this after
the first line is entered: [0,0,0]. We really want to be indented 4
spaces for the 1st closing brace 2 for the 2nd and 0 for the 3rd. i.e.
we want it to be: [0,2,4].
We also saw this issue with a heredoc inside of an array.
```
[<<FOO]
hello
FOO
```
https://github.com/ruby/irb/commit/80c69c8272
|
|
This commit fixes the check_newline_depth_difference method to multiple
open braces on one line into account. Before this change we were
subtracting from the depth in check_newline_depth_difference on
every open brace. This is the right thing to do if the opening and
closing brace are on the same line. For example in a method definition we
have an opening and closing parentheses we want to add 1 to our depth,
and then remove it.
```
def foo()
end
```
However this isn't the correct behavior when the brace spans multiple
lines. If a brace spans multiple lines we don't want to subtract from
check_newline_depth_difference and we want to treat the braces the same
way as we do `end` and allow check_corresponding_token_depth to pop the
correct depth.
Example of bad behavior:
```
def foo()
[
]
puts 'bar'
end
```
Example of desired behavior:
```
def foo()
[
]
puts 'bar'
end
```
https://github.com/ruby/irb/commit/7dc8af01e0
|
|
Follow up of the previous commit
https://github.com/ruby/irb/commit/ab207353d3
|
|
Fixes #47
https://github.com/ruby/irb/commit/6b8eca4635
|
|
|
|
This reverts commit 5e275dd2af4d9d24cdb1cfc0f232f348dae9c2cd.
...The @1 type numberd parameter is reverted from Ruby syntax.
|
|
|