ruby-changes:40467
From: nobu <ko1@a...>
Date: Thu, 12 Nov 2015 14:17:12 +0900 (JST)
Subject: [ruby-changes:40467] nobu:r52548 (trunk): parse.y: ANDDOT fluent interface
nobu 2015-11-12 14:17:06 +0900 (Thu, 12 Nov 2015) New Revision: 52548 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52548 Log: parse.y: ANDDOT fluent interface * parse.y (parser_yylex): ANDDOT at the head of the line denote line continuation from previous one to support fluent interface, as well as single dot. Modified files: trunk/ChangeLog trunk/misc/ruby-mode.el trunk/parse.y trunk/test/ruby/test_syntax.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 52547) +++ ChangeLog (revision 52548) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Nov 12 14:17:01 2015 Nobuyoshi Nakada <nobu@r...> + + * parse.y (parser_yylex): ANDDOT at the head of the line denote + line continuation from previous one to support fluent interface, + as well as single dot. + Thu Nov 12 13:49:50 2015 SHIBATA Hiroshi <hsbt@r...> * lib/rubygems: Update to RubyGems 2.5.0+ HEAD(db78980). Index: misc/ruby-mode.el =================================================================== --- misc/ruby-mode.el (revision 52547) +++ misc/ruby-mode.el (revision 52548) @@ -898,7 +898,7 @@ Emacs to Ruby." https://github.com/ruby/ruby/blob/trunk/misc/ruby-mode.el#L898 (goto-char ruby-indent-point) (beginning-of-line) (skip-syntax-forward " ") - (if (looking-at "\\.[^.]") + (if (looking-at "\\.[^.]\\|&\\.") (+ indent ruby-indent-level) indent)))) Index: parse.y =================================================================== --- parse.y (revision 52547) +++ parse.y (revision 52548) @@ -8034,9 +8034,10 @@ parser_yylex(struct parser_params *parse https://github.com/ruby/ruby/blob/trunk/parse.y#L8034 case '\13': /* '\v' */ space_seen = 1; break; + case '&': case '.': { dispatch_delayed_token(tIGNORED_NL); - if (!peek('.')) { + if (peek('.') == (c == '&')) { pushback(c); dispatch_scan_event(tSP); goto retry; Index: test/ruby/test_syntax.rb =================================================================== --- test/ruby/test_syntax.rb (revision 52547) +++ test/ruby/test_syntax.rb (revision 52548) @@ -628,6 +628,11 @@ eom https://github.com/ruby/ruby/blob/trunk/test/ruby/test_syntax.rb#L628 assert_syntax_error(":#\n foo", /unexpected ':'/) end + def test_fluent_dot + assert_valid_syntax("a\n.foo") + assert_valid_syntax("a\n&.foo") + end + private def not_label(x) @result = x; @not_label ||= nil end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/