Function: ruby-expr-beg
ruby-expr-beg is a byte-compiled function defined in ruby-mode.el.gz.
Signature
(ruby-expr-beg &optional OPTION)
Documentation
Check if point is possibly at the beginning of an expression.
OPTION specifies the type of the expression.
Can be one of heredoc, modifier, expr-qstr, expr-re.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/ruby-mode.el.gz
(defun ruby-expr-beg (&optional option)
"Check if point is possibly at the beginning of an expression.
OPTION specifies the type of the expression.
Can be one of `heredoc', `modifier', `expr-qstr', `expr-re'."
(save-excursion
(store-match-data nil)
(let ((space (skip-chars-backward " \t"))
(start (point)))
(cond
((bolp) t)
((progn
(forward-char -1)
(and (looking-at "\\?")
(or (eq (char-syntax (char-before (point))) ?w)
(ruby-special-char-p))))
nil)
((looking-at ruby-operator-re))
((eq option 'heredoc)
(and (< space 0) (ruby-verify-heredoc start)))
((or (looking-at "[\\[({,;]")
(and (looking-at "[!?]")
(or (not (eq option 'modifier))
(bolp)
(save-excursion (forward-char -1) (looking-at "\\Sw$"))))
(and (looking-at ruby-symbol-re)
(skip-chars-backward ruby-symbol-chars)
(cond
((looking-at (regexp-opt
(append ruby-block-beg-keywords
ruby-block-op-keywords
ruby-block-mid-keywords)
'words))
(goto-char (match-end 0))
(not (looking-at "\\s_")))
((eq option 'expr-qstr)
(looking-at "[a-zA-Z][a-zA-Z0-9_]* +%[^ \t]"))
((eq option 'expr-re)
(looking-at "[a-zA-Z][a-zA-Z0-9_]* +/[^ \t]"))
(t nil)))))))))