Commit graph

109 commits

Author SHA1 Message Date
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
aycabta
94b740b249 Use Ripper for IRB
The debug option of IRB is deleted because it's just for IRB's pure Ruby
parser.
2019-04-30 14:40:06 +09:00
Nobuyoshi Nakada
f4f66bd11c
Revert "IRB is improved with Reline and RDoc, take 2"
Accidentally merged when 89271d4a37
"Adjusted indents".
2019-04-23 21:55:29 +09:00
aycabta
f2cd4f4cd0
IRB is improved with Reline and RDoc, take 2 2019-04-23 20:08:02 +09:00
aycabta
51cec00953 Revert "IRB is improved with Reline and RDoc"
This reverts commit 7f273ac6d0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-21 09:13:49 +00:00
aycabta
7f273ac6d0 IRB is improved with Reline and RDoc
Reline is a readline stdlib compatible library. It also supports
multiline input. IRB is improved with Reline and supports multiline.
Besides, supports showing documents when completed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-20 08:51:20 +00:00
marcandre
b9d42af0f2 lib/*: Prefer require_relative over require, remove explicit extension
[#15206] [Fix GH-1976]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-02 17:52:43 +00:00
marcandre
e859e668d2 lib/*: Prefer require_relative over require.
[#15206] [Fix GH-1976]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-02 17:52:33 +00:00
nobu
f14f0d3464 ruby-lex.rb: fix continued line conditions
* lib/irb/ruby-lex.rb (RubyLex#lex): fix conditions for continued
  line; empty lines, a semicolon, first line in `begin` block,
  just after `else` are not continued.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-20 11:07:02 +00:00
nobu
716ce65138 ruby-lex.rb: merge regexps
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-20 11:07:00 +00:00
nobu
519af46806 ruby-lex.rb: fix for label
* lib/irb/ruby-lex.rb (identify_identifier): treat identifier just
  followed by a colon as a lable.  this is not a precise solution
  but enough for the time being.  [ruby-core:78526] [Bug #13012]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-08 08:31:01 +00:00
hsbt
6f04ae5688 * lib/irb/ruby-lex.rb: fixed parse error for striped heredocument syntax.
[fix GH-1127] Patch by @koic

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-18 01:25:08 +00:00
naruse
3e92b635fb Add frozen_string_literal: false for all files
When you change this to true, you may need to add more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
hsbt
2afed6ecef * lib/e2mmap.rb: remove needless instance variables.
* lib/irb.rb: ditto.
* lib/irb/**/*.rb: ditto.
* lib/shell.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-24 07:16:25 +00:00
hsbt
76515504d5 * lib/irb.rb: removed commented-out code.
* lib/irb/**/*.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-09 02:02:58 +00:00
hsbt
8e5af8b628 * lib/cmath.rb: fixed indent.
* lib/drb/ssl.rb: ditto.
* lib/irb/**/*.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-09 01:36:49 +00:00