Skip to content

Commit

Permalink
Issue #9455: updated example of AST for TokenTypes.INSTANCE_INIT
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhinavRajputEXE authored and romani committed Dec 4, 2021
1 parent 5fd5f72 commit d870e61
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/main/java/com/puppycrawl/tools/checkstyle/api/TokenTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,40 @@ public final class TokenTypes {
* may appear in class and enum definitions. This token will be a child
* of the object block of the declaring type.
*
* <p>For example:</p>
* <pre>
* public class MyClass {
* private int foo;
* {foo = 10;}
* }
* </pre>
* <p>parses as:</p>
* <pre>
* CLASS_DEF -&gt; CLASS_DEF
* |--MODIFIERS -&gt; MODIFIERS
* | `--LITERAL_PUBLIC -&gt; public
* |--LITERAL_CLASS -&gt; class
* |--IDENT -&gt; MyClass
* `--OBJBLOCK -&gt; OBJBLOCK
* |--LCURLY -&gt; {
* |--VARIABLE_DEF -&gt; VARIABLE_DEF
* | |--MODIFIERS -&gt; MODIFIERS
* | | `--LITERAL_PRIVATE -&gt; private
* | |--TYPE -&gt; TYPE
* | | `--LITERAL_INT -&gt; int
* | |--IDENT -&gt; foo
* | `--SEMI -&gt; ;
* |--INSTANCE_INIT -&gt; INSTANCE_INIT
* | `--SLIST -&gt; {
* | |--EXPR -&gt; EXPR
* | | `--ASSIGN -&gt; =
* | | |--IDENT -&gt; foo
* | | `--NUM_INT -&gt; 10
* | |--SEMI -&gt; ;
* | `--RCURLY -&gt; }
* `--RCURLY -&gt; }
* </pre>
*
* @see <a
* href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.6">Java
* Language Specification&sect;8.6</a>
Expand Down

0 comments on commit d870e61

Please sign in to comment.