Function: dcl-get-line-type

dcl-get-line-type is a byte-compiled function defined in dcl-mode.el.gz.

Signature

(dcl-get-line-type)

Documentation

Determine the type of the current line.

Returns one of the following symbols:
  $ for a complete command line or the beginning of a command line.
  - for a continuation line
  $! for a comment line
  data for a data line
  empty-data for an empty line following a data line
  empty-$ for an empty line following a command line

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/dcl-mode.el.gz
;;; *** Support for indentation *********************************************


(defun dcl-get-line-type ()
  "Determine the type of the current line.
Returns one of the following symbols:
  $          for a complete command line or the beginning of a command line.
  -          for a continuation line
  $!         for a comment line
  data       for a data line
  empty-data for an empty line following a data line
  empty-$    for an empty line following a command line"
  (or
   ;; Check if it's a comment line.
   ;; A comment line starts with $!
   (save-excursion
    (beginning-of-line)
    (if (looking-at dcl-comment-line-regexp)
        '$!))
   ;; Check if it's a command line.
   ;; A command line starts with $
   (save-excursion
     (beginning-of-line)
     (if (looking-at "^\\$")
         '$))
   ;; Check if it's a continuation line
   (save-excursion
     (beginning-of-line)
     ;; If we're at the beginning of the buffer it can't be a continuation
     (if (bobp)
         ()
       (let ((opoint (point)))
         (dcl-beginning-of-statement)
         (re-search-forward dcl-command-regexp opoint t)
         (if (>= (point) opoint)
             '-))))
   ;; Empty lines might be different things
   (save-excursion
     (if (and (bolp) (eolp))
         (if (bobp)
             'empty-$
           (forward-line -1)
           (let ((type (dcl-get-line-type)))
             (cond
              ((or (equal type '$) (equal type '$!) (equal type '-))
               'empty-$)
              ((equal type 'data)
               'empty-data))))))
   ;; Anything else must be a data line
   (progn 'data)
   ))