"Regexp to match modifiers.")
(defconst ruby-block-mid-keywords
- '("then" "else" "elsif" "when" "rescue" "ensure")
+ '("then" "else" "elsif" "when" "in" "rescue" "ensure")
"Keywords where the indentation gets shallower in middle of block statements.")
(defconst ruby-block-mid-re
(for-body (for-head ";" insts))
(for-head (id "in" exp))
(cases (exp "then" insts)
- (cases "when" cases) (insts "else" insts))
+ (cases "when" cases)
+ (cases "in" cases)
+ (insts "else" insts))
(expseq (exp) );;(expseq "," expseq)
(hashvals (exp1 "=>" exp1) (hashvals "," hashvals))
(insts-rescue-insts (insts)
(if-body (ielsei) (if-body "elsif" if-body)))
'((nonassoc "in") (assoc ";") (right " @ ")
(assoc ",") (right "="))
- '((assoc "when"))
+ '((assoc "when" "in"))
'((assoc "elsif"))
'((assoc "rescue" "ensure"))
'((assoc ",")))
(cond
((smie-rule-parent-p "def" "begin" "do" "class" "module" "for"
"while" "until" "unless"
- "if" "then" "elsif" "else" "when"
+ "if" "then" "elsif" "else" "when" "in"
"rescue" "ensure" "{")
(smie-rule-parent ruby-indent-level))
;; For (invalid) code between switch and case.
ruby-indent-level))))
(`(:before . ,(or "else" "then" "elsif" "rescue" "ensure"))
(smie-rule-parent))
- ('(:before . "when")
+ (`(:before . ,(or "when" "in"))
;; Align to the previous `when', but look up the virtual
;; indentation of `case'.
(if (smie-rule-sibling-p) 0 (smie-rule-parent)))
2 = 3
:foo= if true
{:abc=>4} # not indented, and '=' is not highlighted
+
+# Pattern matching
+case translation
+in ['th', orig_text, 'en', trans_text]
+ puts "English translation: #{orig_text} => #{trans_text}"
+in {'th' => orig_text, 'ja' => trans_text}
+ puts "Japanese translation: #{orig_text} => #{trans_text}"
+end