Charles Oliver Nutter
2b6848af0e
[ruby/irb] Require jruby lib to get JRuby.compile_ir
...
dc59afe4f6
2020-03-29 04:44:53 +09:00
aycabta
22477128cd
[ruby/irb] Suppress crashing when EncodingError has occurred without lineno
...
13572d8cdc
2020-03-26 17:41:21 +09:00
aycabta
8b8cc01229
[ruby/irb] Fix auto indent with closed brace
...
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.
fbe59e344f
2020-02-12 13:14:28 +09:00
Ben
c94025b630
[ruby/irb] Fix crashing when multiple open braces per line
...
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
```
80c69c8272
2020-01-14 15:40:38 +09:00
Ben
9994eb8a5e
[ruby/irb] Fix newline depth with multiple braces
...
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
```
7dc8af01e0
2020-01-14 15:40:38 +09:00
Yusuke Endoh
616f1357c3
[ruby/irb] Make nesting level up for 1.times do
...
Follow up of the previous commit
ab207353d3
2019-12-22 01:57:35 +09:00
Yusuke Endoh
a3cc2a2fbd
[ruby/irb] Fix auto-indent for 1.times do
...
Fixes #47
6b8eca4635
2019-12-22 01:57:35 +09:00
aycabta
027e847cd2
Fix auto-indent behavior correctly
2019-12-03 13:02:50 +09:00
aycabta
c4686b9235
Revert "Treat :@1, :@@1, @1, and @@1 correctly to check termination"
...
This reverts commit 5e275dd2af
.
...The @1 type numberd parameter is reverted from Ruby syntax.
2019-11-29 17:38:18 +09:00
aycabta
51ea1abb5f
Remove e2mmap dependency
2019-11-25 05:38:09 +09:00
aycabta
9306602f24
Replace typo "bock" with "block"
2019-11-20 09:58:33 +09:00
aycabta
19a310b0ac
A preceding token of "do" of block has EXPR_CMDARG or EXPR_ENDFN
...
meth do # the preceding token of "do" has EXPR_CMDARG
end
meth() do # the preceding token of "do" has EXPR_ENDFN
end
2019-11-20 09:56:13 +09:00
aycabta
49b4507fd3
Number sign comment (# bla bla) is a kind of newline character
2019-11-20 08:39:43 +09:00
aycabta
a5b6d7bca8
Suppress warnings except for when last evaluation
...
Co-authored-by: Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
2019-11-13 15:15:28 +09:00
aycabta
aa03de8ba1
Treat two types "do" correctly
...
A "do" what has followed a token what has EXPR_CMDARG is for a block,
and in other cases "do" is for "while", "until" or "for".
2019-08-20 08:31:02 +09:00
Charles Oliver Nutter
f9f02e8216
Use JRuby equivalent of RubyVM.compile.
...
RubyVM is specific to CRuby and not supported on JRuby. This is
the equivalent operation.
2019-07-27 16:56:04 +09:00
aycabta
7b9bb6f44a
Check code_block_open for whether code continues
2019-07-03 23:37:46 +09:00
aycabta
776759e300
Keyword token that follows EXPR_FNAME must be a method name
2019-07-02 03:34:15 +09:00
aycabta
c718f56ed9
Remove auto indent of continuation line
2019-06-28 22:25:35 +09:00
Nobuyoshi Nakada
951f80f2dd
Removed unused variable
2019-06-28 14:09:26 +09:00
aycabta
2fd03fd7e6
EXPR_LABEL also indicates non-continuation line
...
Example:
[
1, # this is not continuation line
2
]
2019-06-27 16:03:43 +09:00
aycabta
d6bcf36793
EXPR_CMDARG also indicates the end of an expression
2019-06-27 10:59:26 +09:00
aycabta
24c4e6dec1
Increase indent of continuation line
...
v =
3 # auto indent
2019-06-27 01:26:14 +09:00
aycabta
ba17127e99
Decrease nesting level when closing token comes at a non-first token of line
2019-06-26 18:44:27 +09:00
Nobuyoshi Nakada
fe0ddf0e58
ensure
is not a continuos line
2019-06-26 15:01:01 +09:00
Nobuyoshi Nakada
a3d1cacda6
Decrease indent at "elsif" too
2019-06-26 10:49:23 +09:00
Nobuyoshi Nakada
ea8bc6822d
Remove other debug prints
2019-06-26 10:49:23 +09:00
aycabta
cfa1a18431
Remove debug print...sorry
2019-06-26 08:07:58 +09:00
aycabta
57e1a69ea3
Treat auto indent with newline correctly
2019-06-25 22:07:32 +09:00
aycabta
0b57f9b25d
Decrease indent when "else", "rescue", "ensure", "when", or "in" come
2019-06-25 22:02:31 +09:00
aycabta
9c19cd5222
Refactor calculation of corresponding token depth
2019-06-25 00:18:55 +09:00
aycabta
c79131df28
Treat closing token with starting token at head of 2nd line correctly
...
v =
if true # starting token at head of 2nd line
3
end # closing token
2019-06-22 00:31:42 +09:00
aycabta
5e2088665b
Do auto indent only when closing token at first of line
...
if true
3; end # this isn't auto-indented
2019-06-22 00:31:42 +09:00
aycabta
50841eca43
Support irregular auto indent
...
v =
if true
3
end # this "end" is auto-indented correctly
2019-06-21 21:35:25 +09:00
aycabta
d009e321a0
Use IRB.conf[:AUTO_INDENT] setting in multiline mode
2019-06-19 09:19:41 +09:00
aycabta
84903b31c8
Fix auto indent crash when blank input
2019-06-18 21:58:05 +09:00
aycabta
235e72f17e
Implement auto indent for multiline
2019-06-18 20:58:18 +09:00
aycabta
2fb1564c02
Implement line_no correctly
2019-06-16 14:46:28 +09:00
aycabta
f80771f0a9
Use Reline.prompt_proc in IRB
2019-06-14 08:26:06 +09:00
Takashi Kokubun
1808029061
make sync-default-gems GEM=irb
...
Upgrade IRB to 41ea43a4a7
Mostly backport changes.
2019-06-13 00:32:20 +09:00
aycabta
8354cfd03b
Treat "begin rescue end" correctly
2019-06-12 11:00:25 +09:00
aycabta
55c34b994b
Check the end token of heredoc correctly
2019-05-30 15:34:41 +09:00
aycabta
5e275dd2af
Treat :@1, :@@1, @1, and @@1 correctly to check termination
2019-05-28 03:23:52 +09:00
Kazuki Tsujimoto
b2b5ed1410
Supress duplicated warning
2019-05-28 01:32:07 +09:00
aycabta
9840f52c77
Use IRB::InputMethod#eof? to quit
2019-05-27 10:18:09 +09:00
aycabta
e73a68ebc3
Support op, cvar, iver, gvar and kw that follow on symbeg in IRB
2019-05-27 02:59:21 +09:00
aycabta
7686e33ee4
JSON like label ends by differs from the start
...
pp Ripper.lex('{ "a": 3 }')
=>
[[[1, 0], :on_lbrace, "{", EXPR_BEG|EXPR_LABEL],
[[1, 1], :on_sp, " ", EXPR_BEG|EXPR_LABEL],
[[1, 2], :on_tstring_beg, "\"", EXPR_BEG|EXPR_LABEL],
[[1, 3], :on_tstring_content, "a", EXPR_BEG|EXPR_LABEL],
[[1, 4], :on_label_end, "\":", EXPR_BEG|EXPR_LABEL],
[[1, 6], :on_sp, " ", EXPR_BEG|EXPR_LABEL],
[[1, 7], :on_int, "3", EXPR_END],
[[1, 8], :on_sp, " ", EXPR_END],
[[1, 9], :on_rbrace, "}", EXPR_END]]
2019-05-25 10:42:57 +09:00
aycabta
260235ce87
Use Reline as Reidline multiline editor in IRB
2019-05-25 02:16:19 +09:00
aycabta
4613c4bd5c
Symbol beginning token may take a constant token
2019-05-21 18:55:31 +09:00
aycabta
fd95ab44c6
IRB should eval and show an error when only .
is inputted
2019-05-21 18:37:35 +09:00