summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-05-25 10:36:30 +0900
committeraycabta <aycabta@gmail.com>2019-05-25 10:42:57 +0900
commit7686e33ee453d43210afcf90fef8fc613dede31c (patch)
tree80f260e0f6e9932ce625d054a6f96295e75f8db5
parent809ac9f2eaa0b9cf818f571f6febcee6785cc8e2 (diff)
JSON like label ends by differs from the start
pp Ripper.lex('{ "a": 3 }') => [[[1, 0], :on_lbrace, "{", EXPR_BEG|EXPR_LABEL], [[1, 1], :on_sp, " ", EXPR_BEG|EXPR_LABEL], [[1, 2], :on_tstring_beg, "\"", EXPR_BEG|EXPR_LABEL], [[1, 3], :on_tstring_content, "a", EXPR_BEG|EXPR_LABEL], [[1, 4], :on_label_end, "\":", EXPR_BEG|EXPR_LABEL], [[1, 6], :on_sp, " ", EXPR_BEG|EXPR_LABEL], [[1, 7], :on_int, "3", EXPR_END], [[1, 8], :on_sp, " ", EXPR_END], [[1, 9], :on_rbrace, "}", EXPR_END]]
-rw-r--r--lib/irb/ruby-lex.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb
index 71d69348fb..b2ed7b4b3f 100644
--- a/lib/irb/ruby-lex.rb
+++ b/lib/irb/ruby-lex.rb
@@ -251,7 +251,7 @@ class RubyLex
case t[1]
when :on_tstring_beg
start_token << t
- end_type << :on_tstring_end
+ end_type << [:on_tstring_end, :on_label_end]
when :on_regexp_beg
start_token << t
end_type << :on_regexp_end
@@ -269,7 +269,7 @@ class RubyLex
when :on_heredoc_beg
start_token << t
end_type << :on_heredoc_end
- when end_type.last
+ when *end_type.last
start_token.pop
end_type.pop
end