(beginning-of-line)
(looking-at ada-compile-goto-error-file-linenr-re))
(save-excursion
- (if (looking-at "\\([0-9]+\\)") (backward-word 1))
+ (if (looking-at "\\([0-9]+\\)") (backward-word-strictly 1))
(looking-at "line \\([0-9]+\\)"))))
)
(let ((line (if (match-beginning 2) (match-string 2) (match-string 1)))
(save-excursion
(let ((aa-end (point)))
(ada-adjust-case-region
- (progn (goto-char (symbol-value 'beg)) (forward-word -1) (point))
+ (progn (goto-char (symbol-value 'beg)) (forward-word-strictly -1)
+ (point))
(goto-char aa-end)))))
(defun ada-region-selected ()
(save-excursion
(skip-syntax-backward "w")
(setq word (buffer-substring-no-properties
- (point) (save-excursion (forward-word 1) (point)))))))
+ (point) (save-excursion (forward-word-strictly 1)
+ (point)))))))
;; Reread the exceptions file, in case it was modified by some other,
(ada-case-read-exceptions-from-file file-name)
(skip-syntax-backward "w")
(setq word (buffer-substring-no-properties
(point)
- (save-excursion (forward-word 1) (point))))))
+ (save-excursion (forward-word-strictly 1)
+ (point))))))
(modify-syntax-entry ?_ (make-string 1 underscore-syntax)
(syntax-table))))))
;; do not add it again. This way, the user can easily decide which
;; priority should be applied to each casing exception
(let ((word (buffer-substring-no-properties
- (point) (save-excursion (forward-word 1) (point)))))
+ (point) (save-excursion (forward-word-strictly 1)
+ (point)))))
;; Handling a substring ?
(if (char-equal (string-to-char word) ?*)
(defun ada-after-keyword-p ()
"Return t if cursor is after a keyword that is not an attribute."
(save-excursion
- (forward-word -1)
+ (forward-word-strictly -1)
(and (not (and (char-before)
(or (= (char-before) ?_)
(= (char-before) ?'))));; unless we have a _ or '
(goto-char apos)
(ada-goto-next-non-ws)
(while (looking-at "\\<\\(in\\|out\\|access\\)\\>")
- (forward-word 1)
+ (forward-word-strictly 1)
(ada-goto-next-non-ws))
;; read type of parameter
(forward-comment -1000)
(if (= (char-before) ?\))
(forward-sexp -1)
- (forward-word -1))
+ (forward-word-strictly -1))
;; If there is a parameter list, and we have a function declaration
;; or a access to subprogram declaration
(if (and (= (following-char) ?\()
(save-excursion
(or (progn
- (backward-word 1)
+ (backward-word-strictly 1)
(looking-at "\\(function\\|procedure\\)\\>"))
(progn
- (backward-word 1)
+ (backward-word-strictly 1)
(setq num-back 2)
(looking-at "\\(function\\|procedure\\)\\>")))))
;; The indentation depends of the value of ada-indent-return
(if (<= (eval var) 0)
(list (point) (list '- var))
- (list (progn (backward-word num-back) (point))
+ (list (progn (backward-word-strictly num-back) (point))
var))
;; Else there is no parameter list, but we have a function
;; Only do something special if the user want to indent
;; relative to the "function" keyword
(if (and (> (eval var) 0)
- (save-excursion (forward-word -1)
+ (save-excursion (forward-word-strictly -1)
(looking-at "function\\>")))
- (list (progn (forward-word -1) (point)) var)
+ (list (progn (forward-word-strictly -1) (point)) var)
;; Else...
(ada-indent-on-previous-lines nil orgpoint orgpoint)))))))
;; avoid "with procedure"... in generic parts
(save-excursion
- (forward-word -1)
+ (forward-word-strictly -1)
(setq found (not (looking-at "with"))))))
(cond
;; yes, look what's following 'end'
(progn
- (forward-word 1)
+ (forward-word-strictly 1)
(ada-goto-next-non-ws)
(cond
;;
(save-excursion
(ada-check-matching-start (match-string 0))
;; we are now looking at the matching "record" statement
- (forward-word 1)
+ (forward-word-strictly 1)
(ada-goto-stmt-start)
;; now on the matching type declaration, or use clause
(unless (looking-at "\\(for\\|type\\)\\>")
(looking-at "\\<then\\>"))
(setq cur-indent (save-excursion (back-to-indentation) (point))))
;; skip 'then'
- (forward-word 1)
+ (forward-word-strictly 1)
(list cur-indent 'ada-indent))
(list cur-indent 'ada-broken-indent))))
(let ((pos nil))
(cond
((save-excursion
- (forward-word 1)
+ (forward-word-strictly 1)
(setq pos (ada-goto-next-non-ws orgpoint)))
(goto-char pos)
(save-excursion
(and
(goto-char (match-end 0))
(ada-goto-next-non-ws orgpoint)
- (forward-word 1)
- (if (= (char-after) ?') (forward-word 1) t)
+ (forward-word-strictly 1)
+ (if (= (char-after) ?') (forward-word-strictly 1) t)
(ada-goto-next-non-ws orgpoint)
(looking-at "\\<use\\>")
;;
"end" nil orgpoint nil 'word-search-forward))
(ada-goto-next-non-ws)
(looking-at "\\<record\\>")
- (forward-word 1)
+ (forward-word-strictly 1)
(ada-goto-next-non-ws)
(= (char-after) ?\;)))
(goto-char (car match-dat))
(save-excursion
(ada-goto-previous-word)
(looking-at "\\<\\(end\\|or\\|and\\)\\>[ \t]*[^;]")))
- (forward-word -1))
+ (forward-word-strictly -1))
((looking-at "is")
(setq found
((looking-at "private")
(save-excursion
- (backward-word 1)
+ (backward-word-strictly 1)
(setq found (not (looking-at "is")))))
(t
(if (looking-at "\\<declare\\>")
(progn
(forward-comment -1)
- (backward-word 1))
+ (backward-word-strictly 1))
;;
;; no, => 'procedure'/'function'/'task'/'protected'
;;
(progn
- (forward-word 2)
- (backward-word 1)
+ (forward-word-strictly 2)
+ (backward-word-strictly 1)
;;
;; skip 'body' 'type'
;;
(if (looking-at "\\<\\(body\\|type\\)\\>")
- (forward-word 1))
+ (forward-word-strictly 1))
(forward-sexp 1)
(backward-sexp 1)))
;;
;;
((looking-at "if")
(save-excursion
- (forward-word -1)
+ (forward-word-strictly -1)
(unless (looking-at "\\<end[ \t\n]*if\\>")
(progn
(setq nest-count (1- nest-count))
;;
((looking-at "when")
(save-excursion
- (forward-word -1)
+ (forward-word-strictly -1)
(unless (looking-at "\\<exit[ \t\n]*when\\>")
(progn
(if stop-at-when
(unless (and (looking-at "\\<record\\>")
(save-excursion
- (forward-word -1)
+ (forward-word-strictly -1)
(looking-at "\\<null\\>")))
(progn
;; calculate nest-depth
(number-to-string (count-lines 1 (1+ current)))))))
(unless (looking-at "renames")
(progn
- (forward-word 1)
+ (forward-word-strictly 1)
(ada-goto-next-non-ws)
;; ignore it if it is only a declaration with 'new'
;; We could have package Foo is new ....
;; found task start => check if it has a body
((looking-at "task")
(save-excursion
- (forward-word 1)
+ (forward-word-strictly 1)
(ada-goto-next-non-ws)
(cond
((looking-at "\\<body\\>"))
((looking-at "\\<type\\>")
;; In that case, do nothing if there is a "is"
- (forward-word 2);; skip "type"
+ (forward-word-strictly 2);; skip "type"
(ada-goto-next-non-ws);; skip type name
;; Do nothing if we are simply looking at a simple
(t
;; Check if that task declaration had a block attached to
;; it (i.e do nothing if we have just "task name;")
- (unless (progn (forward-word 1)
+ (unless (progn (forward-word-strictly 1)
(looking-at "[ \t]*;"))
(setq nest-count (1- nest-count))))))
(setq last-was-begin (cdr last-was-begin))
;;
;; calculate nest-depth
;;
- (backward-word 1)
+ (backward-word-strictly 1)
(cond
;; procedures and functions need to be processed recursively, in
;; case they are defined in a declare/begin block, as in:
((and (looking-at "\\<procedure\\|function\\>"))
(if first
- (forward-word 1)
+ (forward-word-strictly 1)
(setq pos (point))
(ada-search-ignore-string-comment "is\\|;")
(skip-chars-forward "end")
(ada-goto-next-non-ws)
(looking-at "\\<\\(loop\\|select\\|record\\|case\\|if\\)\\>"))
- (forward-word 1)))
+ (forward-word-strictly 1)))
;; found package start => check if it really starts a block, and is not
;; in fact a generic instantiation for instance
(if (not first)
(setq nest-count (1+ nest-count)))
(setq found (<= nest-count 0))
- (forward-word 1))) ; end of 'cond'
+ (forward-word-strictly 1))) ; end of 'cond'
(setq first nil))
(save-excursion
(and (looking-at "\\<or\\>")
(progn
- (forward-word 1)
+ (forward-word-strictly 1)
(ada-goto-stmt-start)
(looking-at "\\<or\\>")))))
(progn (forward-comment -1000)
(and (not (bobp))
(or (= (char-before) ?\;)
- (and (forward-word -3)
+ (and (forward-word-strictly -3)
(looking-at "\\<package\\>"))))))))
(skip-chars-backward " \t\n")
(if (= (char-before) ?\")
(backward-char 3)
- (backward-word 1))
+ (backward-word-strictly 1))
t)
;; and now over the second one
- (backward-word 1)
+ (backward-word-strictly 1)
;; We should ignore the case when the reserved keyword is in a
;; comment (for instance, when we have:
If BACKWARDP is non-nil, search backward; search forward otherwise."
(let (result)
(while (and (setq result (ada-search-ignore-string-comment regexp backwardp))
- (save-excursion (forward-word -1)
+ (save-excursion (forward-word-strictly -1)
(looking-at "and then\\|or else"))))
result))
(ada-in-string-or-comment-p)
(and (progn
(or (looking-at "[ \t]*\\<end\\>")
- (backward-word 1))
+ (backward-word-strictly 1))
(or (looking-at "[ \t]*\\<end\\>")
- (backward-word 1))
+ (backward-word-strictly 1))
(or (looking-at "[ \t]*\\<end\\>")
(error "Not on end ...;")))
(ada-goto-matching-start 1)
((save-excursion
(and (ada-goto-stmt-start)
(looking-at "\\<task\\>" )
- (forward-word 1)
+ (forward-word-strictly 1)
(ada-goto-next-non-ws)
(looking-at "\\<body\\>")))
(ada-search-ignore-string-comment "begin" nil nil nil
(skip-chars-forward " \t\n")
(if (looking-at "return")
(progn
- (forward-word 1)
+ (forward-word-strictly 1)
(skip-chars-forward " \t\n")
(skip-chars-forward "a-zA-Z0-9_'")))
((or (looking-at "^[ \t]*procedure")
(setq func-found (looking-at "^[ \t]*function")))
;; treat it as a proc/func
- (forward-word 2)
- (forward-word -1)
+ (forward-word-strictly 2)
+ (forward-word-strictly -1)
(setq procname (buffer-substring (point) (cdr match))) ; store proc name
;; goto end of procname
;; if function, skip over 'return' and result type.
(if func-found
(progn
- (forward-word 1)
+ (forward-word-strictly 1)
(skip-chars-forward " \t\n")
(setq functype (buffer-substring (point)
(progn
(if (looking-at "^[ \t]*task")
(progn
(message "Task conversion is not yet implemented")
- (forward-word 2)
+ (forward-word-strictly 2)
(if (looking-at "[ \t]*;")
(forward-line)
(ada-move-to-end))