summaryrefslogtreecommitdiff
path: root/lisp/emulation/viper-ex.el
diff options
context:
space:
mode:
authorMichael Kifer <kifer@cs.stonybrook.edu>1997-09-05 04:48:58 +0000
committerMichael Kifer <kifer@cs.stonybrook.edu>1997-09-05 04:48:58 +0000
commit96dffd25b0668f11da338a68f4d1be69cc65bd94 (patch)
tree0ff12820dad1728525968da420f8bc803a3e60d4 /lisp/emulation/viper-ex.el
parentf152949dc80593916da13be5e7aec477d25796c9 (diff)
downloademacs-96dffd25b0668f11da338a68f4d1be69cc65bd94.tar.gz
new version
Diffstat (limited to 'lisp/emulation/viper-ex.el')
-rw-r--r--lisp/emulation/viper-ex.el184
1 files changed, 93 insertions, 91 deletions
diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el
index 216c1ade83b..dc4d1c3eebd 100644
--- a/lisp/emulation/viper-ex.el
+++ b/lisp/emulation/viper-ex.el
@@ -326,98 +326,100 @@ reversed."
(setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
(set-buffer viper-ex-work-buf)
(skip-chars-forward " \t|")
- (cond ((looking-at "#")
- (setq ex-token-type 'command)
- (setq ex-token (char-to-string (following-char)))
- (forward-char 1))
- ((looking-at "[a-z]") (viper-get-ex-com-subr))
- ((looking-at "\\.")
- (forward-char 1)
- (setq ex-token-type 'dot))
- ((looking-at "[0-9]")
- (set-mark (point))
- (re-search-forward "[0-9]*")
- (setq ex-token-type
- (cond ((eq ex-token-type 'plus) 'add-number)
- ((eq ex-token-type 'minus) 'sub-number)
- (t 'abs-number)))
- (setq ex-token (string-to-int (buffer-substring (point) (mark t)))))
- ((looking-at "\\$")
- (forward-char 1)
- (setq ex-token-type 'end))
- ((looking-at "%")
- (forward-char 1)
- (setq ex-token-type 'whole))
- ((looking-at "+")
- (cond ((or (looking-at "+[-+]") (looking-at "+[\n|]"))
- (forward-char 1)
- (insert "1")
- (backward-char 1)
+ (let ((case-fold-search t))
+ (cond ((looking-at "#")
+ (setq ex-token-type 'command)
+ (setq ex-token (char-to-string (following-char)))
+ (forward-char 1))
+ ((looking-at "[a-z]") (viper-get-ex-com-subr))
+ ((looking-at "\\.")
+ (forward-char 1)
+ (setq ex-token-type 'dot))
+ ((looking-at "[0-9]")
+ (set-mark (point))
+ (re-search-forward "[0-9]*")
+ (setq ex-token-type
+ (cond ((eq ex-token-type 'plus) 'add-number)
+ ((eq ex-token-type 'minus) 'sub-number)
+ (t 'abs-number)))
+ (setq ex-token
+ (string-to-int (buffer-substring (point) (mark t)))))
+ ((looking-at "\\$")
+ (forward-char 1)
+ (setq ex-token-type 'end))
+ ((looking-at "%")
+ (forward-char 1)
+ (setq ex-token-type 'whole))
+ ((looking-at "+")
+ (cond ((or (looking-at "+[-+]") (looking-at "+[\n|]"))
+ (forward-char 1)
+ (insert "1")
+ (backward-char 1)
(setq ex-token-type 'plus))
- ((looking-at "+[0-9]")
- (forward-char 1)
- (setq ex-token-type 'plus))
- (t
- (error viper-BadAddress))))
- ((looking-at "-")
- (cond ((or (looking-at "-[-+]") (looking-at "-[\n|]"))
- (forward-char 1)
- (insert "1")
- (backward-char 1)
- (setq ex-token-type 'minus))
- ((looking-at "-[0-9]")
- (forward-char 1)
- (setq ex-token-type 'minus))
- (t
- (error viper-BadAddress))))
- ((looking-at "/")
- (forward-char 1)
- (set-mark (point))
- (let ((cont t))
- (while (and (not (eolp)) cont)
- ;;(re-search-forward "[^/]*/")
- (re-search-forward "[^/]*\\(/\\|\n\\)")
- (if (not (viper-looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\/"))
- (setq cont nil))))
- (backward-char 1)
- (setq ex-token (buffer-substring (point) (mark t)))
- (if (looking-at "/") (forward-char 1))
- (setq ex-token-type 'search-forward))
- ((looking-at "\\?")
- (forward-char 1)
- (set-mark (point))
- (let ((cont t))
- (while (and (not (eolp)) cont)
- ;;(re-search-forward "[^\\?]*\\?")
- (re-search-forward "[^\\?]*\\(\\?\\|\n\\)")
- (if (not (viper-looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\\\?"))
- (setq cont nil))
- (backward-char 1)
- (if (not (looking-at "\n")) (forward-char 1))))
- (setq ex-token-type 'search-backward)
- (setq ex-token (buffer-substring (1- (point)) (mark t))))
- ((looking-at ",")
- (forward-char 1)
- (setq ex-token-type 'comma))
- ((looking-at ";")
- (forward-char 1)
- (setq ex-token-type 'semi-colon))
- ((looking-at "[!=><&~]")
- (setq ex-token-type 'command)
- (setq ex-token (char-to-string (following-char)))
- (forward-char 1))
- ((looking-at "'")
- (setq ex-token-type 'goto-mark)
- (forward-char 1)
- (cond ((looking-at "'") (setq ex-token nil))
- ((looking-at "[a-z]") (setq ex-token (following-char)))
- (t (error "Marks are ' and a-z")))
- (forward-char 1))
- ((looking-at "\n")
- (setq ex-token-type 'end-mark)
- (setq ex-token "goto"))
- (t
- (error viper-BadExCommand)))))
+ ((looking-at "+[0-9]")
+ (forward-char 1)
+ (setq ex-token-type 'plus))
+ (t
+ (error viper-BadAddress))))
+ ((looking-at "-")
+ (cond ((or (looking-at "-[-+]") (looking-at "-[\n|]"))
+ (forward-char 1)
+ (insert "1")
+ (backward-char 1)
+ (setq ex-token-type 'minus))
+ ((looking-at "-[0-9]")
+ (forward-char 1)
+ (setq ex-token-type 'minus))
+ (t
+ (error viper-BadAddress))))
+ ((looking-at "/")
+ (forward-char 1)
+ (set-mark (point))
+ (let ((cont t))
+ (while (and (not (eolp)) cont)
+ ;;(re-search-forward "[^/]*/")
+ (re-search-forward "[^/]*\\(/\\|\n\\)")
+ (if (not (viper-looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\/"))
+ (setq cont nil))))
+ (backward-char 1)
+ (setq ex-token (buffer-substring (point) (mark t)))
+ (if (looking-at "/") (forward-char 1))
+ (setq ex-token-type 'search-forward))
+ ((looking-at "\\?")
+ (forward-char 1)
+ (set-mark (point))
+ (let ((cont t))
+ (while (and (not (eolp)) cont)
+ ;;(re-search-forward "[^\\?]*\\?")
+ (re-search-forward "[^\\?]*\\(\\?\\|\n\\)")
+ (if (not (viper-looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\\\?"))
+ (setq cont nil))
+ (backward-char 1)
+ (if (not (looking-at "\n")) (forward-char 1))))
+ (setq ex-token-type 'search-backward)
+ (setq ex-token (buffer-substring (1- (point)) (mark t))))
+ ((looking-at ",")
+ (forward-char 1)
+ (setq ex-token-type 'comma))
+ ((looking-at ";")
+ (forward-char 1)
+ (setq ex-token-type 'semi-colon))
+ ((looking-at "[!=><&~]")
+ (setq ex-token-type 'command)
+ (setq ex-token (char-to-string (following-char)))
+ (forward-char 1))
+ ((looking-at "'")
+ (setq ex-token-type 'goto-mark)
+ (forward-char 1)
+ (cond ((looking-at "'") (setq ex-token nil))
+ ((looking-at "[a-z]") (setq ex-token (following-char)))
+ (t (error "Marks are ' and a-z")))
+ (forward-char 1))
+ ((looking-at "\n")
+ (setq ex-token-type 'end-mark)
+ (setq ex-token "goto"))
+ (t
+ (error viper-BadExCommand))))))
;; Reads Ex command. Tries to determine if it has to exit because command
;; is complete or invalid. If not, keeps reading command.