mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
88edab89f4
commit
68e16ddd79
4 changed files with 14 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Thu Nov 12 14:17:01 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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@ruby-lang.org>
|
Thu Nov 12 13:49:50 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
||||||
|
|
||||||
* lib/rubygems: Update to RubyGems 2.5.0+ HEAD(db78980).
|
* lib/rubygems: Update to RubyGems 2.5.0+ HEAD(db78980).
|
||||||
|
|
|
@ -898,7 +898,7 @@ Emacs to Ruby."
|
||||||
(goto-char ruby-indent-point)
|
(goto-char ruby-indent-point)
|
||||||
(beginning-of-line)
|
(beginning-of-line)
|
||||||
(skip-syntax-forward " ")
|
(skip-syntax-forward " ")
|
||||||
(if (looking-at "\\.[^.]")
|
(if (looking-at "\\.[^.]\\|&\\.")
|
||||||
(+ indent ruby-indent-level)
|
(+ indent ruby-indent-level)
|
||||||
indent))))
|
indent))))
|
||||||
|
|
||||||
|
|
3
parse.y
3
parse.y
|
@ -8034,9 +8034,10 @@ parser_yylex(struct parser_params *parser)
|
||||||
case '\13': /* '\v' */
|
case '\13': /* '\v' */
|
||||||
space_seen = 1;
|
space_seen = 1;
|
||||||
break;
|
break;
|
||||||
|
case '&':
|
||||||
case '.': {
|
case '.': {
|
||||||
dispatch_delayed_token(tIGNORED_NL);
|
dispatch_delayed_token(tIGNORED_NL);
|
||||||
if (!peek('.')) {
|
if (peek('.') == (c == '&')) {
|
||||||
pushback(c);
|
pushback(c);
|
||||||
dispatch_scan_event(tSP);
|
dispatch_scan_event(tSP);
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
|
@ -628,6 +628,11 @@ eom
|
||||||
assert_syntax_error(":#\n foo", /unexpected ':'/)
|
assert_syntax_error(":#\n foo", /unexpected ':'/)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_fluent_dot
|
||||||
|
assert_valid_syntax("a\n.foo")
|
||||||
|
assert_valid_syntax("a\n&.foo")
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def not_label(x) @result = x; @not_label ||= nil end
|
def not_label(x) @result = x; @not_label ||= nil end
|
||||||
|
|
Loading…
Add table
Reference in a new issue