comparison lisp/progmodes/cc-langs.el @ 107086:1786f2e6a856

Change strategy for marking < and > as template delimiters: mark them strictly in matching pairs.
author Alan Mackenzie <acm@muc.de>
date Thu, 04 Feb 2010 21:15:37 +0000
parents 1d1d5d9bd884
children 18526db8f26d c18dffa2ba46
comparison
equal deleted inserted replaced
107085:d7831d04952b 107086:1786f2e6a856
389 table))) 389 table)))
390 (c-lang-defvar c++-template-syntax-table 390 (c-lang-defvar c++-template-syntax-table
391 (and (c-lang-const c++-make-template-syntax-table) 391 (and (c-lang-const c++-make-template-syntax-table)
392 (funcall (c-lang-const c++-make-template-syntax-table)))) 392 (funcall (c-lang-const c++-make-template-syntax-table))))
393 393
394 (c-lang-defconst c-no-parens-syntax-table
395 ;; A variant of the standard syntax table which is used to find matching
396 ;; "<"s and ">"s which have been marked as parens using syntax table
397 ;; properties. The other paren characters (e.g. "{", ")" "]") are given a
398 ;; non-paren syntax here. so that the list commands will work on "< ... >"
399 ;; even when there's unbalanced other parens inside them.
400 ;;
401 ;; This variable is nil for languages which don't have template stuff.
402 t `(lambda ()
403 (if (c-lang-const c-recognize-<>-arglists)
404 (let ((table (funcall ,(c-lang-const c-make-mode-syntax-table))))
405 (modify-syntax-entry ?\( "." table)
406 (modify-syntax-entry ?\) "." table)
407 (modify-syntax-entry ?\[ "." table)
408 (modify-syntax-entry ?\] "." table)
409 (modify-syntax-entry ?\{ "." table)
410 (modify-syntax-entry ?\} "." table)
411 table))))
412 (c-lang-defvar c-no-parens-syntax-table
413 (funcall (c-lang-const c-no-parens-syntax-table)))
414
394 (c-lang-defconst c-identifier-syntax-modifications 415 (c-lang-defconst c-identifier-syntax-modifications
395 "A list that describes the modifications that should be done to the 416 "A list that describes the modifications that should be done to the
396 mode syntax table to get a syntax table that matches all identifiers 417 mode syntax table to get a syntax table that matches all identifiers
397 and keywords as words. 418 and keywords as words.
398 419
421 table) 442 table)
422 "Syntax table built on the mode syntax table but additionally 443 "Syntax table built on the mode syntax table but additionally
423 classifies symbol constituents like '_' and '$' as word constituents, 444 classifies symbol constituents like '_' and '$' as word constituents,
424 so that all identifiers are recognized as words.") 445 so that all identifiers are recognized as words.")
425 446
426 (c-lang-defconst c-get-state-before-change-function 447 (c-lang-defconst c-get-state-before-change-functions
427 "If non-nil, a function called from c-before-change-hook. 448 ;; For documentation see the following c-lang-defvar of the same name.
428 Typically it will record enough state to allow 449 ;; The value here may be a list of functions or a single function.
450 t nil
451 c++ '(c-extend-region-for-CPP c-before-change-check-<>-operators)
452 (c objc) 'c-extend-region-for-CPP
453 ;; java 'c-before-change-check-<>-operators
454 awk 'c-awk-record-region-clear-NL)
455 (c-lang-defvar c-get-state-before-change-functions
456 (let ((fs (c-lang-const c-get-state-before-change-functions)))
457 (if (listp fs)
458 fs
459 (list fs)))
460 "If non-nil, a list of functions called from c-before-change-hook.
461 Typically these will record enough state to allow
429 `c-before-font-lock-function' to extend the region to fontify, 462 `c-before-font-lock-function' to extend the region to fontify,
430 and may do such things as removing text-properties which must be 463 and may do such things as removing text-properties which must be
431 recalculated. 464 recalculated.
432 465
433 It takes 2 parameters, the BEG and END supplied to every 466 These functions will be run in the order given. Each of them
467 takes 2 parameters, the BEG and END supplied to every
434 before-change function; on entry, the buffer will have been 468 before-change function; on entry, the buffer will have been
435 widened and match-data will have been saved; point is undefined 469 widened and match-data will have been saved; point is undefined
436 on both entry and exit; the return value is ignored. 470 on both entry and exit; the return value is ignored.
437 471
438 When the mode is initialized, this function is called with 472 The functions are called even when font locking isn't enabled.
439 parameters \(point-min) and \(point-max)." 473
440 t nil 474 When the mode is initialized, the functions are called with
441 (c c++ objc) 'c-extend-region-for-CPP 475 parameters \(point-min) and \(point-max).")
442 awk 'c-awk-record-region-clear-NL) 476
443 (c-lang-defvar c-get-state-before-change-function
444 (c-lang-const c-get-state-before-change-function))
445
446 (c-lang-defconst c-before-font-lock-function 477 (c-lang-defconst c-before-font-lock-function
447 "If non-nil, a function called just before font locking. 478 "If non-nil, a function called just before font locking.
448 Typically it will extend the region about to be fontified \(see 479 Typically it will extend the region about to be fontified \(see
449 below) and will set `syntax-table' text properties on the region. 480 below) and will set `syntax-table' text properties on the region.
450 481