Mercurial > emacs
comparison doc/misc/cc-mode.texi @ 109606:fa191ba50511
Enhance CC Mode manual to cover the new Java features.
author | Alan Mackenzie <acm@muc.de> |
---|---|
date | Sun, 01 Aug 2010 18:07:10 +0000 |
parents | a91e94388547 |
children | 029e4783cbae |
comparison
equal
deleted
inserted
replaced
109605:bdba5a231521 | 109606:fa191ba50511 |
---|---|
310 * Syntactic Symbols:: | 310 * Syntactic Symbols:: |
311 * Indentation Calculation:: | 311 * Indentation Calculation:: |
312 | 312 |
313 Syntactic Symbols | 313 Syntactic Symbols |
314 | 314 |
315 * Function Symbols:: | 315 * Function Symbols:: |
316 * Class Symbols:: | 316 * Class Symbols:: |
317 * Conditional Construct Symbols:: | 317 * Conditional Construct Symbols:: |
318 * Switch Statement Symbols:: | 318 * Switch Statement Symbols:: |
319 * Brace List Symbols:: | 319 * Brace List Symbols:: |
320 * External Scope Symbols:: | 320 * External Scope Symbols:: |
321 * Paren List Symbols:: | 321 * Paren List Symbols:: |
322 * Literal Symbols:: | 322 * Literal Symbols:: |
323 * Multiline Macro Symbols:: | 323 * Multiline Macro Symbols:: |
324 * Objective-C Method Symbols:: | 324 * Objective-C Method Symbols:: |
325 * Anonymous Class Symbol:: | 325 * Java Symbols:: |
326 * Statement Block Symbols:: | 326 * Statement Block Symbols:: |
327 * K&R Symbols:: | 327 * K&R Symbols:: |
328 | 328 |
329 Customizing Indentation | 329 Customizing Indentation |
330 | 330 |
331 * c-offsets-alist:: | 331 * c-offsets-alist:: |
332 * Interactive Customization:: | 332 * Interactive Customization:: |
3969 The first line in a ``topmost'' definition. @ref{Function Symbols}. | 3969 The first line in a ``topmost'' definition. @ref{Function Symbols}. |
3970 @item topmost-intro-cont | 3970 @item topmost-intro-cont |
3971 Topmost definition continuation lines. This is only used in the parts | 3971 Topmost definition continuation lines. This is only used in the parts |
3972 that aren't covered by other symbols such as @code{func-decl-cont} and | 3972 that aren't covered by other symbols such as @code{func-decl-cont} and |
3973 @code{knr-argdecl}. @ref{Function Symbols}. | 3973 @code{knr-argdecl}. @ref{Function Symbols}. |
3974 @item annotation-top-cont | |
3975 Topmost definition continuation lines where all previous items are | |
3976 annotations. @ref{Java Symbols}. | |
3974 @item member-init-intro | 3977 @item member-init-intro |
3975 First line in a member initialization list. @ref{Class Symbols}. | 3978 First line in a member initialization list. @ref{Class Symbols}. |
3976 @item member-init-cont | 3979 @item member-init-cont |
3977 Subsequent member initialization list lines. @ref{Class Symbols}. | 3980 Subsequent member initialization list lines. @ref{Class Symbols}. |
3978 @item inher-intro | 3981 @item inher-intro |
3997 with an open brace. @ref{Brace List Symbols}. | 4000 with an open brace. @ref{Brace List Symbols}. |
3998 @item statement | 4001 @item statement |
3999 A statement. @ref{Function Symbols}. | 4002 A statement. @ref{Function Symbols}. |
4000 @item statement-cont | 4003 @item statement-cont |
4001 A continuation of a statement. @ref{Function Symbols}. | 4004 A continuation of a statement. @ref{Function Symbols}. |
4005 @item annotation-var-cont | |
4006 A continuation of a statement where all previous items are | |
4007 annotations. @ref{Java Symbols}. | |
4002 @item statement-block-intro | 4008 @item statement-block-intro |
4003 The first line in a new statement block. @ref{Conditional Construct | 4009 The first line in a new statement block. @ref{Conditional Construct |
4004 Symbols}. | 4010 Symbols}. |
4005 @item statement-case-intro | 4011 @item statement-case-intro |
4006 The first line in a case block. @ref{Switch Statement Symbols}. | 4012 The first line in a case block. @ref{Switch Statement Symbols}. |
4110 take a statement block as an argument in Pike. @ref{Statement Block | 4116 take a statement block as an argument in Pike. @ref{Statement Block |
4111 Symbols}. | 4117 Symbols}. |
4112 @item inexpr-class | 4118 @item inexpr-class |
4113 A class definition inside an expression. This is used for anonymous | 4119 A class definition inside an expression. This is used for anonymous |
4114 classes in Java. It's also used for anonymous array initializers in | 4120 classes in Java. It's also used for anonymous array initializers in |
4115 Java. @ref{Anonymous Class Symbol}. | 4121 Java. @ref{Java Symbols}. |
4116 @end table | 4122 @end table |
4117 | 4123 |
4118 @menu | 4124 @menu |
4119 * Function Symbols:: | 4125 * Function Symbols:: |
4120 * Class Symbols:: | 4126 * Class Symbols:: |
4121 * Conditional Construct Symbols:: | 4127 * Conditional Construct Symbols:: |
4122 * Switch Statement Symbols:: | 4128 * Switch Statement Symbols:: |
4123 * Brace List Symbols:: | 4129 * Brace List Symbols:: |
4124 * External Scope Symbols:: | 4130 * External Scope Symbols:: |
4125 * Paren List Symbols:: | 4131 * Paren List Symbols:: |
4126 * Literal Symbols:: | 4132 * Literal Symbols:: |
4127 * Multiline Macro Symbols:: | 4133 * Multiline Macro Symbols:: |
4128 * Objective-C Method Symbols:: | 4134 * Objective-C Method Symbols:: |
4129 * Anonymous Class Symbol:: | 4135 * Java Symbols:: |
4130 * Statement Block Symbols:: | 4136 * Statement Block Symbols:: |
4131 * K&R Symbols:: | 4137 * K&R Symbols:: |
4132 @end menu | 4138 @end menu |
4133 | 4139 |
4134 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 4140 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
4135 @node Function Symbols, Class Symbols, Syntactic Symbols, Syntactic Symbols | 4141 @node Function Symbols, Class Symbols, Syntactic Symbols, Syntactic Symbols |
4136 @comment node-name, next, previous, up | 4142 @comment node-name, next, previous, up |
4231 ((inclass 58) (access-label 58)) | 4237 ((inclass 58) (access-label 58)) |
4232 @end example | 4238 @end example |
4233 | 4239 |
4234 @noindent | 4240 @noindent |
4235 The primary syntactic symbol for this line is @code{access-label} as | 4241 The primary syntactic symbol for this line is @code{access-label} as |
4236 this a label keyword that specifies access protection in C++. However, | 4242 this is a label keyword that specifies access protection in C++. However, |
4237 because this line is also a top-level construct inside a class | 4243 because this line is also a top-level construct inside a class |
4238 definition, the analysis actually shows two syntactic symbols. The | 4244 definition, the analysis actually shows two syntactic symbols. The |
4239 other syntactic symbol assigned to this line is @code{inclass}. | 4245 other syntactic symbol assigned to this line is @code{inclass}. |
4240 Similarly, line 6 is given both @code{inclass} and @code{topmost-intro} | 4246 Similarly, line 6 is given both @code{inclass} and @code{topmost-intro} |
4241 syntax: | 4247 syntax: |
4738 macros.}. | 4744 macros.}. |
4739 | 4745 |
4740 @xref{Custom Macros}, for more info about the treatment of macros. | 4746 @xref{Custom Macros}, for more info about the treatment of macros. |
4741 | 4747 |
4742 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 4748 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
4743 @node Objective-C Method Symbols, Anonymous Class Symbol, Multiline Macro Symbols, Syntactic Symbols | 4749 @node Objective-C Method Symbols, Java Symbols, Multiline Macro Symbols, Syntactic Symbols |
4744 @comment node-name, next, previous, up | 4750 @comment node-name, next, previous, up |
4745 @subsection Objective-C Method Symbols | 4751 @subsection Objective-C Method Symbols |
4746 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 4752 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
4747 | 4753 |
4748 In Objective-C buffers, there are three additional syntactic symbols | 4754 In Objective-C buffers, there are three additional syntactic symbols |
4765 Here, line 1 is assigned @code{objc-method-intro} syntax, and line 2 is | 4771 Here, line 1 is assigned @code{objc-method-intro} syntax, and line 2 is |
4766 assigned @code{objc-method-args-cont} syntax. Lines 5 and 6 are both | 4772 assigned @code{objc-method-args-cont} syntax. Lines 5 and 6 are both |
4767 assigned @code{objc-method-call-cont} syntax. | 4773 assigned @code{objc-method-call-cont} syntax. |
4768 | 4774 |
4769 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 4775 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
4770 @node Anonymous Class Symbol, Statement Block Symbols, Objective-C Method Symbols, Syntactic Symbols | 4776 @node Java Symbols, Statement Block Symbols, Objective-C Method Symbols, Syntactic Symbols |
4771 @comment node-name, next, previous, up | 4777 @comment node-name, next, previous, up |
4772 @subsection Anonymous Class Symbol (Java) | 4778 @subsection Java Symbols |
4773 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 4779 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
4774 | 4780 |
4775 Java has a concept of anonymous classes which can look something like | 4781 Java has a concept of anonymous classes which can look something like |
4776 this: | 4782 this: |
4777 | 4783 |
4778 @example | 4784 @example |
4779 1: public void watch(Observable o) @{ | 4785 1: @@Test |
4780 2: o.addObserver(new Observer() @{ | 4786 2: public void watch(Observable o) @{ |
4781 3: public void update(Observable o, Object arg) @{ | 4787 3: @@NonNull |
4782 4: history.addElement(arg); | 4788 4: Observer obs = new Observer() @{ |
4783 5: @} | 4789 5: public void update(Observable o, Object arg) @{ |
4784 6: @}); | 4790 6: history.addElement(arg); |
4785 7: @} | 4791 7: @} |
4792 8: @}; | |
4793 9: o.addObserver(obs); | |
4794 10: @} | |
4786 @end example | 4795 @end example |
4787 | 4796 |
4788 @ssindex inexpr-class | 4797 @ssindex inexpr-class |
4789 The brace following the @code{new} operator opens the anonymous class. | 4798 The brace following the @code{new} operator opens the anonymous class. |
4790 Lines 3 and 6 are assigned the @code{inexpr-class} syntax, besides the | 4799 Lines 5 and 8 are assigned the @code{inexpr-class} syntax, besides the |
4791 @code{inclass} symbol used in normal classes. Thus, the class will be | 4800 @code{inclass} symbol used in normal classes. Thus, the class will be |
4792 indented just like a normal class, with the added indentation given to | 4801 indented just like a normal class, with the added indentation given to |
4793 @code{inexpr-class}. An @code{inexpr-class} syntactic element doesn't | 4802 @code{inexpr-class}. An @code{inexpr-class} syntactic element doesn't |
4794 have an anchor position. | 4803 have an anchor position. |
4795 | 4804 |
4796 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 4805 @ssindex annotation-top-cont |
4797 @node Statement Block Symbols, K&R Symbols, Anonymous Class Symbol, Syntactic Symbols | 4806 @ssindex annotation-var-cont |
4807 Line 2 is assigned the @code{annotation-top-cont} syntax, due to it being a | |
4808 continuation of a topmost introduction with an annotation symbol preceding | |
4809 the current line. Similarly, line 4 is assigned the @code{annotation-var-cont} | |
4810 syntax due to it being a continuation of a variable declaration where preceding | |
4811 the declaration is an annotation. | |
4812 | |
4813 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
4814 @node Statement Block Symbols, K&R Symbols, Java Symbols, Syntactic Symbols | |
4798 @comment node-name, next, previous, up | 4815 @comment node-name, next, previous, up |
4799 @subsection Statement Block Symbols | 4816 @subsection Statement Block Symbols |
4800 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 4817 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
4801 | 4818 |
4802 There are a few occasions where a statement block might be used inside | 4819 There are a few occasions where a statement block might be used inside |