summaryrefslogtreecommitdiff
path: root/test/ruby/test_syntax.rb
AgeCommit message (Collapse)Author
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
2018-03-21parse.y: unindent continued linenobu
* parse.y (tokadd_string): stop at continued line in dedented here documents, to dedent for each lines before removing escaped newlines. [ruby-core:86236] [Bug #14621] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-19compile.c: arg var indexnobu
* compile.c (iseq_set_arguments): determine argument variable indexes by the order, not by just IDs. arguments begin with `_` can be duplicate, so by-ID index may result in a wrong value. [ruby-core:86159] [Bug #14611] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-11parse.y: fix interpolated string literal dedentnobu
* parse.y (heredoc_dedent): fix interpolated string literal dedent, remove indentations from only nodes with the newline flag. [ruby-core:85983] [Bug #14584] * parse.y (here_document): set the newline flag on literal string nodes starting at the beginning of line. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15test/ruby/test_syntax.rb (test_command_with_cmd_brace_block): Addedmame
The bison rules were not covered. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09parse.y: insane syntax too (class definition in cond)mame
This change partially reverts r61724 and take another approach: exploiting struct local_vars to backup the cond_stack state. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09parse.y: insane syntaxnobu
* parse.y (primary): save/restore COND and CMDARG stacks at method definition, to distinguish do_block and do_cond properly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09Allow `-> do rescue; end` as well as `proc do rescue; end`mame
https://twitter.com/takiuchi/status/950593389963051008 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-07parse.y: nd_line of new_qcallnobu
* parse.y (new_qcall): set nd_line to the method name location. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-05compile.c: fix stack consistency errornobu
* compile.c (iseq_peephole_optimize): fix stack consistency error from return in loop, by adding extra `pop` when replacing `jump` with `leave`, which is never reached but needed to adjust sp calculation. [ruby-core:84589] [Bug #14273] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-24compile.c: toplevel return argumentsnobu
* compile.c (compile_return): evaluate arguments to top-level return but ignore the results. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-05test_syntax.rb: Add a test case for `not()`yui-knk
* test/ruby/test_syntax.rb (TestSyntax#test_keyword_not_parens): Currently `not()` is tested by only TestRipper::ParserEvents#test_unary, so I think it's better to test this syntax directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e