Function: semantic-grammar-do-grammar-indent

semantic-grammar-do-grammar-indent is a byte-compiled function defined in grammar.el.gz.

Signature

(semantic-grammar-do-grammar-indent)

Documentation

Indent a line of grammar.

When called the point is not in Lisp code.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/grammar.el.gz
(defun semantic-grammar-do-grammar-indent ()
  "Indent a line of grammar.
When called the point is not in Lisp code."
  (let (indent n)
    (save-excursion
      (beginning-of-line)
      (skip-syntax-forward "-")
      (setq indent (current-column))
      (cond
       ((or (bobp)
            (looking-at "\\(\\w\\|\\s_\\)+\\s-*:")
            (and (looking-at "%")
                 (not (looking-at "%prec\\>"))))
        (setq n 0))
       ((looking-at ":")
        (setq n 2))
       ((and (looking-at ";;")
             (save-excursion (forward-comment (point-max))
                             (looking-at ":")))
        (setq n 1))
       (t
        (setq n (semantic-grammar-anchored-indentation))
        (unless (zerop n)
          (cond
           ((looking-at ";;")
            (setq n (1- n)))
           ((looking-at "[|;]")
            )
           (t
            (setq n (+ n 2)))))))
      (when (/= n indent)
        (beginning-of-line)
        (delete-horizontal-space)
        (indent-to n)))))