comparison lisp/progmodes/cc-engine.el @ 107617:c5f9e4613394

Merge from mainline.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 16 Jan 2010 06:57:09 -0500
parents 855f55740303
children 719b13c3b762
comparison
equal deleted inserted replaced
107616:fa5ad3eee9f5 107617:c5f9e4613394
1 ;;; cc-engine.el --- core syntax guessing engine for CC mode 1 ;;; cc-engine.el --- core syntax guessing engine for CC mode
2 2
3 ;; Copyright (C) 1985, 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 3 ;; Copyright (C) 1985, 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
4 ;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 4 ;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
5 ;; Free Software Foundation, Inc. 5 ;; Free Software Foundation, Inc.
6 6
7 ;; Authors: 2001- Alan Mackenzie 7 ;; Authors: 2001- Alan Mackenzie
8 ;; 1998- Martin Stjernholm 8 ;; 1998- Martin Stjernholm
9 ;; 1992-1999 Barry A. Warsaw 9 ;; 1992-1999 Barry A. Warsaw
445 (defsubst c-put-c-type-property (pos value) 445 (defsubst c-put-c-type-property (pos value)
446 ;; Put a c-type property with the given value at POS. 446 ;; Put a c-type property with the given value at POS.
447 (c-put-char-property pos 'c-type value)) 447 (c-put-char-property pos 'c-type value))
448 448
449 (defun c-clear-c-type-property (from to value) 449 (defun c-clear-c-type-property (from to value)
450 ;; Remove all occurences of the c-type property that has the given 450 ;; Remove all occurrences of the c-type property that has the given
451 ;; value in the region between FROM and TO. VALUE is assumed to not 451 ;; value in the region between FROM and TO. VALUE is assumed to not
452 ;; be nil. 452 ;; be nil.
453 ;; 453 ;;
454 ;; Note: This assumes that c-type is put on single chars only; it's 454 ;; Note: This assumes that c-type is put on single chars only; it's
455 ;; very inefficient if matching properties cover large regions. 455 ;; very inefficient if matching properties cover large regions.
553 "Move to the start of the current statement or declaration, or to 553 "Move to the start of the current statement or declaration, or to
554 the previous one if already at the beginning of one. Only 554 the previous one if already at the beginning of one. Only
555 statements/declarations on the same level are considered, i.e. don't 555 statements/declarations on the same level are considered, i.e. don't
556 move into or out of sexps (not even normal expression parentheses). 556 move into or out of sexps (not even normal expression parentheses).
557 557
558 If point is already at the earliest statment within braces or parens, 558 If point is already at the earliest statement within braces or parens,
559 this function doesn't move back into any whitespace preceding it; it 559 this function doesn't move back into any whitespace preceding it; it
560 returns 'same in this case. 560 returns 'same in this case.
561 561
562 Stop at statement continuation tokens like \"else\", \"catch\", 562 Stop at statement continuation tokens like \"else\", \"catch\",
563 \"finally\" and the \"while\" in \"do ... while\" if the start point 563 \"finally\" and the \"while\" in \"do ... while\" if the start point
603 comment at the start of cc-engine.el for more info." 603 comment at the start of cc-engine.el for more info."
604 604
605 ;; The bulk of this function is a pushdown automaton that looks at statement 605 ;; The bulk of this function is a pushdown automaton that looks at statement
606 ;; boundaries and the tokens (such as "while") in c-opt-block-stmt-key. Its 606 ;; boundaries and the tokens (such as "while") in c-opt-block-stmt-key. Its
607 ;; purpose is to keep track of nested statements, ensuring that such 607 ;; purpose is to keep track of nested statements, ensuring that such
608 ;; statments are skipped over in their entirety (somewhat akin to what C-M-p 608 ;; statements are skipped over in their entirety (somewhat akin to what C-M-p
609 ;; does with nested braces/brackets/parentheses). 609 ;; does with nested braces/brackets/parentheses).
610 ;; 610 ;;
611 ;; Note: The position of a boundary is the following token. 611 ;; Note: The position of a boundary is the following token.
612 ;; 612 ;;
613 ;; Beginning with the current token (the one following point), move back one 613 ;; Beginning with the current token (the one following point), move back one
4392 ;; o The first token after bob. 4392 ;; o The first token after bob.
4393 ;; o The first token after the end of submatch 1 in 4393 ;; o The first token after the end of submatch 1 in
4394 ;; `c-decl-prefix-or-start-re' when that submatch matches. 4394 ;; `c-decl-prefix-or-start-re' when that submatch matches.
4395 ;; o The start of each `c-decl-prefix-or-start-re' match when 4395 ;; o The start of each `c-decl-prefix-or-start-re' match when
4396 ;; submatch 1 doesn't match. 4396 ;; submatch 1 doesn't match.
4397 ;; o The first token after the end of each occurence of the 4397 ;; o The first token after the end of each occurrence of the
4398 ;; `c-type' text property with the value `c-decl-end', provided 4398 ;; `c-type' text property with the value `c-decl-end', provided
4399 ;; `c-type-decl-end-used' is set. 4399 ;; `c-type-decl-end-used' is set.
4400 ;; 4400 ;;
4401 ;; Only a spot that match CFD-DECL-RE and whose face is in the 4401 ;; Only a spot that match CFD-DECL-RE and whose face is in the
4402 ;; CFD-FACE-CHECKLIST list causes CFD-FUN to be called. The face 4402 ;; CFD-FACE-CHECKLIST list causes CFD-FUN to be called. The face