Changeset 12099


Ignore:
Timestamp:
May 20, 2009, 12:00:39 PM (10 years ago)
Author:
gb
Message:

Parse the entire buffer every time. If this gets to be too slow,
we can make it smarter, but it's pretty stupid to give up on parsing
in (e.g.) the middle of a multiline string because we've reached some
arbitrary line limit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/cocoa-ide/hemlock/src/lispmode.lisp

    r11891 r12099  
    233233;;;; Parse block finders.
    234234
    235 (defhvar "Minimum Lines Parsed"
    236   "The minimum number of lines before and after the point parsed by Lisp mode."
    237   :value 50)
    238 (defhvar "Maximum Lines Parsed"
    239   "The maximum number of lines before and after the point parsed by Lisp mode."
    240   :value 500)
    241 (defhvar "Defun Parse Goal"
    242   "Lisp mode parses the region obtained by skipping this many defuns forward
    243    and backward from the point unless this falls outside of the range specified
    244    by \"Minimum Lines Parsed\" and \"Maximum Lines Parsed\"."
    245   :value 2)
    246 
    247 
    248 (macrolet ((frob (step end)
    249              `(let ((min (value minimum-lines-parsed))
    250                     (max (value maximum-lines-parsed))
    251                     (goal (value defun-parse-goal))
    252                     (last-defun nil))
    253                 (declare (fixnum min max goal))
    254                 (do ((line (mark-line mark) (,step line))
    255                      (count 0 (1+ count)))
    256                     ((null line)
    257                      (,end mark))
    258                   (declare (fixnum count))
    259                   (when (char= (line-character line 0) #\()
    260                     (setq last-defun line)
    261                     (decf goal)
    262                     (when (and (<= goal 0) (>= count min))
    263                       (line-start mark line)
    264                       (return)))
    265                   (when (> count max)
    266                     (line-start mark (or last-defun line))
    267                     (return))))))
    268 
    269   (defun start-of-parse-block (mark)
    270     (frob line-previous buffer-start))
    271 
    272   (defun end-of-parse-block (mark)
    273     (frob line-next buffer-end)))
     235
     236(defun start-of-parse-block (mark)
     237  (buffer-start mark))
     238
     239(defun end-of-parse-block (mark)
     240  (buffer-end mark))
    274241
    275242;;;
Note: See TracChangeset for help on using the changeset viewer.