summaryrefslogtreecommitdiff
path: root/test/ruby/test_syntax.rb
AgeCommit message (Collapse)Author
2019-09-24Changed numbered parameter prefixNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/2431
2019-09-19Fixed reserved numbered parameter warningNobuyoshi Nakada
2019-09-15Comment lines can be placed between fluent dot nowNobuyoshi Nakada
2019-09-05Fix code locations of array node inside hash node when multiple kw splatsJeremy Evans
This is broken at least since 2.5 (I didn't check earlier versions). It resulted in failure in test_ast.rb when the tests were added before the parser change. Basically, in remove_duplicate_keys, if the node is modified, set the location information to the previous location information. The removal of keys should not affect the location in the code. Notes: Merged: https://github.com/ruby/ruby/pull/2428
2019-09-02Merge pull request #2418 from jeremyevans/array-empty-kwsplatJeremy Evans
Ignore empty keyword splats in arrays Notes: Merged: https://github.com/ruby/ruby/pull/2418 Merged-By: jeremyevans <code@jeremyevans.net>
2019-09-01Split warning messages for tag-jumpNobuyoshi Nakada
2019-08-30Fix remaining warning issues in the tests due to keyword argument separationJeremy Evans
Notes: Merged: https://github.com/ruby/ruby/pull/2395
2019-08-30Support **nil syntax for specifying a method does not accept keyword argumentsJeremy Evans
This syntax means the method should be treated as a method that uses keyword arguments, but no specific keyword arguments are supported, and therefore calling the method with keyword arguments will raise an ArgumentError. It is still allowed to double splat an empty hash when calling the method, as that does not pass any keyword arguments. Notes: Merged: https://github.com/ruby/ruby/pull/2395
2019-08-30Fix test after keyword argument separationJeremy Evans
Now that keyword splats accept non-Symbols, the type of exception changes. Previously, a TypeError (hash key "k1" is not a Symbol) was raised for this test, but now an ArgumentError (unknown keyword: "k1") is raised. Notes: Merged: https://github.com/ruby/ruby/pull/2395
2019-08-29Refined warnings against literal in flip-flopNobuyoshi Nakada
2019-08-29Revert "Add pipeline operator [Feature #15799]"Nobuyoshi Nakada
This reverts commits: * d365fd5a024254d7c105a62a015a7ea29ccf3e5d * d780c3662484d6072b3a6945b840049de72c2096 * aa7211836b769231a2a8ef6b6ec2fd0ec882ef29 * 043f010c28e82ea38978bf8ed885416f133b5b75 * bb4dd7c6af05c7821d572e2592ea3d0cc748d81f * 043f010c28e82ea38978bf8ed885416f133b5b75 * f169043d81524b5b529f2c1e9c35437ba5bc3a7a http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/94645
2019-07-29Warn if using return at top-level with an argumentJeremy Evans
Fixes [Bug #14062]
2019-07-11Revert "parse.y: Deprecate flip-flops"Nobuyoshi Nakada
This reverts commit bae638ad5b782c44c80efe33834cb9039279af46. [Feature #5400]
2019-07-05Fix segfault when using method reference operator without using resultJeremy Evans
Fixes [Bug #15985]
2019-06-17Fix wrong "void value expression" errorNobuyoshi Nakada
* parse.y (value_expr_check): `then` or `else` only `if` is not a void value expression, as the counterpart is evaluated as `nil`. [Bug #15932]
2019-06-17Fix wrong "void value expression" errorNobuyoshi Nakada
* parse.y (value_expr_check): if either of `then` or `else` statements is not a void value expression, the whole `if` is not also a void value expression. [Bug #15932]
2019-06-15Revert github/pull/2230, commit missNobuyoshi Nakada
2019-06-15Test for blank lines between leadinig dot method chainsJosh Cheek
2019-06-15Multiline method chain with leading dot works for blank linesJosh Cheek
2019-06-15Test comments between multiline method chainJosh Cheek
2019-06-14An operator is not allowed just after `|>`Nobuyoshi Nakada
https://twitter.com/yukihiro_matz/status/1139454774640726019
2019-06-13Continue to the next line beginning with a pipelineNobuyoshi Nakada
2019-06-13parse.y: moved pipeline to exprNobuyoshi Nakada
To allow arguments without parentheses.
2019-06-13Add pipeline operator [Feature #15799]Nobuyoshi Nakada
2019-06-11Refined syntax error messagesNobuyoshi Nakada
2019-06-11&. is not allowed inside LHS of massignNobuyoshi Nakada
https://hackerone.com/reports/605262
2019-05-30parse.y: continue after heredoc errorNobuyoshi Nakada
* parse.y: continue parsing the rest of the here-document starting line, after the terminator was not found.
2019-05-27parse.y: broke the terminator condition downNobuyoshi Nakada
* parse.y (here_document): broke the terminator condition down into each piece, the positional condition, resetting the dedented here-document indentation, and matching identifier. suppress a false warning by icc.
2019-05-24Mixed encoding error can continue to parseNobuyoshi Nakada
2019-05-22Fix mixed encoding in heredocJeremy Evans
Heredocs are parsed line-by-line, so we need to keep track of the temporary encoding of the string. Previously, a heredoc would only detect mixed encoding errors if they were on the same line, this changes things so they will be caught on different lines. Fixes [Bug #15839]
2019-05-05Fix use of numbered parameter inside proc that is default value of optargJeremy Evans
This allows cases such as: ```ruby m ->(a = ->{@1}) {a} m.call.call(1) m2 ->(a: ->{@1}) {a} m2.call.call(2) ``` Previously, this would cause a syntax error. [Bug#15789]
2019-05-05Fix a case where numbered parameters should not be allowedJeremy Evans
Because `proc{|| @1}` is a syntax error, the following should also be syntax errors: ```ruby proc { | | @1} ``` ```ruby proc { |; a| @1 } ``` This fixes both cases. [Bug #15825]
2019-05-05parse.y: duplicated when clause warningNobuyoshi Nakada
* parse.y (case_args): moved "duplicated when clause" warning from compile phase, so that `ruby -wc` shows them.
2019-04-29Disallow also CR in here-doc identifierNobuyoshi Nakada
* parse.y (heredoc_identifier): CR in here-document identifier might or might not result in a syntax error, by the EOL code. make a syntax error regardless of the EOL code.
2019-04-29parse.y: fix here-doc identifier with newlineNobuyoshi Nakada
* parse.y (heredoc_identifier): quoted here-document identifier must end within the same line. the only corner case that here-document identifier can contain a newline is that the closing qoute is placed at the beginning of the next line, and has been warned since 2.4. ```ruby <<"EOS " # warning: here document identifier ends with a newline EOS ```
2019-04-23Disallow numbered parameter as the default value of optional argumentSeiei Miyagi
[Fix GH-2139] [Bug #15783]
2019-04-23Fix internal error of `->x:@2{}`Seiei Miyagi
[Fix GH-2139] [Bug #15783]
2019-03-18parse.y: numbered parameter in lambdanobu
* parse.y (lambda): support numbered parameters, only when no argument list including empty parentheses, like empty vertical bars. [ruby-core:91859] [Bug #15672] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-17Numbered parameters [Feature #4475]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-26parse.y: trim newline in erred codenobu
* parse.y (parser_yyerror): trim a newline at the end of the erred code which was replaced with an extra space in the succeeding cursor line. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-24parse.y: remove an extra error messagenobu
* parse.y (parse_string): bail out when word-list meets end of input not to show an extra "unexpected" error message after the preceding error. $ ruby -e "%w[" -e:1: unterminated string meets end of file -e:1: syntax error, unexpected terminator, expecting ' ' git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-22parse.y: enclose keyword token names by quotesnobu
* parse.y (rb_yytnamerr): strip enclosing double-quotes, same as the default yytnamerr except for that single-quotes matching back-quotes do not stop stripping. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-05parse.y: refine error messagesnobu
* parse.y: refine error messages for tSYMBEG and tSTRING_BEG, which can appear at invalid places. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-31Method reference operatornobu
Introduce the new operator for method reference, `.:`. [Feature #12125] [Feature #13581] [EXPERIMENTAL] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-25parser: improve error messagesnobu
[Fix GH-2011] From: Akim Demaille <akim.demaille@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-31parse.y: last node of NODE_ARRAYnobu
* parse.y (heredoc_dedent): manage the last node of NODE_ARRAY, when concatenating dedented literals. [ruby-core:89649] [Bug #15272] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-30parse.y: last location from bisonnobu
* parse.y (command): set the last location from the location managed by bison, so that other nodes are not needed. [ruby-core:89648] [Bug #15271] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-15parse.y: Deprecate flip-flopsmame
Ref #5400 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-11Use `&.` instead of modifier ifkazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-21parse.y: terminator at continued linenobu
* parse.y (here_document): a continuing line is not the terminator. [ruby-core:86283] [Bug #14621] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e