summaryrefslogtreecommitdiff
path: root/lib/irb/ruby-lex.rb
AgeCommit message (Collapse)Author
2021-04-26[ruby/irb] Fix typo ture -> true [ci skip]Ryuta Kamizono
https://github.com/ruby/irb/commit/783a0569e8
2021-04-03[ruby/irb] Evaluate each toplevel statementaycabta
https://github.com/ruby/irb/commit/bc1b1d8bc3
2021-03-24[ruby/irb] Change ripper_lex_without_warning to a class methodaycabta
https://github.com/ruby/irb/commit/d9f8abc17e
2021-03-05[ruby/irb] Do not continue line if last expression is an endless rangeJeremy Evans
Fixes [Bug #14824] https://github.com/ruby/irb/commit/63414f8465
2021-02-03[ruby/irb] follow up the actual line numberNobuhiro IMAI
https://github.com/ruby/irb/commit/7aed8fe3b1
2021-01-27[ruby/irb] use `RubyLex::TerminateLineInput` appropriately [Bug #17564]Nobuhiro IMAI
* 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
2021-01-24[ruby/irb] Indent correctly with method calling with receiveraycabta
https://github.com/ruby/irb/commit/e7c68e74a0
2021-01-24[ruby/irb] Indent correctly with keyword "for" and "in"aycabta
https://github.com/ruby/irb/commit/47c83ea724
2021-01-22[ruby/irb] Delete a doodle-level memo comment...aycabta
https://github.com/ruby/irb/commit/fc3e1d9e0c
2021-01-05[ruby/irb] Ensure to restore $VERBOSENobuyoshi Nakada
https://github.com/ruby/irb/commit/cef474a76a
2021-01-05[ruby/irb] Use error tokens if there are no correct tokens in the same placeaycabta
For example, the broken code "%www" will result in only one error token. https://github.com/ruby/irb/commit/9fa39a7cf3
2021-01-05[ruby/irb] Use Ripper::Lexer#scan to take broken tokensaycabta
ref. https://github.com/ruby/reline/pull/242 https://github.com/ruby/irb/commit/54f90cb6c9
2021-01-05[ruby/irb] Heredoc may contain multiple newlines in a single tokenaycabta
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
2021-01-05[ruby/irb] Handle indentations related to keyword "do" correctlyaycabta
This fixes ruby/irb#158. https://github.com/ruby/irb/commit/964643400b
2021-01-05[ruby/irb] Newline in oneliner def doesn't reset indentaycabta
This closes ruby/irb#132. https://github.com/ruby/irb/commit/43456dcf5e
2020-12-23[ruby/irb] Suppress "shadowing outer" warningaycabta
https://github.com/ruby/irb/commit/8b83fbef69
2020-12-23[ruby/reline] [ruby/irb] Handle multiple newlines in a token correctlyaycabta
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
2020-12-22[ruby/irb] Change variables handling for compatibilityaycabta
https://github.com/ruby/irb/commit/26fd1a75cf
2020-12-20[ruby/irb] Handle rest of tokens correctly if no newline at lastaycabta
https://github.com/ruby/irb/commit/f3c8edad2a
2020-12-19[ruby/reline] [ruby/irb] Call ripper only once when generating dynamic promptaycabta
https://github.com/ruby/irb/commit/babb122a48 https://github.com/ruby/reline/commit/e6dbcb3b42
2020-12-17[ruby/irb] Fixed a typo in a comment [ci skip]Nobuyoshi Nakada
https://github.com/ruby/irb/commit/ce373417f3
2020-12-17[ruby/irb] workaround for lack of tokens from `Ripper.lex`Nobuhiro IMAI
* Fixes #38 https://github.com/ruby/irb/commit/905fb8e52e
2020-11-22[ruby/irb] Add a fallback for check_code_block that does not depend on ↵Benoit Daloze
implementation-private APIs * Fixes https://github.com/ruby/irb/issues/133 https://github.com/ruby/irb/commit/5eb3ef3293
2020-11-22[ruby/irb] support more body argument for oneliner method definitionNobuhiro IMAI
https://github.com/ruby/irb/commit/2ff1295533
2020-08-18[ruby/irb] Support shortening lambda notetion for nesting level of promptaycabta
https://github.com/ruby/irb/commit/f1a775af47
2020-08-18[ruby/irb] Support shortening lambda notationaycabta
https://github.com/ruby/irb/commit/8e3f81d428
2020-08-18[ruby/irb] Support oneline method definitionaycabta
https://github.com/ruby/irb/commit/826ae909c9
2020-07-23Suppress "assigned but unused variable" warningsYusuke Endoh
2020-07-22[ruby/irb] handle rescue modifier properlyNobuhiro IMAI
https://github.com/ruby/irb/commit/6de1341f5e
2020-07-22[ruby/irb] Simplify RubyLex.compile_with_errors_suppressedaycabta
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
2020-07-22[ruby/irb] Suppress incomplete encoding magic comment erroraycabta
https://github.com/ruby/irb/commit/443e90af80
2020-07-22[ruby/irb] Suppress incomplete coding magic comment erroraycabta
https://github.com/ruby/irb/commit/6a457edbd1
2020-03-29[ruby/irb] Require jruby lib to get JRuby.compile_irCharles Oliver Nutter
https://github.com/ruby/irb/commit/dc59afe4f6
2020-03-26[ruby/irb] Suppress crashing when EncodingError has occurred without linenoaycabta
https://github.com/ruby/irb/commit/13572d8cdc
2020-02-12[ruby/irb] Fix auto indent with closed braceaycabta
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
2020-01-14[ruby/irb] Fix crashing when multiple open braces per lineBen
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
2020-01-14[ruby/irb] Fix newline depth with multiple bracesBen
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
2019-12-22[ruby/irb] Make nesting level up for `1.times do`Yusuke Endoh
Follow up of the previous commit https://github.com/ruby/irb/commit/ab207353d3
2019-12-22[ruby/irb] Fix auto-indent for `1.times do`Yusuke Endoh
Fixes #47 https://github.com/ruby/irb/commit/6b8eca4635
2019-12-03Fix auto-indent behavior correctlyaycabta
2019-11-29Revert "Treat :@1, :@@1, @1, and @@1 correctly to check termination"aycabta
This reverts commit 5e275dd2af4d9d24cdb1cfc0f232f348dae9c2cd. ...The @1 type numberd parameter is reverted from Ruby syntax.
2019-11-25Remove e2mmap dependencyaycabta
2019-11-20Replace typo "bock" with "block"aycabta
2019-11-20A preceding token of "do" of block has EXPR_CMDARG or EXPR_ENDFNaycabta
meth do # the preceding token of "do" has EXPR_CMDARG end meth() do # the preceding token of "do" has EXPR_ENDFN end
2019-11-20Number sign comment (# bla bla) is a kind of newline characteraycabta
2019-11-13Suppress warnings except for when last evaluationaycabta
Co-authored-by: Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
2019-08-20Treat two types "do" correctlyaycabta
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-07-27Use JRuby equivalent of RubyVM.compile.Charles Oliver Nutter
RubyVM is specific to CRuby and not supported on JRuby. This is the equivalent operation.
2019-07-03Check code_block_open for whether code continuesaycabta
2019-07-02Keyword token that follows EXPR_FNAME must be a method nameaycabta