Lines Matching +defs:indent +defs:spaces
30 ;; $XFree86: xc/programs/xedit/lisp/modules/indent.lsp,v 1.6 2003/01/16 03:50:46 paulo Exp $
33 (provide "indent")
37 (defconstant indent-spaces '(#\Tab #\Space))
42 ;; indent
43 ;; Number of spaces to insert
49 (defun indent-text (indent offset &optional no-tabs
50 &aux start line length index current tabs spaces string
64 (and (minusp indent) (setq indent 0))
66 ;; Skip any spaces after offset, "paranoia check"
67 (while (member (char-after offset) indent-spaces)
71 ;; Check if there are only spaces before `offset' and the line `start'
72 (while (and (>= index 0) (member (char line index) indent-spaces))
76 ;; `index' will be zero if there are only spaces in the `line'
88 (and (> base indent) (return-from indent-text nil))
101 ;; correct, removing spaces "inside" tabs.
102 (when (/= indent current)
105 length (- indent base)
110 (multiple-value-setq (tabs spaces) (floor (- indent base) 8))
112 length (+ tabs spaces)
124 (compile 'indent-text)
138 (indent 0))
143 (incf indent (- 8 (rem indent 8)))
146 (incf indent)
148 (return indent)
152 (return indent)
159 (dotimes (i (length line) indent)
161 (incf indent (- 8 (rem indent 8)))
163 (or align (member char indent-spaces)
164 (return indent)
166 (incf indent)
179 (defun default-indent (syntax syntable)
197 (gethash :disable-indent (syntax-options syntax))
202 (return-from default-indent)
218 #'(lambda (char) (member char indent-spaces))
223 ;; indent the current line
224 (indent-text (offset-indentation (+ left start) :align t) offset)
230 (compile 'default-indent)
236 (defun indent-clear-empty-line (&aux left offset right line index)
249 (while (and (>= index 0) (member (char line index) indent-spaces))
252 ;; If line was only spaces
261 (defmacro indent-macro-terminate (&optional result)
266 ;; Like indent-terminate, but "rejects" the input for the current line
269 (defmacro indent-macro-reject (&optional result)
277 ;; Like indent-reject, but "rejects" anything before the current token
279 (defmacro indent-macro-reject-left (&optional result)
336 (defstruct indent
352 (setq ,variable (compile-indent-table ,label ,@lists))
359 ;; Create an indent token.
395 (error "INDTABLE: invalid indent table argument ~A" item)
399 ;; return indent table structure
415 (error "INDAUGMENT: bad indent table label ~A" keyword)
441 (or (listp rule) (error "INDREDUCE: invalid indent rule ~A" rule))
482 ;; result of macro, return indent reduce structure
503 ;; result of macro, return indent resolve structure
512 ;; Helper function for compile-indent-table. Returns a list of all
532 (defun compile-indent-augment-list (table table-list &aux labels augment tokens)
545 ;; Check if the specified indent tables exists!
560 ;; to the indent table in the second pass.
565 (compile-indent-augment-list child table-list)
573 (defun link-indent-augment-list (table)
589 (link-indent-augment-list child)
594 ;; Compile the indent reduction rules
596 (defun compile-indent-reduces (reduces
655 ;; Compile the indent resolve code
657 (defun compile-indent-resolves (resolves &aux match resolve resolve-code)
695 (defun compile-indent-table (name &rest lists
719 ;; Check for typos in the keywords, or for not defined indent tables.
735 (compile-indent-augment-list main tables)
736 (link-indent-augment-list main)
738 ;; Change switch and begin fields to point to the indent table
780 (compile-indent-reduces reduces)
783 (make-indent
791 :resolve-code (compile-indent-resolves resolves)
800 (defun indent-search-rule (rule-pattern match-pattern
941 (compile 'indent-search-rule)
946 (defmacro indent-macro (ind-definition ind-offset &optional ind-no-tabs)
950 (ind-table (car (indent-tables ,ind-definition)))
953 (ind-reduces (indent-reduces ,ind-definition))
962 (*indent* 0)
998 ;; For use with (indent-macro-reject)
1035 ,@(indent-inits (eval ind-definition))
1043 ;; know before entering indent parser, but useful inside
1044 ;; indent macros.
1218 ,(indent-token-code (eval ind-definition))
1248 (car (indent-tables ,ind-definition))
1263 ;; If current "indent pattern table" changed
1296 (indent-search-rule rule ind-change)
1348 ,(indent-check-code (eval ind-definition))
1393 ,(indent-reduce-code (eval ind-definition))
1416 ,(indent-resolve-code (eval ind-definition))
1421 (and (integerp *indent*)
1423 (indent-text *indent* *offset* ,ind-no-tabs)