• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/progmodes/

Lines Matching +defs:indent +defs:string

36 ;; To get keyword, comment, and string literal coloring, be sure that font-lock
103 string instead of a list. If a directory ends in \"...\" then that
105 :type 'string
108 (defcustom delphi-indent-level 3
112 // This is an indent of 3.
117 (defcustom delphi-compound-block-indent 0
120 // block indent = 0 vs // block indent = 2
130 (defcustom delphi-case-label-indent delphi-indent-level
133 // case indent = 0 vs // case indent = 3
156 line, insert a blank line and move to the default indent column of the blank
168 (defcustom delphi-string-face 'font-lock-string-face
217 '(string double-quoted-string)
218 "Tokens that represent string literals.")
273 "Unit sections within which the indent is 0.")
360 (defun delphi-string-of (start end)
361 ;; Returns the buffer string from start to end.
364 (defun delphi-looking-at-string (p s)
365 ;; True if point p marks the start of string s. s is not a regular
369 (string= s (delphi-string-of p limit)))))
399 (defun delphi-token-string (token)
400 ;; Returns the string image of the token.
402 (delphi-string-of (delphi-token-start token) (delphi-token-end token))
416 ((delphi-is token-kind delphi-strings) delphi-string-face)
483 (string . "'")
484 (double-quoted-string . "\"")))))
492 (string . "'")
493 (double-quoted-string . "\"")))))
503 (string . "['\n]")
504 (double-quoted-string . "[\"\n]")))))
511 (delphi-looking-at-string p pattern))))
519 (and (delphi-looking-at-string (- p (length pattern)) pattern)
521 ;; Special case: string delimiters are start/end ambiguous.
522 ;; We have an end only if there is some string content (at
558 ;; Searches for the next literal region (i.e. comment or string) and sets the
577 ((match-beginning 4) 'string)
578 ((match-beginning 5) 'double-quoted-string)))
633 (let* ((word-image (downcase (delphi-token-string word)))
635 (when (and (or keyword (string= "nil" word-image))
640 (defun delphi-explicit-token-at (p token-string kind)
641 ;; If point p is anywhere in the token string then returns the resulting
643 (let ((token (delphi-charset-token-at p token-string kind)))
644 (when (and token (string= token-string (delphi-token-string token)))
790 (defun delphi-indent-of (token &optional offset)
792 (let ((indent (+ (delphi-column-of (delphi-token-start token))
797 "\n column: %d indent: %d offset: %d")
798 token (delphi-token-string token)
800 indent (if offset offset 0)))
801 indent))
803 (defun delphi-line-indent-of (from-token &optional offset &rest terminators)
824 (delphi-indent-of last-token offset)))
826 (defun delphi-stmt-line-indent-of (from-token &optional offset)
827 ;; Like `delphi-line-indent-of' except is also stops on a use clause, and
851 (delphi-indent-of last-token offset)))
853 (defun delphi-open-group-indent (token last-token &optional offset)
854 ;; Returns the indent relative to an unmatched ( or [.
857 (delphi-indent-of last-token offset)
859 (delphi-stmt-line-indent-of token delphi-indent-level))))
1011 (defun delphi-comment-indent-of (comment)
1017 (delphi-enclosing-indent-of comment)
1023 (delphi-indent-of start-comment))
1028 (delphi-indent-of comment))
1073 (defun delphi-previous-indent-of (from-token)
1084 ;; An open ( or [ always is an indent point.
1086 (throw 'done (delphi-open-group-indent token last-token)))
1100 ;; are in some kind of uses clause, and thus indent to column 0. This
1117 (throw 'done (delphi-stmt-line-indent-of last-token 0)))
1122 ;; Remember any ':' we encounter, since that affects how we indent to
1126 ;; A case statement delimits a previous statement. We indent labels
1130 (if last-colon (delphi-line-indent-of last-colon)
1131 (delphi-line-indent-of token delphi-case-label-indent))))
1140 (delphi-indent-of last-token)
1142 (delphi-line-indent-of token delphi-indent-level))
1144 (delphi-line-indent-of token))))
1146 ;; Assembly sections always indent in from the asm keyword.
1148 (throw 'done (delphi-stmt-line-indent-of token delphi-indent-level)))
1151 ;; We try to use the existing indent of the previous statement,
1155 ;; Otherwise indent to the last token
1156 (delphi-line-indent-of last-token)
1157 ;; Just indent from the enclosing keyword
1158 (delphi-line-indent-of token delphi-indent-level))))
1166 (delphi-line-indent-of token)
1169 (delphi-line-indent-of last-token delphi-indent-level))))
1173 (throw 'done (delphi-stmt-line-indent-of token 0)))
1181 (defun delphi-section-indent-of (section-token)
1196 (throw 'done (delphi-open-group-indent token last-token)))
1226 ;; Enclosing body statements are delimiting. We indent the compound
1231 (delphi-stmt-line-indent-of token delphi-compound-block-indent)))
1241 (delphi-stmt-line-indent-of token delphi-indent-level)))
1246 (delphi-stmt-line-indent-of token delphi-indent-level)))
1252 (throw 'done (delphi-line-indent-of token 0)))
1254 ;; Unit statements mean we indent right to the left.
1263 (defun delphi-enclosing-indent-of (from-token)
1277 ;; An open ( or [ always is an indent point.
1280 (delphi-open-group-indent
1285 delphi-indent-level))))
1297 ;; should be the actual indent point.
1301 ;; With a non-delimited expression statement we indent after the
1308 (delphi-stmt-line-indent-of token 0))
1312 (delphi-indent-of last-token))
1316 (delphi-indent-of last-token delphi-indent-level))
1319 ((delphi-indent-of token delphi-indent-level)))))
1328 (delphi-stmt-line-indent-of
1329 stmt-start delphi-indent-level)
1331 (delphi-stmt-line-indent-of
1332 token delphi-case-label-indent))))
1339 (delphi-stmt-line-indent-of
1340 (or stmt-start token) delphi-indent-level)))
1345 (throw 'done (delphi-stmt-line-indent-of
1346 (or last-token token) delphi-indent-level)))
1348 ;; We indent relative to an enclosing declaration section.
1350 (throw 'done (delphi-indent-of (if last-token last-token token)
1351 delphi-indent-level)))
1353 ;; In unit sections we indent right to the left.
1363 (delphi-indent-of last-token))
1367 (delphi-indent-of last-token delphi-indent-level))
1370 ;; indent.
1371 ((delphi-previous-indent-of token)))))
1382 (cond (last-token (delphi-indent-of last-token delphi-indent-level))
1384 ((+ (delphi-section-indent-of token) delphi-indent-level)))))
1386 ;; Assembly sections always indent in from the asm keyword.
1388 (throw 'done (delphi-stmt-line-indent-of token delphi-indent-level)))
1390 ;; Stop at an enclosing statement and indent from it.
1392 (throw 'done (delphi-stmt-line-indent-of
1393 (or last-token token) delphi-indent-level)))
1398 (delphi-line-indent-of last-token delphi-indent-level)))
1400 ;; A ":" we indent relative to its line beginning. If we are in a
1409 (delphi-indent-of last-token delphi-indent-level)
1410 (delphi-line-indent-of token delphi-indent-level 'semicolon))))
1413 ;; then indent from the "=". Ignore :=, however.
1426 ;;(throw 'done (delphi-indent-of before-equals 0)))
1428 ;; Assignments (:=) we skip over to get a normal indent.
1431 ;; Otherwise indent in from the equals.
1433 (delphi-indent-of before-equals delphi-indent-level)))))
1455 (indent
1458 (delphi-indent-of (delphi-group-start token)))
1464 (delphi-comment-indent-of token))
1467 ;; Use a previous section/routine's indent.
1468 (delphi-section-indent-of token))
1475 ;; When trailing a body statement, indent to
1478 (delphi-section-indent-of block-start))
1480 ;; Otherwise just indent to the block start.
1481 ((delphi-stmt-line-indent-of block-start 0)))))
1485 (delphi-stmt-line-indent-of (delphi-else-start token) 0))
1487 ;; Otherwise indent in from enclosing statement.
1488 ((delphi-enclosing-indent-of
1491 indent)))
1493 (defun delphi-indent-line ()
1495 before the indent, the point is moved to the indent."
1501 (old-indent 0)
1502 (new-indent 0))
1506 (setq old-indent (current-column))
1507 (setq new-indent (delphi-corrected-indentation))
1509 ;; If before the indent column, then move to it.
1513 (when (/= old-indent new-indent)
1515 (insert (make-string new-indent ?\s)))
1543 (defun delphi-debug-log (format-string &rest args)
1548 (concat (format-time-string "%H:%M:%S " (current-time))
1549 (apply #'format (cons format-string args))
1552 (defun delphi-debug-token-string (token)
1553 (let* ((image (delphi-token-string token))
1554 (has-newline (string-match "^\\([^\n]*\\)\n\\(.+\\)?$" image)))
1556 (setq image (concat (match-string 1 image)
1563 (delphi-debug-log "Token: %S %S" token (delphi-debug-token-string token))))
1578 (defun delphi-debug-show-current-string (from to)
1636 "Terminate the current line with a newline and indent the next, unless
1646 (delphi-indent-line))
1647 (delphi-indent-line)))
1657 (delphi-indent-line)
1682 (if (and (string= unit-file (downcase file))
1706 (if (string-match "^\\(.+\\)\\.\\.\\.$" dir-name)
1707 (setq dir-name (match-string 1 dir-name)
1710 (if (string-match "^\\(.+\\)[\\\\/]$" dir-name)
1711 (setq dir-name (match-string 1 dir-name)))
1735 (let* ((unit-file (if (string-match "^\\(.*\\)\\.[a-z]+$" unit)
1780 (content-indent (delphi-column-of content-start))
1781 (content-prefix (make-string content-indent ?\s))
1788 (let ((comment-indent (delphi-column-of comment-start)))
1789 (concat (make-string comment-indent ?\s) "//"
1790 (make-string (- content-indent comment-indent 2)
1823 (let ((fill-column (- fill-column content-indent)))
1863 (concat (make-string (delphi-column-of comment-start) ?\s) "//"
1864 (make-string (- content-start comment-start 2) ?\s))))
1870 ;; Sets the match region used by (match-string 0) and friends to the token's
1898 ("s" delphi-debug-show-current-string)
1929 This is ok since we do our own keyword/comment/string face coloring.")
1939 M-x indent-region also works for indenting a whole region.
1943 `delphi-indent-level' (default 3)
1945 `delphi-compound-block-indent' (default 0)
1947 `delphi-case-label-indent' (default 0)
1954 line, insert a blank line and move to the default indent column of the
1965 `delphi-string-face' (default font-lock-string-face)
1989 (list '(indent-line-function delphi-indent-line)
1990 '(comment-indent-function delphi-indent-line)