comparison lisp/progmodes/cc-engine.el @ 109599:c18dffa2ba46

Enhance Java Mode to handle Java 5.0 (Tiger) and Java 6 (Mustang). Contributed by Nathaniel Flath.
author Alan Mackenzie <acm@muc.de>
date Sat, 31 Jul 2010 20:01:08 +0000
parents bfaf9e31b45e
children 012ed5d2e4dd
comparison
equal deleted inserted replaced
109598:ec823851a46c 109599:c18dffa2ba46
5399 (when (consp c-record-found-types) 5399 (when (consp c-record-found-types)
5400 (setq c-record-type-identifiers 5400 (setq c-record-type-identifiers
5401 ;; `nconc' doesn't mind that the tail of 5401 ;; `nconc' doesn't mind that the tail of
5402 ;; `c-record-found-types' is t. 5402 ;; `c-record-found-types' is t.
5403 (nconc c-record-found-types c-record-type-identifiers))) 5403 (nconc c-record-found-types c-record-type-identifiers)))
5404 (if (c-major-mode-is 'java-mode) (c-fontify-recorded-types-and-refs))
5404 t) 5405 t)
5405 5406
5406 (goto-char start) 5407 (goto-char start)
5407 nil))) 5408 nil)))
5408 5409
5418 ;; on successful completion. 5419 ;; on successful completion.
5419 (c-record-found-types c-record-found-types) 5420 (c-record-found-types c-record-found-types)
5420 ;; List that collects the positions after the argument 5421 ;; List that collects the positions after the argument
5421 ;; separating ',' in the arglist. 5422 ;; separating ',' in the arglist.
5422 arg-start-pos) 5423 arg-start-pos)
5423
5424 ;; If the '<' has paren open syntax then we've marked it as an angle 5424 ;; If the '<' has paren open syntax then we've marked it as an angle
5425 ;; bracket arglist before, so skip to the end. 5425 ;; bracket arglist before, so skip to the end.
5426 (if (and (not c-parse-and-markup-<>-arglists) 5426 (if (and (not c-parse-and-markup-<>-arglists)
5427 (c-get-char-property (point) 'syntax-table)) 5427 (c-get-char-property (point) 'syntax-table))
5428 5428
5429 (progn 5429 (progn
5430 (forward-char) 5430 (forward-char)
5431 (if (and (c-go-up-list-forward) 5431 (if (and (c-go-up-list-forward)
5432 (eq (char-before) ?>)) 5432 (eq (char-before) ?>))
5433 t 5433 t
5434
5435 ;; Got unmatched paren angle brackets. We don't clear the paren 5434 ;; Got unmatched paren angle brackets. We don't clear the paren
5436 ;; syntax properties and retry, on the basis that it's very 5435 ;; syntax properties and retry, on the basis that it's very
5437 ;; unlikely that paren angle brackets become operators by code 5436 ;; unlikely that paren angle brackets become operators by code
5438 ;; manipulation. It's far more likely that it doesn't match due 5437 ;; manipulation. It's far more likely that it doesn't match due
5439 ;; to narrowing or some temporary change. 5438 ;; to narrowing or some temporary change.
5440 (goto-char start) 5439 (goto-char start)
5441 nil)) 5440 nil))
5442 5441
5443 (forward-char) 5442 (forward-char)
5443
5444 (unless (looking-at c-<-op-cont-regexp) 5444 (unless (looking-at c-<-op-cont-regexp)
5445 (while (and 5445 (while (and
5446 (progn 5446 (progn
5447 5447 (c-forward-syntactic-ws)
5448 (when c-record-type-identifiers 5448 (let ((orig-record-found-types c-record-found-types))
5449 (if all-types 5449 (when (or (and c-record-type-identifiers all-types)
5450 5450 (c-major-mode-is 'java-mode))
5451 ;; All encountered identifiers are types, so set the 5451 ;; All encountered identifiers are types, so set the
5452 ;; promote flag and parse the type. 5452 ;; promote flag and parse the type.
5453 (progn 5453 (progn
5454 (c-forward-syntactic-ws) 5454 (c-forward-syntactic-ws)
5455 (when (looking-at c-identifier-start) 5455 (if (looking-at "\\?")
5456 (let ((c-promote-possible-types t)) 5456 (forward-char)
5457 (c-forward-type)))) 5457 (when (looking-at c-identifier-start)
5458 5458 (let ((c-promote-possible-types t)
5459 ;; Check if this arglist argument is a sole type. If 5459 (c-record-found-types t))
5460 ;; it's known then it's recorded in 5460 (c-forward-type))))
5461 ;; `c-record-type-identifiers'. If it only is found 5461
5462 ;; then it's recorded in `c-record-found-types' which we 5462 (c-forward-syntactic-ws)
5463 ;; might roll back if it turns out that this isn't an 5463
5464 ;; angle bracket arglist afterall. 5464 (when (or (looking-at "extends")
5465 (when (memq (char-before) '(?, ?<)) 5465 (looking-at "super"))
5466 (let ((orig-record-found-types c-record-found-types)) 5466 (forward-word)
5467 (c-forward-syntactic-ws) 5467 (c-forward-syntactic-ws)
5468 (and (memq (c-forward-type) '(known found)) 5468 (let ((c-promote-possible-types t)
5469 (not (looking-at "[,>]")) 5469 (c-record-found-types t))
5470 ;; A found type was recorded but it's not the 5470 (c-forward-type)
5471 ;; only thing in the arglist argument, so reset 5471 (c-forward-syntactic-ws))))))
5472 ;; `c-record-found-types'. 5472
5473 (setq c-record-found-types 5473 (setq pos (point))
5474 orig-record-found-types)))))) 5474
5475 5475 (or
5476 (setq pos (point)) 5476 ;; Note: These regexps exploit the match order in \| so
5477 (or (when (eq (char-after) ?>) 5477 ;; that "<>" is matched by "<" rather than "[^>:-]>".
5478 ;; Must check for '>' at the very start separately, 5478 (c-syntactic-re-search-forward
5479 ;; since the regexp below has to avoid ">>" without 5479 ;; Stop on ',', '|', '&', '+' and '-' to catch
5480 ;; using \\=. 5480 ;; common binary operators that could be between
5481 (forward-char) 5481 ;; two comparison expressions "a<b" and "c>d".
5482 t) 5482 "[<;{},|+&-]\\|[>)]"
5483 5483 nil t t)
5484 ;; Note: These regexps exploit the match order in \| so 5484 t))
5485 ;; that "<>" is matched by "<" rather than "[^>:-]>". 5485
5486 (c-syntactic-re-search-forward 5486 (cond
5487 (if c-restricted-<>-arglists 5487 ((eq (char-before) ?>)
5488 ;; Stop on ',', '|', '&', '+' and '-' to catch
5489 ;; common binary operators that could be between
5490 ;; two comparison expressions "a<b" and "c>d".
5491 "[<;{},|&+-]\\|\\([^>:-]>\\)"
5492 ;; Otherwise we still stop on ',' to find the
5493 ;; argument start positions.
5494 "[<;{},]\\|\\([^>:-]>\\)")
5495 nil 'move t t 1)
5496
5497 ;; If the arglist starter has lost its open paren
5498 ;; syntax but not the closer, we won't find the
5499 ;; closer above since we only search in the
5500 ;; balanced sexp. In that case we stop just short
5501 ;; of it so check if the following char is the closer.
5502 (when (eq (char-after) ?>)
5503 (forward-char)
5504 t)))
5505
5506 (cond
5507 ((eq (char-before) ?>)
5508 ;; Either an operator starting with '>' or the end of 5488 ;; Either an operator starting with '>' or the end of
5509 ;; the angle bracket arglist. 5489 ;; the angle bracket arglist.
5510 5490
5511 (if (looking-at c->-op-cont-regexp) 5491 (if (looking-at c->-op-cont-regexp)
5512 (progn 5492 (progn
5524 (setq res t) 5504 (setq res t)
5525 nil)) ; Exit the loop. 5505 nil)) ; Exit the loop.
5526 5506
5527 ((eq (char-before) ?<) 5507 ((eq (char-before) ?<)
5528 ;; Either an operator starting with '<' or a nested arglist. 5508 ;; Either an operator starting with '<' or a nested arglist.
5529
5530 (setq pos (point)) 5509 (setq pos (point))
5531 (let (id-start id-end subres keyword-match) 5510 (let (id-start id-end subres keyword-match)
5532 (if (if (looking-at c-<-op-cont-regexp) 5511 (if (if (looking-at c-<-op-cont-regexp)
5533 (setq tmp (match-end 0)) 5512 (setq tmp (match-end 0))
5534 (setq tmp pos) 5513 (setq tmp pos)
5544 (setq id-end (point)) 5523 (setq id-end (point))
5545 (c-simple-skip-symbol-backward) 5524 (c-simple-skip-symbol-backward)
5546 (when (or (setq keyword-match 5525 (when (or (setq keyword-match
5547 (looking-at c-opt-<>-sexp-key)) 5526 (looking-at c-opt-<>-sexp-key))
5548 (not (looking-at c-keywords-regexp))) 5527 (not (looking-at c-keywords-regexp)))
5549 (setq id-start (point)))) 5528 (setq id-start (point))))
5550 5529
5551 (setq subres 5530 (setq subres
5552 (let ((c-record-type-identifiers nil) 5531 (let ((c-promote-possible-types t)
5553 (c-record-found-types nil)) 5532 (c-record-found-types t))
5554 (c-forward-<>-arglist-recur 5533 (c-forward-<>-arglist-recur
5555 (and keyword-match 5534 (and keyword-match
5556 (c-keyword-member 5535 (c-keyword-member
5557 (c-keyword-sym (match-string 1)) 5536 (c-keyword-sym (match-string 1))
5558 'c-<>-type-kwds))))) 5537 'c-<>-type-kwds)))))
5559 ))) 5538 )))
5560 5539
5561 ;; It was not an angle bracket arglist. 5540 ;; It was not an angle bracket arglist.
5572 (if (and c-opt-identifier-concat-key 5551 (if (and c-opt-identifier-concat-key
5573 (progn 5552 (progn
5574 (c-forward-syntactic-ws) 5553 (c-forward-syntactic-ws)
5575 (looking-at c-opt-identifier-concat-key))) 5554 (looking-at c-opt-identifier-concat-key)))
5576 (c-record-ref-id (cons id-start id-end)) 5555 (c-record-ref-id (cons id-start id-end))
5577 (c-record-type-id (cons id-start id-end)))))) 5556 (c-record-type-id (cons id-start id-end))))))
5578 t) 5557 t)
5579 5558
5580 ((and (eq (char-before) ?,) 5559 ((and (not c-restricted-<>-arglists)
5581 (not c-restricted-<>-arglists)) 5560 (or (and (eq (char-before) ?&)
5582 ;; Just another argument. Record the position. The 5561 (not (eq (char-after) ?&)))
5583 ;; type check stuff that made us stop at it is at 5562 (eq (char-before) ?,)))
5584 ;; the top of the loop. 5563 ;; Just another argument. Record the position. The
5564 ;; type check stuff that made us stop at it is at
5565 ;; the top of the loop.
5585 (setq arg-start-pos (cons (point) arg-start-pos))) 5566 (setq arg-start-pos (cons (point) arg-start-pos)))
5586 5567
5587 (t 5568 (t
5588 ;; Got a character that can't be in an angle bracket 5569 ;; Got a character that can't be in an angle bracket
5589 ;; arglist argument. Abort using `throw', since 5570 ;; arglist argument. Abort using `throw', since
5590 ;; it's useless to try to find a surrounding arglist 5571 ;; it's useless to try to find a surrounding arglist
5591 ;; if we're nested. 5572 ;; if we're nested.
5592 (throw 'angle-bracket-arglist-escape nil)))))) 5573 (throw 'angle-bracket-arglist-escape nil))))))
5593
5594 (if res 5574 (if res
5595 (or c-record-found-types t))))) 5575 (or c-record-found-types t)))))
5596 5576
5597 (defun c-backward-<>-arglist (all-types &optional limit) 5577 (defun c-backward-<>-arglist (all-types &optional limit)
5598 ;; The point is assumed to be directly after a ">". Try to treat it 5578 ;; The point is assumed to be directly after a ">". Try to treat it
5791 t) 5771 t)
5792 5772
5793 ((and c-recognize-<>-arglists 5773 ((and c-recognize-<>-arglists
5794 (eq (char-after) ?<)) 5774 (eq (char-after) ?<))
5795 ;; Maybe an angle bracket arglist. 5775 ;; Maybe an angle bracket arglist.
5796 5776 (when (let ((c-record-type-identifiers t)
5797 (when (let (c-record-type-identifiers 5777 (c-record-found-types t))
5798 c-record-found-types)
5799 (c-forward-<>-arglist nil)) 5778 (c-forward-<>-arglist nil))
5800 5779
5801 (c-add-type start (1+ pos)) 5780 (c-add-type start (1+ pos))
5802 (c-forward-syntactic-ws) 5781 (c-forward-syntactic-ws)
5803 (setq pos (point) 5782 (setq pos (point)
5842 ;; This function records identifier ranges on 5821 ;; This function records identifier ranges on
5843 ;; `c-record-type-identifiers' and `c-record-ref-identifiers' if 5822 ;; `c-record-type-identifiers' and `c-record-ref-identifiers' if
5844 ;; `c-record-type-identifiers' is non-nil. 5823 ;; `c-record-type-identifiers' is non-nil.
5845 ;; 5824 ;;
5846 ;; This function might do hidden buffer changes. 5825 ;; This function might do hidden buffer changes.
5826 (when (looking-at "<")
5827 (c-forward-<>-arglist t)
5828 (c-forward-syntactic-ws))
5847 5829
5848 (let ((start (point)) pos res name-res id-start id-end id-range) 5830 (let ((start (point)) pos res name-res id-start id-end id-range)
5849 5831
5850 ;; Skip leading type modifiers. If any are found we know it's a 5832 ;; Skip leading type modifiers. If any are found we know it's a
5851 ;; prefix of a type. 5833 ;; prefix of a type.
6040 (cons id-range c-record-found-types)))) 6022 (cons id-range c-record-found-types))))
6041 6023
6042 ;;(message "c-forward-type %s -> %s: %s" start (point) res) 6024 ;;(message "c-forward-type %s -> %s: %s" start (point) res)
6043 6025
6044 res)) 6026 res))
6027
6028 (defun c-forward-annotation ()
6029 ;; Used for Java code only at the moment. Assumes point is on the
6030 ;; @, moves forward an annotation. returns nil if there is no
6031 ;; annotation at point.
6032 (and (looking-at "@")
6033 (progn (forward-char) t)
6034 (c-forward-type)
6035 (progn (c-forward-syntactic-ws) t)
6036 (if (looking-at "(")
6037 (c-go-list-forward)
6038 t)))
6045 6039
6046 6040
6047 ;; Handling of large scale constructs like statements and declarations. 6041 ;; Handling of large scale constructs like statements and declarations.
6048 6042
6049 ;; Macro used inside `c-forward-decl-or-cast-1'. It ought to be a 6043 ;; Macro used inside `c-forward-decl-or-cast-1'. It ought to be a
6210 ;; speculatively and should be thrown away if it turns out 6204 ;; speculatively and should be thrown away if it turns out
6211 ;; that it isn't a declaration or cast. 6205 ;; that it isn't a declaration or cast.
6212 (save-rec-type-ids c-record-type-identifiers) 6206 (save-rec-type-ids c-record-type-identifiers)
6213 (save-rec-ref-ids c-record-ref-identifiers)) 6207 (save-rec-ref-ids c-record-ref-identifiers))
6214 6208
6209 (while (c-forward-annotation)
6210 (c-forward-syntactic-ws))
6211
6215 ;; Check for a type. Unknown symbols are treated as possible 6212 ;; Check for a type. Unknown symbols are treated as possible
6216 ;; types, but they could also be specifiers disguised through 6213 ;; types, but they could also be specifiers disguised through
6217 ;; macros like __INLINE__, so we recognize both types and known 6214 ;; macros like __INLINE__, so we recognize both types and known
6218 ;; specifiers after them too. 6215 ;; specifiers after them too.
6219 (while 6216 (while
6543 (progn 6540 (progn
6544 6541
6545 ;; CASE 3 6542 ;; CASE 3
6546 (when (= (point) start) 6543 (when (= (point) start)
6547 ;; Got a plain list of identifiers. If a colon follows it's 6544 ;; Got a plain list of identifiers. If a colon follows it's
6548 ;; a valid label. Otherwise the last one probably is the 6545 ;; a valid label. Otherwise the last one probably is the
6549 ;; declared identifier and we should back up to the previous 6546 ;; declared identifier and we should back up to the previous
6550 ;; type, providing it isn't a cast. 6547 ;; type, providing it isn't a cast.
6551 (if (eq (char-after) ?:) 6548 (if (and (eq (char-after) ?:)
6552 ;; If we've found a specifier keyword then it's a 6549 (not (c-major-mode-is 'java-mode)))
6553 ;; declaration regardless. 6550 ;; If we've found a specifier keyword then it's a
6554 (throw 'at-decl-or-cast (eq at-decl-or-cast t)) 6551 ;; declaration regardless.
6552 (throw 'at-decl-or-cast (eq at-decl-or-cast t))
6555 (setq backup-if-not-cast t) 6553 (setq backup-if-not-cast t)
6556 (throw 'at-decl-or-cast t))) 6554 (throw 'at-decl-or-cast t)))
6557 6555
6558 ;; CASE 4 6556 ;; CASE 4
6559 (when (and got-suffix 6557 (when (and got-suffix
8510 ;; cases 18 and 10. It's a continued statement or top level 8508 ;; cases 18 and 10. It's a continued statement or top level
8511 ;; construct of some kind. 8509 ;; construct of some kind.
8512 ;; 8510 ;;
8513 ;; This function might do hidden buffer changes. 8511 ;; This function might do hidden buffer changes.
8514 8512
8515 (let (special-brace-list) 8513 (let (special-brace-list placeholder)
8516 (goto-char indent-point) 8514 (goto-char indent-point)
8517 (skip-chars-forward " \t") 8515 (skip-chars-forward " \t")
8518 8516
8519 (cond 8517 (cond
8520 ;; (CASE A removed.) 8518 ;; (CASE A removed.)
8616 ;; type in this case, since that's more likely to be 8614 ;; type in this case, since that's more likely to be
8617 ;; a macro followed by a block. 8615 ;; a macro followed by a block.
8618 (c-forward-decl-or-cast-1 (c-point 'bosws) nil nil)))) 8616 (c-forward-decl-or-cast-1 (c-point 'bosws) nil nil))))
8619 (c-add-stmt-syntax 'func-decl-cont nil t 8617 (c-add-stmt-syntax 'func-decl-cont nil t
8620 containing-sexp paren-state)) 8618 containing-sexp paren-state))
8619
8620 ;;CASE F: continued statement and the only preceding items are
8621 ;;annotations.
8622 ((and (c-major-mode-is 'java-mode)
8623 (setq placeholder (point))
8624 (c-beginning-of-statement-1)
8625 (progn
8626 (while (and (c-forward-annotation)
8627 (< (point) placeholder))
8628 (c-forward-syntactic-ws))
8629 t)
8630 (prog1
8631 (>= (point) placeholder)
8632 (goto-char placeholder)))
8633 (c-beginning-of-statement-1 containing-sexp)
8634 (c-add-syntax 'annotation-var-cont (point)))
8621 8635
8622 ;; CASE D: continued statement. 8636 ;; CASE D: continued statement.
8623 (t 8637 (t
8624 (c-beginning-of-statement-1 containing-sexp) 8638 (c-beginning-of-statement-1 containing-sexp)
8625 (c-add-stmt-syntax 'statement-cont nil nil 8639 (c-add-stmt-syntax 'statement-cont nil nil
8716 ;; typically only noticeable when statements are used in macro 8730 ;; typically only noticeable when statements are used in macro
8717 ;; arglists. 8731 ;; arglists.
8718 (when (and containing-sexp 8732 (when (and containing-sexp
8719 (eq (char-after containing-sexp) ?\()) 8733 (eq (char-after containing-sexp) ?\())
8720 (setq c-stmt-delim-chars c-stmt-delim-chars-with-comma)) 8734 (setq c-stmt-delim-chars c-stmt-delim-chars-with-comma))
8721
8722 ;; cache char before and after indent point, and move point to 8735 ;; cache char before and after indent point, and move point to
8723 ;; the most likely position to perform the majority of tests 8736 ;; the most likely position to perform the majority of tests
8724 (goto-char indent-point) 8737 (goto-char indent-point)
8725 (c-backward-syntactic-ws lim) 8738 (c-backward-syntactic-ws lim)
8726 (setq before-ws-ip (point) 8739 (setq before-ws-ip (point)
9466 (when (looking-at c-opt-method-key) 9479 (when (looking-at c-opt-method-key)
9467 (setq placeholder (point))))) 9480 (setq placeholder (point)))))
9468 (c-add-syntax 'objc-method-args-cont placeholder)) 9481 (c-add-syntax 'objc-method-args-cont placeholder))
9469 9482
9470 ;; CASE 5L: we are at the first argument of a template 9483 ;; CASE 5L: we are at the first argument of a template
9471 ;; arglist that begins on the previous line. 9484 ;; arglist that begins on the previous line.
9472 ((and c-recognize-<>-arglists 9485 ((and c-recognize-<>-arglists
9473 (eq (char-before) ?<) 9486 (eq (char-before) ?<)
9474 (setq placeholder (1- (point))) 9487 (not (and c-overloadable-operators-regexp
9475 (not (and c-overloadable-operators-regexp 9488 (c-after-special-operator-id lim))))
9476 (c-after-special-operator-id lim)))) 9489 (c-beginning-of-statement-1 (c-safe-position (point) paren-state))
9477 (c-beginning-of-statement-1 (c-safe-position (point) paren-state)) 9490 (c-add-syntax 'template-args-cont (c-point 'boi)))
9478 (c-add-syntax 'template-args-cont (c-point 'boi) placeholder)) 9491
9479 9492 ;; CASE 5Q: we are at a statement within a macro.
9480 ;; CASE 5Q: we are at a statement within a macro. 9493 (macro-start
9481 (macro-start 9494 (c-beginning-of-statement-1 containing-sexp)
9482 (c-beginning-of-statement-1 containing-sexp) 9495 (c-add-stmt-syntax 'statement nil t containing-sexp paren-state))
9483 (c-add-stmt-syntax 'statement nil t containing-sexp paren-state)) 9496
9484 9497 ;;CASE 5N: We are at a tompmost continuation line and the only
9485 ;; CASE 5M: we are at a topmost continuation line 9498 ;;preceding items are annotations.
9486 (t 9499 ((and (c-major-mode-is 'java-mode)
9487 (c-beginning-of-statement-1 (c-safe-position (point) paren-state)) 9500 (setq placeholder (point))
9501 (c-beginning-of-statement-1)
9502 (progn
9503 (while (and (c-forward-annotation))
9504 (c-forward-syntactic-ws))
9505 t)
9506 (prog1
9507 (>= (point) placeholder)
9508 (goto-char placeholder)))
9509 (c-add-syntax 'annotation-top-cont (c-point 'boi)))
9510
9511 ;; CASE 5M: we are at a topmost continuation line
9512 (t
9513 (c-beginning-of-statement-1 (c-safe-position (point) paren-state))
9488 (when (c-major-mode-is 'objc-mode) 9514 (when (c-major-mode-is 'objc-mode)
9489 (setq placeholder (point)) 9515 (setq placeholder (point))
9490 (while (and (c-forward-objc-directive) 9516 (while (and (c-forward-objc-directive)
9491 (< (point) indent-point)) 9517 (< (point) indent-point))
9492 (c-forward-syntactic-ws) 9518 (c-forward-syntactic-ws)
9493 (setq placeholder (point))) 9519 (setq placeholder (point)))
9494 (goto-char placeholder)) 9520 (goto-char placeholder))
9495 (c-add-syntax 'topmost-intro-cont (c-point 'boi))) 9521 (c-add-syntax 'topmost-intro-cont (c-point 'boi)))
9496 )) 9522 ))
9497 9523
9498 ;; (CASE 6 has been removed.) 9524
9499 9525 ;; (CASE 6 has been removed.)
9500 ;; CASE 19: line is an expression, not a statement, and is directly 9526
9501 ;; contained by a template delimiter. Most likely, we are in a 9527 ;; CASE 7: line is an expression, not a statement. Most
9502 ;; template arglist within a statement. This case is based on CASE 9528 ;; likely we are either in a function prototype or a function
9503 ;; 7. At some point in the future, we may wish to create more 9529 ;; call argument list
9504 ;; syntactic symbols such as `template-intro', 9530 ((not (or (and c-special-brace-lists
9505 ;; `template-cont-nonempty', etc., and distinguish between them as we 9531 (save-excursion
9506 ;; do for `arglist-intro' etc. (2009-12-07). 9532 (goto-char containing-sexp)
9507 ((and c-recognize-<>-arglists 9533 (c-looking-at-special-brace-list)))
9508 (setq containing-< (c-up-list-backward indent-point containing-sexp)) 9534 (eq (char-after containing-sexp) ?{)))
9509 (eq (char-after containing-<) ?\<)) 9535 (cond
9510 (setq placeholder (c-point 'boi containing-<)) 9536
9511 (goto-char containing-sexp) ; Most nested Lbrace/Lparen (but not 9537 ;; CASE 7A: we are looking at the arglist closing paren.
9512 ; '<') before indent-point.
9513 (if (>= (point) placeholder)
9514 (progn
9515 (forward-char)
9516 (skip-chars-forward " \t"))
9517 (goto-char placeholder))
9518 (c-add-stmt-syntax 'template-args-cont (list containing-<) t
9519 (c-most-enclosing-brace c-state-cache (point))
9520 paren-state))
9521
9522
9523 ;; CASE 7: line is an expression, not a statement. Most
9524 ;; likely we are either in a function prototype or a function
9525 ;; call argument list, or a template argument list.
9526 ((not (or (and c-special-brace-lists
9527 (save-excursion
9528 (goto-char containing-sexp)
9529 (c-looking-at-special-brace-list)))
9530 (eq (char-after containing-sexp) ?{)
9531 (eq (char-after containing-sexp) ?<)))
9532 (cond
9533
9534 ;; CASE 7A: we are looking at the arglist closing paren.
9535 ;; C.f. case 7F. 9538 ;; C.f. case 7F.
9536 ((memq char-after-ip '(?\) ?\])) 9539 ((memq char-after-ip '(?\) ?\]))
9537 (goto-char containing-sexp) 9540 (goto-char containing-sexp)
9538 (setq placeholder (c-point 'boi)) 9541 (setq placeholder (c-point 'boi))
9539 (if (and (c-safe (backward-up-list 1) t) 9542 (if (and (c-safe (backward-up-list 1) t)
9541 (progn 9544 (progn
9542 (forward-char) 9545 (forward-char)
9543 (skip-chars-forward " \t")) 9546 (skip-chars-forward " \t"))
9544 (goto-char placeholder)) 9547 (goto-char placeholder))
9545 (c-add-stmt-syntax 'arglist-close (list containing-sexp) t 9548 (c-add-stmt-syntax 'arglist-close (list containing-sexp) t
9546 (c-most-enclosing-brace paren-state (point)) 9549 (c-most-enclosing-brace paren-state (point))
9547 paren-state)) 9550 paren-state))
9548 9551
9549 ;; CASE 7B: Looking at the opening brace of an 9552 ;; CASE 19: line is an expression, not a statement, and is directly
9550 ;; in-expression block or brace list. C.f. cases 4, 16A 9553 ;; contained by a template delimiter. Most likely, we are in a
9551 ;; and 17E. 9554 ;; template arglist within a statement. This case is based on CASE
9555 ;; 7. At some point in the future, we may wish to create more
9556 ;; syntactic symbols such as `template-intro',
9557 ;; `template-cont-nonempty', etc., and distinguish between them as we
9558 ;; do for `arglist-intro' etc. (2009-12-07).
9559 ((and c-recognize-<>-arglists
9560 (setq containing-< (c-up-list-backward indent-point containing-sexp))
9561 (eq (char-after containing-<) ?\<))
9562 (setq placeholder (c-point 'boi containing-<))
9563 (goto-char containing-sexp) ; Most nested Lbrace/Lparen (but not
9564 ; '<') before indent-point.
9565 (if (>= (point) placeholder)
9566 (progn
9567 (forward-char)
9568 (skip-chars-forward " \t"))
9569 (goto-char placeholder))
9570 (c-add-stmt-syntax 'template-args-cont (list containing-<) t
9571 (c-most-enclosing-brace c-state-cache (point))
9572 paren-state))
9573
9574 ;; CASE 7B: Looking at the opening brace of an
9575 ;; in-expression block or brace list. C.f. cases 4, 16A
9576 ;; and 17E.
9552 ((and (eq char-after-ip ?{) 9577 ((and (eq char-after-ip ?{)
9553 (progn 9578 (progn
9554 (setq placeholder (c-inside-bracelist-p (point) 9579 (setq placeholder (c-inside-bracelist-p (point)
9555 paren-state)) 9580 paren-state))
9556 (if placeholder 9581 (if placeholder