summaryrefslogtreecommitdiff
path: root/test/ruby/test_syntax.rb
AgeCommit message (Collapse)Author
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
2017-11-16parse.y: no return in classnobu
* parse.y (k_return): prohibit return in class/module body except for singleton class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-01test_syntax.rb: all assertionsnobu
* test/ruby/test_syntax.rb (test_return_toplevel): try all assertions even if any assertions failed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-31compile.c: ensure after return in library toplevelnobu
* compile.c (compile_return): execute ensure clause after toplevel return even in library toplevel other than the main script. [ruby-core:83589] [Bug #14061] test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-22Fixed misspelling words.hsbt
These are detected by https://github.com/client9/misspell git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-19parse.y: indent at '#'nobu
* parse.y (parser_here_document): update indent at '#', which is not a space. [ruby-core:83368] [Bug #14032] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-01compile.c: ensure after toplevel returnnobu
* compile.c (iseq_compile_each0): toplevel returns should fire ensures. [ruby-core:82492] [Bug #13844] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-31test_syntax.rb: suppress warningsnobu
* test/ruby/test_syntax.rb (TestSyntax#test_return_toplevel): suppress unreachable statement warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-31test_syntax.rb: assert outputnobu
* test/ruby/test_syntax.rb (TestSyntax#test_return_toplevel): assert expected output if given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-26parse.y: brace after array literal argnobu
* parse.y (parser_yylex): array is another literal. set state to END too not only ENDARG and after a literal, so that a left brace after it should be a primary block bound to the literal, which causes syntax error. [ruby-core:81037] [Bug #13547] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-20parse.y: empty hash in definednobu
* parse.y (command): NODE_ARRAY with NULL is invalid. traversal in defined_expr0 is simplified than iseq_compile_each0. [ruby-core:82113] [Bug #13756] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-20compile.c: restore stack at returnnobu
* compile.c (iseq_compile_each0): restore the stack depth after return to the previous depth, to fix the stack depth at returning from rescue iseq. [ruby-core:82108] [Bug #13755] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-29compile.c: disallow next in oncenobu
* compile.c (iseq_compile_each0): turned dregx context in "once" into "guarded" type from "block" type, to disallow `next`, `break`, `redo` as well as outside "once". [ruby-core:81805] [Bug #13690] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-27fix return in toplevel ensurenobu
* compile.c (iseq_compile_each0): adjust stack after return in toplevel ensure, when the value is used. [ruby-core:81777] [Bug #13682] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-27fix return in toplevel rescue/ensurenobu
* compile.c (iseq_compile_each0): throw TAG_RETURN at return in toplevel rescue/ensure to adjust VM stack properly. [ruby-core:81777] [Bug #13682] * vm_insnhelper.c (vm_throw_start): allow return in toplevel rescue/ensure. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-25compile.c: toplevel return in argumentnobu
* compile.c (iseq_compile_each0): adjust the stack before return in an evstr/argument (reported by Balazs <balazs@kutilovi.cz>) to fix stack consistency error. [ruby-core:81761] [Bug #13678] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09parse.y: brace after literal argnobu
* parse.y (symbol, dsym, parser_set_number_literal, parser_yylex): set state to END too not only ENDARG and after a literal, so that a left brace after it should be a primary block bound to the literal, which causes syntax error. [ruby-core:81037] [Bug #13547] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09parse.y: do after cmdarg in parennobu
* parse.y (parser_yylex): set state to ENDARG after a string literal, so that `do` after a literal should be `do_block` and bound to the outer method, as well as a numeric/symbol literal. [ruby-core:72482] [Bug #11873] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09test_syntax.rb: test_brace_after_local_variablenobu
* test/ruby/test_syntax.rb (test_brace_after_local_variable): another test using braces. [Bug #11873] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-26parse.y: indent at invalid identifiernobu
* parse.y (parser_heredoc_identifier): set indent only when valid identifier, not to dedent non-existent contents later. [ruby-core:79772] [Bug #13253] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-19parse.y: rescue/else/ensure in do-endnobu
* parse.y (do_body): allow rescue/else/ensure inside do/end blocks. [Feature #12906] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-12immediate message mode of compile errornobu
* compile.c (append_compile_error): set Qtrue for erred state with showing the message immediately. * iseq.c (prepare_iseq_build): make immediate message mode if main or top level context, not to show the failed path twice in the first line. * iseq.c (cleanup_iseq_build): raise default message exception if immediate message mode. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-10compile.c: check compilenobu
* compile.c (iseq_compile_each): check if sub nodes succeeded. [ruby-core:76531] [Bug #12613] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-26parse.y: preserve cmdarg stacknobu
* parse.y (do_body): preserve cmdarg stack around do/end block. [ruby-core:78837] [Bug #13073] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-21compile.c: toplevel returnnobu
* compile.c (iseq_compile_each): stop execution of the current source by toplevel return. [ruby-core:36785] [Feature #4840] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-16multiline heredoc identifiernobu
* parse.y (parser_heredoc_identifier): reject multiline here document identifier, which never matches single line. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-15parse.y: newline in heredoc identifiernobu
* parse.y (parser_heredoc_identifier): warn newline in here document identifier. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-29parse.y: !-operator warningnobu
* parse.y (cond0): !-operator is a method call, no warning for literal in condition. [ruby-core:77801] [Bug #12881] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-27parse.y: fix up r56198nobu
* parse.y (symbol, dsym, parser_set_number_literal): set state to ENDARG, so that `do` after a literal should be `do_block` and bound to the outer method. [ruby-core:72482] [Bug #11873] * parse.y (parse_ident): revert r56198. * parse.y (warn_balanced): the state of symbol and numeric literals is now EXPR_ENDARG, do not exclude it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-27test_syntax.rb: more test_warn_balancednobu
* test/ruby/test_syntax.rb (test_warn_balanced): more assertions for a symbol literal and a local variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-21parse.y: preserve cmdarg_stacknobu
* parse.y (brace_body, do_body): preserve cmdarg_stack so that `do` after cmdarg in a block should be `do_block` and bound to the outer method. [ruby-core:72482] [Bug #11873] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-21parse.y: do after cmdarg in parennobu
* parse.y: `do` after cmdarg in parentheses should be `do_block` and bound to the outer method. [ruby-core:72482] [Bug #11873] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-19parse.y: lparen_arg statementnobu
* parse.y (primary): allow parenthesised statement as a method argument. [Feature #12686] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-07test_syntax.rb: formal argument name testsnobu
* test/ruby/test_syntax.rb: add invalid formal argument name tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-16parse.y: symbol literals for alias/undefnobu
* defs/keywords (alias, undef): symbol literals are allowed. * parse.y (parse_percent): should parse symbol literals for alias and undef. [ruby-dev:47681] [Bug #8851] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-19test/ruby: suppress runtime warningsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-19test/ruby: suppress parser warningsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e