From 6b0eae541177e9ee8655356ae85694a4e901762e Mon Sep 17 00:00:00 2001 From: deathaxe Date: Mon, 8 Nov 2021 07:15:28 +0100 Subject: [PATCH] [Java] Rewrite Syntax (#2654) * [Java] Add method invocation tests * [Java] Rename instantiation context We express non-popping contexts by plural * [Java] Update accessor_dot variable * [Java] Remove variable-namespace context The pattern defined by this context is used only once. * [Java] Nondeterministic local variable declaration Adds support for case-insensitive object types in local variable declaration statements. * [Java] Reorganize declarations as class-members The current declarations context describes class member declarations. Thus move it to class-body as it is used once only there. * [Java] Reorganize declarations in sections Creates dedicated sections for global and member declaration contexts and moves all related member contexts. * [Java] Set away from branch contexts Try to find a consistent and common strategy to handle branches with multi-push / multi-set statements. * [Java] Rename statements contexts We express non-popping contexts by plural. * [Java] Update comments * [Java] Scope all commas separator.comma for consistency * [Java] Rename parens -> group * [Java] Fix array-only or object types in generics * [Java] Fix exception list Only object-types are supported, no primitives, no arrays. * [Java] Reorganize object-type Current solution was too inflexible. * [Java] Add cast expression contexts implements: https://docs.oracle.com/javase/specs/jls/se13/html/jls-15.html#jls-15.16 * [Java] Rename variable branch contexts * [Java] Refactor reference-type context * [Java] Add variables to improve readability Clarify the meaning of lookaheads. * [Java] Move blocks section next to groups * [Java] Rename generic type contexts 1. Express optional contexts by `maybe-` 2. Singular context names express popping 3. Plural context names express non-popping * [Java] Rename generic type contexts part 2 Removes `generic-` from context names as it not used by specs. * [Java] Improve incomplete type-parameter handling Don't break syntax if type identifier is missing * [Java] Extend generic local declaration tests - verify fixes for #1611 - make sure no details can break * [Java] Add more ambiguity tests - verify fixes for #1611 * [Java] annotation context to annotations Plural expresses non-popping. * [Java] Improve annotation performance - tweaks qualified identifier patterns - tweaks parameter patterns * [Java] Tweak annotation boundaries Don't include trailing whitespace into annotation identifiers. * [Java] Reorganize expression contexts * [Java] Declaration vs. expressions performance tweak Perform `declarations` branching only for tokens which look like identifiers as declarations always begin with such. Catch assignments to improve performance in some situations. * [Java] Use declarations in for statements * [Java] Use declarations in try statements * [Java] Simplify variable declaration identifier Don't highlight unexpected keywords, just continue. * [Java] Tweak variable identifier performance The trick is as follows: 1. Push into branch if the next token looks like an identifier but without testing the whole list of reserved words. 3. Just match the simple `{{id}}` as all reserved words are expected to be matched before variables context. * [Java] Add some incomplete for statement tests * [Java] Reorganize assignment expressions Introduces common rules for all kinds of assignments. * [Java] Remove declaration-assignment branch 1. Recent changes reduced performance impacts. 2. Keeping this branch required additional variable identifier rules. * [Java] Simplify method default context * [Java] Move stray-group from blocks to statements * [Java] Merge declaration sections * [Java] Move member-declarations Between class/enum/interface and field/method seems more logical. * [Java] Rename member-statements * [Java] Merge class-body into class-body-block-common * [Java] Tweak field declaration contexts * [Java] Add some field declaration tests - ensure no overlapping meta.field appear - add invalid var type test * [Java] Tweak method declaration contexts * [Java] Rename class/enum/interface modifier contexts Plural expresses non-popping. * [Java] Tweak package declaration * [Java] Rename expect-type-reference -> maybe-... "expect" is too strong as context just pops if no reference is matched. * [Java] Make more use of group-body * [Java] Make more use of block-body * [Java] Rework instantiation-type - highlight illegal modifiers/keywords - use general scope for unexpected keywords, types and modifiers - update block contexts - update tests * [Java] Tweak for parameters Avoid popping group off stack, if unmatched tokens exist. * [Java] Tweak module declaration * [Java] Add tests to verify lowercase constructor - verify fix for https://github.com/sublimehq/Packages/issues/1610 * [Java] Fix hexadecimal floats - add float suffixes to hex numbers - reorganize literal tests * [Java] Reorganize/Cleanup "Incomplete" Tests Moves all unrelated to "incomplete" tests to their correct section. * [Java] Recover from incomplete expressions and unclosed groups Highlighting semicolon illegal and pop causes nested expressions not to be popped off stack correctly. As a result an expression may be endless. Hence the illegal-semicolon and illegal-open-block are replaced by lookaheads. * [Java] Rename illegal-type-parameters Use singular to express popping contexts. * [Java] Tweak expression-terminator * [Java] Tweak annotation contexts - reuse `annotation-parameters` context in qualified and unqualified annotations - replace `(?=\S)` patterns by empty patterns in identifier like contexts as word boundaries are already maintained by the pushing pattern. * [Java] Tweak enum-constant contexts * [Java] More permissive case enum constant matching Keep enum-constants highlighted even if `:` is missing. * [Java] Move method reference expressions tests * [Java] Move while statements tests * [Java] Move for statements tests * [Java] Move instance creation expressions tests * [Java] Move type cast expressions tests * [Java] Move incomplete method declarations tests * [Java] Tweak local variable declarations tests * [Java] Add labeled statement tests * [Java] Add assert statements tests * [Java] Fix word separators Java identifiers may contain `$` for legacy reasons. Hence that character is not part of word bounderies and `\b` is insufficient to use. * [Java] Tweak identifier's word separator * [Java] Give variables branch up immediately * [Java] Use entity.name.tag in JavaDoc see: #2569 * [Java] Rename wildcards scope This commit scopes `*` as `variable.language.wildcard` because 1. it matches anonymous variables `_` in Python and Scala. 2. Makefile scopes asterisks `variable.language` already. 3. it is used in recently reworked CSS 4. by scoping it `keyword.operator` a wildcard in general might not easily be distinguished from arithmetic operators. Note: An alternative scope was `constant.other.placeholder`. * [Java] Scope extends/implements as storage.modifier That one fits better than keyword.declaration as those keywords denote modification to an existing data structure. * [Java] Scope invalid extends/implements unexpected-keyword * [Java] Use keyword.declaration.function * [Java] Exclude prototype from meta-only contexts * [Java] Fix JavaDoc Base Syntax * [Java] Simplify groups patterns Uses `set` within `branching` to match `(` only once. Needs ST 4092+ * [Java] Remove obsolete reserved-pop contexts * [Java] Rename enum-constant to constant The section defines a pattern to match qualified or unqualified constants. The prefix `enum-` might cause confusion with those belonging to the enum declarations section. * [Java] Tweak case label statements 1. Scope label part as `meta.case.label`. 2. Common `case-label-end` context. 3. Add case labels to symbol list to support working with huge state machines. * [Java] Fix tmPreferences indentation * [Java] Tweak illegal highlighting in catch groups * [Java] Tweak anonymous function tests * [Java] Rename meta.method to meta.function * [Java] Remove Symbol List - Method 1. Function names are added to symbol list by default. 2. Function/method names consist of unqualified identifiers only, thus don't need any symbol transformation. * [Java] Tweak line comment punctuation * [Java] Move test files into tests directory * [Java] Move JavaDoc tests to the top of the file I just like comments to be tested first as their contexts are at the top of the syntax file as well. * [Java] Reduce Java/JavaDoc coupling by using embed Avoid injecting JavaDoc contexts directly into Java by replacing the include statement by embed. This reduces Java cache file by the size of JavaDoc as Java now uses a reference of JavaDoc instead of a copy. * [Java] Rename documentation comment scopes * [Java] Make use of HTML prototypes * [Java] Simplify JavaDoc tag names Don't need a sub scope for each tag. * [Java] Remove meta.block-tag.javadoc The meta scope covers everything beginning with the first @... keyword. That's a bit useless then. * [Java] Rework inline javadoc tags This commit... 1. removes `punctuation.definition` scope from `@` in tag names as it is considered not needed during discussions. 2. scopes opening and closing inline-tag braces as `punctuation.definition.tag.[begin|end]` 3. scopes inline tags as `meta.tag.inline.javadoc` as counterpart to `meta.tag.html` * [Java] Add various JavaDoc tests * [Java] Re-add meta.tag.block.javadoc The meta scope covers the block tag name only to follow the scheme of HTML tags. * [Java] Add javadoc-inline-tag-end context * [Java] Add some notes about JavaDoc * [Java] Fix syntax name * [Java] Add java syntax highlighting to {@code ...} * [Java] Remove obsolete syntax_test_java from root Was readded by merging master because Sublime Merge can't handle merge conflicts with moved/deleted files properly. Due to too many differences it was not seen this file was added again. * [Java] Add description to Java (for JavaDoc) * [Java] Simplify JavaDoc asterisk * [Java] Remove expressions from declaration branches ST seems to gracefully continue with the next pattern of the context which includes `declarations` in case no branch succeeds. * [Java] Tweak branch lookaheads * [Java] Improve array item access meta scopes * [Java] Named string body contexts * [Java] Enable angle bracket matching * [Java] Named ternary expression contexts * [Java] Tweak member declaration contexts * [Java] Add local variable declaration section ... for variable only use cases such as for/try parameter lists. * [Java] Rework lambda parameters accordingly Follows local variable declarations. * [Java] Express optional character of variadic contexts * [Java] Rename support.class to storage.type.class As `support` is primarily meant for builtin or stdlib data types, a general class shouldn't use it. Now that `class` uses `keyword.declaration` is seems safe to use `storage.type.class` to denote user defined class data types. * [Java] Add named comment body contexts * [Java] Add named receiver identifier end context * [Java] Tweak array modifiers after identifiers * [Java] Add named accessor contexts * [Java] Tweak object types childs ... used in code blocks. * [Java] Remove expression from member branches Obsolete as ST now handles failing branches well. * [Java] Add support for multi-line qualifiers in code blocks * [Java] Improve illegal type parameters * [Java] Reorganize primitive and var types * [Java] Rename additional bounds operator * [Java] Rename function reference context * [Java] Rename _ variable * [Java] Tweak expressions * [Java] Use accessor variable * [Java] Improve type comparison expressions * [Java] Refactor char and string literal contexts * [Java] Scope import as keyword.declaration.import * [Java] Codestyle * [Java] Fix array modifier in incomplete expressions * [Java] Fix variable highlighting in embedded code Consider an `embed`ed section which ends with a variable. We might want to highlight it `variable.other` rather than `variable.namespace`. That's what this commit is for. Example: variable * [Java] Rework Server Pages (JSP) * [Java] Tweak receiver end context ... to match annotation-parameter strategy. * [Java] rename var scope to storage.type.variant Make clear it is a variant data type but no keyword.declaration! * [Java] Tweak variable declaration context names * [Java] Add specs reference for language literals * [Java] Tweak code style * [Java] Rename contexts from ...-body-block to ...-block * [Java] Remove block-body context * [Java] Remove group-body context * [Java] Add named array dimensions and initializers * [Java] Rename context tails from -content to -body * [Java] Tweak symbol list scopes * [Java] Tweak illegal stray scope names * [Java] Refine meta.declaration Distinguish type, identifier, value parts the same way fields do that. * [Java] Tweak context names * [Java] Move variable declaration contexts * [Java] Remove .readwrite from variable scopes * [Java] Use constant.other in local variable declarations * [Java] Tweak context names * [Java] Fix JSP test cases * [LaTeX] Fix Java test cases * [Java] Enable completions in try with resource statements * Revert "[Java] Add java syntax highlighting to {@code ...}" This reverts commit e8fdd8496ca16decd5b6e6dc8d608e7e10ec987b. A code tag may contain any kind of syntax. Thus highlighting the content as Java only is wrong. * [Java] Fix block comment line start asterisks This commit fixes an issue with the first `*` in normal non-javadoc block comments not to be highlighted. * [Java] Rescope anonymous function declaration operator This commit renames anonymous function declaration operator to `keyword.declaration.function.arrow` with regards to https://github.com/sublimehq/Packages/pull/2617#issuecomment-759683664 Notes: 1. The function body is still scoped `meta.function.anonymous` because a lambda function is anonymous regardless the keyword or operator being used to declare it. 2. The sub-scope `anonymous` is chosen, because it may be used as common name for anonymous functions and variables such as `_` in python and others. 3. The main reason for this commit is to provide separate scopes for lambda function operators such as `->` and `=>` and declaration keywords like `lambda` (Python) or `fun` (Erlang). Some users might want to assign different colors. * [Java] Improve indentation rules Standalone modifiers such as `protected:` are not present in Java's syntax specification documentation and have not been found in real world's code bases. Hence those are removed from indentation rules. Otherwise `switch ... case` statements are supported now. Conditional and loop statements' patterns have been improved to fix some issues with block comments, strings and incomplete statements (missing `;`). Indentation tests are added to verify correctness of rules. Those tests concentrate on control flow statements. They may need to be extended by class/enum/interface declarations and/or annotations etc. * [Java] Simplify completion rules 1. A conditional or loop statement may be a one-liner. Examples: if (v) { fun(); } else { bar(); } do { fun(); } while (bar()); We don't want to prevent completions after `do` or `else` then, even though it is not good coding style. 2. Prevent completions when defining interfaces. Example: interface Name { ... } Note: It seems not possible to disable completions for class/enum/ interface names in case line already contains further expressions: class Name| extends Other { } With `|` denoting caret, completion is still triggered due to `extends...`. * [Java] Fix HTML integration This commit fixes the no longer existing tag-custom context in HTML.sublime-syntax, which was removed by PR #2723. * [Java] Update first line match pattern * [Java] Make sure not to fail on JDK14 switch expressions * [Java] Make sure not to fail on JDK14 instanceof patterns * [Java] Add support for JDK15's sealed classes/interfaces * [Java] Add support for JDK16 record classes Add support for record ClassIdent (Type var, Type var2, ...); Note: Java calls the group after class identifier `RecordHeader` and the content `RecordComponentList`, while this commit just applies the `meta.parameters` scope, which is used in several places already. * [Java] Add support for compact constructors Required for record classes. * [Java] Merge class- and enum-modifiers Two contexts, same content. * [Java] Improve readability of keyword variable lists * [Java] Avoid duplicate look ahead patterns Should save some roundtrips. * [Java] Exclude prototypes from immediately popping contexts * [Java] Use simple id pattern where safe Avoids duplicated negative lookaheads patterns in situations when the token is known not to be a reserved keyword due to the previous pattern, which was executed. Should safe some roundtrips. * [Java] Rename sealed class/interface tests ... to remove duplicate name for class vs. interface tests. * [Java] Add support for yield-statements Introduced with switch expressions. * [Java] Refine case label meta scopes in arrow notation * [Java] Split string literal contexts We may be able to rework Groovy Syntax by extending Java with limited effort, so let's start some preparations. * [Java] Add dedicated literals context Helps inheriting syntax definitions to inject literals. * [Java] Add number suffix variables May help inheriting syntax definitions to extend suffixes easily. * [Java] More robust decimal point Ensure not to match with Groovy's `..` range operators or `...` variadics. * [Java] Rename accessor_dot to single_dot A more general name for more general use. * [Java] Reorganizes textblock contexts This commit... 1. renames `multiline-strings` to `textblock` as this is what Java documentation calls triple quoted strings (""" ... """). 2. reorganizes them in a dedicated context for easier and selective replacement by inheriting syntax definitions. * [Java] Reorganize tmPreferences This package renames some tmPreferences to make clear which syntax definition they belong to. * [Java] Add @interface and record to cancelCompletion * [Java] Update completions This commit... 1. removes "contents" keys as those are equal to "trigger". 2. removes `goto` and `const` as those are illegal keywords. 3. adds `record`, `sealed`, `permits`, `yield`, `var` keywords 4. adds `null`, `false`, `true` constants 5. assigns `bool`, `char`, ... the "type" kind. 6. assigns `protected`, `public`, ... the "type" (modifier) kind. 7. assigns `suber`, `this` the "variable" kind. 8. sorts each group alphabetically * [Java] Tweak tests formatting * [Java] Detailed builtin constants scopes Follows JavaScript * [Java] Avoid duplicate look ahead patterns part 2 Should save some roundtrips. * [Java] Exclude prototypes from immediately popping contexts part 2 Prototypes are not required in immediatelly popping contexts with patterns, if it is known for comments or annotations to have been matched by previous contexts on stack already. * [Java] Tweak receiver branches First pop, then set new contexts to reduce the number of contexts on stack by one. * [Java] Ensure meta.path boundaries in export statements Ensure not to modify patterns in a way which break it. * [Java] Rename meta.if scope This commit scopes if statements `meta.statement.conditional` for consistency with Python and to provide some kind of logical meta scoping for common tokens. meta declaration variable statement conditional loop other expression * [Java] Rename meta.else scope This commit scopes else statements `meta.statement.conditional` for consistency with Python and to provide some kind of logical meta scoping for common tokens. * [Java] Rename meta.switch scope This commit scopes switch statements `meta.statement.conditional` for consistency with Python and to provide some kind of logical meta scoping for common tokens. * [Java] Rename meta.case scope This commit scopes case statements `meta.statement.conditional` for consistency with Python and to provide some kind of logical meta scoping for common tokens. * [Java] Rename meta.while scope This commit scopes while statements `meta.statement.loop` for consistency with Python and to provide some kind of logical meta scoping for common tokens. * [Java] Rename meta.for scope This commit scopes for statements `meta.statement.loop` for consistency with Python and to provide some kind of logical meta scoping for common tokens. * [Java] Rename meta.assertion scope This commit scopes assert statements `meta.statement.conditional` for consistency with Python and to provide some kind of logical meta scoping for common tokens. * [Java] Rename meta.[break|continue|...] scope This commit scopes flow statements `meta.statement.flow` for consistency with Python and to provide some kind of logical meta scoping for common tokens. * [Java] Rename meta.synchronized scope This commit scopes synchronized statements `meta.statement.flow` for consistency with Python and to provide some kind of logical meta scoping for common tokens. * [Java] Rename meta.catch scope This commit scopes catch statements `meta.statement.exception` for consistency with Python and to provide some kind of logical meta scoping for common tokens. * [Java] Rename meta.finally scope This commit scopes finally statements `meta.statement.exception` for consistency with Python and to provide some kind of logical meta scoping for common tokens. * [Java] Rename meta.try scope This commit scopes try statements `meta.statement.exception` for consistency with Python and to provide some kind of logical meta scoping for common tokens. * [Java] Rename meta.typecast scope This commit scopes typecasts `meta.cast` for consistency with C#. * [Java] Rename ternary operator scopes * Revert "[Java] Rename ternary operator scopes" This reverts commit b469b7c287b3ce40b2fa06983a6109006b4791e7. * [Java] Highlight global/local function definitions Required to maintain highlighting when embedding Java into other syntaxes. * [Java] Reduce boolean scope granularity * [Java] Reorganize embedded contexts in JSP - renames meta.interpolation scopes to meta.embedded as this is what all the other syntaxes such as ASP/PHP/Rails use. - rename context names accordingly. * [Java] Add jsp string interpolation in CSS/JS * [Java] Rename all embedded Java scopes in JSP Finalizing scopes with HTML feels odd when those contexts are included in JS/CSS. * [Java] Fix meta.annotation.parameters boundaries This commit fixes overlapping meta.annotation.identifier meta.annotation.parameters * [Java] Improve catch() expression This commit ... 1. scopes variables in catch arguments `variabe.other`. 2. scopes array modifiers illegal. addresses https://github.com/sublimehq/Packages/pull/2654#issuecomment-856668801 * [Java] Use punctuation.section.generic Addresses https://github.com/sublimehq/Packages/pull/2654#issuecomment-856668801 * [Java] Fix meta.annotation boundaries This commit makes sure to not scope trailing newline of annotations `meta.annotation` if no parameter list follows on next line. * [Java] No class entity in static imports * [Java] Exclude prototypes * [Java] Improve emacs mode tag Anything is allowed in front of `-*- mode: java -*-` * [Java] Update java properties to sublime-syntax v2 * [Java] Scope file/page attributes in JSP as url * [Java] Fix indentation after block comments * [Java] Add indentation tests with line comments * [Java] Fix toggle html comments in embedded css/js tags in JSP * [Java] Scope arrow in switch statements separator This commit... 1. modifies scope of arrows after case labels in switch statements to the same as colons in switch statements. 2. Shorten meta.scopes of `default` branch a bit by removing `.case`, so we end up with - `meta.statement.conditional.case` vs. - `meta.statement.conditional.default` Satisfy: https://github.com/sublimehq/Packages/pull/2654#issuecomment-905659014 * [Java] Add shebang highlighting Closes #2991 * [Java] Add JSTL variable interpolation support see: https://www.oracle.com/technical-resources/articles/javase/code-convention.html * [Java] Add file extension for Java Server Page Fragments * [Java] Highlight namespace part of html/xml-tags JSTL provides functions by namespaced custom tags. Therefore this commit adds scopes namespace part of custom/unknown tags to make them visually consistent with normal JSP tags. They are still scoped `meta.tag.other` as it is not intended to start long lists of "known" JSTL tags. * [Java] Rename symbol list for fields Uses plural for all files. * [Java] Exclude local imports from global symbol index Satisfy: https://github.com/sublimehq/Packages/pull/2654#issuecomment-905641657 * [Java] Tweak indentation rules comment ... to keep inline with CSS. * [Java] Fix highlighting issue with constant case label Fixes https://github.com/sublimehq/Packages/pull/2654#issuecomment-912668422 * [Java] Tweak case label end bailout Exclude `{{variables}}` from bailout. Not sure why, but `super` or other reserved variables should have caused the context to be popped, which should have caused some trouble. Nevertheless, make sure it doesn't in future releases of ST. * [Java] Fix case constant labels with annotations This commit ensures not to break highlighting of case statements if the label is preceded by an annotation. * [Java] Improve qualified constants parsing performance This commit increases parsing performance of qualified constants in case statements by 820%. Benchmark: 1. Create a `syntax_test_perf_constant_fqn.java` file 2. paste 100k lines of `case mod.sub.MyClass.EnumConst:` into the file 3. Run `Syntax Test - Performance` Parsing times: Before: 175ms After: 32ms * [Java] Tweak qualified constants parsing contexts Turn `qualified-constant-class-or-name` into an immediately popping intermediate management context without own patterns after the scheme of `qualified-constant` context. This doesn't change external behavior. * [Java] Remove obsolete prototype contexts * [Java] Tweak block comment patterns * [Java] Restrict shebang highlighting to very first line This commit adds some prototype exclusions to ensure shebang comments to be highlighted at the very first line only. * [Java] Fix allowed method modifiers Both `native` and `strictfp` are valid method modifiers. --- Java/CSS (for JSP).sublime-syntax | 32 + Java/Comments - Properties.tmPreferences | 27 - Java/Default.sublime-keymap | 27 + Java/HTML (JSP).sublime-syntax | 503 + Java/Indentation Rules Annex.tmPreferences | 14 - Java/Indentation Rules.tmPreferences | 22 - Java/Java (for HTML).sublime-syntax | 45 + Java/Java (for JSP).sublime-syntax | 35 + ...ferences => Java - Comments.tmPreferences} | 2 - ... => Java - Completion Rules.tmPreferences} | 5 +- ...Indentation Rules (Comments).tmPreferences | 27 + Java/Java - Indentation Rules.tmPreferences | 84 + Java/Java Server Pages (JSP).sublime-syntax | 87 - Java/Java.sublime-completions | 358 +- Java/Java.sublime-settings | 6 + Java/Java.sublime-syntax | 4122 ++++-- Java/JavaDoc.sublime-syntax | 381 +- Java/JavaProperties - Comments.tmPreferences | 25 + Java/JavaProperties.sublime-syntax | 75 +- Java/JavaScript (for JSP).sublime-syntax | 32 + ...=> Symbol List - Case Label.tmPreferences} | 10 +- Java/Symbol List - Classes.tmPreferences | 6 +- Java/Symbol List - Constants.tmPreferences | 2 - ...nces => Symbol List - Enums.tmPreferences} | 6 +- Java/Symbol List - Fields.tmPreferences | 12 + Java/Symbol List - Imports.tmPreferences | 21 + .../Symbol List - Inner Classes.tmPreferences | 16 - ...l List - Inner Inner Classes.tmPreferences | 16 - Java/Symbol List - Interfaces.tmPreferences | 14 + Java/Symbol List - Method.tmPreferences | 19 - Java/Symbol List - Modules.tmPreferences | 10 +- ...s => Symbol List - Packages.tmPreferences} | 9 +- Java/Symbol List - Properties.tmPreferences | 2 - Java/syntax_test_java.java | 2577 ---- Java/syntax_test_jsp.jsp | 59 - Java/tests/syntax_test_java.java | 10549 ++++++++++++++++ Java/tests/syntax_test_java_indentation.java | 997 ++ .../syntax_test_java_properties.properties | 64 +- Java/tests/syntax_test_jsp.jsp | 677 + LaTeX/syntax_test_latex.tex | 2 +- 40 files changed, 16601 insertions(+), 4376 deletions(-) create mode 100644 Java/CSS (for JSP).sublime-syntax delete mode 100644 Java/Comments - Properties.tmPreferences create mode 100644 Java/Default.sublime-keymap create mode 100644 Java/HTML (JSP).sublime-syntax delete mode 100644 Java/Indentation Rules Annex.tmPreferences delete mode 100644 Java/Indentation Rules.tmPreferences create mode 100644 Java/Java (for HTML).sublime-syntax create mode 100644 Java/Java (for JSP).sublime-syntax rename Java/{Comments.tmPreferences => Java - Comments.tmPreferences} (93%) rename Java/{Completion Rules.tmPreferences => Java - Completion Rules.tmPreferences} (55%) create mode 100644 Java/Java - Indentation Rules (Comments).tmPreferences create mode 100644 Java/Java - Indentation Rules.tmPreferences delete mode 100644 Java/Java Server Pages (JSP).sublime-syntax create mode 100644 Java/Java.sublime-settings create mode 100644 Java/JavaProperties - Comments.tmPreferences create mode 100644 Java/JavaScript (for JSP).sublime-syntax rename Java/{Symbol List - Inner Inner Class Methods.tmPreferences => Symbol List - Case Label.tmPreferences} (50%) rename Java/{Indexed Symbol List.tmPreferences => Symbol List - Enums.tmPreferences} (57%) create mode 100644 Java/Symbol List - Fields.tmPreferences create mode 100644 Java/Symbol List - Imports.tmPreferences delete mode 100644 Java/Symbol List - Inner Classes.tmPreferences delete mode 100644 Java/Symbol List - Inner Inner Classes.tmPreferences create mode 100644 Java/Symbol List - Interfaces.tmPreferences delete mode 100644 Java/Symbol List - Method.tmPreferences rename Java/{Symbol List - Inner Class Methods.tmPreferences => Symbol List - Packages.tmPreferences} (51%) delete mode 100644 Java/syntax_test_java.java delete mode 100644 Java/syntax_test_jsp.jsp create mode 100644 Java/tests/syntax_test_java.java create mode 100644 Java/tests/syntax_test_java_indentation.java rename Java/{ => tests}/syntax_test_java_properties.properties (54%) create mode 100644 Java/tests/syntax_test_jsp.jsp diff --git a/Java/CSS (for JSP).sublime-syntax b/Java/CSS (for JSP).sublime-syntax new file mode 100644 index 0000000000..3b2864d328 --- /dev/null +++ b/Java/CSS (for JSP).sublime-syntax @@ -0,0 +1,32 @@ +%YAML 1.2 +--- +############################################################################### +# This intermediate syntax is used by `HTML (JSP).sublime-syntax` +# +# It powers Java highlighting within JSP tags in embedded CSS. +# +# +# +# The primary task is to add `jsp-embedded` context to CSS's prototype +# to highlight all the <% %> tags. +############################################################################### + +scope: source.css.embedded.jsp +version: 2 +hidden: true + +extends: Packages/CSS/CSS.sublime-syntax + +contexts: + + prototype: + - meta_prepend: true + - include: HTML (JSP).sublime-syntax#jsp-embedded + + string-content: + - meta_prepend: true + - include: HTML (JSP).sublime-syntax#jsp-interpolations diff --git a/Java/Comments - Properties.tmPreferences b/Java/Comments - Properties.tmPreferences deleted file mode 100644 index 7462ae5c97..0000000000 --- a/Java/Comments - Properties.tmPreferences +++ /dev/null @@ -1,27 +0,0 @@ - - - - name - Comments - Properties - scope - source.java-props - settings - - shellVariables - - - name - TM_COMMENT_START - value - # - - - name - TM_COMMENT_START_2 - value - ! - - - - - diff --git a/Java/Default.sublime-keymap b/Java/Default.sublime-keymap new file mode 100644 index 0000000000..92a4a90a52 --- /dev/null +++ b/Java/Default.sublime-keymap @@ -0,0 +1,27 @@ +[ + // Auto-pair double quotes (also if followed by comma or semicolon) + // Example: key: |; -> key: "|"; + { "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\"$0\""}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "source.java - string", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|,|:|;|\\+|$)", "match_all": true }, + { "key": "preceding_text", "operator": "not_regex_contains", "operand": "[\"a-zA-Z0-9_]$", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double - punctuation.definition.string.end", "match_all": true } + ] + }, + + // Auto-pair double quotes (also if followed by comma or semicolon) + // Example: key: |; -> key: '|'; + { "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'$0'"}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "source.java - string", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|,|:|;|\\+|$)", "match_all": true }, + { "key": "preceding_text", "operator": "not_regex_contains", "operand": "['a-zA-Z0-9_]$", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double - punctuation.definition.string.end", "match_all": true } + ] + }, +] \ No newline at end of file diff --git a/Java/HTML (JSP).sublime-syntax b/Java/HTML (JSP).sublime-syntax new file mode 100644 index 0000000000..47218d9490 --- /dev/null +++ b/Java/HTML (JSP).sublime-syntax @@ -0,0 +1,503 @@ +%YAML 1.2 +--- +# https://www.oracle.com/technetwork/java/syntaxref12-149806.pdf +# https://www.sublimetext.com/docs/syntax.html +name: HTML (JSP) +scope: text.html.jsp +version: 2 + +extends: Packages/HTML/HTML.sublime-syntax + +file_extensions: + - jsp + - jspf + - jspx + +contexts: + + prototype: + - meta_prepend: true + - include: jsp-embedded + +###[ HTML CUSTOM TAGS ]####################################################### + + tag-other: + - meta_prepend: true + - include: tag-jsp-declaration + - include: tag-jsp-directive + - include: tag-jsp-expression + - include: tag-jsp-scriptlet + - include: tag-jsp-other + - include: tag-jstl + + script-javascript-content: + - meta_include_prototype: false + - match: '{{script_content_begin}}' + captures: + 1: comment.block.html punctuation.definition.comment.begin.html + pop: 1 # make sure to match only once + embed: scope:source.js.embedded.jsp + embed_scope: source.js.embedded.html + escape: '{{script_content_end}}' + escape_captures: + 1: source.js.embedded.html + 2: comment.block.html punctuation.definition.comment.end.html + 3: source.js.embedded.html + 4: comment.block.html punctuation.definition.comment.end.html + + style-css-content: + - meta_include_prototype: false + - match: '{{style_content_begin}}' + captures: + 1: comment.block.html punctuation.definition.comment.begin.html + pop: 1 # make sure to match only once + embed: scope:source.css.embedded.jsp + embed_scope: source.css.embedded.html + escape: '{{style_content_end}}' + escape_captures: + 1: source.css.embedded.html + 2: comment.block.html punctuation.definition.comment.end.html + 3: source.css.embedded.html + 4: comment.block.html punctuation.definition.comment.end.html + + tag-event-attribute-value: + - match: \" + scope: + meta.string.html string.quoted.double.html + punctuation.definition.string.begin.html + embed: scope:source.js.embedded.jsp + embed_scope: + meta.string.html meta.interpolation.html + source.js.embedded.html + escape: \" + escape_captures: + 0: meta.string.html string.quoted.double.html + punctuation.definition.string.end.html + - match: \' + scope: + meta.string.html string.quoted.single.html + punctuation.definition.string.begin.html + embed: scope:source.js.embedded.jsp + embed_scope: + meta.string.html meta.interpolation.html + source.js.embedded.html + escape: \' + escape_captures: + 0: meta.string.html string.quoted.single.html + punctuation.definition.string.end.html + - include: else-pop + + tag-style-attribute-value: + - match: \" + scope: + meta.string.html string.quoted.double.html + punctuation.definition.string.begin.html + embed: scope:source.css.embedded.jsp#rule-list-body + embed_scope: + meta.string.html meta.interpolation.html + source.css.embedded.html + escape: \" + escape_captures: + 0: meta.string.html string.quoted.double.html + punctuation.definition.string.end.html + - match: \' + scope: + meta.string.html string.quoted.single.html + punctuation.definition.string.begin.html + embed: scope:source.css.embedded.jsp#rule-list-body + embed_scope: + meta.string.html meta.interpolation.html + source.css.embedded.html + escape: \' + escape_captures: + 0: meta.string.html string.quoted.single.html + punctuation.definition.string.end.html + - include: else-pop + + tag-href-attribute: + - meta_append: true + - include: tag-xmlns-attribute + + tag-xmlns-attribute: + - match: ((?i:xmlns))(?:(:)([^{{attribute_name_break_char}}]+))?{{attribute_name_break}} + captures: + 1: entity.other.attribute-name.namespace.html + 2: punctuation.separator.namespace.html + 3: entity.other.attribute-name.localname.html + push: + - tag-xmlns-attributes-meta + - tag-href-attributes-assignment + + tag-xmlns-attributes-meta: + - meta_include_prototype: false + - meta_scope: meta.attribute-with-value.xmlns.html + - include: immediately-pop + + tag-attribute-value-content: + - meta_prepend: true + - include: jsp-interpolations + + strings-common-content: + - meta_prepend: true + - include: jsp-interpolations + +###[ JSP TAG DECLARATION ]#################################################### + + tag-jsp-declaration: + - match: (?i)(<)(jsp)(:)(declaration){{tag_name_break}} + captures: + 1: punctuation.definition.tag.begin.html + 2: entity.name.tag.namespace.html + 3: entity.name.tag.html punctuation.separator.namespace.html + 4: entity.name.tag.localname.html + push: tag-jsp-declaration-attributes + - match: (?i)(' + scope: + meta.tag.jsp.declaration.begin.html + punctuation.definition.tag.end.html + pop: 1 + embed: scope:source.java.embedded.html + embed_scope: source.java.embedded.jsp + escape: (?=' + scope: + meta.tag.jsp.expression.begin.html + punctuation.definition.tag.end.html + pop: 1 + embed: scope:source.java.embedded.html#expressions + embed_scope: source.java.embedded.jsp + escape: (?=' + scope: + meta.tag.jsp.scriptlet.begin.html + punctuation.definition.tag.end.html + pop: 1 + embed: scope:source.java.embedded.html + embed_scope: source.java.embedded.jsp + escape: (?= + scope: punctuation.definition.comment.end.jsp + pop: 1 + + jsp-embedded-declarations: + - match: <%! + scope: + meta.embedded.declaration.jsp + punctuation.section.embedded.begin.jsp + embed: scope:source.java.embedded.jsp + embed_scope: + meta.embedded.declaration.jsp + source.java.embedded.jsp + escape: \%> + escape_captures: + 0: meta.embedded.declaration.jsp + punctuation.section.embedded.end.jsp + + jsp-embedded-directives: + - match: <%@ + scope: punctuation.section.embedded.begin.jsp + push: jsp-embedded-directives-common + + jsp-embedded-directives-common: + - meta_include_prototype: false + - meta_scope: meta.embedded.directive.jsp + - match: \%> + scope: punctuation.section.embedded.end.jsp + pop: 1 + - match: \w+ + scope: keyword.control.directive.jsp + push: jsp-embedded-directives-content + + jsp-embedded-directives-content: + - meta_include_prototype: false + - match: \w+ + scope: entity.other.attribute-name.jsp + - match: = + scope: punctuation.separator.key-value.jsp + - include: jsp-strings-double-quoted + - include: jsp-strings-single-quoted + - include: else-pop + + jsp-embedded-expressions: + - match: <%= + scope: + meta.embedded.expression.jsp + punctuation.section.embedded.begin.jsp + embed: scope:source.java.embedded.jsp#expressions + embed_scope: + meta.embedded.expression.jsp + source.java.embedded.jsp + escape: \%> + escape_captures: + 0: meta.embedded.expression.jsp + punctuation.section.embedded.end.jsp + + jsp-embedded-scriptlets: + - match: <% + scope: + meta.embedded.scriptlet.jsp + punctuation.section.embedded.begin.jsp + embed: scope:source.java.embedded.jsp + embed_scope: + meta.embedded.scriptlet.jsp + source.java.embedded.jsp + escape: \%> + escape_captures: + 0: meta.embedded.scriptlet.jsp + punctuation.section.embedded.end.jsp + +###[ JSP CONSTANTS ]########################################################## + + jsp-strings-double-quoted: + - match: \" + scope: punctuation.definition.string.begin.jsp + push: jsp-strings-double-quoted-content + + jsp-strings-double-quoted-content: + - meta_include_prototype: false + - meta_scope: meta.string.jsp string.quoted.double.jsp + - match: \" + scope: punctuation.definition.string.end.jsp + pop: 1 + - include: jsp-string-escapes + + jsp-strings-single-quoted: + - match: \' + scope: punctuation.definition.string.begin.jsp + push: jsp-strings-single-quoted-content + + jsp-strings-single-quoted-content: + - meta_include_prototype: false + - meta_scope: meta.string.jsp string.quoted.single.jsp + - match: \' + scope: punctuation.definition.string.end.jsp + pop: 1 + - include: jsp-string-escapes + + jsp-string-escapes: + - match: \\. + scope: constant.character.escape.jsp diff --git a/Java/Indentation Rules Annex.tmPreferences b/Java/Indentation Rules Annex.tmPreferences deleted file mode 100644 index 83689d8523..0000000000 --- a/Java/Indentation Rules Annex.tmPreferences +++ /dev/null @@ -1,14 +0,0 @@ - - - - name - Indentation Rules Annex - scope - source.java - settings - - unIndentedLinePattern - ^\s*((\*/|//| \*).*)?$ - - - diff --git a/Java/Indentation Rules.tmPreferences b/Java/Indentation Rules.tmPreferences deleted file mode 100644 index 0373ea5982..0000000000 --- a/Java/Indentation Rules.tmPreferences +++ /dev/null @@ -1,22 +0,0 @@ - - - - name - Indentation Rules - scope - source.java - comment - settings - - decreaseIndentPattern - ^(.*\*/)?\s*\}.*$|^\s*(public|private|protected):\s*$ - increaseIndentPattern - ^.*\{[^}"']*$|^\s*(public|private|protected):\s*$ - - bracketIndentNextLinePattern - (?x) - ^ \s* \b(if|while|else)\b [^;]* $ - | ^ \s* \b(for)\b .* $ - - - - diff --git a/Java/Java (for HTML).sublime-syntax b/Java/Java (for HTML).sublime-syntax new file mode 100644 index 0000000000..dae98e7505 --- /dev/null +++ b/Java/Java (for HTML).sublime-syntax @@ -0,0 +1,45 @@ +%YAML 1.2 +--- +############################################################################### +# This intermediate syntax is used by `HTML (JSP).sublime-syntax` +# +# It powers Java highlighting within following XML noted JSP tags: +# ... +# ... +# ... +# +# The primary tasks are: +# 1) to disable stray bracket highlighting +# 2) highlight HTML entities within Java code +# 3) highlight CDATA tags within Java code +############################################################################### + +scope: source.java.embedded.html +version: 2 +hidden: true + +extends: Java.sublime-syntax + +contexts: + + prototype: + - meta_append: true + - include: HTML (Plain).sublime-syntax#entities + - match: (' + scope: + meta.tag.sgml.cdata.html + punctuation.definition.tag.end.html + + stray-braces: + - match: \} + scope: punctuation.section.block.end.java + + stray-group: + - match: \) + scope: punctuation.section.group.end.java diff --git a/Java/Java (for JSP).sublime-syntax b/Java/Java (for JSP).sublime-syntax new file mode 100644 index 0000000000..50c9023f58 --- /dev/null +++ b/Java/Java (for JSP).sublime-syntax @@ -0,0 +1,35 @@ +%YAML 1.2 +--- +############################################################################### +# This intermediate syntax is used by `HTML (JSP).sublime-syntax` +# +# It powers Java highlighting within following JSP embedding tags: +# <%! ... %> +# <%= ... %> +# <% ... %> +# +# The primary tasks are: +# 1) to disable stray bracket highlighting +# 2) highlight escaped %> end tags +############################################################################### + +scope: source.java.embedded.jsp +version: 2 +hidden: true + +extends: Java.sublime-syntax + +contexts: + + stray-braces: + - match: \} + scope: punctuation.section.block.end.java + + stray-group: + - match: \) + scope: punctuation.section.group.end.java + + literal-string-escapes: + # escaped <% and %> to not detect them as end of interpolation + - match: <\\%|%\\> + scope: constant.character.escape.jsp diff --git a/Java/Comments.tmPreferences b/Java/Java - Comments.tmPreferences similarity index 93% rename from Java/Comments.tmPreferences rename to Java/Java - Comments.tmPreferences index a880b9ecd8..8b104c6c51 100644 --- a/Java/Comments.tmPreferences +++ b/Java/Java - Comments.tmPreferences @@ -1,8 +1,6 @@ - name - Comments scope source.java settings diff --git a/Java/Completion Rules.tmPreferences b/Java/Java - Completion Rules.tmPreferences similarity index 55% rename from Java/Completion Rules.tmPreferences rename to Java/Java - Completion Rules.tmPreferences index 093a13fc99..111327de91 100644 --- a/Java/Completion Rules.tmPreferences +++ b/Java/Java - Completion Rules.tmPreferences @@ -6,7 +6,10 @@ settings cancelCompletion - ^\s*(\}?\s*(else|try|do|finally)|(class|package|enum)\s*[a-zA-Z_0-9]+*)$ + diff --git a/Java/Java - Indentation Rules (Comments).tmPreferences b/Java/Java - Indentation Rules (Comments).tmPreferences new file mode 100644 index 0000000000..6cab147cab --- /dev/null +++ b/Java/Java - Indentation Rules (Comments).tmPreferences @@ -0,0 +1,27 @@ + + + + scope + source.java comment.block + settings + + + preserveIndent + + unIndentedLinePattern + . + + + diff --git a/Java/Java - Indentation Rules.tmPreferences b/Java/Java - Indentation Rules.tmPreferences new file mode 100644 index 0000000000..6961675b36 --- /dev/null +++ b/Java/Java - Indentation Rules.tmPreferences @@ -0,0 +1,84 @@ + + + + scope + source.java + settings + + decreaseIndentPattern + + increaseIndentPattern + + bracketIndentNextLinePattern + (?: \s* (? /\*.*\*/ ) )* \s* ) + (?: + # indent after: + # - `else` + else + # indent after: + # - `else if (...)` + # - `if (...)` + # - `for (...)` + # - `while (...)` + | (?: (?: else \g )? if | for | while ) + # followed by whitespace or block comments [optional] + \g + # top-level balanced parentheses + \( + (? (?: + # nested balanced parentheses + \( \g \) + # double quoted string with ignored escaped quotation marks + | \".*(? + # anything but closing parenthesis + | [^)] + )* ) + # maybe missing, balanced or stray closing parenthesis + \)* + ) + # followed by whitespace or block comments [optional] + \g + # followed by line comment [optional] + (?: //.* )? $ + ]]> + preserveIndent + + unIndentedLinePattern + + + + diff --git a/Java/Java Server Pages (JSP).sublime-syntax b/Java/Java Server Pages (JSP).sublime-syntax deleted file mode 100644 index f34f5e58cf..0000000000 --- a/Java/Java Server Pages (JSP).sublime-syntax +++ /dev/null @@ -1,87 +0,0 @@ -%YAML 1.2 ---- -# http://www.sublimetext.com/docs/3/syntax.html -name: Java Server Page (JSP) -file_extensions: - - jsp -scope: text.html.jsp -contexts: - main: - - match: <%-- - scope: punctuation.definition.comment.jsp - push: - - meta_scope: comment.block.jsp - - match: "--%>" - scope: punctuation.definition.comment.jsp - pop: true - - match: <%@ - scope: punctuation.section.directive.jsp - push: - - meta_scope: meta.directive.jsp - - match: "%>" - scope: punctuation.section.directive.jsp - pop: true - - match: \w+ - scope: keyword.other.directive.jsp - push: - - match: \w+ - scope: constant.other.directive.attribute.jsp - - match: "=" - scope: keyword.operator.assignment.jsp - - match: '"' - scope: punctuation.definition.string.begin.jsp - push: - - meta_scope: string.quoted.double.jsp - - match: '"' - scope: punctuation.definition.string.end.jsp - pop: true - - match: \\. - scope: constant.character.escape.jsp - - match: "'" - scope: punctuation.definition.string.begin.jsp - push: - - meta_scope: string.quoted.single.jsp - - match: "'" - scope: punctuation.definition.string.end.jsp - pop: true - - match: \\. - scope: constant.character.escape.jsp - - match: '(?=\S)' - pop: true - - match: "(<%[!=]?)|(||)" - captures: - 1: punctuation.section.embedded.begin.jsp - 2: meta.tag.block.jsp - push: - - match: (||)|(%>) - captures: - 1: meta.tag.block.jsp - 2: punctuation.section.embedded.end.jsp - pop: true - - match: '(?|||%>|\{|\})' - push: - - meta_scope: source.java.embedded.html - - match: '(?=|||%>|\{|\})|\n' - pop: true - - include: scope:source.java - - match: "{" - push: - - match: "}" - pop: true - - match: (||)|(%>) - captures: - 1: meta.tag.block.jsp - 2: punctuation.section.embedded.end.jsp - push: - - match: "(||)|(<%(?!--)[!=]?)" - captures: - 1: meta.tag.block.jsp - 2: punctuation.section.embedded.begin.jsp - pop: true - - include: scope:text.html.jsp - - include: scope:source.java - # Prevent stray brace detection since brace matching won't work with - # %> pop pattern - - match: "}" - - include: scope:source.java - - include: scope:text.html.basic diff --git a/Java/Java.sublime-completions b/Java/Java.sublime-completions index 9b302bda0a..d5c92dc510 100644 --- a/Java/Java.sublime-completions +++ b/Java/Java.sublime-completions @@ -5,254 +5,248 @@ "completions": [ // Keywords { - "trigger": "abstract", - "contents": "abstract", + "trigger": "assert", "kind": "keyword" }, { - "trigger": "continue", - "contents": "continue", + "trigger": "break", "kind": "keyword" }, { - "trigger": "for", - "contents": "for", + "trigger": "case", "kind": "keyword" }, { - "trigger": "new", - "contents": "new", + "trigger": "catch", "kind": "keyword" }, { - "trigger": "switch", - "contents": "switch", + "trigger": "class", "kind": "keyword" }, { - "trigger": "assert", - "contents": "assert", + "trigger": "continue", "kind": "keyword" }, { "trigger": "default", - "contents": "default", "kind": "keyword" }, { - "trigger": "goto", - "contents": "goto", + "trigger": "do", "kind": "keyword" }, { - "trigger": "package", - "contents": "package", + "trigger": "double", "kind": "keyword" }, { - "trigger": "synchronized", - "contents": "synchronized", + "trigger": "else", "kind": "keyword" }, { - "trigger": "boolean", - "contents": "boolean", + "trigger": "enum", "kind": "keyword" }, { - "trigger": "do", - "contents": "do", + "trigger": "extends", "kind": "keyword" }, { - "trigger": "if", - "contents": "if", + "trigger": "finally", "kind": "keyword" }, { - "trigger": "private", - "contents": "private", + "trigger": "for", "kind": "keyword" }, { - "trigger": "this", - "contents": "this", + "trigger": "if", "kind": "keyword" }, { - "trigger": "break", - "contents": "break", + "trigger": "implements", "kind": "keyword" }, { - "trigger": "double", - "contents": "double", + "trigger": "import", "kind": "keyword" }, { - "trigger": "implements", - "contents": "implements", + "trigger": "instanceof", "kind": "keyword" }, { - "trigger": "protected", - "contents": "protected", + "trigger": "interface", "kind": "keyword" }, { - "trigger": "throw", - "contents": "throw", + "trigger": "new", "kind": "keyword" }, { - "trigger": "byte", - "contents": "byte", + "trigger": "package", "kind": "keyword" }, { - "trigger": "else", - "contents": "else", + "trigger": "record", "kind": "keyword" }, { - "trigger": "import", - "contents": "import", + "trigger": "return", "kind": "keyword" }, { - "trigger": "public", - "contents": "public", + "trigger": "switch", "kind": "keyword" }, { - "trigger": "throws", - "contents": "throws", + "trigger": "synchronized", "kind": "keyword" }, { - "trigger": "case", - "contents": "case", + "trigger": "throw", "kind": "keyword" }, { - "trigger": "enum", - "contents": "enum", + "trigger": "throws", "kind": "keyword" }, { - "trigger": "instanceof", - "contents": "instanceof", + "trigger": "try", "kind": "keyword" }, { - "trigger": "return", - "contents": "return", + "trigger": "var", "kind": "keyword" }, { - "trigger": "transient", - "contents": "transient", + "trigger": "void", "kind": "keyword" }, { - "trigger": "catch", - "contents": "catch", + "trigger": "while", "kind": "keyword" }, { - "trigger": "extends", - "contents": "extends", + "trigger": "yield", "kind": "keyword" }, + + // Built-In Constants { - "trigger": "int", - "contents": "int", - "kind": "keyword" + "trigger": "false", + "annotation": "built-in", + "kind": ["variable", "c", "Constant"] }, { - "trigger": "short", - "contents": "short", - "kind": "keyword" + "trigger": "null", + "annotation": "built-in", + "kind": ["variable", "c", "Constant"] }, { - "trigger": "try", - "contents": "try", - "kind": "keyword" + "trigger": "true", + "annotation": "built-in", + "kind": ["variable", "c", "Constant"] }, + + // Built-In Modifiers { - "trigger": "char", - "contents": "char", - "kind": "keyword" + "trigger": "abstract", + "kind": ["keyword", "m", "Modifier"] }, { "trigger": "final", - "contents": "final", - "kind": "keyword" + "kind": ["keyword", "m", "Modifier"] }, { - "trigger": "interface", - "contents": "interface", - "kind": "keyword" + "trigger": "native", + "kind": ["keyword", "m", "Modifier"] }, { - "trigger": "static", - "contents": "static", - "kind": "keyword" + "trigger": "permits", + "kind": ["keyword", "m", "Modifier"] }, { - "trigger": "void", - "contents": "void", - "kind": "keyword" + "trigger": "private", + "kind": ["keyword", "m", "Modifier"] }, { - "trigger": "class", - "contents": "class", - "kind": "keyword" + "trigger": "protected", + "kind": ["keyword", "m", "Modifier"] }, { - "trigger": "finally", - "contents": "finally", - "kind": "keyword" + "trigger": "public", + "kind": ["keyword", "m", "Modifier"] }, { - "trigger": "long", - "contents": "long", - "kind": "keyword" + "trigger": "static", + "kind": ["keyword", "m", "Modifier"] }, { "trigger": "strictfp", - "contents": "strictfp", - "kind": "keyword" + "kind": ["keyword", "m", "Modifier"] + }, + { + "trigger": "sealed", + "kind": ["keyword", "m", "Modifier"] + }, + { + "trigger": "transient", + "kind": ["keyword", "m", "Modifier"] }, { "trigger": "volatile", - "contents": "volatile", - "kind": "keyword" + "kind": ["keyword", "m", "Modifier"] }, + + // Built-In Types { - "trigger": "const", - "contents": "const", - "kind": "keyword" + "trigger": "boolean", + "annotation": "built-in", + "kind": "type" + }, + { + "trigger": "byte", + "annotation": "built-in", + "kind": "type" + }, + { + "trigger": "char", + "annotation": "built-in", + "kind": "type" }, { "trigger": "float", - "contents": "float", - "kind": "keyword" + "annotation": "built-in", + "kind": "type" }, { - "trigger": "native", - "contents": "native", - "kind": "keyword" + "trigger": "int", + "annotation": "built-in", + "kind": "type" + }, + { + "trigger": "long", + "annotation": "built-in", + "kind": "type" + }, + { + "trigger": "short", + "annotation": "built-in", + "kind": "type" }, + + // Built-In Variables { "trigger": "super", - "contents": "super", - "kind": "keyword" + "annotation": "built-in", + "kind": "variable" }, { - "trigger": "while", - "contents": "while", - "kind": "keyword" + "trigger": "this", + "annotation": "built-in", + "kind": "variable" }, // Extracted from https://docs.oracle.com/javase/8/docs/api/java/lang/package-summary.html @@ -260,42 +254,34 @@ // java.lang interfaces { "trigger": "Appendable", - "contents": "Appendable", "kind": ["type", "i", "Interface"] }, { "trigger": "AutoCloseable", - "contents": "AutoCloseable", "kind": ["type", "i", "Interface"] }, { "trigger": "CharSequence", - "contents": "CharSequence", "kind": ["type", "i", "Interface"] }, { "trigger": "Cloneable", - "contents": "Cloneable", "kind": ["type", "i", "Interface"] }, { "trigger": "Comparable", - "contents": "Comparable", "kind": ["type", "i", "Interface"] }, { "trigger": "Iterable", - "contents": "Iterable", "kind": ["type", "i", "Interface"] }, { "trigger": "Readable", - "contents": "Readable", "kind": ["type", "i", "Interface"] }, { "trigger": "Runnable", - "contents": "Runnable", "kind": ["type", "i", "Interface"] }, // "Thread.UncaughtExceptionHandler", @@ -303,175 +289,141 @@ // java.lang Classes { "trigger": "Boolean", - "contents": "Boolean", "kind": ["type", "c", "Class"] }, { "trigger": "Byte", - "contents": "Byte", "kind": ["type", "c", "Class"] }, { "trigger": "Character", - "contents": "Character", "kind": ["type", "c", "Class"] }, // "Character.Subset", // "Character.UnicodeBlock", { "trigger": "Class", - "contents": "Class", "kind": ["type", "c", "Class"] }, { "trigger": "ClassLoader", - "contents": "ClassLoader", "kind": ["type", "c", "Class"] }, { "trigger": "ClassValue", - "contents": "ClassValue", "kind": ["type", "c", "Class"] }, { "trigger": "Compiler", - "contents": "Compiler", "kind": ["type", "c", "Class"] }, { "trigger": "Double", - "contents": "Double", "kind": ["type", "c", "Class"] }, { "trigger": "Enum", - "contents": "Enum", "kind": ["type", "c", "Class"] }, { "trigger": "Float", - "contents": "Float", "kind": ["type", "c", "Class"] }, { "trigger": "InheritableThreadLocal", - "contents": "InheritableThreadLocal", "kind": ["type", "c", "Class"] }, { "trigger": "Integer", - "contents": "Integer", "kind": ["type", "c", "Class"] }, { "trigger": "Long", - "contents": "Long", "kind": ["type", "c", "Class"] }, { "trigger": "Math", - "contents": "Math", "kind": ["type", "c", "Class"] }, { "trigger": "Number", - "contents": "Number", "kind": ["type", "c", "Class"] }, { "trigger": "Object", - "contents": "Object", "kind": ["type", "c", "Class"] }, { "trigger": "Package", - "contents": "Package", "kind": ["type", "c", "Class"] }, { "trigger": "Process", - "contents": "Process", "kind": ["type", "c", "Class"] }, { "trigger": "ProcessBuilder", - "contents": "ProcessBuilder", "kind": ["type", "c", "Class"] }, // "ProcessBuilder.Redirect", { "trigger": "Runtime", - "contents": "Runtime", "kind": ["type", "c", "Class"] }, { "trigger": "RuntimePermission", - "contents": "RuntimePermission", "kind": ["type", "c", "Class"] }, { "trigger": "SecurityManager", - "contents": "SecurityManager", "kind": ["type", "c", "Class"] }, { "trigger": "Short", - "contents": "Short", "kind": ["type", "c", "Class"] }, { "trigger": "StackTraceElement", - "contents": "StackTraceElement", "kind": ["type", "c", "Class"] }, { "trigger": "StrictMath", - "contents": "StrictMath", "kind": ["type", "c", "Class"] }, { "trigger": "String", - "contents": "String", "kind": ["type", "c", "Class"] }, { "trigger": "StringBuffer", - "contents": "StringBuffer", "kind": ["type", "c", "Class"] }, { "trigger": "StringBuilder", - "contents": "StringBuilder", "kind": ["type", "c", "Class"] }, { "trigger": "System", - "contents": "System", "kind": ["type", "c", "Class"] }, { "trigger": "Thread", - "contents": "Thread", "kind": ["type", "c", "Class"] }, { "trigger": "ThreadGroup", - "contents": "ThreadGroup", "kind": ["type", "c", "Class"] }, { "trigger": "ThreadLocal", - "contents": "ThreadLocal", "kind": ["type", "c", "Class"] }, { "trigger": "Throwable", - "contents": "Throwable", "kind": ["type", "c", "Class"] }, { "trigger": "Void", - "contents": "Void", "kind": ["type", "c", "Class"] }, @@ -483,281 +435,226 @@ // java.lang Exceptions { "trigger": "ArithmeticException", - "contents": "ArithmeticException", "kind": ["type", "x", "Exception"] }, { "trigger": "ArrayIndexOutOfBoundsException", - "contents": "ArrayIndexOutOfBoundsException", "kind": ["type", "x", "Exception"] }, { "trigger": "ArrayStoreException", - "contents": "ArrayStoreException", "kind": ["type", "x", "Exception"] }, { "trigger": "ClassCastException", - "contents": "ClassCastException", "kind": ["type", "x", "Exception"] }, { "trigger": "ClassNotFoundException", - "contents": "ClassNotFoundException", "kind": ["type", "x", "Exception"] }, { "trigger": "CloneNotSupportedException", - "contents": "CloneNotSupportedException", "kind": ["type", "x", "Exception"] }, { "trigger": "EnumConstantNotPresentException", - "contents": "EnumConstantNotPresentException", "kind": ["type", "x", "Exception"] }, { "trigger": "Exception", - "contents": "Exception", "kind": ["type", "x", "Exception"] }, { "trigger": "IllegalAccessException", - "contents": "IllegalAccessException", "kind": ["type", "x", "Exception"] }, { "trigger": "IllegalArgumentException", - "contents": "IllegalArgumentException", "kind": ["type", "x", "Exception"] }, { "trigger": "IllegalMonitorStateException", - "contents": "IllegalMonitorStateException", "kind": ["type", "x", "Exception"] }, { "trigger": "IllegalStateException", - "contents": "IllegalStateException", "kind": ["type", "x", "Exception"] }, { "trigger": "IllegalThreadStateException", - "contents": "IllegalThreadStateException", "kind": ["type", "x", "Exception"] }, { "trigger": "IndexOutOfBoundsException", - "contents": "IndexOutOfBoundsException", "kind": ["type", "x", "Exception"] }, { "trigger": "InstantiationException", - "contents": "InstantiationException", "kind": ["type", "x", "Exception"] }, { "trigger": "InterruptedException", - "contents": "InterruptedException", "kind": ["type", "x", "Exception"] }, { "trigger": "NegativeArraySizeException", - "contents": "NegativeArraySizeException", "kind": ["type", "x", "Exception"] }, { "trigger": "NoSuchFieldException", - "contents": "NoSuchFieldException", "kind": ["type", "x", "Exception"] }, { "trigger": "NoSuchMethodException", - "contents": "NoSuchMethodException", "kind": ["type", "x", "Exception"] }, { "trigger": "NullPointerException", - "contents": "NullPointerException", "kind": ["type", "x", "Exception"] }, { "trigger": "NumberFormatException", - "contents": "NumberFormatException", "kind": ["type", "x", "Exception"] }, { "trigger": "ReflectiveOperationException", - "contents": "ReflectiveOperationException", "kind": ["type", "x", "Exception"] }, { "trigger": "RuntimeException", - "contents": "RuntimeException", "kind": ["type", "x", "Exception"] }, { "trigger": "SecurityException", - "contents": "SecurityException", "kind": ["type", "x", "Exception"] }, { "trigger": "StringIndexOutOfBoundsException", - "contents": "StringIndexOutOfBoundsException", "kind": ["type", "x", "Exception"] }, { "trigger": "TypeNotPresentException", - "contents": "TypeNotPresentException", "kind": ["type", "x", "Exception"] }, { "trigger": "UnsupportedOperationException", - "contents": "UnsupportedOperationException", "kind": ["type", "x", "Exception"] }, // java.lang Errors { "trigger": "AbstractMethodError", - "contents": "AbstractMethodError", "kind": ["type", "e", "Error"] }, { "trigger": "AssertionError", - "contents": "AssertionError", "kind": ["type", "e", "Error"] }, { "trigger": "BootstrapMethodError", - "contents": "BootstrapMethodError", "kind": ["type", "e", "Error"] }, { "trigger": "ClassCircularityError", - "contents": "ClassCircularityError", "kind": ["type", "e", "Error"] }, { "trigger": "ClassFormatError", - "contents": "ClassFormatError", "kind": ["type", "e", "Error"] }, { "trigger": "Error", - "contents": "Error", "kind": ["type", "e", "Error"] }, { "trigger": "ExceptionInInitializerError", - "contents": "ExceptionInInitializerError", "kind": ["type", "e", "Error"] }, { "trigger": "IllegalAccessError", - "contents": "IllegalAccessError", "kind": ["type", "e", "Error"] }, { "trigger": "IncompatibleClassChangeError", - "contents": "IncompatibleClassChangeError", "kind": ["type", "e", "Error"] }, { "trigger": "InstantiationError", - "contents": "InstantiationError", "kind": ["type", "e", "Error"] }, { "trigger": "InternalError", - "contents": "InternalError", "kind": ["type", "e", "Error"] }, { "trigger": "LinkageError", - "contents": "LinkageError", "kind": ["type", "e", "Error"] }, { "trigger": "NoClassDefFoundError", - "contents": "NoClassDefFoundError", "kind": ["type", "e", "Error"] }, { "trigger": "NoSuchFieldError", - "contents": "NoSuchFieldError", "kind": ["type", "e", "Error"] }, { "trigger": "NoSuchMethodError", - "contents": "NoSuchMethodError", "kind": ["type", "e", "Error"] }, { "trigger": "OutOfMemoryError", - "contents": "OutOfMemoryError", "kind": ["type", "e", "Error"] }, { "trigger": "StackOverflowError", - "contents": "StackOverflowError", "kind": ["type", "e", "Error"] }, { "trigger": "ThreadDeath", - "contents": "ThreadDeath", "kind": ["type", "e", "Error"] }, { "trigger": "UnknownError", - "contents": "UnknownError", "kind": ["type", "e", "Error"] }, { "trigger": "UnsatisfiedLinkError", - "contents": "UnsatisfiedLinkError", "kind": ["type", "e", "Error"] }, { "trigger": "UnsupportedClassVersionError", - "contents": "UnsupportedClassVersionError", "kind": ["type", "e", "Error"] }, { "trigger": "VerifyError", - "contents": "VerifyError", "kind": ["type", "e", "Error"] }, { "trigger": "VirtualMachineError", - "contents": "VirtualMachineError", "kind": ["type", "e", "Error"] }, // java.lang Annotations { "trigger": "Deprecated", - "contents": "Deprecated", "kind": ["function", "a", "Annotation"] }, { "trigger": "FunctionalInterface", - "contents": "FunctionalInterface", "kind": ["function", "a", "Annotation"] }, { "trigger": "Override", - "contents": "Override", "kind": ["function", "a", "Annotation"] }, { "trigger": "SafeVarargs", - "contents": "SafeVarargs", "kind": ["function", "a", "Annotation"] }, { "trigger": "SuppressWarnings", - "contents": "SuppressWarnings", "kind": ["function", "a", "Annotation"] }, @@ -767,217 +664,174 @@ // java.util.function Interfaces { "trigger": "BiConsumer", - "contents": "BiConsumer", "kind": ["type", "i", "Interface"] }, { "trigger": "BiFunction", - "contents": "BiFunction", "kind": ["type", "i", "Interface"] }, { "trigger": "BinaryOperator", - "contents": "BinaryOperator", "kind": ["type", "i", "Interface"] }, { "trigger": "BiPredicate", - "contents": "BiPredicate", "kind": ["type", "i", "Interface"] }, { "trigger": "BooleanSupplier", - "contents": "BooleanSupplier", "kind": ["type", "i", "Interface"] }, { "trigger": "Consumer", - "contents": "Consumer", "kind": ["type", "i", "Interface"] }, { "trigger": "DoubleBinaryOperator", - "contents": "DoubleBinaryOperator", "kind": ["type", "i", "Interface"] }, { "trigger": "DoubleConsumer", - "contents": "DoubleConsumer", "kind": ["type", "i", "Interface"] }, { "trigger": "DoubleFunction", - "contents": "DoubleFunction", "kind": ["type", "i", "Interface"] }, { "trigger": "DoublePredicate", - "contents": "DoublePredicate", "kind": ["type", "i", "Interface"] }, { "trigger": "DoubleSupplier", - "contents": "DoubleSupplier", "kind": ["type", "i", "Interface"] }, { "trigger": "DoubleToIntFunction", - "contents": "DoubleToIntFunction", "kind": ["type", "i", "Interface"] }, { "trigger": "DoubleToLongFunction", - "contents": "DoubleToLongFunction", "kind": ["type", "i", "Interface"] }, { "trigger": "DoubleUnaryOperator", - "contents": "DoubleUnaryOperator", "kind": ["type", "i", "Interface"] }, { "trigger": "Function", - "contents": "Function", "kind": ["type", "i", "Interface"] }, { "trigger": "IntBinaryOperator", - "contents": "IntBinaryOperator", "kind": ["type", "i", "Interface"] }, { "trigger": "IntConsumer", - "contents": "IntConsumer", "kind": ["type", "i", "Interface"] }, { "trigger": "IntFunction", - "contents": "IntFunction", "kind": ["type", "i", "Interface"] }, { "trigger": "IntPredicate", - "contents": "IntPredicate", "kind": ["type", "i", "Interface"] }, { "trigger": "IntSupplier", - "contents": "IntSupplier", "kind": ["type", "i", "Interface"] }, { "trigger": "IntToDoubleFunction", - "contents": "IntToDoubleFunction", "kind": ["type", "i", "Interface"] }, { "trigger": "IntToLongFunction", - "contents": "IntToLongFunction", "kind": ["type", "i", "Interface"] }, { "trigger": "IntUnaryOperator", - "contents": "IntUnaryOperator", "kind": ["type", "i", "Interface"] }, { "trigger": "LongBinaryOperator", - "contents": "LongBinaryOperator", "kind": ["type", "i", "Interface"] }, { "trigger": "LongConsumer", - "contents": "LongConsumer", "kind": ["type", "i", "Interface"] }, { "trigger": "LongFunction", - "contents": "LongFunction", "kind": ["type", "i", "Interface"] }, { "trigger": "LongPredicate", - "contents": "LongPredicate", "kind": ["type", "i", "Interface"] }, { "trigger": "LongSupplier", - "contents": "LongSupplier", "kind": ["type", "i", "Interface"] }, { "trigger": "LongToDoubleFunction", - "contents": "LongToDoubleFunction", "kind": ["type", "i", "Interface"] }, { "trigger": "LongToIntFunction", - "contents": "LongToIntFunction", "kind": ["type", "i", "Interface"] }, { "trigger": "LongUnaryOperator", - "contents": "LongUnaryOperator", "kind": ["type", "i", "Interface"] }, { "trigger": "ObjDoubleConsumer", - "contents": "ObjDoubleConsumer", "kind": ["type", "i", "Interface"] }, { "trigger": "ObjIntConsumer", - "contents": "ObjIntConsumer", "kind": ["type", "i", "Interface"] }, { "trigger": "ObjLongConsumer", - "contents": "ObjLongConsumer", "kind": ["type", "i", "Interface"] }, { "trigger": "Predicate", - "contents": "Predicate", "kind": ["type", "i", "Interface"] }, { "trigger": "Supplier", - "contents": "Supplier", "kind": ["type", "i", "Interface"] }, { "trigger": "ToDoubleBiFunction", - "contents": "ToDoubleBiFunction", "kind": ["type", "i", "Interface"] }, { "trigger": "ToDoubleFunction", - "contents": "ToDoubleFunction", "kind": ["type", "i", "Interface"] }, { "trigger": "ToIntBiFunction", - "contents": "ToIntBiFunction", "kind": ["type", "i", "Interface"] }, { "trigger": "ToIntFunction", - "contents": "ToIntFunction", "kind": ["type", "i", "Interface"] }, { "trigger": "ToLongBiFunction", - "contents": "ToLongBiFunction", "kind": ["type", "i", "Interface"] }, { "trigger": "ToLongFunction", - "contents": "ToLongFunction", "kind": ["type", "i", "Interface"] }, { "trigger": "UnaryOperator", - "contents": "UnaryOperator", "kind": ["type", "i", "Interface"] }, ] diff --git a/Java/Java.sublime-settings b/Java/Java.sublime-settings new file mode 100644 index 0000000000..4d14cb762e --- /dev/null +++ b/Java/Java.sublime-settings @@ -0,0 +1,6 @@ +{ + "match_brackets_angle": true, + + // Default word boundaries except: $ + "word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?" +} \ No newline at end of file diff --git a/Java/Java.sublime-syntax b/Java/Java.sublime-syntax index 39716286d9..6b5eab9692 100644 --- a/Java/Java.sublime-syntax +++ b/Java/Java.sublime-syntax @@ -1,8 +1,10 @@ %YAML 1.2 --- -# http://www.sublimetext.com/docs/3/syntax.html +# https://www.sublimetext.com/docs/syntax.html +# https://docs.oracle.com/javase/specs/jls/se13/html/index.html name: Java scope: source.java +version: 2 file_extensions: - java @@ -14,20 +16,91 @@ first_line_match: |- | ^ \s* // .*? -\*- .*? \bjava\b .*? -\*- # editorconfig ) -variables: - primitives: (?:boolean|byte|char|short|int|float|long|double) - storage_modifiers: (?:public|private|protected|static|final|native|synchronized|strictfp|abstract|transient|default|volatile) - - id: (?:[\p{L}_$][\p{L}\p{N}_$]*) - classcase_id: (?:\p{Lu}[\p{L}\p{N}_$]*) - lowercase_id: (?:[_$]*\p{Ll}[\p{Ll}\p{N}_$]*\b) - uppercase_id: (?:[_$]*\p{Lu}[\p{Lu}\p{N}_$]*\b) +############################################################################### - # One dot is mandatory to not compete with other regexes that match an id. - before_fqn: (?={{lowercase_id}}\s*\.) - - # utility lookaround - lambda_lookahead: (?:\(.*\)|{{id}})\s*-> +variables: + # Reserved keywords + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-3.html#jls-3.9 + reserved_words: |- + (?x: + {{keywords}} + | {{storage_types}} + | {{storage_modifiers}} + | {{constants}} + | {{variables}} + ) + keywords: |- + (?x: + {{declaration_keywords}} + | {{control_keywords}} + | {{operator_keywords}} + | {{illegal_keywords}} + ) + declaration_keywords: |- + (?x: class | enum | @?interface | record | var | void | extends | implements | import | package ) + control_keywords: |- + (?x: assert | break | case | catch | continue | do | else | finally | for + | if | return | switch | throw | throws | try | while ) + operator_keywords: |- + (?x: new | instanceof ) + illegal_keywords: |- + (?x: const | goto ) + + # Storage Modifiers + storage_modifiers: |- + (?x: + {{class_modifier}} + | {{class_no_modifier}} + ) + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.1.1 + class_modifier: |- + (?x: public | protected | private | abstract | final | sealed | static | strictfp ) + class_no_modifier: |- + (?x: default | native | synchronized | transient | volatile ) + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.8 + constructor_modifier: |- + (?x: public | protected | private ) + constructor_no_modifier: |- + (?x: abstract | default | final | native | sealed | static | strictfp | synchronized | transient | volatile ) + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.3.1 + field_modifier: |- + (?x: public | protected | private | final | static | transient | volatile ) + field_no_modifier: |- + (?x: abstract | default | native | sealed | strictfp | synchronized ) + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-9.1.1 + interface_modifier: |- + (?x: public | protected | private | abstract | sealed | static | strictfp ) + interface_no_modifier: |- + (?x: default | final | native | synchronized | transient | volatile ) + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.4.3 + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-9.html#jls-9.4 + method_modifier: |- + (?x: public | protected | private | abstract | default | final | native | static | strictfp | synchronized ) + method_no_modifier: |- + (?x: sealed | transient | volatile ) + + # Storage Types + storage_types: |- + (?x: boolean | byte | char | short | int | float | long | double ) + + # Literals + constants: |- + (?x: false | null | true ) + variables: |- + (?x: _ | super | this ) + + # Identifiers + break: (?!{{id_char}}) + + identifier: (?!{{reserved_words}}[^{{id_char}}]){{id}} + + id: (?:{{id_first_char}}{{id_char}}*) + id_first_char: '[\p{L}_$]' + id_char: '[\p{L}\p{N}_$]' + + classcase_id: (?:\p{Lu}{{id_char}}*) + lowercase_id: (?:[_$]*\p{Ll}[\p{Ll}\p{N}_$]*{{break}}) + uppercase_id: (?:[_$]*\p{Lu}[\p{Lu}\p{N}_$]*{{break}}) # digits bin_digit: '[01_]' @@ -36,1207 +109,3126 @@ variables: hex_digit: '[\h_]' dec_exponent: '[eE][-+]?{{dec_digit}}*' hex_exponent: '[pP][-+]?{{dec_digit}}*' + float_suffix: '[dDfF]{{break}}' + int_suffix: '[lL]{{break}}' -contexts: - prototype: - - match: (?=%>) - pop: true - - include: comments - - include: illegal-keywords + escape_octal: \\[0-3]?[0-7]{1,2} + escape_other: \\[btnfr"'\\] + escape_unicode: \\u+\h{4} - any_POP: - - match: (?=\S) - pop: true + # accessor but no variadic operator + single_dot: \.(?!\.) - immediate_POP: - - match: '' - pop: true +############################################################################### +contexts: main: - - include: prototype - - include: package-statement - - include: import-statement + - meta_include_prototype: false + - match: '' + push: [java, shebang] + + java: + - include: import - include: module - - include: class - - include: annotations - # Get modifiers defined on a different line than the class + - include: package + - include: statements + - include: declarations + - include: else-expressions + + statements: + - include: member-statements + - include: synchronized-statements + + member-statements: + - include: punctuation-terminator-semicolon + - include: blocks + - include: stray-group + - include: flow-control-statements + - include: if-else-statements + - include: switch-case-statements + - include: do-while-statements + - include: for-statements + - include: try-catch-statements + - include: labeled-statements + + expressions: + - include: groups + - include: literals + - include: punctuations + - include: lambdas + - include: operators + - include: instantiations + - include: primitive-types + - include: var-types + - include: array-modifiers - include: storage-modifiers - - include: stray-braces - - include: code + - include: object-types + - include: variables - punctuation-accessor-dot: - - match: \. - scope: punctuation.accessor.dot.java +###[ COMMENTS ]################################################################ - punctuation-separator-comma: - - match: \, - scope: punctuation.separator.comma.java + comments: + - include: line-comments + - include: block-comments - punctuation-terminator-semicolon: - - match: ; - scope: punctuation.terminator.java + block-comments: + # empty block comments + - match: /\*\*+/ + scope: comment.block.empty.java punctuation.definition.comment.java + # documentation block comments + - match: /\*\*+ + scope: + comment.block.documentation.java + punctuation.definition.comment.begin.java + embed: Packages/Java/JavaDoc.sublime-syntax#javadoc + embed_scope: comment.block.documentation.java + escape: \*+/ + escape_captures: + 0: comment.block.documentation.java + punctuation.definition.comment.end.java + # normal block comments + - match: /\* + scope: punctuation.definition.comment.begin.java + push: block-comment-body + + block-comment-body: + - meta_include_prototype: false + - meta_scope: comment.block.java + - match: \*+/ + scope: punctuation.definition.comment.end.java + pop: 1 + - match: ^\s*(\*)(?![*/]) + scope: punctuation.definition.comment.java - dot-separated-identifier: - - match: '{{id}}' - - include: punctuation-accessor-dot - - include: immediate_POP + line-comments: + - match: //+ + scope: punctuation.definition.comment.java + push: line-comment-body - package-statement: - - match: \bpackage\b - scope: keyword.other.package.java - push: - - - meta_scope: meta.package-declaration.java - - include: immediate_POP - - - match: '{{id}}' - set: - - meta_scope: meta.path.java entity.name.namespace.java - - include: dot-separated-identifier - - include: any_POP - - import-statement: - - match: \bimport\b - scope: keyword.control.import.java - push: - - - meta_scope: meta.import.java - - include: immediate_POP - - import-statement-body - - import-statement-body: - - match: \bstatic\b - scope: keyword.control.import.static.java - set: static-import-statement-body - - include: before-next-import - - match: '{{lowercase_id}}' - scope: meta.path.java support.type.package.java + line-comment-body: + - meta_include_prototype: false + - meta_scope: comment.line.double-slash.java + - match: (//+)?\n + captures: + 1: punctuation.definition.comment.java + pop: 1 + + shebang: + - meta_include_prototype: false + - match: ^\#! + scope: punctuation.definition.comment.java + set: shebang-body + - match: ^|(?=\S) # Note: Ensure to highlight shebang if Erlang is embedded. + pop: 1 + + shebang-body: + - meta_include_prototype: false + - meta_scope: comment.line.shebang.java + # Note: Keep sync with first_line_match! + - match: \b(bsh|java)\b + scope: constant.language.shebang.java + - match: \n + pop: 1 + +###[ ANNOTATIONS ]############################################################# + + annotations: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-9.html#jls-9.7 + - match: \@(?!interface{{break}}) + scope: punctuation.definition.annotation.java + branch_point: annotation-identifier + branch: + - annotation-unqualified-identifier + - annotation-qualified-identifier + + annotation-unqualified-identifier: + - meta_scope: meta.annotation.identifier.java + - match: '{{identifier}}' + scope: variable.annotation.java + branch_point: annotation-unqualified-parameters + branch: + - annotation-unqualified-parameters + - immediately-pop2 + - include: else-pop + + annotation-unqualified-parameters: + - match: \( + scope: punctuation.section.group.begin.java + pop: 2 + push: annotation-parameters-body + # fail: looks like a qualified annotation + - match: (?={{single_dot}}) + fail: annotation-identifier + # fail: truncate meta scope immediatelly + - match: (?=\S) + fail: annotation-unqualified-parameters + + annotation-qualified-identifier: + - meta_include_prototype: false + - meta_scope: meta.annotation.identifier.java meta.path.java + - match: '' + branch_point: annotation-qualified-identifier + branch: + - annotation-qualified-identifier-path + - annotation-qualified-identifier-name + + annotation-qualified-identifier-path: + - match: '{{identifier}}' + scope: variable.annotation.namespace.java + set: annotation-qualified-identifier-accessor + - include: else-pop2 + + annotation-qualified-identifier-accessor: + - include: punctuation-accessor-dot-pop + - match: (?=\S) + fail: annotation-qualified-identifier + + annotation-qualified-identifier-name: + - match: '{{identifier}}' + scope: + meta.annotation.identifier.java meta.path.java + variable.annotation.java + pop: 2 + branch_point: annotation-qualified-parameters + branch: + - annotation-qualified-parameters + - immediately-pop + - include: else-pop2 + + annotation-qualified-parameters: + - meta_content_scope: meta.annotation.identifier.java + - match: \( + scope: punctuation.section.group.begin.java + set: annotation-parameters-body + - match: (?=\S) + fail: annotation-qualified-parameters + + annotation-parameters-body: + - meta_scope: meta.annotation.parameters.java meta.group.java + - include: group-end + - match: (?={{id_first_char}}) + branch_point: annotation-parameter + branch: + - annotation-parameter + - expression + - include: variable-initializers + + annotation-parameter: + - match: '{{identifier}}' + scope: variable.parameter.java + set: annotation-parameter-assignment + - match: '' + fail: annotation-parameter + + annotation-parameter-assignment: + - match: = + scope: keyword.operator.assignment.java + set: variable-initializer + - match: (?=\S) + fail: annotation-parameter + +###[ DECLARATIONS ]############################################################ + + declarations: + # As per specification separate declarations for globals, members, and + # locals are needed, as each of them supports only a subset of declaration + # statements: + # - globals: class, enum, interface + # - members: class, enum, interface, constructor, field, method + # - locals: class, variables + # - try/for: variables + # + # Member declarations need to be handled differently as constructurs look + # exactly like function calls. The other two scopes (global, local) are + # merged here to maintain syntax highlighting whenever possible. That's + # needed for `incomplete code` scenarios or if contexts are lost due to + # embedding Java into JSP. + - match: (?=[{{id_first_char}}@<]) + branch_point: declarations + branch: + - declaration-maybe-class + - declaration-maybe-enum + - declaration-maybe-interface + - declaration-maybe-variable + - declaration-maybe-method + + declaration-else-fail: + - match: (?=\S) + fail: declarations + + declaration-maybe-class: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.1 + - meta_scope: meta.class.java + - include: class-keyword + - include: record-keyword + - include: class-modifiers + - include: declaration-else-fail + + declaration-maybe-enum: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.9 + # Note: Local enum declarations are not valid, + # but may help maintaining highlighting in incomplete code. + - meta_scope: meta.enum.java + - include: enum-keyword + - include: class-modifiers + - include: declaration-else-fail + + declaration-maybe-interface: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-9.html#jls-9.1 + # Note: Local interface declarations are not valid, + # but may help maintaining highlighting in incomplete code. + - meta_scope: meta.interface.java + - include: interface-keyword + - include: interface-modifiers + - include: declaration-else-fail + + declaration-maybe-method: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.4 + - meta_include_prototype: false + - match: '' set: - - meta_content_scope: meta.path.java - - include: before-next-import - - include: package - - match: \* - scope: meta.path.java keyword.operator.wildcard.asterisk.java - pop: true - - match: '{{classcase_id}}' - scope: support.class.import.java - set: - - include: before-next-import - - include: punctuation-accessor-dot - - include: import-class - - include: import-wildcard - - include: any_POP - - include: any_POP - - include: any_POP - - static-import-statement-body: - - include: before-next-import - - match: '{{lowercase_id}}' - scope: meta.path.java support.type.package.java + - method-block + - method-attributes + - method-array-modifiers + - declaration-method-signature + - method-modifier + + declaration-method-signature: + - include: method-void-signature + - match: (?=\S) set: - - meta_content_scope: meta.path.java - - include: before-next-import - - include: package - - match: '{{classcase_id}}' - scope: support.class.import.java - set: - - include: before-next-import - - include: punctuation-accessor-dot - - include: import-constant - - include: import-class - - include: import-function - - include: import-wildcard - - include: any_POP - - include: any_POP - - include: any_POP - - before-next-import: - # Prevent next import statement to be consumed when a current statement isn't terminated with ';'. - - match: (?=\bimport\b) - pop: true - # For a case of a statement immediately before a class definition. - - match: (?=\b(?:{{storage_modifiers}}|class|interface|enum)\b) - pop: true + - declaration-method-expect-parameters + - declaration-method-expect-identifier + - method-result-modifier + - method-result-type + + declaration-method-expect-identifier: + - include: method-identifier + - include: declaration-else-fail + + declaration-method-expect-parameters: + - meta_content_scope: meta.function.identifier.java + - include: method-parameters + - include: declaration-else-fail + + declaration-maybe-variable: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.4 + - meta_include_prototype: false + - match: '' + set: + - variable-declaration-list + - variable-declaration-value-assignment + - variable-declaration-expect-identifier + - variable-declaration-type-modifier + - variable-declaration-type + +###[ PACKAGE DECLARATIONS ]#################################################### package: - - match: '{{lowercase_id}}' - scope: support.type.package.java - - include: punctuation-accessor-dot + - match: package{{break}} + scope: keyword.declaration.namespace.package.java + push: + - meta_scope: meta.namespace.package.java + - match: (?=\S) + set: package-identifier - all-types: - - include: primitive-types - - include: object-types + package-identifier: + - meta_include_prototype: false + - meta_content_scope: meta.namespace.package.identifier.java + - include: entity-package + - include: immediately-pop - import-constant: - - match: '{{uppercase_id}}' - scope: constant.other.import.java +###[ MODULE DECLARATIONS ]##################################################### - import-class: - - match: '{{classcase_id}}' - scope: support.class.import.java + module: + - match: (?:(open)\s+)?(module){{break}} + captures: + 1: storage.modifier.java + 2: keyword.declaration.namespace.module.java + push: + - meta_scope: meta.namespace.module.java + - match: (?=\S) + set: + - module-block + - module-identifier - import-function: - - match: '{{id}}' - scope: support.function.import.java + module-identifier: + - meta_include_prototype: false + - include: entity-module + - include: immediately-pop - import-wildcard: - - match: \* - scope: keyword.operator.wildcard.asterisk.java + module-block: + - meta_content_scope: meta.namespace.module.identifier.java + - match: \{ + scope: punctuation.section.block.begin.java + set: module-block-body + - include: else-pop - annotations: - - match: \@ - scope: punctuation.definition.annotation.java + module-block-body: + - meta_scope: meta.namespace.module.java meta.block.java + - include: block-end + - include: punctuation-terminator-semicolon + - match: exports{{break}} + scope: keyword.other.module.exports.java push: - - - meta_scope: meta.annotation.java - - include: immediate_POP - - annotation-parameters - - - meta_content_scope: meta.annotation.identifier.java - - include: immediate_POP - - annotation-type-reference - - annotation-type-reference: - - match: '{{before_fqn}}' - set: - - meta_scope: meta.path.java - - match: '{{lowercase_id}}' - scope: variable.annotation.package.java - - include: punctuation-accessor-dot - - include: annotation-type-no-fqn - - include: annotation-type-no-fqn + - module-exports-meta + - module-exports-or-opens-body + - match: opens{{break}} + scope: keyword.other.module.opens.java + push: + - module-opens-meta + - module-exports-or-opens-body + - match: requires{{break}} + scope: keyword.other.module.requires.java + push: module-requires-body + - match: uses{{break}} + scope: keyword.other.module.uses.java + push: + - module-uses-meta + - module-provides-or-uses-body + - match: provides{{break}} + scope: keyword.other.module.provides.java + push: + - module-provides-meta + - module-provides-or-uses-body - annotation-type-no-fqn: - - match: '{{classcase_id}}' - scope: variable.annotation.java - set: after-annotation-type-reference - - include: any_POP + module-exports-meta: + - meta_include_prototype: false + - meta_scope: meta.exports.java + - include: immediately-pop - after-annotation-type-reference: - - match: \. - scope: punctuation.accessor.dot.java - set: annotation-type-no-fqn - - include: any_POP + module-opens-meta: + - meta_include_prototype: false + - meta_scope: meta.opens.java + - include: immediately-pop - annotation-parameters: - - match: \( - scope: punctuation.section.parens.begin.java + module-exports-or-opens-body: + - include: module-statement-terminator + - match: to{{break}} + scope: keyword.other.module.to.java set: - - meta_scope: meta.annotation.parameters.java - - match: \) - scope: punctuation.section.parens.end.java - pop: true - - match: ({{id}})\s*(=) - captures: - 1: variable.parameter.java - 2: keyword.operator.assignment.java - push: - - match: (?=[,})]) - pop: true - - include: annotations - - include: code - - include: annotation-array-initialization - - include: annotations - - include: code - - include: any_POP - - annotation-array-initialization: - - match: \{ - scope: punctuation.section.braces.begin.java - push: - - meta_scope: meta.braces.annotation-array-initialization.java - - include: array-initialization-common - - include: annotations + - include: module-statement-terminator + - include: punctuation-separator-comma + - include: entity-module + - include: entity-package - anonymous-classes-and-new: - - match: \bnew\b - scope: keyword.other.storage.new.java - push: - - - meta_scope: meta.instantiation.java - - include: immediate_POP - - instantiation + module-requires-body: + - meta_scope: meta.requires.java + - match: transitive{{break}} + scope: keyword.other.module.transitive.java + - include: module-statement-terminator + - include: entity-module - instantiation: - - match: \b{{primitives}}\b - scope: storage.type.primitive.java - set: array-definition - - match: '{{before_fqn}}' - set: [after-object-type-in-instantiation, object-type-fqn] - - include: object-type-instantiation-no-fqn + module-uses-meta: + - meta_include_prototype: false + - meta_scope: meta.uses.java + - include: immediately-pop - object-type-instantiation-no-fqn: - - match: '{{classcase_id}}' - scope: support.class.java - set: after-object-type-in-instantiation - - include: any_POP + module-provides-meta: + - meta_include_prototype: false + - meta_scope: meta.provides.java + - include: immediately-pop - after-object-type-in-instantiation: - - match: (?=\[) - set: array-definition - - match: (?=\() - set: object-construction - - match: <> - scope: punctuation.definition.generic.diamond.java - set: object-construction - - match: (?=<) - set: [after-generic-in-instantiation, generic-type-invocation] - - match: \. - scope: punctuation.accessor.dot.java - set: object-type-instantiation-no-fqn - - include: any_POP + module-provides-or-uses-body: + - include: module-statement-terminator + - match: with{{break}} + scope: keyword.other.module.with.java + set: + - include: module-statement-terminator + - include: punctuation-separator-comma + - include: entity-class + - include: entity-class - after-generic-in-instantiation: - - match: (?=\[) - set: array-definition - - include: object-construction + module-statement-terminator: + - match: (?=[;}]|(?:exports|opens|requires|provides|uses|{{reserved_words}}){{break}}) + pop: 1 - object-construction: - - match: \( - scope: punctuation.section.parens.begin.java - set: - - meta_scope: meta.parens.constructor-arguments.java - - match: \) - scope: punctuation.section.parens.end.java - set: - - match: \{ - scope: punctuation.section.braces.begin.java - set: - - meta_scope: meta.class.body.anonymous.java - - match: \} - scope: punctuation.section.braces.end.java - pop: true - - include: class-body - - include: any_POP - - include: illegal-parens-terminators - - include: code - - include: any_POP - - array-definition: - - match: \[ - scope: punctuation.section.brackets.begin.java +###[ IMPORT DECLARATIONS ]##################################################### + + import: + - match: import{{break}} + scope: keyword.declaration.import.java + push: import-modifier + + import-modifier: + - meta_scope: meta.import.java + - match: static{{break}} + scope: storage.modifier.java set: - - meta_scope: meta.brackets.array-initialization.java - - match: \] - scope: punctuation.section.brackets.end.java - set: - - match: (?=\[) - set: array-definition - - match: \{ - scope: punctuation.section.braces.begin.java - set: array-initialization - - include: any_POP - - include: code - - include: any_POP - - array-initialization: - - meta_scope: meta.braces.array-initialization.java - - include: array-initialization-common - - array-initialization-common: - - match: \} - scope: punctuation.section.braces.end.java - pop: true - - match: \{ - scope: punctuation.section.braces.begin.java - push: array-initialization - - include: code + - meta_content_scope: meta.import.java + - match: (?=\S) + set: import-static-namespace + - match: (?=\S) + set: import-normal-namespace - class: - - match: (?=({{storage_modifiers}}\s+)*(?:class|(?:@)?interface|enum)\b) - push: [class-meta, class-type] + import-normal-namespace: + - meta_content_scope: meta.import.java meta.path.java + - include: import-terminator + - include: import-package-name + - match: (?=\S) + set: import-normal-class + + import-normal-class: + - meta_content_scope: meta.import.java meta.path.java + - include: import-terminator + - include: import-class-name + - include: import-wildcard + - include: else-pop + + import-static-namespace: + - meta_content_scope: meta.import.java meta.path.java + - include: import-terminator + - include: import-package-name + - match: (?=\S) + set: import-static-class + + import-static-class: + - meta_content_scope: meta.import.java meta.path.java + - include: import-terminator + - include: import-constant-name + - include: import-class-path + - include: import-function-name + - include: import-wildcard + - include: else-pop + + import-constant-name: + - match: '{{uppercase_id}}(?!\s*\.)' + scope: + meta.import.java meta.path.java + entity.name.constant.java + set: import-expect-terminator + + import-package-name: + - match: '{{lowercase_id}}' + scope: variable.namespace.java + push: import-acessor-or-termintor + - include: punctuation-accessor-dot - class-meta: - - meta_scope: meta.class.java - - include: immediate_POP + import-class-path: + - match: '{{classcase_id}}' + scope: storage.type.class.java + push: import-acessor-or-termintor + - include: punctuation-accessor-dot - class-type: - - include: storage-modifiers - - match: (?:class|(\@?)interface)\b - scope: storage.type.java - captures: - 1: punctuation.definition.type.java + import-class-name: + - match: '{{classcase_id}}' + scope: entity.name.class.java + push: import-acessor-or-termintor + - include: punctuation-accessor-dot + + import-function-name: + - match: '{{identifier}}' + scope: + meta.import.java meta.path.java + entity.name.function.java + set: import-expect-terminator + + import-wildcard: + - match: \* + scope: + meta.import.java meta.path.java + variable.language.wildcard.asterisk.java + set: import-expect-terminator + + import-acessor-or-termintor: + # continue with the import context + - include: punctuation-accessor-dot-pop + # pop the import context + - match: (?=\s*;|\S) + pop: 2 + + import-expect-terminator: + - include: import-terminator + - match: \S + scope: invalid.illegal.expect-semicolon.java + + import-terminator: + - match: (?=\s*;|{{reserved_words}}{{break}}) + pop: 1 + +###[ CLASS DECLARATIONS ]###################################################### + + class-keyword: + - match: class{{break}} + scope: keyword.declaration.class.java set: - class-block - class-extends - - generic-type-declaration + - class-name-meta + - maybe-type-parameter - class-name - - match: enum\b - scope: storage.type.java - set: - - enum-block - - class-extends - - generic-type-declaration - - class-name - - include: any_POP + + class-modifiers: + - match: '{{class_modifier}}{{break}}' + scope: storage.modifier.java + - match: '{{class_no_modifier}}{{break}}' + scope: invalid.illegal.unexpected-keyword.java + - include: annotations class-name: - - meta_scope: meta.class.identifier.java - - match: (?!extends|implements){{id}}\b + - match: '{{identifier}}' scope: entity.name.class.java - pop: true - - include: any_POP + pop: 1 + - include: else-pop + + class-name-meta: + - meta_content_scope: meta.class.identifier.java + - include: else-pop class-extends: - - match: extends\b - scope: keyword.declaration.extends.java + - match: extends{{break}} + scope: storage.modifier.extends.java push: - - - meta_scope: meta.class.extends.java - - match: \, - scope: punctuation.separator.comma.java - push: inherited-object-type-reference - - include: any_POP - - inherited-object-type-reference - - match: implements\b - scope: keyword.declaration.implements.java + - class-extends-object-type-list + - inherited-object-type + - match: implements{{break}} + scope: storage.modifier.implements.java push: - - - meta_scope: meta.class.implements.java - - match: \, - scope: punctuation.separator.comma.java - push: inherited-object-type-reference - - include: any_POP - - inherited-object-type-reference - - include: any_POP + - class-implements-object-type-list + - inherited-object-type + - match: permits{{break}} + scope: storage.modifier.permits.java + push: + - class-permits-object-type-list + - inherited-object-type + - include: else-pop + + class-extends-object-type-list: + - meta_scope: meta.class.extends.java + - include: inherited-object-type-list + - include: else-pop + + class-implements-object-type-list: + - meta_scope: meta.class.implements.java + - include: inherited-object-type-list + - include: else-pop + + class-permits-object-type-list: + - meta_scope: meta.class.permits.java + - include: inherited-object-type-list + - include: else-pop class-block: - match: \{ scope: punctuation.section.block.begin.java + set: class-block-body + - include: else-pop + + class-block-body: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.1.6 + - meta_scope: meta.class.java meta.block.java + - include: block-end + - include: member-statements + - include: member-declarations + - include: else-expressions + +###[ ENUM DECLARATIONS ]####################################################### + + enum-keyword: + - match: enum{{break}} + scope: keyword.declaration.enum.java set: - - meta_scope: meta.class.body.java meta.block.java - - match: \} - scope: punctuation.section.block.end.java - pop: true - - include: class-body - - include: any_POP - - class-body: - - include: class - - include: annotations - - include: fields-and-methods - - include: constants-and-special-vars - - include: storage-modifiers - - include: all-types - - include: static-code-block - - include: punctuation-separator-comma - - include: punctuation-terminator-semicolon - - match: (?=<) - push: generic-type-declaration + - enum-block + - enum-extends + - enum-name-meta + - maybe-illegal-type-parameter + - enum-name + + enum-name: + - match: '{{identifier}}' + scope: entity.name.enum.java + pop: 1 + - include: else-pop + + enum-name-meta: + - meta_content_scope: meta.enum.identifier.java + - include: else-pop + + enum-extends: + - match: extends{{break}} + scope: invalid.illegal.unexpected-keyword.java + push: + - enum-extends-object-type-list + - inherited-object-type + - match: implements{{break}} + scope: storage.modifier.implements.java + push: + - enum-implements-object-type-list + - inherited-object-type + - match: permits{{break}} + scope: invalid.illegal.unexpected-keyword.java + push: + - enum-permits-object-type-list + - inherited-object-type + - include: else-pop + + enum-extends-object-type-list: + - meta_scope: meta.enum.extends.java + - include: inherited-object-type-list + - include: else-pop + + enum-implements-object-type-list: + - meta_scope: meta.enum.implements.java + - include: inherited-object-type-list + - include: else-pop + + enum-permits-object-type-list: + - meta_scope: meta.enum.permits.java + - include: inherited-object-type-list + - include: else-pop enum-block: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.9.1 - match: \{ scope: punctuation.section.block.begin.java set: - - meta_scope: meta.class.body.java meta.block.java - - match: \} - scope: punctuation.section.block.end.java - pop: true - - include: enum-body - - include: any_POP - - enum-body: - - match: ^(?=\s*([[:upper:]_][[:upper:][:digit:]_]*|(?!{{primitives}}|{{storage_modifiers}})[[:lower:]_][[:alnum:]_]*)\s*[,;{(]) - push: - - match: (?=[;}]) - pop: true - - match: \w+ - scope: constant.other.enum.java - push: - - meta_scope: meta.enum.java - - match: \{ - scope: punctuation.section.block.begin.java - push: - - meta_scope: meta.enum.body.java meta.block.java - - match: \} - scope: punctuation.section.block.end.java - pop: true - - include: enum-body - - include: parens - - include: any_POP - - include: punctuation-separator-comma - - include: class-body + - enum-block-body + - enum-constants-list + - include: else-pop + + enum-block-body: + - meta_scope: meta.enum.java meta.block.java + - include: class-block-body + + enum-constants-list: + - meta_content_scope: meta.sequence.constants.java + - match: '{{identifier}}' + scope: meta.constant.identifier.java entity.name.constant.java + push: enum-constant-arguments + - include: punctuation-separator-comma + - include: else-pop - code: - - include: constants-and-special-vars - - include: assignment - - include: lambdas - - include: strings - - include: anonymous-classes-and-new - - include: keywords-control - - include: method-invocations - - include: uppercase-identifiers - - include: all-types - - include: keywords - - include: code-block-include - - include: parens - code-block-include: + enum-constant-arguments: + - meta_content_scope: meta.constant.identifier.java + - match: \( + scope: punctuation.section.group.begin.java + set: + - enum-constant-block + - enum-constant-arguments-body + - include: enum-constant-block + + enum-constant-arguments-body: + - clear_scopes: 1 + - meta_scope: meta.constant.arguments.java meta.group.java + - include: group-body + + enum-constant-block: + - meta_content_scope: meta.constant.java - match: \{ scope: punctuation.section.block.begin.java - push: - - meta_scope: meta.block.java - - match: \} - scope: punctuation.section.block.end.java - pop: true - - include: code-block - code-block: - - include: storage-modifiers - - include: var-type - - include: code + set: enum-constant-block-body + - include: else-pop + + enum-constant-block-body: + - meta_scope: meta.constant.java meta.block.java + - include: class-block-body + +###[ INTERFACE DECLARATIONS ]################################################## + + interface-keyword: + - match: (@?)interface{{break}} + scope: keyword.declaration.interface.java + set: + - interface-block + - interface-extends + - interface-name-meta + - maybe-type-parameter + - interface-name + + interface-modifiers: + - match: '{{interface_modifier}}{{break}}' + scope: storage.modifier.java + - match: '{{interface_no_modifier}}{{break}}' + scope: invalid.illegal.unexpected-keyword.java - include: annotations - - include: code-block-include - - include: stray-parens - comments: - - match: /\*\*/ - scope: comment.block.empty.java punctuation.definition.comment.java - - include: scope:text.html.javadoc - - include: comments-inline - comments-inline: - - match: /\* - scope: punctuation.definition.comment.java + + interface-name: + - match: '{{identifier}}' + scope: entity.name.interface.java + pop: 1 + - include: else-pop + + interface-name-meta: + - meta_content_scope: meta.interface.identifier.java + - include: else-pop + + interface-extends: + - match: extends{{break}} + scope: storage.modifier.extends.java push: - - meta_scope: comment.block.java - - match: \*/ - scope: punctuation.definition.comment.java - pop: true - - match: // - scope: punctuation.definition.comment.java + - interface-extends-object-type-list + - inherited-object-type + - match: implements{{break}} + scope: invalid.illegal.unexpected-keyword.java push: - - meta_scope: comment.line.double-slash.java - - match: \n - pop: true - - match: (?=%>) - pop: true - - constants-and-special-vars: - - match: \b(true|false|null)\b - scope: constant.language.java - - match: \b(this|super)\b - scope: variable.language.java - # hexadecimal floats - - match: |- - (?x) - \b(0[xX]) - ( - # 0x1., 0x1.1, 0x1.1p1, 0x1.1p-1, 0x1.p1, 0x1.p-1 | 0x1p1 - {{hex_digit}}* (?: (\.) {{hex_digit}}* (?:{{hex_exponent}})? | {{hex_exponent}} ) - # 0x.1, 0x.1p1, 0x.1p-1 - | (\.) {{hex_digit}}+ (?:{{hex_exponent}})? - ) - scope: meta.number.float.hexadecimal.java - captures: - 1: constant.numeric.base.java - 2: constant.numeric.value.java - 3: punctuation.separator.decimal.java - 4: punctuation.separator.decimal.java - # decimal floats - - match: |- - (?x) - \b([0-9]{{dec_digit}}*) - (?: - # 1., 1.1, 1.1e1, 1.1e-1, 1.e1, 1.e-1, 1.d, 1.1d, 1.1e1d, 1.1e-1d, 1.e1d, 1.e-1d - ( (\.) {{dec_digit}}* (?:{{dec_exponent}})? ) ([dDfF]\b)? - # 1e1 1e1d - | ({{dec_exponent}}) ([dDfF]\b)? - # 1d - | ([dDfF]\b) - ) - | ( (\.) {{dec_digit}}+ (?:{{dec_exponent}})? ) ([dDfF]\b)? - scope: meta.number.float.decimal.java - captures: - 1: constant.numeric.value.java - 2: constant.numeric.value.java - 3: punctuation.separator.decimal.java - 4: constant.numeric.suffix.java - 5: constant.numeric.value.java - 6: constant.numeric.suffix.java - 7: constant.numeric.suffix.java - 8: constant.numeric.value.java - 9: punctuation.separator.decimal.java - 10: constant.numeric.suffix.java - # binary integers - - match: \b(0[bB])({{bin_digit}}*)([lL]\b)? - scope: meta.number.integer.binary.java - captures: - 1: constant.numeric.base.java - 2: constant.numeric.value.java - 3: constant.numeric.suffix.java - # hexadecimal integers - - match: \b(0[xX])({{hex_digit}}*)([lL]\b)? - scope: meta.number.integer.hexadecimal.java - captures: - 1: constant.numeric.base.java - 2: constant.numeric.value.java + - interface-implements-object-type-list + - inherited-object-type + - match: permits{{break}} + scope: storage.modifier.permits.java + push: + - interface-permits-object-type-list + - inherited-object-type + - include: else-pop + + interface-extends-object-type-list: + - meta_scope: meta.interface.extends.java + - include: inherited-object-type-list + - include: else-pop + + interface-implements-object-type-list: + - meta_scope: meta.interface.implements.java + - include: inherited-object-type-list + - include: else-pop + + interface-permits-object-type-list: + - meta_scope: meta.interface.permits.java + - include: inherited-object-type-list + - include: else-pop + + interface-block: + - match: \{ + scope: punctuation.section.block.begin.java + set: interface-block-body + - include: else-pop + + interface-block-body: + - meta_scope: meta.interface.java meta.block.java + - include: class-block-body + +###[ RECORD DECLARATIONS ]##################################################### + + record-keyword: + # https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-8.10 + - match: record{{break}} + scope: keyword.declaration.record.java + set: + - class-block + - record-extends + - record-parameters + - maybe-type-parameter + - class-name + + record-parameters: + - meta_content_scope: meta.class.identifier.java + - match: \( + scope: punctuation.section.group.begin.java + set: + - record-parameter-body + - parameter-maybe-identifier + - parameter-maybe-variadic + - maybe-array-modifiers + - parameter-type + - include: else-pop + + record-parameter-body: + - meta_scope: meta.class.parameters.java meta.group.java + - match: \) + scope: punctuation.section.group.end.java + set: + - meta_content_scope: meta.class.java + - include: else-pop + - include: method-parameters-body + + record-extends: + - match: extends{{break}} + scope: invalid.illegal.unexpected-keyword.java + push: + - class-extends-object-type-list + - inherited-object-type + - match: implements{{break}} + scope: storage.modifier.implements.java + push: + - class-implements-object-type-list + - inherited-object-type + - match: permits{{break}} + scope: invalid.illegal.unexpected-keyword.java + push: + - class-permits-object-type-list + - inherited-object-type + - include: else-pop + +###[ MEMBER DECLARATIONS ]##################################################### + + member-declarations: + - match: (?=[{{id_first_char}}@<]) + branch_point: class-members + branch: + - member-maybe-constructor + - member-maybe-method + - member-maybe-field + - member-maybe-class + - member-maybe-enum + - member-maybe-interface + + member-else-fail: + - match: (?=\S) + fail: class-members + + member-reserved-fail: + - match: (?={{reserved_words}}{{break}}) + fail: class-members + + member-maybe-class: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.1 + - meta_scope: meta.class.java + - include: class-keyword + - include: record-keyword + - include: class-modifiers + - include: member-else-fail + + member-maybe-enum: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.9 + - meta_scope: meta.enum.java + - include: enum-keyword + - include: class-modifiers + - include: member-else-fail + + member-maybe-interface: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-9.html#jls-9.1 + - meta_scope: meta.interface.java + - include: interface-keyword + - include: interface-modifiers + - include: member-else-fail + + member-maybe-field: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.3 + - meta_include_prototype: false + - match: '' + set: + - field-identifier-list + - field-value-assignment + - field-identifier + - field-type-modifier + - field-type + - field-modifier + + member-maybe-constructor: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.8 + - meta_include_prototype: false + - match: '' + set: + - method-block + - method-attributes + - method-array-modifiers + - method-expect-parameters + - constructor-name + - method-modifier + + member-maybe-method: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.4 + - meta_include_prototype: false + - match: '' + set: + - method-block + - method-attributes + - method-array-modifiers + - method-signature + - method-modifier + +###[ FIELD DECLARATIONS ]###################################################### + + field-modifier: + - clear_scopes: 1 + - meta_scope: meta.field.modifier.java + - match: '{{field_modifier}}{{break}}' + scope: storage.modifier.java + - match: '{{field_no_modifier}}{{break}}' + scope: invalid.illegal.unexpected-keyword.java + - include: type-parameters + - include: annotation-else-pop + + field-type: + - include: primitive-type + - include: object-type + - include: illegal-var-type + - include: member-else-fail + + field-type-modifier: + - clear_scopes: 1 + - meta_scope: meta.field.type.java + - include: array-modifiers + - include: annotations + - match: (?=[{(]|{{declaration_keywords}}{{break}}) + fail: class-members + - include: else-pop + + field-identifier-list: + - match: ',' + scope: + meta.field.java + punctuation.separator.comma.java + push: + - field-value-assignment + - field-identifier + - include: else-pop + + field-identifier: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-VariableDeclaratorId + - match: '{{uppercase_id}}' + scope: entity.name.constant.java + pop: 1 + - match: '{{identifier}}' + scope: variable.other.member.java + pop: 1 + - match: '{{variables}}{{break}}' + scope: invalid.illegal.identifier.java + pop: 1 + - include: else-pop + + field-value-assignment: + - meta_content_scope: meta.field.identifier.java + - match: = + scope: + meta.field.java + keyword.operator.assignment.java + set: field-value-initializer + - include: maybe-only-array-modifiers + + field-value-initializer: + - meta_content_scope: meta.field.value.java + - include: variable-initializer + +###[ METHOD DECLARATIONS ]##################################################### + + constructor-name: + - include: member-reserved-fail + - match: '{{id}}' + scope: entity.name.function.constructor.java + pop: 1 + - include: else-pop + + method-modifier: + - meta_scope: meta.function.modifier.java + - match: '{{method_modifier}}{{break}}' + scope: storage.modifier.java + - match: '{{method_no_modifier}}{{break}}' + scope: invalid.illegal.unexpected-keyword.java + - include: type-parameters + - include: annotation-else-pop + + method-signature: + - include: method-void-signature + - include: method-result-signature + + method-void-signature: + # void indicates a method for sure + - match: (?=void{{break}}) + set: + - method-maybe-parameters + - method-maybe-identifier + - method-result-modifier + - method-void-type + + method-void-type: + - match: void + scope: storage.type.void.java + pop: 1 + + method-result-signature: + # a method only if parameter list found + - match: (?=\S) + set: + - method-expect-parameters + - method-expect-identifier + - method-result-modifier + - method-result-type + + method-result-type: + - include: primitive-type + - include: object-type + - include: illegal-var-type + - include: else-pop + + method-result-modifier: + - clear_scopes: 1 + - meta_scope: meta.function.return-type.java + - include: maybe-array-modifiers + + method-expect-identifier: + - include: method-identifier + - include: member-else-fail + + method-maybe-identifier: + - include: method-identifier + - include: else-pop + + method-identifier: + - match: '{{identifier}}' + scope: entity.name.function.java + pop: 1 + + method-expect-parameters: + - meta_content_scope: meta.function.identifier.java + - include: method-parameters + - match: (?=\{) + pop: 1 + - include: member-else-fail + + method-maybe-parameters: + - meta_content_scope: meta.function.identifier.java + - include: method-parameters + - include: else-pop + + method-parameters: + - match: \( + scope: punctuation.section.group.begin.java + set: + - method-parameters-body + - receiver-or-parameter + + method-parameters-body: + - meta_scope: meta.function.parameters.java meta.group.java + - include: group-end + - match: ',' + scope: punctuation.separator.comma.java + push: + - parameter-maybe-identifier + - parameter-maybe-variadic + - maybe-array-modifiers + - parameter-type + - include: expression-terminator + + method-array-modifiers: + - meta_include_prototype: false + - match: '' + set: method-array-modifiers-content + + method-array-modifiers-content: + - meta_scope: meta.function.java + - include: maybe-array-modifiers + + method-attributes: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.4.6 + - match: throws{{break}} + scope: keyword.declaration.throws.java + set: + - method-throws-body + - maybe-illegal-array-modifiers + - expect-object-type + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-9.html#jls-9.6.2 + - match: default{{break}} + scope: keyword.declaration.default.java + set: method-default-body + - include: else-pop + + method-default-body: + - meta_scope: meta.function.default.java + - include: variable-initializer + + method-throws-body: + - meta_scope: meta.function.throws.java + - match: ',' + scope: punctuation.separator.comma.java + push: + - maybe-illegal-array-modifiers + - expect-object-type + - include: else-pop + + method-block: + - match: \{ + scope: punctuation.section.block.begin.java + set: method-block-body + - include: else-pop + + method-block-body: + - meta_scope: meta.function.java meta.block.java + - include: block-body + +###[ VARIABLE DECLARATIONS ]################################################### + + variable-declaration-type: + - include: primitive-type + - include: var-type + - include: object-type + - include: final-modifiers + - include: annotations + - include: illegal-storage-modifiers + - include: else-pop + + variable-declaration-type-modifier: + - clear_scopes: 1 + - meta_scope: meta.declaration.type.java + - include: maybe-only-array-modifiers + + variable-declaration-list: + - match: ',' + scope: + meta.declaration.java + punctuation.separator.comma.java + push: + - variable-declaration-value-assignment + - variable-declaration-maybe-identifier + - include: else-pop + + variable-declaration-expect-identifier: + - include: variable-declaration-identifier + - include: declaration-else-fail + + variable-declaration-maybe-identifier: + - include: variable-declaration-identifier + - include: else-pop + + variable-declaration-identifier: + - match: '{{uppercase_id}}' + scope: constant.other.java + pop: 1 + - match: '{{identifier}}' + scope: variable.other.java + pop: 1 + + variable-declaration-value-assignment: + - meta_content_scope: meta.declaration.identifier.java + - match: = + scope: + meta.declaration.java + keyword.operator.assignment.java + set: variable-declaration-value-initializer + # found parentheses after identifier, appears to be a method declaration + - match: (?=\() + fail: declarations + - include: maybe-only-array-modifiers + + variable-declaration-value-initializer: + - meta_content_scope: meta.declaration.value.java + - include: variable-initializer + +###[ VARIABLE DECLARATIONS OR ASSIGNMENTS ]#################################### + + variable-declarations-or-assignments: + # A subset of `declarations` to optimize performance in contexts which need + # to distinguish between variable declaration and variable assignment only. + - match: (?=[{{id_first_char}}@<]) + branch_point: variable-declarations-or-assignments + branch: + - variable-maybe-declaration + - variable-maybe-assignment + + variable-maybe-assignment: + - meta_include_prototype: false + - match: '' + set: + - variable-maybe-modifier + - variable-expect-identifier + + variable-maybe-modifier: + - meta_content_scope: meta.variable.identifier.java + - include: maybe-only-array-modifiers + + variable-maybe-declaration: + - meta_include_prototype: false + - match: '' + set: + - variable-declaration-list + - variable-declaration-value-assignment + - variable-expect-identifier + - variable-declaration-type-modifier + - variable-declaration-type + + variable-expect-identifier: + - include: variable-declaration-identifier + - match: (?=\S) + fail: variable-declarations-or-assignments + +###[ IF ELSE STATEMENTS ]###################################################### + + if-else-statements: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.9 + - match: if{{break}} + scope: keyword.control.conditional.if.java + push: + - if-meta + - block-or-expression + - maybe-group + - match: else{{break}} + scope: keyword.control.conditional.else.java + push: + - else-meta + - block-or-expression + + if-meta: + - meta_include_prototype: false + - meta_scope: meta.statement.conditional.if.java + - include: immediately-pop + + else-meta: + - meta_include_prototype: false + - meta_scope: meta.statement.conditional.else.java + - include: immediately-pop + +###[ SWITCH CASE STATEMENTS ]################################################## + + switch-case-statements: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.11 + - match: case{{break}} + scope: keyword.control.conditional.case.java + branch_point: case-label + branch: + - case-label-constant + - case-label-expression + - match: default{{break}} + scope: keyword.control.conditional.default.java + push: case-default-end + - match: switch{{break}} + scope: keyword.control.conditional.switch.java + push: + - switch-meta + - block-or-expression + - maybe-group + + switch-meta: + - meta_include_prototype: false + - meta_scope: meta.statement.conditional.switch.java + - include: immediately-pop + + case-default-end: + - meta_scope: meta.statement.conditional.default.java + - match: ':|->' + scope: punctuation.separator.expressions.java + pop: 1 + - include: else-pop + + case-label-constant: + - meta_scope: meta.statement.conditional.case.java + - match: (?=\S) + set: + - case-label-constant-end + - case-label-constant-identifier + + case-label-constant-identifier: + - include: literal-constant + - include: constant + - include: annotations + - include: case-label-fail + + case-label-constant-end: + - meta_content_scope: meta.statement.conditional.case.label.java + - include: case-label-end + - match: (?=[;{}]|(?:{{keywords}}|{{storage_types}}|{{storage_modifiers}}){{break}}) + pop: 1 + - include: case-label-fail + + case-label-expression: + - meta_scope: meta.statement.conditional.case.java + - match: (?=\S) + set: case-label-expression-body + + case-label-expression-body: + - meta_content_scope: meta.statement.conditional.case.label.java + - include: case-label-end + - include: expression + + case-label-end: + - match: ':|->' + scope: meta.statement.conditional.case.java punctuation.separator.expressions.java + pop: 1 + + case-label-fail: + - match: (?=\S) + fail: case-label + +###[ DO WHILE STATEMENTS ]##################################################### + + do-while-statements: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.12 + - match: while{{break}} + scope: keyword.control.loop.while.java + push: + - while-meta + - block-or-expression + - maybe-group + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.13 + - match: do{{break}} + scope: keyword.control.loop.do-while.java + push: + - do-meta + - block-or-expression + + do-meta: + - meta_include_prototype: false + - meta_scope: meta.statement.loop.do-while.java + - include: immediately-pop + + while-meta: + - meta_include_prototype: false + - meta_scope: meta.statement.loop.while.java + - include: immediately-pop + +###[ FOR LOOP STATEMENTS ]##################################################### + + for-statements: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.14 + - match: for{{break}} + scope: keyword.control.loop.for.java + push: + - for-meta + - block-or-expression + - for-parameters + + for-meta: + - meta_include_prototype: false + - meta_scope: meta.statement.loop.for.java + - include: immediately-pop + + for-parameters: + - match: \( + scope: punctuation.section.group.begin.java + set: + - for-parameters-update + - for-parameters-init + - include: else-pop + + for-parameters-init: + # enhanced for statement + - match: ':' + scope: keyword.operator.assignment.java + pop: 1 + # basic for statement + - match: ';' + scope: punctuation.terminator.java + set: for-parameters-condition + - include: variable-declarations-or-assignments + - include: expressions + - include: expression-terminator + + for-parameters-condition: + - include: punctuation-terminator-semicolon-pop + - include: expressions + - include: expression-terminator + + for-parameters-update: + - meta_scope: meta.group.java + - include: group-end + - include: expressions + - match: ; + scope: invalid.illegal.stray.java + - include: expression-terminator + +###[ FLOW CONTROL STATEMENTS ]################################################# + + labeled-statements: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.7 + - match: ({{identifier}})(:)(?!:) + captures: + 1: entity.name.label.java + 2: punctuation.separator.colon.java + + flow-control-statements: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.10 + - match: assert{{break}} + scope: keyword.control.flow.assert.java + push: assert-statement-body + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.15 + - match: break{{break}} + scope: keyword.control.flow.break.java + push: + - break-statement-end + - variable-label + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.16 + - match: continue{{break}} + scope: keyword.control.flow.continue.java + push: + - continue-statement-end + - variable-label + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.17 + - match: return{{break}} + scope: keyword.control.flow.return.java + push: return-statement-body + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.18 + - match: throw{{break}} + scope: keyword.control.flow.throw.java + push: throw-statement-body + # https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-14.21 + - match: yield{{break}} + scope: keyword.control.flow.yield.java + push: yield-statement-body + + assert-statement-body: + - meta_scope: meta.statement.conditional.assertion.java + - match: ':' + scope: punctuation.separator.expressions.java + - include: expression + + break-statement-end: + - meta_scope: meta.statement.flow.break.java + - include: expect-expression-terminator + + continue-statement-end: + - meta_scope: meta.statement.flow.continue.java + - include: expect-expression-terminator + + return-statement-body: + - meta_scope: meta.statement.flow.return.java + - include: expression + + throw-statement-body: + - meta_scope: meta.statement.flow.throw.java + - include: expression + + yield-statement-body: + - meta_scope: meta.statement.flow.yield.java + - include: expression + + variable-label: + - match: '{{identifier}}' + scope: variable.label.java + pop: 1 + - include: else-pop + +###[ SYNCHRONIZED STATEMENTS ]################################################# + + synchronized-statements: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.19 + - match: synchronized{{break}} + scope: keyword.control.flow.synchronized.java + push: + - synchronized-meta + - block-or-expression + - maybe-group + + synchronized-meta: + - meta_include_prototype: false + - meta_scope: meta.statement.flow.synchronized.java + - include: immediately-pop + +###[ TRY CATCH STATEMENTS ]#################################################### + + try-catch-statements: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.20 + - match: catch{{break}} + scope: keyword.control.exception.catch.java + push: + - catch-meta + - block-or-expression + - catch-parameters + - match: finally{{break}} + scope: keyword.control.exception.finally.java + push: + - finally-meta + - block-or-expression + - match: try{{break}} + scope: keyword.control.exception.try.java + push: + - try-meta + - block-or-expression + - try-parameters + + catch-meta: + - meta_include_prototype: false + - meta_scope: meta.statement.exception.catch.java + - include: immediately-pop + + catch-parameters: + - match: \( + scope: punctuation.section.group.begin.java + set: + - catch-parameters-end + - maybe-illegal-array-modifiers + - catch-parameter-identifier + - maybe-illegal-array-modifiers + - catch-parameter-type + - include: else-pop + + catch-parameter-type: + - include: final-modifiers + - include: illegal-storage-modifiers + - include: expect-object-type + + catch-parameter-identifier: + - match: \| + scope: punctuation.separator.pipe.java + push: + - maybe-illegal-array-modifiers + - catch-parameter-type + - match: '{{identifier}}' + scope: variable.other.java + pop: 1 + - match: '{{variables}}{{break}}' + scope: invalid.illegal.identifier.java + pop: 1 + - include: else-pop + + catch-parameters-end: + - meta_scope: meta.group.java + - include: group-end + - match: '[^\s\)]+' + scope: invalid.illegal.unexpected-token.java + + finally-meta: + - meta_include_prototype: false + - meta_scope: meta.statement.exception.finally.java + - include: immediately-pop + + try-meta: + - meta_include_prototype: false + - meta_scope: meta.statement.exception.try.java + - include: immediately-pop + + try-parameters: + - match: \( + scope: punctuation.section.group.begin.java + set: try-parameters-body + - include: else-pop + + try-parameters-body: + - meta_scope: meta.group.java + - include: group-end + - include: variable-declarations-or-assignments + - include: punctuation-terminator-semicolon + - include: expressions + - include: expression-terminator + +###[ EXPRESSIONS ]############################################################# + + else-expressions: + - match: (?=\S) + push: expression + + else-expression: + - match: (?=\S) + set: expression + + expression: + - include: expression-terminator + - include: expressions + + expression-terminator: + - match: |- + (?x)(?= + [;)\]{}] | + ( {{control_keywords}} + | {{declaration_keywords}} + | {{storage_modifiers}} + | {{storage_types}} + ){{break}} + ) + pop: 1 + + expect-expression-terminator: + - include: expression-terminator + - match: \S + scope: invalid.illegal.expect-terminator.java + +###[ INSTANTIATION EXPRESSIONS ]############################################### + + instantiations: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-15.html#jls-15.9 + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-15.html#jls-15.10 + - match: new{{break}} + scope: keyword.other.storage.new.java + push: + - instantiation-meta + - instantiation-arguments + - instantiation-type + - maybe-type-argument + - include: annotations + + instantiation-meta: + - meta_include_prototype: false + - meta_scope: meta.instantiation.java + - include: immediately-pop + + instantiation-type: + - include: primitive-type + - include: object-type + - include: annotations + - include: illegal-storage-modifiers + - include: illegal-unexpected-keywords + - include: else-pop + + instantiation-arguments: + - match: \( + scope: punctuation.section.group.begin.java + set: + - class-block + - group-body + - include: array-dimensions + - include: else-pop + + array-dimensions: + - match: \[ + scope: punctuation.section.brackets.begin.java + set: array-dimension-body + - include: array-initializer + - include: annotations + + array-dimension-body: + - meta_scope: meta.brackets.java + - match: \] + scope: punctuation.section.brackets.end.java + set: + - include: array-dimensions + - include: else-pop + - include: expressions + - include: expression-terminator + +###[ INITIALIZATION EXPRESSIONS ]############################################## + + variable-initializers: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.3 + - include: array-initializers + - include: ternary-initializers + - include: expressions + + variable-initializer: + - match: (?=,) + pop: 1 + - include: array-initializers + - include: ternary-initializers + - include: expression + + array-initializers: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-10.html#jls-10.6 + - match: \{ + scope: punctuation.section.braces.begin.java + push: array-initializer-body + + array-initializer: + - match: \{ + scope: punctuation.section.braces.begin.java + set: array-initializer-body + + array-initializer-body: + - meta_scope: meta.braces.java + - match: \} + scope: punctuation.section.braces.end.java + pop: 1 + - include: variable-initializers + + ternary-initializers: + - match: \? + scope: keyword.operator.ternary.java + push: ternary-initializer-body + + ternary-initializer-body: + - include: operator-ternary-colon + - include: variable-initializer + +###[ BLOCKS ]################################################################## + + block-or-expression: + - include: block + - include: else-expression + + blocks: + - match: \{ + scope: punctuation.section.block.begin.java + push: block-body + - include: stray-braces + + block: + - match: \{ + scope: punctuation.section.block.begin.java + set: block-body + + block-end: + - match: \} + scope: punctuation.section.block.end.java + pop: 1 + + block-body: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.2 + - meta_scope: meta.block.java + - include: block-end + - include: statements + - include: declarations + - include: else-expressions + +###[ GROUPS ]################################################################## + + groups: + - match: \( + scope: punctuation.section.group.begin.java + branch_point: groups + branch: + - cast-expression-group + - expression-group + - lambda-parameter-group + + group-else-fail: + - match: (?=\S) + fail: groups + + maybe-group: + - match: \( + scope: punctuation.section.group.begin.java + set: group-body + - include: else-pop + + group-body: + - meta_scope: meta.group.java + - include: group-end + - include: expressions + - include: expression-terminator + + group-end: + - match: \) + scope: punctuation.section.group.end.java + pop: 1 + +###[ CAST EXPRESSION GROUPS ]################################################## + + cast-expression-group: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-15.html#jls-15.16 + - meta_scope: meta.cast.java meta.group.java + - meta_include_prototype: false + - match: '' + set: + - cast-expression-group-body + - maybe-only-array-modifiers + - cast-expression-type + + cast-expression-group-body: + - meta_scope: meta.cast.java meta.group.java + - match: \) + scope: punctuation.section.group.end.java + set: cast-expression-group-end + - include: additional-bounds + - include: group-else-fail + + cast-expression-group-end: + # cast expressions may be followed by: + # - `!` : unary operator + # - `~` : unary operator + # - `(` : cast, lambda or group expression + # - literal : variable, type or method + - match: (?=[{{id_first_char}}!~(]) + pop: 1 + - include: group-else-fail + + cast-expression-type: + - include: primitive-type + - include: object-type + - include: illegal-var-type + - include: annotations + - include: maybe-type-argument + +###[ EXPRESSION GROUPS ]####################################################### + + expression-group: + - meta_scope: meta.group.java + - match: \) + scope: punctuation.section.group.end.java + set: expression-group-end + - include: expressions + - include: expression-terminator + + expression-group-end: + # looks like a lambda + - match: (?=->) + fail: groups + - include: else-pop + +###[ LAMBDA PARAMETER GROUPS ]################################################# + + lambda-parameter-group: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-15.html#jls-15.27 + - meta_scope: meta.function.anonymous.parameters.java meta.group.java + - match: \) + scope: punctuation.section.group.end.java + set: lambda-meta + - match: (?=[{{id_first_char}}@<]) + branch_point: lambda-parameter-declaration + branch: + - lambda-parameter-declaration + - lambda-parameter-declaration-identifier + - include: punctuation-separator-comma + - include: expect-expression-terminator + + lambda-parameter-declaration: + - meta_include_prototype: false + - match: '' + set: + - lambda-parameter-declaration-identifier + - parameter-maybe-variadic + - maybe-array-modifiers + - variable-declaration-type + + lambda-parameter-declaration-identifier: + - include: parameter-identifier + - match: (?=\S) + fail: lambda-parameter-declaration + + lambdas: + - match: -> + scope: + meta.function.anonymous.java + keyword.declaration.function.arrow.java + push: + - lambda-meta + - block-or-expression + + lambda-meta: + - meta_content_scope: meta.function.anonymous.java + - include: else-pop + +###[ RECEIVER OR FORMAL PARAMETERS ]########################################### + + receiver-or-parameter: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.4 + # The first parameter of a method or constructor declaration may be a + # receiver parameter which represents the object to invoke the method for. + - match: (?=[{{id_first_char}}<]) + branch_point: receiver-or-parameter + branch: + - receiver + - parameter + - include: annotation-else-pop + + receiver: + - meta_include_prototype: false + - match: '' + pop: 1 + set: + - receiver-identifier + - receiver-type + + receiver-type: + # A 'receiver-type' is basically an 'object-type' whose 'namespace' part + # is skipped as it is expected to be declared in the same source file due + # to receiver args being valid only for nested class' methods. + - match: (?={{reserved_words}}{{break}}) + fail: receiver-or-parameter + - match: (?=\S) + branch_point: receiver-type + branch: + - receiver-unqualified-type + - receiver-qualified-type + + receiver-unqualified-type: + - match: '{{identifier}}' + scope: storage.type.class.java + push: + - receiver-unqualified-type-end + - maybe-array-modifiers + - maybe-type-argument + - include: else-pop2 + + receiver-unqualified-type-end: + - match: (?={{id_first_char}}) + pop: 3 + - match: (?={{single_dot}}) + fail: receiver-type + - match: (?=\S) + fail: receiver-or-parameter + + receiver-qualified-type: + - meta_scope: meta.path.java + - match: '{{identifier}}' + scope: storage.type.class.java + push: + - receiver-qualified-type-end + - qualified-object-type-arguments + - include: annotation-else-pop2 + + receiver-qualified-type-end: + - match: \s*({{single_dot}}) + captures: + 1: punctuation.accessor.dot.java + pop: 1 + # consume comments + - match: \s*(?=/[/*]) + # Maintain meta.path boundaries at the end of the type. + - match: (?=\s*\S) + pop: 3 + + receiver-identifier: + - match: (?=\S) + branch_point: receiver-identifier + branch: + - receiver-unqualified-identifier + - receiver-qualified-identifier + + receiver-unqualified-identifier: + - match: this{{break}} + scope: variable.parameter.this.java + push: receiver-identifier-end + - match: '{{identifier}}' + scope: variable.parameter.java + set: receiver-unqualified-identifier-end + - include: annotation-else-pop2 + + receiver-unqualified-identifier-end: + - match: (?={{single_dot}}) + fail: receiver-identifier + - match: (?=\S) + fail: receiver-or-parameter + + receiver-qualified-identifier: + - meta_include_prototype: false + - match: '' + branch_point: receiver-qualified-identifier + branch: + - receiver-qualified-identifier-path + - receiver-qualified-identifier-name + + receiver-qualified-identifier-path: + - meta_scope: meta.path.java + - match: '{{id}}' + scope: storage.type.class.java + push: + - receiver-qualified-identifier-accessor + - maybe-type-argument + - include: annotation-else-pop3 + + receiver-qualified-identifier-accessor: + - include: punctuation-accessor-dot-pop2 + - match: (?=\S) + fail: receiver-qualified-identifier + + receiver-qualified-identifier-name: + - meta_scope: meta.path.java + - match: this{{break}} + scope: variable.parameter.this.java + set: receiver-identifier-end + - match: '{{identifier}}' + scope: invalid.illegal.identifier.java + set: receiver-identifier-end + - include: annotation-else-pop3 + + receiver-identifier-end: + - include: illegal-array-modifiers + - include: illegal-members + - include: annotation-else-pop3 + + parameter: + - meta_include_prototype: false + - match: '' + pop: 1 + set: + - parameter-maybe-identifier + - parameter-maybe-variadic + - maybe-array-modifiers + - parameter-type + + parameter-type: + - include: final-modifiers + - include: illegal-storage-modifiers + - include: primitive-type + - include: illegal-var-type + - include: maybe-object-type + + parameter-maybe-variadic: + - match: \.\.\. + scope: keyword.operator.variadic.java + pop: 1 + - include: annotation-else-pop + + parameter-maybe-identifier: + - include: parameter-identifier + - include: else-pop + + parameter-identifier: + - match: '{{identifier}}' + scope: variable.parameter.java + set: maybe-only-array-modifiers + - match: '{{variables}}{{break}}' + scope: invalid.illegal.identifier.java + set: maybe-only-array-modifiers + +###[ VARIABLES ]############################################################### + + variables: + # Note: + # 1) `variable-other` must be the first branch to scope the very last + # identifier before eof or end of embedded section as ordinary variable. + # 2) `variable-qualifier` scopes identifiers not followed by ClassCaseIds + # as ordinary variables. Found no easy enough solution by only using + # `variable-other` and `variable-namespace`. + - match: (?={{id_first_char}}) + branch_point: variables + branch: + - variable-other + - variable-namespace + - variable-qualifier + - method-call-identifier + - lambda-parameter + - include: variable-item-access + + method-call-identifier: + - meta_include_prototype: false + - match: '{{id}}' + scope: + meta.function-call.identifier.java + variable.function.java + set: method-call-arguments + - include: immediately-pop + + method-call-arguments: + - meta_content_scope: meta.function-call.identifier.java + - match: \( + scope: punctuation.section.group.begin.java + set: method-call-arguments-body + - match: (?=\S) + fail: variables + + method-call-arguments-body: + - meta_scope: meta.function-call.arguments.java meta.group.java + - include: group-body + + lambda-parameter: + - meta_include_prototype: false + - match: '{{id}}' + scope: + meta.function.anonymous.parameters.java + variable.parameter.java + set: lambda-parameter-end + - include: immediately-pop + + lambda-parameter-end: + - meta_content_scope: meta.function.anonymous.java + - include: else-pop + + variable-namespace: + - match: '{{lowercase_id}}' + scope: variable.namespace.java + push: variable-namespace-accessor + - match: '' + fail: variables + + variable-namespace-accessor: + - meta_scope: meta.path.java + - match: '{{single_dot}}' + scope: punctuation.accessor.dot.java + set: + - match: '{{classcase_id}}' + scope: storage.type.class.java + set: + - variable-namespace-meta + - maybe-object-type-child + - maybe-array-modifiers + - maybe-type-argument + - include: else-pop + - match: (?=\S) + fail: variables + + variable-namespace-meta: + - meta_include_prototype: false + - meta_scope: meta.path.java + - include: immediately-pop2 + + variable-other: + - meta_include_prototype: false + - match: '{{id}}' + scope: + meta.variable.identifier.java + variable.other.java + set: variable-other-end + - include: immediately-pop + + variable-other-end: + - meta_content_scope: meta.variable.identifier.java + - match: \s*(\.|\(|->) + fail: variables + - include: variable-item-access-end + + variable-qualifier: + - meta_include_prototype: false + - match: '{{id}}' + scope: + meta.variable.identifier.java + variable.other.java + set: variable-qualifier-end + - include: immediately-pop + + variable-qualifier-end: + - meta_content_scope: meta.variable.identifier.java + - match: \s*(\(|->) + fail: variables + - include: variable-item-access-end + + variable-item-access: + - match: \[ + scope: punctuation.section.brackets.begin.java + push: variable-item-access-body + + variable-item-access-body: + - meta_scope: meta.variable.item-access.java meta.brackets.java + - match: \] + scope: punctuation.section.brackets.end.java + set: variable-item-access-end + - include: expressions + - include: expression-terminator + + variable-item-access-end: + - meta_content_scope: meta.variable.item-access.java + - match: \s*(?=\[|/[/*]) + - match: (?=\s*\S) + pop: 1 + + variable-language-class: + - match: class{{break}} + scope: variable.language.class.java + pop: 1 + + maybe-function-reference: + - match: new{{break}} + scope: keyword.other.storage.new.java + pop: 1 + - match: '{{identifier}}' + scope: variable.function.reference.java + pop: 1 + - include: else-pop + +###[ LITERALS ]################################################################ + + literals: + - include: literal-chars + - include: literal-strings + - include: literal-numbers + - include: literal-constants + - include: literal-variables + + literal-variables: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-3.html#jls-3.9 + - match: _{{break}} + scope: variable.language.anonymous.java + - match: super{{break}} + scope: variable.language.super.java + - match: this{{break}} + scope: variable.language.this.java + + literal-constants: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-3.html#jls-3.10.3 + - match: (?:false|true){{break}} + scope: constant.language.boolean.java + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-3.html#jls-3.10.7 + - match: null{{break}} + scope: constant.language.null.java + + literal-constant: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-3.html#jls-3.10.3 + - match: (?:false|true){{break}} + scope: constant.language.boolean.java + pop: 1 + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-3.html#jls-3.10.7 + - match: null{{break}} + scope: constant.language.null.java + pop: 1 + + literal-numbers: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-3.html#jls-3.10 + # hexadecimal floats + - match: |- + (?x) + # 0x1., 0x1.1, 0x1.1p1, 0x1.1p-1, 0x1.p1, 0x1.p-1 | 0x1p1 | 0x.1, 0x.1p1, 0x.1p-1 + (0[xX]) ( {{hex_digit}}* (?: ({{single_dot}}) {{hex_digit}}* (?:{{hex_exponent}})? | {{hex_exponent}} ) ) ({{float_suffix}})? + scope: meta.number.float.hexadecimal.java + captures: + 1: constant.numeric.base.java + 2: constant.numeric.value.java + 3: punctuation.separator.decimal.java + 4: constant.numeric.suffix.java + # decimal floats + - match: |- + (?x) + ([0-9]{{dec_digit}}*) + (?: + # 1., 1.1, 1.1e1, 1.1e-1, 1.e1, 1.e-1, 1.d, 1.1d, 1.1e1d, 1.1e-1d, 1.e1d, 1.e-1d + ( ({{single_dot}}) {{dec_digit}}* (?:{{dec_exponent}})? ) ({{float_suffix}})? + # 1e1 1e1d + | ({{dec_exponent}}) ({{float_suffix}})? + # 1d + | ({{float_suffix}}) + ) + | ( ({{single_dot}}) {{dec_digit}}+ (?:{{dec_exponent}})? ) ({{float_suffix}})? + scope: meta.number.float.decimal.java + captures: + 1: constant.numeric.value.java + 2: constant.numeric.value.java + 3: punctuation.separator.decimal.java + 4: constant.numeric.suffix.java + 5: constant.numeric.value.java + 6: constant.numeric.suffix.java + 7: constant.numeric.suffix.java + 8: constant.numeric.value.java + 9: punctuation.separator.decimal.java + 10: constant.numeric.suffix.java + # binary integers + - match: (0[bB])({{bin_digit}}*)({{int_suffix}})? + scope: meta.number.integer.binary.java + captures: + 1: constant.numeric.base.java + 2: constant.numeric.value.java + 3: constant.numeric.suffix.java + # hexadecimal integers + - match: (0[xX])({{hex_digit}}*)({{int_suffix}})? + scope: meta.number.integer.hexadecimal.java + captures: + 1: constant.numeric.base.java + 2: constant.numeric.value.java 3: constant.numeric.suffix.java # octal integers - - match: \b(0)({{oct_digit}}+)([lL]\b|(?![\d_])) + - match: (0)({{oct_digit}}+)({{int_suffix}}|(?![\d_])) scope: meta.number.integer.octal.java captures: 1: constant.numeric.base.java 2: constant.numeric.value.java 3: constant.numeric.suffix.java # decimal integers - - match: \b((0_*)?[1-9]{{dec_digit}}*|0(?![\d_]))([lL]\b)? + - match: ((0_*)?[1-9]{{dec_digit}}*|0(?![\d_]))({{int_suffix}})? scope: meta.number.integer.decimal.java captures: 1: constant.numeric.value.java 2: invalid.illegal.numeric.java 3: constant.numeric.suffix.java - keywords: - - match: '::' - scope: punctuation.accessor.double-colon.java - push: - - match: '{{id}}' - scope: variable.function.reference.java - pop: true - - include: any_POP - - match: '\?|:' - scope: keyword.operator.ternary.java - - match: \binstanceof\b - scope: keyword.operator.word.instanceof.java - - match: (<<|>>>?) - scope: keyword.operator.bitshift.java - - match: (==|!=|<=|>=|<>|<|>) + literal-chars: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-3.html#jls-3.10.4 + - match: (')(?:({{escape_unicode}})|({{escape_octal}})|({{escape_other}})|([^']))(') + scope: meta.string.java string.quoted.single.java + captures: + 1: punctuation.definition.string.begin.java + 2: constant.character.escape.unicode.java + 3: constant.character.escape.octal.java + 4: constant.character.escape.other.java + 5: constant.character.literal.java + 6: punctuation.definition.string.end.java + + literal-strings: + - include: literal-double-quoted-textblocks + - include: literal-double-quoted-strings + - include: literal-single-quoted-strings + + literal-single-quoted-strings: + # Java doesn't support single quoted strings, but Groovy does. + - match: (')[^']+(') + scope: invalid.illegal.not-a-char.java + + literal-double-quoted-strings: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-3.html#jls-3.10.5 + - match: \" + scope: punctuation.definition.string.begin.java + push: literal-double-quoted-string-body + + literal-double-quoted-string-body: + - meta_include_prototype: false + - meta_scope: meta.string.java string.quoted.double.java + - match: \" + scope: punctuation.definition.string.end.java + pop: 1 + - include: illegal-newline + - include: literal-string-escapes + + literal-double-quoted-textblocks: + # https://docs.oracle.com/javase/specs/jls/se16/html/jls-3.html#jls-3.10.6 + - match: (\"{3})\s*(.*)$ + captures: + 1: punctuation.definition.string.begin.java + 2: invalid.illegal.unexpected-content.java + push: literal-double-quoted-textblock-body + + literal-double-quoted-textblock-body: + - meta_include_prototype: false + - meta_scope: meta.string.java string.quoted.triple.java + - match: \"{3} + scope: punctuation.definition.string.end.java + pop: 1 + - include: literal-string-escapes + + literal-string-escapes: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-3.html#jls-3.3 + - match: '{{escape_unicode}}' + scope: constant.character.escape.unicode.java + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-3.html#jls-3.10.6 + - match: '{{escape_octal}}' + scope: constant.character.escape.octal.java + - match: '{{escape_other}}' + scope: constant.character.escape.other.java + - match: \\. + scope: invalid.illegal.escape.java + +###[ OPERATORS ]############################################################### + + operators: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-3.html#jls-3.12 + - match: (<<|>>>?|[-+*/%|&\^])= + scope: keyword.operator.assignment.augmented.java + - match: '<<|>>>?' + scope: keyword.operator.bitwise.java + - match: '==|!=|<=|>=|<>|<|>' scope: keyword.operator.comparison.java - - match: (\-\-|\+\+) - scope: keyword.operator.increment-decrement.java - - match: (\-|\+|\*|\/|%) + - match: '=' + scope: keyword.operator.assignment.java + push: variable-initializer + - match: '\+\+?|\-\-?|[*/%]' scope: keyword.operator.arithmetic.java - - match: (!|&&|\|\|) + - match: '!|&&|\|\|' scope: keyword.operator.logical.java - - match: (~|\^|&|\|) + - match: '[~|&\^]' scope: keyword.operator.bitwise.java - - match: (\.)(class\b)? - captures: - 1: punctuation.accessor.dot.java - 2: variable.language.java - - include: punctuation-separator-comma - - include: punctuation-terminator-semicolon + - match: '\?' + scope: keyword.operator.ternary.java + push: ternary-expression + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-15.html#jls-15.20.2 + - match: instanceof{{break}} + scope: keyword.other.storage.instanceof.java + push: + - maybe-only-array-modifiers + - cast-expression-type - keywords-control: - # exceptions - - match: \bcatch\b - scope: keyword.control.exception.catch.java + operator-ternary-colon: + - match: ':' + scope: keyword.operator.ternary.java + pop: 1 + + ternary-expression: + - include: operator-ternary-colon + - include: expression + +###[ PUNCTUATIONS ]############################################################ + + punctuations: + - match: '::' + scope: punctuation.accessor.double-colon.java push: - - meta_scope: meta.catch.java - - match: (?=\() - set: - - match: \( - scope: punctuation.section.parens.begin.java - set: - - meta_scope: meta.catch.parameters.java meta.parens.java - - match: \) - scope: punctuation.section.parens.end.java - pop: true - - match: \| - scope: punctuation.separator.bar.java - - include: parameters - - include: any_POP - - match: \bfinally\b - scope: keyword.control.exception.finally.java - - match: \btry\b - scope: keyword.control.exception.try.java - push: declaration-statement-parens - # flow - - match: \bassert\b - scope: keyword.control.flow.assert.java + - maybe-function-reference + - maybe-type-argument + - match: '{{single_dot}}' + scope: punctuation.accessor.dot.java push: - - meta_scope: meta.assertion.java - - match: (?=;) - pop: true - - match: ':' - scope: punctuation.separator.expressions.java - - include: code - - match: \bbreak\b - scope: keyword.control.flow.break.java - - match: \bcontinue\b - scope: keyword.control.flow.continue.java - - match: \breturn\b - scope: keyword.control.flow.return.java - - match: \bthrow\b - scope: keyword.control.flow.throw.java - # conditional - - match: \bif\b - scope: keyword.control.conditional.if.java - - match: \belse\b - scope: keyword.control.conditional.else.java - - match: \bswitch\b - scope: keyword.control.conditional.switch.java - - match: \bcase\b - scope: keyword.control.conditional.case.java - - match: \bdefault\b - scope: keyword.control.conditional.default.java - # loop - - match: \bdo\b - scope: keyword.control.loop.do-while.java - - match: \bfor\b - scope: keyword.control.loop.for.java - push: declaration-statement-parens - - match: \bwhile\b - scope: keyword.control.loop.while.java + - include: variable-language-class + - include: maybe-type-argument + - include: punctuation-separator-comma + + punctuation-accessor-dot: + - match: '{{single_dot}}' + scope: punctuation.accessor.dot.java + + punctuation-accessor-dot-pop: + - match: '{{single_dot}}' + scope: punctuation.accessor.dot.java + pop: 1 + + punctuation-accessor-dot-pop2: + - match: '{{single_dot}}' + scope: punctuation.accessor.dot.java + pop: 2 + + punctuation-separator-comma: + - match: ',' + scope: punctuation.separator.comma.java + + punctuation-terminator-semicolon: + - match: ; + scope: punctuation.terminator.java + + punctuation-terminator-semicolon-pop: + - match: ; + scope: punctuation.terminator.java + pop: 1 + +###[ CONSTANT ]################################################################ + + constant: + - match: (?={{identifier}}) + branch_point: constant + branch: + - unqualified-constant + - qualified-constant + + unqualified-constant: + - meta_include_prototype: false + - match: '{{id}}' + scope: constant.other.java + set: unqualified-constant-end + - include: immediately-pop2 + + unqualified-constant-end: + - match: (?={{single_dot}}) + fail: constant + - include: else-pop2 + + qualified-constant: + - meta_include_prototype: false + - meta_content_scope: meta.path.java + - match: '' + branch_point: qualified-constant + branch: + - qualified-constant-package + - qualified-constant-class-or-name + + qualified-constant-package: + - match: '{{lowercase_id}}' + scope: variable.namespace.java + set: qualified-constant-package-accessor + - include: annotations + - match: (?=\S) + fail: qualified-constant + + qualified-constant-package-accessor: + - include: punctuation-accessor-dot-pop + - match: (?=\S) + fail: qualified-constant - illegal-keywords: - - match: \b(goto|const)\b - scope: invalid.illegal.keyword.java + qualified-constant-class-or-name: + - meta_include_prototype: false + - match: '' + pop: 1 + branch_point: qualified-constant-class-or-name + branch: + - qualified-constant-class + - qualified-constant-name + + qualified-constant-class: + - meta_include_prototype: false + - match: '{{identifier}}' + scope: storage.type.class.java + set: + - qualified-constant-class-accessor + - maybe-type-argument + - include: annotation-else-pop3 - illegal-open-block: - - match: \s?(?={) - scope: invalid.illegal.stray-terminator-end - pop: true + qualified-constant-class-accessor: + - include: punctuation-accessor-dot-pop + - match: (?=\S) + fail: qualified-constant-class-or-name - illegal-semicolon: - - match: ; - scope: invalid.illegal.stray-terminator-end - pop: true + qualified-constant-name: + - meta_include_prototype: false + - match: '{{identifier}}' + scope: constant.other.java + pop: 3 + - include: annotation-else-pop3 - illegal-parens-terminators: - # Pops the stack if anything matches - - include: illegal-semicolon - - include: illegal-open-block +###[ ENTITY CLASS ]############################################################ - method-invocations: - - match: (\.)\s*(?=<) - captures: - 1: punctuation.accessor.dot.java - push: generic-type-invocation - - match: ({{id}})\s*(\() - captures: - 1: variable.function.java - 2: punctuation.section.parens.begin.java - push: - - meta_scope: meta.function-call.java - - match: \) - scope: punctuation.section.parens.end.java - pop: true - - include: illegal-parens-terminators - - include: code - - fields-and-methods: - - match: \bvoid\b - scope: storage.type.void.java - push: method - - match: (?={{id}}\s*\() - push: method - - match: '{{before_fqn}}' - push: [field-or-method, after-object-and-array-types, object-type-fqn] - - match: \b{{classcase_id}} - scope: support.class.java - push: [field-or-method, after-object-and-array-types] - - match: \b{{primitives}}\b - scope: storage.type.primitive.java - push: [field-or-method, array-brackets] + entity-class: + - match: (?={{identifier}}) + branch_point: entity-class + branch: + - entity-class-qualified-identifier + - entity-class-unqualified-identifier - field-or-method: - - match: (?={{id}}\s*\() - set: method - - match: (?=\S) + entity-class-qualified-identifier: + - match: '{{id}}' + scope: variable.namespace.java set: - - include: before-next-field - - match: (?:({{uppercase_id}})|({{id}})) - captures: - 1: entity.name.constant.java - 2: meta.field.java - push: [static-assignment, array-brackets] - - include: punctuation-separator-comma - - include: any_POP - - before-next-field: - # Prevent style from being removed from whole file when making a new expression - - match: (?=\b(?:{{storage_modifiers}}|{{primitives}}|void)\b) - pop: true - - method: - - meta_scope: meta.method.java - - match: ({{classcase_id}})\s*(?=\() - captures: - 1: meta.method.identifier.java entity.name.function.constructor.java - - match: ({{id}})\s*(?=\() - captures: - 1: meta.method.identifier.java entity.name.function.java - - match: \( - scope: punctuation.section.parens.begin.java - push: - - meta_scope: meta.method.parameters.java meta.parens.java - - match: \) - scope: punctuation.section.parens.end.java - pop: true - - include: parameters - - match: \S - scope: invalid.illegal.missing-parameter-end - pop: true - - include: throws - - include: annotation-default - - match: \{ - scope: punctuation.section.block.begin.java + - meta_scope: meta.path.java + - match: '{{single_dot}}' + scope: punctuation.accessor.dot.java + set: + - meta_include_prototype: false + - meta_content_scope: meta.path.java + - match: '' + branch_point: entity-class-path + branch: + - entity-class-qualifier + - entity-class-identifier + - match: (?=\S) + fail: entity-class + + entity-class-qualifier: + - match: '{{identifier}}' + scope: variable.namespace.java set: - - meta_scope: meta.method.java meta.method.body.java - - match: \} - scope: punctuation.section.block.end.java - pop: true - - include: code-block - - include: any_POP - - throws: - - match: \bthrows\b - scope: keyword.declaration.throws.java - push: - - - meta_scope: meta.method.throws.java - - match: \, - scope: punctuation.separator.comma.java - push: object-type-reference - - include: any_POP - - object-type-reference - - # Stand-along uppercase id, either type or constant. - # Should be used only inside code blocks. - uppercase-identifiers: - # Popular JDK classes - - match: \b(?:UUID|UR[LI])\b - scope: support.class.java - push: after-object-type - # Generic type variable - - match: \b\p{Lu}\b - scope: support.class.java - push: after-object-type - # Uppercase constants - - match: \b{{uppercase_id}} - scope: constant.other.java + - entity-class-accessor + - maybe-type-argument + - include: else-pop2 - # Stand-alone type, maybe type of the variable or class object reference. - # Should be used only inside code blocks. - object-types: - # Here the match is more complex than 'before_fqn'. - # In code block we can't simply distinguish package from variable. - - match: (?=\b(?:{{lowercase_id}}\.)+\p{Lu}) - push: [after-object-type, object-type-fqn] - - match: \b{{classcase_id}}\b - scope: support.class.java - push: after-object-type - - object-type-fqn: - - meta_scope: meta.path.java - - include: package - - match: '{{classcase_id}}' - scope: support.class.java - pop: true - - include: any_POP - - after-object-type: - - match: (?=<) - set: [array-brackets, generic-type-invocation] - - match: \.(?!\.) - scope: punctuation.accessor.dot.java + entity-class-accessor: + - include: punctuation-accessor-dot-pop + - match: (?=\S) + fail: entity-class-path + + entity-class-identifier: + - match: '{{identifier}}' + scope: entity.name.class.java set: - - match: (?=<) - set: generic-type-invocation - - match: (?:(class)\b|({{uppercase_id}})) - captures: - 1: variable.language.java - 2: constant.other.java - pop: true - - match: '{{classcase_id}}' - scope: support.class.java - set: after-object-type - - include: any_POP - - include: array-brackets - - # Used in 'throws' and generic bounds - object-type-reference: - - match: '{{before_fqn}}' + - immediately-pop2 + - maybe-type-argument + - include: else-pop2 + + entity-class-unqualified-identifier: + - match: '{{id}}' + scope: entity.name.class.java + set: maybe-type-argument + +###[ ENTITY MODULE ]########################################################### + + entity-module: + - match: (?={{identifier}}) + branch_point: entity-module + branch: + - entity-module-qualified-identifier + - entity-module-unqualified-identifier + + entity-module-qualified-identifier: + - match: '{{id}}' + scope: variable.namespace.java set: - meta_scope: meta.path.java - - include: package - - include: object-type-reference-no-fqn - - include: object-type-reference-no-fqn + - match: '{{single_dot}}' + scope: punctuation.accessor.dot.java + set: + - meta_include_prototype: false + - meta_content_scope: meta.path.java + - match: '' + branch_point: entity-module-path + branch: + - entity-module-qualifier + - entity-module-identifier + - match: (?=\S) + fail: entity-module + + entity-module-qualifier: + - match: '{{identifier}}' + scope: variable.namespace.java + set: entity-module-accessor + - include: else-pop2 + + entity-module-accessor: + - include: punctuation-accessor-dot-pop + - match: (?=\S) + fail: entity-module-path - object-type-reference-no-fqn: - - match: '{{classcase_id}}' - scope: support.class.java - set: after-object-type-reference - - include: any_POP - - after-object-type-reference: - - match: (?=<) - set: generic-type-invocation - - match: \. - scope: punctuation.accessor.dot.java - set: object-type-reference-no-fqn - - include: any_POP + entity-module-identifier: + - match: '{{identifier}}' + scope: entity.name.namespace.module.java + pop: 2 + - include: else-pop2 - # Used in method's and generic's parameters - object-and-array-types: - - match: '{{before_fqn}}' - push: + entity-module-unqualified-identifier: + - match: '{{id}}' + scope: entity.name.namespace.module.java + pop: 1 + +###[ ENTITY PACKAGE ]########################################################## + + entity-package: + - match: (?={{identifier}}) + branch_point: entity-package + branch: + - entity-package-qualified-identifier + - entity-package-unqualified-identifier + + entity-package-qualified-identifier: + - match: '{{id}}' + scope: variable.namespace.java + set: - meta_scope: meta.path.java - - include: package - - include: object-and-array-types-no-fqn - - match: \b({{primitives}})(?=\s*\[) - scope: storage.type.primitive.java - push: array-brackets - - match: \b{{classcase_id}} - scope: support.class.java - push: after-object-and-array-types + - match: '{{single_dot}}' + scope: punctuation.accessor.dot.java + set: + - meta_include_prototype: false + - meta_content_scope: meta.path.java + - match: '' + branch_point: entity-package-path + branch: + - entity-package-qualifier + - entity-package-identifier + - match: (?=\S) + fail: entity-package + + entity-package-qualifier: + - match: '{{identifier}}' + scope: variable.namespace.java + set: entity-package-accessor + - include: else-pop2 + + entity-package-accessor: + - include: punctuation-accessor-dot-pop + - match: (?=\S) + fail: entity-package-path + + entity-package-identifier: + - match: '{{identifier}}' + scope: entity.name.namespace.package.java + pop: 2 + - include: else-pop2 + + entity-package-unqualified-identifier: + - match: '{{id}}' + scope: entity.name.namespace.package.java + pop: 1 - object-and-array-types-no-fqn: +###[ OBJECT TYPES ]############################################################ + + object-types: + # Popular JDK classes, generic type variable + - match: (?:UUID|UR[LI]|\p{Lu}){{break}} + scope: storage.type.class.java + push: + - maybe-object-type-child + - maybe-array-modifiers + - maybe-type-argument + # Uppercase constants + - match: '{{uppercase_id}}' + scope: constant.other.java + # Classes - match: '{{classcase_id}}' - scope: support.class.java - set: after-object-and-array-types - - include: any_POP - - after-object-and-array-types: - - match: (?=<) - set: [array-brackets, generic-type-invocation] - - match: \.(?!\.) + scope: storage.type.class.java + push: + - maybe-object-type-child + - maybe-array-modifiers + - maybe-type-argument + + maybe-object-type-child: + - match: '{{single_dot}}' scope: punctuation.accessor.dot.java - set: object-and-array-types-no-fqn - - include: array-brackets + set: object-types-child-identifier + - include: else-pop - # Used in class-level 'extends' and 'implements' - inherited-object-type-reference: - - match: '{{before_fqn}}' + object-types-child-identifier: + - include: variable-language-class + - match: '{{uppercase_id}}' + scope: constant.other.java + pop: 1 + - match: '{{classcase_id}}' + scope: storage.type.class.java set: - - meta_scope: meta.path.java - - match: '{{lowercase_id}}' - scope: entity.other.inherited-class.package.java - - include: punctuation-accessor-dot - - include: inherited-object-type-reference-no-fqn - - include: inherited-object-type-reference-no-fqn - - inherited-object-type-reference-no-fqn: - - match: (?!class|extends|implements|interface){{id}} - scope: entity.other.inherited-class.java - set: after-inherited-object-type-reference - - include: any_POP + - maybe-object-type-child + - maybe-array-modifiers + - maybe-type-argument + - include: annotation-else-pop - after-inherited-object-type-reference: - - match: (?=<) - set: generic-type-invocation - - match: \. - scope: punctuation.accessor.dot.java - set: inherited-object-type-reference-no-fqn - - include: any_POP +###[ OBJECT TYPE ]############################################################# - generic-type-declaration: - - match: < - scope: punctuation.definition.generic.begin.java - push: generic-type-parameter - - include: any_POP - - generic-type-terminator: - - include: illegal-semicolon - # These characters can't appear in a generic. If we've matched - # them then someone forgot to close it. - - match: (?=[{}()]) - pop: true - - match: '>' - scope: punctuation.definition.generic.end.java - pop: true + expect-object-type: + - include: object-type + - include: annotations + - include: illegal-unexpected-reserved + - include: else-pop + + maybe-object-type: + - include: object-type + - include: annotation-else-pop + + object-type: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-4.html#jls-4.3 + - match: (?={{identifier}}) + branch_point: object-type + branch: + - unqualified-object-type + - qualified-object-type + + unqualified-object-type: + - match: '{{id}}' + scope: storage.type.class.java + push: + - unqualiefied-object-type-end + - maybe-type-argument - generic-type-parameter: - - meta_scope: meta.generic.declaration.java - - match: \b{{id}}\b - scope: variable.parameter.type.java - push: generic-type-bounds - - include: generic-type-terminator + unqualiefied-object-type-end: + - match: (?={{single_dot}}) + fail: object-type + - include: else-pop3 + + qualified-object-type: + - meta_include_prototype: false + - meta_scope: meta.path.java + - match: '' + branch_point: qualified-object-type + branch: + - qualified-object-type-package + - qualified-object-type-class + + qualified-object-type-package: + - match: '{{lowercase_id}}' + scope: variable.namespace.java + set: qualified-object-type-accessor + - include: annotations + - match: (?=\S) + fail: qualified-object-type + + qualified-object-type-accessor: + - include: punctuation-accessor-dot-pop + - match: (?=\S) + fail: qualified-object-type - generic-type-bounds: - - match: (,)|(?=>) + qualified-object-type-class: + - match: '{{identifier}}' + scope: storage.type.class.java + push: + - qualified-object-type-end + - qualified-object-type-arguments + - include: annotation-else-pop3 + + qualified-object-type-arguments: + - match: (?=\s*<) + set: maybe-type-argument + - match: (?=\s*\S) + pop: 1 + + qualified-object-type-end: + - match: \s*({{single_dot}}) captures: - 1: punctuation.separator.comma.java - pop: true - - match: \bextends\b - scope: keyword.declaration.extends.java - push: [generic-type-extends-multiple-bounds, object-type-reference] - - match: \bsuper\b - scope: keyword.declaration.super.java - push: object-type-reference + 1: punctuation.accessor.dot.java + pop: 1 + - match: (?=\s*\S) + pop: 4 + +###[ REFERENCE TYPE ]########################################################## + + maybe-additional-bounds: + - include: additional-bounds + - include: else-pop - generic-type-extends-multiple-bounds: + additional-bounds: - match: '&' - scope: keyword.operator.multiple-bounds.java - set: [generic-type-extends-multiple-bounds, object-type-reference] - - include: any_POP + scope: keyword.operator.logical.java + push: maybe-reference-type + + maybe-reference-type: + - include: reference-type + - include: annotation-else-pop + + reference-type: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-4.html#jls-4.3 + - match: (?={{storage_types}}{{break}}) + branch_point: primitive-array-type + branch: + - reference-type-array + - reference-type-illegal + - match: (?={{id_first_char}}) + set: + - maybe-array-modifiers + - maybe-object-type - generic-type-invocation: - - match: < - scope: punctuation.definition.generic.begin.java - set: generic-type-argument - - include: any_POP + reference-type-array: + # note: simplified pattern as primitive types consist of ascii chars only + - match: '[A-Za-z]+' + scope: storage.type.primitive.java + set: reference-type-array-item-access - generic-type-argument: - - meta_scope: meta.generic.java - - match: \? - scope: keyword.operator.wildcard.java - push: generic-type-bounds - - include: generic-type-terminator - - include: object-and-array-types + reference-type-array-item-access: + - match: (?=\[) + pop: 1 + set: maybe-array-modifiers - include: annotations - - include: punctuation-separator-comma + - match: (?=\S) + fail: primitive-array-type - annotation-default: - - match: \bdefault\b - scope: keyword.declaration.default.java + reference-type-illegal: + # note: simplified pattern as primitive types consist of ascii chars only + - match: '[A-Za-z]+' + scope: invalid.illegal.unexpected-keyword.java + pop: 2 + +###[ INHERRITED TYPE REFERENCES ]############################################## + + # Used in class-level 'extends' and 'implements' + inherited-object-type-list: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.1.4 + - match: ',' + scope: punctuation.separator.comma.java + push: inherited-object-type + + inherited-object-type: + - match: (?={{identifier}}) + branch_point: inherited-object-type + branch: + - unqualified-inherited-object-type + - qualified-inherited-object-type + - include: annotation-else-pop + + unqualified-inherited-object-type: + - match: '{{id}}' + scope: entity.other.inherited-class.java push: - - meta_scope: meta.annotation.default.java - - match: (?=;) - pop: true - - include: code + - unqualiefied-inherited-object-type-end + - maybe-type-argument - parameters: - - match: \bfinal\b - scope: storage.modifier.java + unqualiefied-inherited-object-type-end: + - match: (?={{single_dot}}) + fail: inherited-object-type + - include: illegal-array-modifiers + - include: annotation-else-pop3 + + qualified-inherited-object-type: + - meta_include_prototype: false + - meta_scope: meta.path.java + - match: '' + branch_point: qualified-inherited-object-type + branch: + - qualified-inherited-object-type-package + - qualified-inherited-object-type-class + + qualified-inherited-object-type-package: + - match: '{{lowercase_id}}' + scope: variable.namespace.java + set: qualified-inherited-object-type-accessor - include: annotations - - include: primitive-types - - include: object-and-array-types - - match: \.\.\. - scope: keyword.operator.variadic.java - - match: '{{id}}' - scope: variable.parameter.java - push: array-brackets - - include: punctuation-separator-comma + - match: (?=\S) + fail: qualified-inherited-object-type - lambdas: - - match: (?={{lambda_lookahead}}) - push: lambda-params + qualified-inherited-object-type-accessor: + - include: punctuation-accessor-dot-pop + - match: (?=\S) + fail: qualified-inherited-object-type - lambda-params: - - meta_scope: meta.function.anonymous.parameters.java - - match: \( - scope: punctuation.section.parens.begin.java + qualified-inherited-object-type-class: + - match: '{{identifier}}' + scope: entity.other.inherited-class.java + push: + - qualified-object-type-end + - qualified-object-type-arguments + - include: annotation-else-pop3 + +###[ TYPE ARGUMENTS ]########################################################## + + maybe-type-argument: + - include: type-argument + - include: else-pop + + type-argument: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-4.html#jls-4.5.1 + - match: <> + scope: + meta.generic.java + punctuation.section.generic.diamond.java + pop: 1 + - match: < + scope: punctuation.section.generic.begin.java set: - - meta_scope: meta.function.anonymous.parameters.java - - match: \) - scope: punctuation.section.parens.end.java - set: lambda-arrow - - include: parameters - - match: '{{id}}' - scope: variable.parameter.java - set: lambda-arrow + - type-argument-body + - type-argument-reference - lambda-arrow: - - match: -> - scope: storage.type.function.anonymous.java + type-argument-body: + - meta_scope: meta.generic.java + - match: ',' + scope: punctuation.separator.comma.java + push: type-argument-reference + - include: type-parameter-end + + type-argument-reference: + - match: \? + scope: variable.language.wildcard.java + set: type-argument-bounds + - include: maybe-reference-type + + type-argument-bounds: + - match: extends{{break}} + scope: storage.modifier.extends.java set: - - meta_scope: meta.function.anonymous.body.java - - match: (?=[)};]) - pop: true - - include: code + - maybe-additional-bounds + - maybe-reference-type + - match: super{{break}} + scope: keyword.declaration.super.java + set: maybe-reference-type + - include: else-pop - parens: - - match: \( - scope: punctuation.section.parens.begin.java +###[ TYPE PARAMETERS ]######################################################### + + maybe-type-parameter: + - include: type-parameter + - include: else-pop + + type-parameters: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.1.2 + - match: < + scope: punctuation.section.generic.begin.java push: - - meta_scope: meta.parens.java - - match: \) - scope: punctuation.section.parens.end.java - pop: true - - include: illegal-parens-terminators - - include: code - - declaration-statement-parens: - - match: \( - scope: punctuation.section.parens.begin.java + - type-parameter-body + - type-parameter-bounds + - type-parameter-reference + + type-parameter: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.1.2 + - match: < + scope: punctuation.section.generic.begin.java + set: + - type-parameter-body + - type-parameter-bounds + - type-parameter-reference + + type-parameter-body: + - meta_scope: meta.generic.declaration.java + - match: ',' + scope: punctuation.separator.comma.java + push: + - type-parameter-bounds + - type-parameter-reference + - include: type-parameter-end + + type-parameter-reference: + # https://docs.oracle.com/javase/specs/jls/se13/html/jls-4.html#jls-4.4 + - match: '{{identifier}}' + scope: variable.parameter.type.java + pop: 1 + - match: \?|{{storage_types}}{{break}} + scope: invalid.illegal.unexpected-keyword.java + pop: 1 + - include: annotation-else-pop + + type-parameter-bounds: + - match: extends{{break}} + scope: storage.modifier.extends.java set: - - meta_scope: meta.parens.java - - match: \) - scope: punctuation.section.parens.end.java - pop: true - - include: illegal-open-block - - include: code-block - - include: any_POP + - maybe-additional-bounds + - maybe-reference-type + - match: super{{break}} + scope: invalid.illegal.unexpected-keyword.java + set: maybe-reference-type + - include: else-pop + + type-parameter-end: + - match: '>' + scope: punctuation.section.generic.end.java + pop: 1 + - match: extends{{break}} + scope: invalid.illegal.unexpected-keyword.java + push: + - maybe-additional-bounds + - maybe-reference-type + - match: super{{break}} + scope: invalid.illegal.unexpected-keyword.java + push: maybe-reference-type + - include: annotation-else-pop + +###[ PRIMITIVE TYPES ]######################################################### primitive-types: - - match: \b{{primitives}}\b + - match: '{{storage_types}}{{break}}' + scope: storage.type.primitive.java + push: maybe-array-modifiers + + primitive-type: + - match: '{{storage_types}}{{break}}' scope: storage.type.primitive.java - push: array-brackets + pop: 1 + + var-types: + - match: var{{break}} + scope: storage.type.variant.java + push: maybe-illegal-array-modifiers var-type: - - match: \bvar\b - scope: storage.type.var.java + - match: var{{break}} + scope: storage.type.variant.java + set: maybe-illegal-array-modifiers + + maybe-array-modifiers: + - include: array-modifiers + - include: annotation-else-pop + + maybe-only-array-modifiers: + - include: array-modifiers + - include: annotations + - include: illegal-members + - include: else-pop - array-brackets: + array-modifiers: - match: \[\s*\] scope: storage.modifier.array.java - - include: any_POP - static-assignment: - - match: \= - scope: keyword.operator.assignment.java - set: - - meta_scope: meta.assignment.rhs.java - - match: (?=[,;]) - pop: true - - include: before-next-field - - include: code - - include: stray-parens - - include: any_POP - - assignment: - - match: ([|&^*/+-]\=|\=(?!=)) - scope: keyword.operator.assignment.java - push: - - meta_scope: meta.assignment.rhs.java - - match: (?=;|\)|\}|,) - pop: true - - include: code - static-code-block: - - match: \{ - scope: punctuation.section.block.begin.java - push: - - meta_scope: meta.static.body.java - - match: \} - scope: punctuation.section.block.end.java - pop: true - - include: code-block + final-modifiers: + - match: final{{break}} + scope: storage.modifier.java + storage-modifiers: - - match: \b{{storage_modifiers}}\b + - match: '{{storage_modifiers}}{{break}}' scope: storage.modifier.java - stray-braces: - - match: \} - scope: invalid.illegal.stray-brace-end - stray-parens: - - match: \) - scope: invalid.illegal.stray-parens-end - strings: - - match: \" - scope: punctuation.definition.string.begin.java - push: - - meta_include_prototype: false - - meta_scope: string.quoted.double.java - - match: \" - scope: punctuation.definition.string.end.java - pop: true - - include: strings-common - - match: \' - scope: punctuation.definition.string.begin.java - push: - - meta_include_prototype: false - - meta_scope: string.quoted.single.java - - match: \' - scope: punctuation.definition.string.end.java - pop: true - - include: strings-common - - strings-common: - - match: \n - scope: invalid.illegal.newline.java - pop: true - - include: string-escapes +###[ PROTOTYPES ]############################################################## - string-escapes: - - match: \\u+\h{4} - scope: constant.character.escape.unicode.java - - match: \\[0-3]?[0-7]{1,2} - scope: constant.character.escape.octal.java - - match: \\[btnfr"'\\] - scope: constant.character.escape.java - - match: \\. - scope: invalid.illegal.escape.java + prototype: + - include: comments + - include: illegal-keywords - module: - - match: (?=\b(?:open\s+)?module\b) - push: - - - meta_scope: meta.module.java - - include: immediate_POP - - - match: \bopen\b - scope: storage.modifier.java - - match: \bmodule\b - scope: storage.type.java - set: [module-body, module-identifier-scope, module-identifier] - - module-identifier-scope: - - meta_scope: meta.module.identifier.java - - include: immediate_POP + annotation-else-pop: + - include: annotations + - include: else-pop - module-identifier: - - match: '{{id}}' - set: - - - meta_scope: entity.name.module.java - - include: immediate_POP - - dot-separated-identifier - - include: any_POP + annotation-else-pop2: + - include: annotations + - include: else-pop2 - module-body: - - match: \{ - scope: punctuation.section.braces.begin.java - set: - - meta_scope: meta.module.body.java - - include: module-body-content - - match: \} - scope: punctuation.section.braces.end.java - pop: true - - include: any_POP - - module-body-content: - - match: \bexports\b - scope: keyword.other.module.exports.java - push: [exports-statement-scope, exports-or-opens-statement] - - match: \bopens\b - scope: keyword.other.module.opens.java - push: [opens-statement-scope, exports-or-opens-statement] - - match: \brequires\b - scope: keyword.other.module.requires.java - push: requires-statement - - match: \buses\b - scope: keyword.other.module.uses.java - push: [uses-statement-scope, object-type-reference] - - match: \bprovides\b - scope: keyword.other.module.provides.java - push: [provides-statement-scope, provides-with-statement, object-type-reference] - - include: punctuation-terminator-semicolon + annotation-else-pop3: + - include: annotations + - include: else-pop3 - # Should always come before module/package patterns - module-statement-terminator: - - match: (?=[;\}]) - pop: true - - match: (?=\b(?:requires|exports|uses|provides|opens)\b) - pop: true + else-pop: + - match: (?=\S) + pop: 1 - support-type-module: - - match: '{{id}}' - push: - - - meta_scope: support.type.module.java - - include: immediate_POP - - dot-separated-identifier + else-pop2: + - match: (?=\S) + pop: 2 - exports-statement-scope: - - meta_scope: meta.exports.java - - include: immediate_POP + else-pop3: + - match: (?=\S) + pop: 3 - opens-statement-scope: - - meta_scope: meta.opens.java - - include: immediate_POP + immediately-pop: + - match: '' + pop: 1 - exports-or-opens-statement: - - match: \bto\b - scope: keyword.other.module.to.java - set: - - include: module-statement-terminator - - include: support-type-module - - include: punctuation-separator-comma - - include: module-statement-terminator - - match: '{{id}}' + immediately-pop2: + - match: '' + pop: 2 + + immediately-pop3: + - match: '' + pop: 3 + +###[ ILLEGALS ]################################################################ + + maybe-illegal-array-modifiers: + - include: illegal-array-modifiers + - include: annotation-else-pop + + illegal-array-modifiers: + - match: \[\s*\] + scope: invalid.illegal.unexpected-modifier.java + + illegal-keywords: + - match: '{{illegal_keywords}}{{break}}' + scope: invalid.illegal.keyword.java + + illegal-unexpected-keywords: + - match: '{{keywords}}{{break}}' + scope: invalid.illegal.unexpected-keyword.java + + illegal-unexpected-reserved: + - match: '{{reserved_words}}' + scope: invalid.illegal.unexpected-keyword.java + pop: 1 + + illegal-members: + - match: '{{single_dot}}' + scope: invalid.illegal.unexpected-accessor.java push: - - - meta_scope: support.type.package.java - - include: immediate_POP - - dot-separated-identifier + - maybe-illegal-array-modifiers + - maybe-illegal-member - requires-statement: - - meta_scope: meta.requires.java - - match: \btransitive\b - scope: keyword.other.module.transitive.java - - include: module-statement-terminator - - include: support-type-module + maybe-illegal-member: + - match: '{{id}}' + scope: invalid.illegal.unexpected-member.java + pop: 1 + - include: else-pop - uses-statement-scope: - - meta_scope: meta.uses.java - - include: immediate_POP + illegal-newline: + - match: \n + scope: invalid.illegal.unexpected-newline.java + pop: 1 - provides-statement-scope: - - meta_scope: meta.provides.java - - include: immediate_POP + illegal-storage-modifiers: + - match: '{{storage_modifiers}}{{break}}' + scope: invalid.illegal.unexpected-keyword.java - provides-with-statement: - - match: \bwith\b - scope: keyword.other.module.with.java - set: - - - match: \, - scope: punctuation.separator.comma.java - push: object-type-reference - - include: any_POP - - object-type-reference - - include: any_POP + maybe-illegal-type-parameter: + - match: \< + set: illegal-type-parameter-body + - include: else-pop + + illegal-type-parameter-body: + - meta_scope: invalid.illegal.unexpected-type-parameters.java + - match: \< + push: + - match: \> + pop: 1 + - match: \> + pop: 1 + + illegal-var-type: + - match: var{{break}} + scope: invalid.illegal.unexpected-keyword.java + pop: 1 + + stray-braces: + - match: \} + scope: invalid.illegal.stray.java + + stray-group: + - match: \) + scope: invalid.illegal.stray.java diff --git a/Java/JavaDoc.sublime-syntax b/Java/JavaDoc.sublime-syntax index 422a6a9833..8cf041754d 100644 --- a/Java/JavaDoc.sublime-syntax +++ b/Java/JavaDoc.sublime-syntax @@ -1,195 +1,286 @@ %YAML 1.2 --- -# http://www.sublimetext.com/docs/3/syntax.html -name: Javadoc -file_extensions: [] +############################################################################### +# Notes: +# +# The comment block is part of Java Syntax and thus scoped +# `comment.block.documentation.java`. +# +# The comment's content followed by the first `*` of each line contains the +# JavaDoc content itself. +# +# JavaDoc is pure HTML with some specific JavaDoc Tags being supported for +# easier authoring. A JavaDoc may contain: +# +# - HTML tags : content : meta.tag.html +# - JavaDoc Inline Tags : {@tag content} : meta.tag.inline.javadoc +# - JavaDoc Block Tags : @tag content : meta.tag.block.javadoc +# +# While `HTML Tags` and `JavaDoc Inline Tags` are supported everywhere, +# `JavaDoc Block Tags` form the block tag section following the description +# section. Each tag terminates a former block tag's content (if one) and +# starts a new block section. Only the first token after `*` is matched as +# `JavaDoc Block Tag`. +# +# References: +# +# https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#documentation +# https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#documentationcomments +# http://www.sublimetext.com/docs/syntax.html +# +############################################################################### + +name: JavaDoc scope: text.html.javadoc +version: 2 hidden: true +extends: Packages/HTML/HTML (Plain).sublime-syntax + +############################################################################### + variables: id: '(?:[\p{L}_$][\p{L}\p{N}_$]*)' - javadoc_block_tag_terminator: (?=^\s*\*?\s*@) + +############################################################################### contexts: - prototype: - # https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#leadingasterisks - - match: ^\s*(\*)\s*(?!\s*@) - captures: - 1: punctuation.definition.comment.javadoc + # The main context can be included directly by a 3rd-party syntax. + # + # Example: + # + # - include: scope:text.html.javadoc + # main: - - meta_include_prototype: false - - match: /\*\* - scope: comment.block.documentation.javadoc punctuation.definition.comment.begin.javadoc - embed: contents - embed_scope: comment.block.documentation.javadoc text.html.javadoc - escape: \*/ + - match: /\*\*+ + scope: + comment.block.documentation.java + punctuation.definition.comment.begin.java + embed: javadoc + embed_scope: comment.block.documentation.java + escape: \*+/ escape_captures: - 0: comment.block.documentation.javadoc punctuation.definition.comment.end.javadoc + 0: comment.block.documentation.java + punctuation.definition.comment.end.java - contents: - - meta_include_prototype: false + # The javadoc context can be used to embed JavaDoc content. + # + # Example: + # + # - match: /\*\*+ + # scope: + # comment.block.documentation.java + # punctuation.definition.comment.begin.java + # embed: scope:text.html.javadoc#javadoc + # embed_scope: comment.block.documentation.java + # escape: \*+/ + # escape_captures: + # 0: comment.block.documentation.java + # punctuation.definition.comment.end.java + # + javadoc: + - match: '' + set: [javadoc-body, javadoc-block-tag] - # Block tag in the first line (immediately after '/**'). - - match: \s*(?=@) - embed: javadoc-block-tags - escape: '{{javadoc_block_tag_terminator}}' + javadoc-body: + - match: ^\s*(\*)?\s* + captures: + 1: punctuation.definition.comment.java + push: javadoc-block-tag + - include: javadoc-inline-formatting - # We rely on 'escape' to pop the inner context out. - # 'set' unfortunately will mess up the meta scopes. - - match: '' - push: - - match: ^\s*(\*)?\s*(?=@) - captures: - 1: punctuation.definition.comment.javadoc - embed: javadoc-block-tags - escape: '{{javadoc_block_tag_terminator}}' - - include: inline-formatting - - inline-formatting: - - include: javadoc-inline-tags - - include: scope:text.html.basic + javadoc-asterisk: + - match: ^(?:\s*(\*)\s?)? + captures: + 1: punctuation.definition.comment.java + pop: 1 - javadoc-block-tag-base: - - meta_scope: meta.block-tag.javadoc - - include: inline-formatting +###[ JAVADOC BLOCK TAGS ]###################################################### - javadoc-block-tags: + javadoc-block-tag: # https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#param - - match: (@)param\b - scope: keyword.other.documentation.param.javadoc - captures: - 1: punctuation.definition.keyword.javadoc - push: [javadoc-block-tag-base, param-tag-parameter] + - match: \@param\b + scope: meta.tag.block.javadoc entity.name.tag.documentation.javadoc + set: + - javadoc-block-tag-common + - javadoc-block-tag-param-args # https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#see - - match: (@)see\b - scope: keyword.other.documentation.see.javadoc - captures: - 1: punctuation.definition.keyword.javadoc - push: [javadoc-block-tag-base, see-tag-content] + - match: \@see\b + scope: meta.tag.block.javadoc entity.name.tag.documentation.javadoc + set: + - javadoc-block-tag-common + - javadoc-block-tag-reference # https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#throws - - match: (@)(throws|exception)\b - scope: keyword.other.documentation.throws.javadoc - captures: - 1: punctuation.definition.keyword.javadoc - push: [javadoc-block-tag-base, reference] - - match: (@)(uses|provides)\b - scope: keyword.other.documentation.uses-or-provides.javadoc - captures: - 1: punctuation.definition.keyword.javadoc - push: [javadoc-block-tag-base, reference] - - match: (@)(return|deprecated|author|version|since|apiNote|impl(?:Note|Spec)|moduleGraph|serial(?:Field|Data)?)\b - scope: keyword.other.documentation.javadoc - captures: - 1: punctuation.definition.keyword.javadoc - push: javadoc-block-tag-base - - match: '@' - pop: true + - match: \@(throws|exception)\b + scope: meta.tag.block.javadoc entity.name.tag.documentation.javadoc + set: + - javadoc-block-tag-common + - javadoc-block-tag-reference + - match: \@(uses|provides)\b + scope: meta.tag.block.javadoc entity.name.tag.documentation.javadoc + set: + - javadoc-block-tag-common + - javadoc-block-tag-reference + - match: \@(return|deprecated|author|version|since|apiNote|impl(?:Note|Spec)|moduleGraph|serial(?:Field|Data)?)\b + scope: meta.tag.block.javadoc entity.name.tag.documentation.javadoc + set: javadoc-block-tag-common + - match: (?=\S)|$ + pop: 1 + + javadoc-block-tag-common: + - include: javadoc-block-tag-terminator + - include: javadoc-inline-formatting - param-tag-parameter: + javadoc-block-tag-param-args: + - include: javadoc-block-tag-terminator - match: \S+ scope: variable.parameter.javadoc - pop: true + pop: 1 - see-tag-content: - - match: (?=['<]) - pop: true - - match: (?=\S) - set: reference + javadoc-block-tag-reference: + - include: javadoc-block-tag-terminator + - include: javadoc-reference - reference: - - match: (?:{{id}}\.)*{{id}}(?:#{{id}})?|#{{id}} - scope: markup.underline.link.javadoc - set: - - match: \( - scope: markup.underline.link.javadoc - set: - - match: \) - scope: markup.underline.link.javadoc - pop: true - - match: . - scope: markup.underline.link.javadoc - - match: '' - pop: true - - javadoc-inline-tag-terminator: - - match: \} - scope: punctuation.section.inline-tag.end.javadoc - pop: true + javadoc-block-tag-terminator: + - match: (?=^\s*\*?\s*@) + pop: 1 + - match: ^\s*(\*)\s* + captures: + 1: punctuation.definition.comment.java - javadoc-inline-tag-base: - - meta_scope: meta.inline-tag.javadoc - - include: javadoc-inline-tag-terminator +###[ JAVADOC INLINE TAGS ]##################################################### + + javadoc-inline-formatting: + - include: javadoc-inline-tags + - include: javadoc-html-tags - # Multi-line tags mustn't highlight leading asterisk. javadoc-inline-tags: # https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#code # https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#literal - - match: ({)((@)(?:code|literal))(?:\s+|(?=\})) + - match: ({)(@(?:code|literal))(?:\s+|(?=\})) captures: - 1: punctuation.section.inline-tag.begin.javadoc - 2: keyword.other.documentation.code-or-literal.javadoc - 3: punctuation.definition.keyword.javadoc - push: - - meta_scope: meta.inline-tag.javadoc - - include: javadoc-inline-tag-terminator - - include: code-tag-bracket-balancing - - match: ^\s+ - - match: . - scope: markup.raw.javadoc + 1: punctuation.definition.tag.begin.javadoc + 2: entity.name.tag.documentation.javadoc + push: javadoc-inline-tag-raw # https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#link - - match: ({)((@)link(?:plain)?)\b + - match: ({)(@link(?:plain)?)\b captures: - 1: punctuation.section.inline-tag.begin.javadoc - 2: keyword.other.documentation.link.javadoc - 3: punctuation.definition.keyword.javadoc - push: [javadoc-inline-tag-base, link-tag-label, reference-in-inline-tag] + 1: punctuation.definition.tag.begin.javadoc + 2: entity.name.tag.documentation.javadoc + push: + - javadoc-inline-tag-common + - javadoc-inline-tag-label + - javadoc-inline-tag-reference # https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#value - - match: ({)((@)value)\b + - match: ({)(@value)\b captures: - 1: punctuation.section.inline-tag.begin.javadoc - 2: keyword.other.documentation.value.javadoc - 3: punctuation.definition.keyword.javadoc - push: [javadoc-inline-tag-base, reference-in-inline-tag] + 1: punctuation.definition.tag.begin.javadoc + 2: entity.name.tag.documentation.javadoc + push: + - javadoc-inline-tag-common + - javadoc-inline-tag-reference # http://openjdk.java.net/jeps/225 # https://bugs.openjdk.java.net/browse/JDK-8178725 - - match: ({)((@)(?:index|extLink))\b + - match: ({)(@(?:index|extLink))\b captures: - 1: punctuation.section.inline-tag.begin.javadoc - 2: keyword.other.documentation.javadoc - 3: punctuation.definition.keyword.javadoc - push: javadoc-inline-tag-base + 1: punctuation.definition.tag.begin.javadoc + 2: entity.name.tag.documentation.javadoc + push: javadoc-inline-tag-common # https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#inheritDoc - - match: ({)((@)inheritDoc)(}) - scope: meta.inline-tag.javadoc + - match: ({)(@inheritDoc)(}) + scope: meta.tag.inline.javadoc captures: - 1: punctuation.section.inline-tag.begin.javadoc - 2: keyword.other.documentation.javadoc - 3: punctuation.definition.keyword.javadoc - 4: punctuation.section.inline-tag.end.javadoc + 1: punctuation.definition.tag.begin.javadoc + 2: entity.name.tag.documentation.javadoc + 3: punctuation.definition.tag.end.javadoc + + javadoc-inline-tag-end: + - match: \} + scope: punctuation.definition.tag.end.javadoc + pop: 1 + + javadoc-inline-tag-common: + - meta_scope: meta.tag.inline.javadoc + - include: javadoc-inline-tag-end + - include: javadoc-inline-tag-continuation-1 + + javadoc-inline-tag-continuation-1: + # Leading asterisk (*) characters on each line are discarded; + # Blanks preceding the initial asterisk (*) characters are also discarded. + - match: $ + push: + - clear_scopes: 1 # clear `meta.tag.inline` + - include: javadoc-inline-tag-continuation-body + + javadoc-inline-tag-continuation-2: + # Leading asterisk (*) characters on each line are discarded; + # Blanks preceding the initial asterisk (*) characters are also discarded. + - match: $ + push: + - clear_scopes: 2 # clear `meta.tag.inline markup.[raw|reference]` + - include: javadoc-inline-tag-continuation-body + + javadoc-inline-tag-continuation-body: + - match: (?=\}) + pop: 1 + - include: javadoc-asterisk + + javadoc-inline-tag-raw: + - meta_scope: meta.tag.inline.javadoc + - meta_content_scope: markup.raw.javadoc + - include: javadoc-inline-tag-end + - include: javadoc-inline-tag-raw-braces - code-tag-bracket-balancing: + javadoc-inline-tag-raw-braces: - match: \{ - scope: markup.raw.javadoc push: - match: \} - scope: markup.raw.javadoc - pop: true - - include: code-tag-bracket-balancing - - match: . - scope: markup.raw.javadoc + pop: 1 + - include: javadoc-inline-tag-raw-braces + - include: javadoc-inline-tag-continuation-2 - link-tag-label: + javadoc-inline-tag-label: - match: \s* set: - meta_content_scope: meta.label.javadoc - - include: scope:text.html.basic - match: (?=\}) - pop: true + pop: 1 + - include: javadoc-inline-tag-continuation-2 + - include: javadoc-html-tags - reference-in-inline-tag: - - match: '' - set: reference - with_prototype: - - match: (?=\}) - pop: true + javadoc-inline-tag-reference: + - include: javadoc-inline-tag-continuation-1 + - include: javadoc-reference + + javadoc-reference: + # url + - match: \w+://\S+ + scope: markup.underline.link.javadoc + # class reference + - match: (?:{{id}}\.)*{{id}}(?:#{{id}})?|#{{id}} + scope: markup.underline.link.javadoc + set: + - match: \( + set: + - meta_scope: markup.underline.link.javadoc + - match: \) + pop: 1 + - include: javadoc-inline-tag-continuation-2 + - include: immediately-pop + - include: else-pop + +###[ JAVADOC HTML TAGS ]####################################################### + + javadoc-html-tags: + - include: comment + - include: cdata + - include: tag + - include: entities + + tag-attributes: + - meta_prepend: true + - match: ^ + push: + - clear_scopes: 1 + - include: javadoc-asterisk diff --git a/Java/JavaProperties - Comments.tmPreferences b/Java/JavaProperties - Comments.tmPreferences new file mode 100644 index 0000000000..e5eec95f48 --- /dev/null +++ b/Java/JavaProperties - Comments.tmPreferences @@ -0,0 +1,25 @@ + + + + scope + source.java-props + settings + + shellVariables + + + name + TM_COMMENT_START + value + # + + + name + TM_COMMENT_START_2 + value + ! + + + + + diff --git a/Java/JavaProperties.sublime-syntax b/Java/JavaProperties.sublime-syntax index a9fae8ed7d..848553ed41 100644 --- a/Java/JavaProperties.sublime-syntax +++ b/Java/JavaProperties.sublime-syntax @@ -1,50 +1,63 @@ %YAML 1.2 --- -# http://www.sublimetext.com/docs/3/syntax.html +# https://en.wikipedia.org/wiki/.properties +# http://www.sublimetext.com/docs/syntax.html name: Java Properties +scope: source.java-props +version: 2 + file_extensions: - properties -scope: source.java-props -# https://en.wikipedia.org/wiki/.properties contexts: main: - - match: ^\s*([#!]).* - scope: comment.line.java-props + - match: ([#!]).*\n? captures: + 0: comment.line.java-props 1: punctuation.definition.comment.java-props + - match: (?=\S) + push: property-key + + property-key: + - meta_content_scope: meta.mapping.key.java-props entity.name.key.java-props + - include: line-continuation + - include: escapes + - match: \s*([:=]) + captures: + 1: punctuation.separator.mapping.key-value.java-props + set: maybe-property-value + - match: \s+(?=\S) + set: maybe-property-value + - match: \s*$ + pop: 1 + maybe-property-value: + - meta_include_prototype: false + - meta_scope: meta.mapping.java-props - match: (?=\S) - push: - - - meta_scope: meta.property.java-props - - match: '' - pop: true - - property - - property: - - meta_content_scope: entity.name.key.java-props - - include: backslash - - match: (?=[:=\s]) - set: - - match: '[:=]' - scope: punctuation.separator.java-props - set: property-value - - include: property-value - with_prototype: - - match: (?=\n) - pop: true + set: property-value + - include: eol-pop property-value: - - match: (?=\S) - set: - - meta_content_scope: string.unquoted.java-props - - include: backslash + - meta_content_scope: meta.mapping.value.java-props string.unquoted.java-props + - include: eol-pop + - include: escapes - backslash: - - match: (\\)\n - captures: - 1: punctuation.separator.continuation.java-props + escapes: - match: \\u[[:xdigit:]]{4} scope: constant.character.escape.unicode.java-props - match: \\[^u] scope: constant.character.escape.java-props + + eol-pop: + - include: line-continuation + - match: $ + pop: 1 + + line-continuation: + - match: (\\)\n + captures: + 1: punctuation.separator.continuation.java-props + push: + - match: ^ + pop: 1 diff --git a/Java/JavaScript (for JSP).sublime-syntax b/Java/JavaScript (for JSP).sublime-syntax new file mode 100644 index 0000000000..08308e4e12 --- /dev/null +++ b/Java/JavaScript (for JSP).sublime-syntax @@ -0,0 +1,32 @@ +%YAML 1.2 +--- +############################################################################### +# This intermediate syntax is used by `HTML (JSP).sublime-syntax` +# +# It powers Java highlighting within JSP tags in embedded JavaScript. +# +# +# +# The primary task is to add `jsp-embedded` context to JavaScript's +# prototype to match all the <% %> tags. +############################################################################### + +scope: source.js.embedded.jsp +version: 2 +hidden: true + +extends: Packages/JavaScript/JavaScript.sublime-syntax + +contexts: + + prototype: + - meta_prepend: true + - include: HTML (JSP).sublime-syntax#jsp-embedded + + string-content: + - meta_prepend: true + - include: HTML (JSP).sublime-syntax#jsp-interpolations diff --git a/Java/Symbol List - Inner Inner Class Methods.tmPreferences b/Java/Symbol List - Case Label.tmPreferences similarity index 50% rename from Java/Symbol List - Inner Inner Class Methods.tmPreferences rename to Java/Symbol List - Case Label.tmPreferences index 26fedfeb82..c2a984c077 100644 --- a/Java/Symbol List - Inner Inner Class Methods.tmPreferences +++ b/Java/Symbol List - Case Label.tmPreferences @@ -1,18 +1,18 @@ - name - Symbol List: Inner Inner Class Methods scope - source.java meta.class.body meta.class.body meta.class.body meta.method.identifier + source.java meta.statement.conditional.case.label.java settings showInSymbolList 1 symbolTransformation - s/\s{2,}/ /g; - s/.*/ $0/g; + s/\/\*.*?\*\///g; # remove block comments + s/\/\/[^\n]*\n//g; # remove line comments + s/\s+//g; # remove whitespace + s/^/case /; # prepend case keyword diff --git a/Java/Symbol List - Classes.tmPreferences b/Java/Symbol List - Classes.tmPreferences index f22d0f1fff..a2884fe965 100644 --- a/Java/Symbol List - Classes.tmPreferences +++ b/Java/Symbol List - Classes.tmPreferences @@ -1,12 +1,12 @@ - name - Symbol List: Classes scope - source.java meta.class meta.class.identifier + source.java meta.class.identifier entity.name.class settings + showInIndexedSymbolList + 1 showInSymbolList 1 diff --git a/Java/Symbol List - Constants.tmPreferences b/Java/Symbol List - Constants.tmPreferences index a6dffc7a21..bff544c226 100644 --- a/Java/Symbol List - Constants.tmPreferences +++ b/Java/Symbol List - Constants.tmPreferences @@ -1,8 +1,6 @@ - name - Symbol List: Constants scope source.java entity.name.constant.java settings diff --git a/Java/Indexed Symbol List.tmPreferences b/Java/Symbol List - Enums.tmPreferences similarity index 57% rename from Java/Indexed Symbol List.tmPreferences rename to Java/Symbol List - Enums.tmPreferences index 65a38934bf..2368884305 100644 --- a/Java/Indexed Symbol List.tmPreferences +++ b/Java/Symbol List - Enums.tmPreferences @@ -1,14 +1,14 @@ - name - Symbol List: Classes scope - source.java entity.name.class.java, source.java entity.name.function.java + source.java meta.enum.identifier entity.name.enum settings showInIndexedSymbolList 1 + showInSymbolList + 1 diff --git a/Java/Symbol List - Fields.tmPreferences b/Java/Symbol List - Fields.tmPreferences new file mode 100644 index 0000000000..96ceca2c55 --- /dev/null +++ b/Java/Symbol List - Fields.tmPreferences @@ -0,0 +1,12 @@ + + + + scope + source.java meta.field.identifier variable.other + settings + + showInSymbolList + 1 + + + diff --git a/Java/Symbol List - Imports.tmPreferences b/Java/Symbol List - Imports.tmPreferences new file mode 100644 index 0000000000..d7dd258ac7 --- /dev/null +++ b/Java/Symbol List - Imports.tmPreferences @@ -0,0 +1,21 @@ + + + + scope + source.java meta.import meta.path + settings + + showInIndexedSymbolList + 0 + showInSymbolList + 1 + symbolTransformation + + s/\/\*.*?\*\///g; # remove block comments + s/\/\/[^\n]*\n//g; # remove line comments + s/\s+//g; # remove whitespace + s/^/import /; # prepend import keyword + + + + diff --git a/Java/Symbol List - Inner Classes.tmPreferences b/Java/Symbol List - Inner Classes.tmPreferences deleted file mode 100644 index 412090efec..0000000000 --- a/Java/Symbol List - Inner Classes.tmPreferences +++ /dev/null @@ -1,16 +0,0 @@ - - - - name - Symbol List: Inner Classes - scope - source.java meta.class.body meta.class.identifier - settings - - showInSymbolList - 1 - symbolTransformation - s/.*/ $0/g - - - diff --git a/Java/Symbol List - Inner Inner Classes.tmPreferences b/Java/Symbol List - Inner Inner Classes.tmPreferences deleted file mode 100644 index 899123ab8a..0000000000 --- a/Java/Symbol List - Inner Inner Classes.tmPreferences +++ /dev/null @@ -1,16 +0,0 @@ - - - - name - Symbol List: Inner Inner Classes - scope - source.java meta.class.body meta.class.body meta.class.identifier - settings - - showInSymbolList - 1 - symbolTransformation - s/.*/ $0/g - - - diff --git a/Java/Symbol List - Interfaces.tmPreferences b/Java/Symbol List - Interfaces.tmPreferences new file mode 100644 index 0000000000..11d6233620 --- /dev/null +++ b/Java/Symbol List - Interfaces.tmPreferences @@ -0,0 +1,14 @@ + + + + scope + source.java meta.interface.identifier entity.name.interface + settings + + showInIndexedSymbolList + 1 + showInSymbolList + 1 + + + diff --git a/Java/Symbol List - Method.tmPreferences b/Java/Symbol List - Method.tmPreferences deleted file mode 100644 index b435782d80..0000000000 --- a/Java/Symbol List - Method.tmPreferences +++ /dev/null @@ -1,19 +0,0 @@ - - - - name - Symbol List: Methods - scope - source.java meta.class.body meta.method.identifier - settings - - showInSymbolList - 1 - symbolTransformation - - s/\s{2,}/ /g; - s/.*/ $0/g; - - - - diff --git a/Java/Symbol List - Modules.tmPreferences b/Java/Symbol List - Modules.tmPreferences index a7e471c315..b29b7d7715 100644 --- a/Java/Symbol List - Modules.tmPreferences +++ b/Java/Symbol List - Modules.tmPreferences @@ -1,14 +1,18 @@ - name - Symbol List: Modules scope - source.java meta.module meta.module.identifier + source.java meta.namespace.module.identifier & (meta.path, entity.name.namespace) settings showInSymbolList 1 + symbolTransformation + + s/\/\*.*?\*\///g; # remove block comments + s/\/\/[^\n]*\n//g; # remove line comments + s/\s+//g; # remove whitespace + diff --git a/Java/Symbol List - Inner Class Methods.tmPreferences b/Java/Symbol List - Packages.tmPreferences similarity index 51% rename from Java/Symbol List - Inner Class Methods.tmPreferences rename to Java/Symbol List - Packages.tmPreferences index ce5faf197a..666feab98f 100644 --- a/Java/Symbol List - Inner Class Methods.tmPreferences +++ b/Java/Symbol List - Packages.tmPreferences @@ -1,18 +1,17 @@ - name - Symbol List: Inner Class Methods scope - source.java meta.class.body meta.class.body meta.method.identifier + source.java meta.namespace.package.identifier & (meta.path, entity.name.namespace) settings showInSymbolList 1 symbolTransformation - s/\s{2,}/ /g; - s/.*/ $0/g; + s/\/\*.*?\*\///g; # remove block comments + s/\/\/[^\n]*\n//g; # remove line comments + s/\s+//g; # remove whitespace diff --git a/Java/Symbol List - Properties.tmPreferences b/Java/Symbol List - Properties.tmPreferences index 736aba798a..7d53ae4a4a 100644 --- a/Java/Symbol List - Properties.tmPreferences +++ b/Java/Symbol List - Properties.tmPreferences @@ -1,8 +1,6 @@ - name - Symbol List - Properties scope entity.name.key.java-props settings diff --git a/Java/syntax_test_java.java b/Java/syntax_test_java.java deleted file mode 100644 index 96d941314d..0000000000 --- a/Java/syntax_test_java.java +++ /dev/null @@ -1,2577 +0,0 @@ -// SYNTAX TEST "Packages/Java/Java.sublime-syntax" - -package apple; -// <- source.java meta.package-declaration.java keyword.other.package.java -// ^^^^^ entity.name.namespace.java -// ^ punctuation.terminator.java - -package com.example.apple; -//^^^^^^^^^^^^^^^^^^^^^^^ meta.package-declaration.java -// ^^^^^^^^^^^^^^^^^ entity.name.namespace.java -// ^ punctuation.accessor.dot.java -// ^ punctuation.accessor.dot.java -// ^ punctuation.terminator.java - -import a.b.Class; -// <- meta.import.java keyword.control.import.java -// ^^^^^^^^^ meta.path.java -// ^ support.type.package.java -// ^ punctuation.accessor.dot.java -// ^ support.type.package.java -// ^ punctuation.accessor.dot.java -// ^^^^^ support.class.import.java -// ^ punctuation.terminator.java - -import a.b.Class.SubClass; -//^^^^^^^^^^^^^^^^^^^^^^^ meta.import.java -// ^ punctuation.accessor.dot.java -// ^^^^^^^^ support.class.import.java - -import a.b.Class.*; -//^^^^^^^^^^^^^^^^ meta.import.java -// ^ punctuation.accessor.dot.java -// ^ keyword.operator.wildcard.asterisk.java - -import com.google -// ^^^^^^^^^^ meta.import.java meta.path.java -// ^ punctuation.accessor.dot.java -// ^^^^^^ support.type.package.java - .common.collect -//^ punctuation.accessor.dot.java -// ^ punctuation.accessor.dot.java -// ^^^^^^^ support.type.package.java -//^^^^^^^^^^^^^^^ meta.import.java meta.path.java - .ListMultimap; -//^ punctuation.accessor.dot.java -// ^^^^^^^^^^^^ support.class.import.java -//^^^^^^^^^^^^^ meta.import.java meta.path.java -// ^ punctuation.terminator.java - -import no.terminator -// <- meta.import.java keyword.control.import.java - -import static no.terminator -// <- meta.import.java keyword.control.import.java - -import -// <- meta.import.java keyword.control.import.java - -import static -// <- meta.import.java keyword.control.import.java - -import java.net.URL; -// <- meta.import.java keyword.control.import.java -//^^^^^^^^^^^^^^^^^ meta.import.java -// ^^^^^^^^^^^^ meta.path.java -// ^^^ support.class.import.java -// ^^^^ support.type.package.java -// ^ punctuation.accessor.dot.java -// ^^^ support.type.package.java -// ^ punctuation.accessor.dot.java -// ^ punctuation.terminator.java - -import java.util.*; -//^^^^^^^^^^^^^^^^ meta.import.java -// ^^^^^^^^^^^ meta.path.java -// ^^^^ support.type.package.java -// ^ punctuation.accessor.dot.java -// ^^^^ support.type.package.java -// ^ punctuation.accessor.dot.java -// ^ keyword.operator.wildcard.asterisk.java - -import static a.b.Class.fooMethod; -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.import.java -// <- meta.import.java keyword.control.import.java -// ^^^^^^ meta.import.java keyword.control.import.static.java -// ^ punctuation.accessor.dot.java -// ^^^^^^^^^ meta.path.java -// ^^^^ support.class.import.java -// ^ punctuation.accessor.dot.java -// ^ punctuation.accessor.dot.java -// ^^^^^^^^^ meta.import.java support.function.import.java -// ^ punctuation.terminator.java - -import static a.b.Class.CONSTANT; -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.import.java -// ^^^^^^^^^ meta.path.java -// ^^^^ support.class.import.java -// ^ punctuation.accessor.dot.java -// ^^^^^^^^ constant.other.import.java - -import static a.b.Class.*; -// ^ punctuation.accessor.dot.java -// ^ keyword.operator.wildcard.asterisk.java - -public class SyntaxTest { -//^^^^^^^^^^^^^^^^^^^^^^^ meta.class -// ^^^ storage.modifier.java -// ^^^^^ storage.type.java -// ^^^^^^^^^^ meta.class.identifier entity.name.class.java -// ^ - meta.class.identifier.java - meta.class.body.java -// ^ meta.class.body.java - private String memberString = "Hello"; - private String memberString2 = new String("Hello"); -// ^^^^^^ support.class.java - private String memberString3 = String.valueOf("Hello"); -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.assignment.rhs.java -// ^^^^^^^ storage.modifier.java -// ^^^^^^ support.class.java -// ^ keyword.operator.assignment.java -// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.assignment.rhs.java -// ^^^^^^^ string.quoted.double.java -// ^ punctuation.definition.string.begin.java -// ^ punctuation.definition.string.end.java -// ^ - string.quoted.double.java -// ^ punctuation.terminator.java - meta.assignment.rhs.java - private int memberLpos = memberString3.indexOf("l"); -// ^^^ storage.type -// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.assignment.rhs.java -// ^^^ string -// ^ punctuation.terminator.java - - public static void main(String... args) { -// ^^^^^^^^^^^^^^^^^^^^^^^ meta.method -// ^^^^^^ storage.modifier.java -// ^^^^^^ storage.modifier.java -// ^^^^ storage.type -// ^^^^ meta.method.identifier.java entity.name.function.java -// ^^^^^^^^^^^^^^^^ meta.method.parameters.java -// ^ punctuation.section.parens.begin.java -// ^^^ keyword.operator.variadic.java -// ^^^^^ support.class.java -// ^^^^ variable.parameter.java -// ^ punctuation.section.parens.end.java -// ^ - meta.method.parameters -// ^ meta.method.body.java punctuation.section.block.begin.java - String[] strings = new String[5]; -// ^^^^^^^^^^^^^^ meta.assignment.rhs.java -// ^^^ keyword.other.storage.new.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java - printList(Arrays.stream(args) - .collect(Collectors.toCollection(ArrayList::new))); -// ^^^ meta.method.body.java - keyword.other.storage.new.java -// ^^^ variable.function.reference.java -// ^^ punctuation.accessor.double-colon.java - anotherMethod(); - try (Stream lines = Files.lines(path)) { -// ^^^ keyword.control.exception.try.java -// ^^^^^^^^^^^^^^^^^^ meta.assignment.rhs.java -// ^ - meta.parens.java -// ^ meta.method.body.java - meta.assignment.rhs.java - lines.forEach(System.out::println); -// ^^^^^^^ variable.function.reference.java - - } catch (IOException ignore) { -// ^^^^^^ meta.catch.java -// ^^^^^^^^^^^^^^^^^^^^ meta.catch.parameters.java meta.parens.java -// ^^^^^ keyword.control.exception.catch.java -// ^ punctuation.section.parens.begin.java -// ^^^^^^^^^^^ support.class.java -// ^^^^^^ variable.parameter -// ^ punctuation.section.parens.end.java - } catch (final MyException | com.net.org.Foo.Bar | -// ^^^^^^ meta.catch.java -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.catch.parameters.java meta.parens.java -// ^^^^^ keyword.control.exception.catch.java -// ^ punctuation.section.parens.begin -// ^ meta.catch.parameters storage.modifier.java -// ^^^^^^^^^^^ support.class -// ^ punctuation.separator.bar.java -// ^^^ support.type.package.java -// ^ punctuation.accessor.dot.java -// ^^^ support.type.package.java -// ^ punctuation.accessor.dot.java -// ^^^ support.type.package.java -// ^ punctuation.accessor.dot.java -// ^^^ support.class.java -// ^ punctuation.accessor.dot.java -// ^^^ support.class.java -// ^ punctuation.separator.bar.java - YourException ignore) {} -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.catch -// ^ support.class -// ^ variable.parameter -// ^ meta.catch.parameters -// ^ punctuation.section.parens.end - - try (final InputStream is = new FileInputStream(args[0]); -// ^^^^^ storage.modifier - final OutputStream os = new FileOutputStream(args[1])) { -// ^^^^^ storage.modifier - - os.write(is.read()); -// ^^^^ variable.function - } - - try { -// ^^^ keyword.control.exception.try.java - Class.forName(args[2]); - } catch (Exception e) { -// ^^^^^ keyword.control.exception.catch.java - log.error(e); - } finally { -// ^^^^^^^ keyword.control.exception.finally.java - } - - for (final int x = 10;;) { System.out.println(x); break; } -// ^^^^^ storage.modifier - - for (int i = 0; i < 10; i+= 2) { -// ^^^ keyword.control -// ^^^ storage.type -// ^ keyword.operator.assignment.java -// ^^ meta.assignment.rhs.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.terminator.java - meta.assignment.rhs.java -// ^ keyword.operator.comparison.java -// ^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.terminator.java -// ^^ keyword.operator.assignment.java -// ^^ meta.assignment.rhs.java -// ^ - meta.assignment.rhs.java - System.out.println(i); - } - } -// ^ meta.method.java meta.method.body.java punctuation.section.block.end.java - private static void printList(List args) { -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method -// ^^^^^^^ storage.modifier.java -// ^^^^^^ storage.modifier.java -// ^^^^ storage.type -// ^^^^^^^^^ meta.method.identifier entity.name.function.java -// ^^^^^^^^^^^^^^^^^^^ meta.method.parameters -// ^^^^^^ support.class.java -// ^^^^ variable.parameter.java -// ^^ - meta.method.identifier.java -// ^^ meta.method.body.java - args.stream().forEach(System.out::println); -// ^^ punctuation.accessor.double-colon.java - } - - private static void anotherMethod() throws MyException { -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method -// ^^^^^^^ storage.modifier.java -// ^^^^^^ storage.modifier.java -// ^^^^ storage.type -// ^^^^^^^^^^^^^ meta.method.identifier entity.name.function.java -// ^^ meta.method.parameters -// ^^^^^^^^^^^^^^^^^^^^^^^ meta.method.throws -// ^^^^^^ keyword.declaration.throws.java -// ^^^^^ meta.generic.java -// ^^ meta.method.body.java -meta.method.throws - throw new MyException - ("hello (world)"); -// ^ - string - } - void save(T obj); -// ^^^^^^^^^^^ meta.method -// ^^^ meta.generic -// ^ variable.parameter.type -// ^^^^ storage.type -// ^^^^ meta.method.identifier -// ^^^^^^^ meta.method.parameters -} - -class ExtendsTest extends Foo {} -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class -// ^^^^^^^^^^^ meta.class.extends -// ^^^^^^^ keyword.declaration.extends.java -// ^^^ entity.other.inherited-class.java -// ^ - meta.class.extends - -class ExtendsTest implements Foo {} -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class -// ^^^^^^^^^^^^^^ meta.class.implements.java -// ^^^^^^^^^^ keyword.declaration.implements.java -// ^^^ entity.other.inherited-class.java -// ^ - meta.class.implements.java - -class Foo extends Bar {} -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class -// ^^^ meta.generic.declaration.java -// ^ variable.parameter.type.java -// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.extends -// ^^^^^^^ keyword.declaration.extends.java - -class ExtendsAndImplementsTest extends Foo implements Bar, OtherBar {} -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class -// ^^^^^^^^^^^ meta.class.extends -// ^^^^^^^ keyword.declaration.extends.java -// ^^^ entity.other.inherited-class.java -// ^ - meta.class.extends -// ^^^^^^^^^^^^^^ meta.class.implements.java -// ^^^^^^^^^^ keyword.declaration.implements.java -// ^^^ entity.other.inherited-class.java -// ^^^^^ meta.generic.java -// ^ punctuation.separator.comma.java -// ^^^^^^^^ entity.other.inherited-class.java -// ^ - meta.class.implements.java - -class ExtendsAndImplementsTest extends Foo, Bar implements Bar, OtherBar {} -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class -// ^^^^^^^^^^^^^^^^^ meta.class.extends -// ^^^^^^^ keyword.declaration.extends.java -// ^^^ entity.other.inherited-class.java -// ^ punctuation.separator.comma.java -// ^^^ entity.other.inherited-class.java -// ^ - meta.class.extends -// ^^^^^^^^^^^^^^ meta.class.implements.java -// ^^^^^^^^^^ keyword.declaration.implements.java -// ^^^ entity.other.inherited-class.java -// ^^^^^ meta.generic.java -// ^ punctuation.separator.comma.java -// ^^^^^^^^ entity.other.inherited-class.java -// ^ - meta.class.implements.java - -class AnyClass { -// ^^^^^^^^ entity.name.class.java - int bar; // this comment() is recognized as code -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line -// ^^ punctuation.definition.comment.java - - public void anyMethod(String finality){ -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method -// ^^^^^^^^^ meta.method.identifier -// ^^^^^^^^^^^^^^^^^ meta.method.parameters -// ^^^^^^^^ variable.parameter - storage.modifier -// ^^ meta.method.body.java - meta.method.identifier.java - System.out.println("Printed: " + finality); -// ^ keyword.operator - } - - public abstract void test(A thing); -// ^^^ meta.generic.declaration.java -// ^ variable.parameter.type.java - - public void test2(Type) abc -// ^^^ - variable.parameter -// ^ - meta.method.java -} -// <- punctuation.section.block.end.java - -interface T extends A, BB {} -//^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java -// ^^ meta.class.identifier.java -// ^^^^^^^^^^^^^^ meta.class.extends.java -// ^^ meta.class.body.java -// ^ entity.name.class.java -// ^^^^^^^ keyword.declaration.extends.java -// ^ entity.other.inherited-class.java -// ^ punctuation.separator.comma.java -// ^^ entity.other.inherited-class.java -// ^ punctuation.section.block.begin.java -// ^ punctuation.section.block.end.java - -public enum FooBaz { -// ^^^^ storage.type.java -//^^^^^^^^^^^^^^^^^^ meta.class -// ^^^^^^ meta.class.identifier.java entity.name.class.java -// ^ meta.class.body - // This is a test -// ^^^^^^^^^^^^^^^^^^ comment.line - UPLOAD("foo bar"), /* This a comment */ -// ^^^^^^ constant.other.enum -// ^^^^^^^^^ string.quoted.double.java -// ^^^^^^^^^^^^^^^^^^^^ comment.block -// ^ - comment.block - DELETE("baz"), -// ^^^^^^ constant.other.enum - // Comment here -// ^^^^^^^^^^^^^^^^ comment.line -} - -enum MyEnum { - FIRST_VALUE, // comment1 -//^^^^^^^^^^^ constant.other.enum -// ^^^^^^^^^^^ comment - MID_VALUE, // comment2 -//^^^^^^^^^ constant.other.enum -// ^^^^^^^^^^^ comment - LAST_VALUE // comment3 -//^^^^^^^^^^ constant.other.enum -// ^^^^^^^^^^^ comment -} - -public enum TokenKind extends MyEnum, FooBaz implements Foo, Bar { -//<- meta.class.java storage.modifier.java -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java -//^^^^ storage.modifier.java -// ^^^^ storage.type.java -// ^^^^^^^^^ entity.name.class.java -// ^^^^^^^ keyword.declaration.extends.java -// ^^^^^^ entity.other.inherited-class.java -// ^ punctuation.separator.comma.java -// ^^^^^^ entity.other.inherited-class.java -// ^^^^^^^^^^ keyword.declaration.implements.java -// ^^^ entity.other.inherited-class.java -// ^ punctuation.separator.comma.java -// ^^^ entity.other.inherited-class.java -// ^ punctuation.section.block.begin.java - a, -// ^ constant.other.enum.java -// ^ punctuation.separator.comma.java - a(1, 2, 3), -// ^ constant.other.enum.java -// ^^^^^^^^^ meta.parens.java -// ^ punctuation.section.parens.begin.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.separator.comma.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.separator.comma.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.section.parens.end.java -// ^ punctuation.separator.comma.java - a {}, -// ^ constant.other.enum.java -// ^ meta.block.java punctuation.section.block.begin.java -// ^ meta.block.java punctuation.section.block.end.java -// ^ punctuation.separator.comma.java - A, -// ^ constant.other.enum.java -// ^ punctuation.separator.comma.java - A(1), -// ^ constant.other.enum.java -// ^^^ meta.parens.java -// ^ punctuation.section.parens.begin.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.section.parens.end.java -// ^ punctuation.separator.comma.java - A {}, -// ^ constant.other.enum.java -// ^ meta.block.java punctuation.section.block.begin.java -// ^ meta.block.java punctuation.section.block.end.java -// ^ punctuation.separator.comma.java - integerToken, -// ^^^^^^^^^^^^ constant.other.enum.java -// ^ punctuation.separator.comma.java - integerToken("integer literal"), -// ^^^^^^^^^^^^^^^^^^^ meta.parens.java -// ^^^^^^^^^^^^ constant.other.enum.java -// ^ punctuation.section.parens.begin.java -// ^^^^^^^^^^^^^^^^^ string.quoted.double.java -// ^ punctuation.section.parens.end.java -// ^ punctuation.separator.comma.java - integerToken {}; -// ^^^^^^^^^^^^ constant.other.enum.java -// ^ meta.block.java punctuation.section.block.begin.java -// ^ meta.block.java punctuation.section.block.end.java -// ^ punctuation.terminator.java - int {} -// ^^^ storage.type.primitive.java - static {} -// ^^^^^^ storage.modifier.java - String image = ""; -// ^^^^^^ support.class.java -// ^^^^^ meta.field.java -// ^ keyword.operator.assignment.java -// ^^ string.quoted.double.java -// ^ punctuation.terminator.java - TokenKind(String s) {} -// ^^^^^^^^^^^^^^^^^^^^^^ meta.method.java -// ^^^^^^^^^ meta.method.identifier.java entity.name.function.constructor.java -// ^^^^^^^^^^ meta.method.parameters.java meta.parens.java -// ^^ meta.method.body.java -// ^ punctuation.section.parens.begin.java -// ^^^^^^ support.class.java -// ^ variable.parameter.java -// ^ punctuation.section.parens.end.java -// ^ punctuation.section.block.begin.java -// ^ punctuation.section.block.end.java - public static void main(String[]a){} -// ^^^^^^^^^^^^^^ meta.class.java meta.class.body.java meta.block.java -// ^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.class.body.java meta.block.java meta.method.java -// ^^^^ meta.method.identifier.java -// ^^^^^^^^^^^ meta.method.parameters.java meta.parens.java -// ^^ meta.method.body.java -// ^^^^^^ storage.modifier.java -// ^^^^^^ storage.modifier.java -// ^^^^ storage.type.void.java -// ^^^^ entity.name.function.java -// ^ punctuation.section.parens.begin.java -// ^^^^^^ support.class.java -// ^^ storage.modifier.array.java -// ^ variable.parameter.java -// ^ punctuation.section.parens.end.java -// ^ punctuation.section.block.begin.java -// ^ punctuation.section.block.end.java -} - -public // comment -//<- storage.modifier.java -enum // comment -//<- meta.class.java meta.class.identifier.java storage.type.java -TokenKind // comment -//<- meta.class.java meta.class.identifier.java entity.name.class.java -extends // comment -//<- meta.class.java meta.class.extends.java keyword.declaration.extends.java -MyEnum, // comment -//<- meta.class.java meta.class.extends.java entity.other.inherited-class.java -FooBaz // comment -//<- meta.class.java meta.class.extends.java entity.other.inherited-class.java -implements // comment -//<- meta.class.java meta.class.implements.java keyword.declaration.implements.java -Foo, // comment -//<- meta.class.java meta.class.implements.java entity.other.inherited-class.java -Bar // comment -//<- meta.class.java meta.class.implements.java entity.other.inherited-class.java -{ -//<- meta.class.java meta.class.body.java meta.block.java punctuation.section.block.begin.java -} -//<- meta.class.java meta.class.body.java meta.block.java punctuation.section.block.end.java - -class InvalidStuff -{ - goto -// ^^^^ invalid.illegal - - const int 3; -// ^^^^^ invalid.illegal -} - -public class Lambdas { - volatile int foo; -//^^^^^^^^ storage.modifier.java - - void anonymousFunctions() { - foo(); -// ^^^ variable.function.java - -// Capital names are usually used for classes - Foo(); -// ^^^ variable.function.java - - foo (); -// ^^^ variable.function.java - this.foo(); -// ^^^ variable.function.java -// ^^^ meta.generic.java -// ^ punctuation.definition.generic.begin.java -// ^ support.class.java - this. foo(); -// ^^^ variable.function.java -// ^^^ meta.generic.java -// ^ punctuation.definition.generic.begin.java -// ^ support.class.java - - Function func = a -> 42; -// ^^^^^^^^^ meta.assignment.rhs.java -// ^ variable.parameter.java -// ^^ storage.type.function.anonymous.java -// ^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.terminator.java - foo(a -> 42); -// ^^^^^^^^^^^^ meta.function-call.java -// ^^^ variable.function.java -// ^ punctuation.section.parens.begin.java -// ^ variable.parameter.java -// ^^ storage.type.function.anonymous.java -// ^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.section.parens.end.java -// ^ punctuation.terminator.java - - a -> { return 42; }; -// ^^^^^^^^^^^^^^ meta.function.anonymous.body.java - - (a, b) -> 42; -// ^ variable.parameter.java -// ^ variable.parameter.java -// ^^ storage.type.function.anonymous.java -// ^^ meta.number.integer.decimal.java constant.numeric.value.java - - (int a, Foo[] b) -> 42; -// ^^^ storage.type.primitive -// ^ variable.parameter.java -// ^^^ support.class.java -// ^ punctuation.definition.generic.begin.java -// ^^^^^^^ support.class.java -// ^ punctuation.definition.generic.end.java -// ^ variable.parameter.java -// ^^ storage.type.function.anonymous.java -// ^^ meta.number.integer.decimal.java constant.numeric.value.java - - // Lambda parameter tests - Function lambda1 = (final @MyAnnotation String foo) -> foo; -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.anonymous.parameters.java -// ^^^^^ storage.modifier.java -// ^^^^^^^^^^^^^ meta.annotation -// ^ punctuation.definition.annotation -// ^^^^^^ support.class.java - meta.annotation -// ^^^ variable.parameter.java -// ^^ storage.type.function.anonymous.java - meta.function.anonymous.parameters.java - - Function lambda2 = (@MyAnnotation String foo) -> foo; -// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.anonymous.parameters.java -// ^^^^^^^^^^^^^ meta.annotation -// ^ punctuation.definition.annotation -// ^^^^^^ support.class.java - meta.annotation -// ^^^ variable.parameter.java -// ^^ storage.type.function.anonymous.java - meta.function.anonymous.parameters.java - - Function lambda3 = (@MyAnnotation(foo = Foo.BAR) String foo) -> foo; -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.anonymous.parameters.java -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation -// ^ punctuation.definition.annotation -// ^^^ variable.parameter.java -// ^^^ support.class.java -// ^ punctuation.accessor.dot.java -// ^^^ constant.other.java -// ^^^^^^ support.class.java - meta.annotation -// ^^^ variable.parameter.java -// ^^ storage.type.function.anonymous.java - meta.function.anonymous.parameters.java - - Function lambda4 = (String foo) -> foo; -// ^^^^^^^^^^^^ meta.function.anonymous.parameters.java -// ^^^^^^ support.class.java - meta.annotation -// ^^^ variable.parameter.java -// ^^ storage.type.function.anonymous.java - meta.function.anonymous.parameters.java - - Function lambda5 = (foo) -> foo; -// ^^^^^ meta.function.anonymous.parameters.java -// ^^^ variable.parameter.java -// ^^ storage.type.function.anonymous.java - meta.function.anonymous.parameters.java - - Function lambda6 = foo -> foo; -// ^^^ meta.function.anonymous.parameters.java -// ^^^ variable.parameter.java -// ^^ storage.type.function.anonymous.java - meta.function.anonymous.parameters.java - - Function lambda7 = (String... foo) -> foo[0]; -// ^^^^^^^^^^^^^^^ meta.function.anonymous.parameters.java -// ^^^^^^ support.class.java - meta.annotation -// ^^^ keyword.operator.variadic.java -// ^^^ variable.parameter.java -// ^^ storage.type.function.anonymous.java - meta.function.anonymous.parameters.java - - IntFunction intLambda1 = (int foo) -> String.valueOf(foo); -// ^^^^^^^^^ meta.function.anonymous.parameters.java -// ^^^ storage.type.primitive - meta.annotation -// ^^^ variable.parameter.java -// ^^ storage.type.function.anonymous.java - meta.function.anonymous.parameters.java - } -} - -class Generics { - - List field; -// ^^^^^^^^ meta.generic.java -// ^ punctuation.definition.generic.begin.java -// ^^^^^^ support.class.java -// ^ punctuation.definition.generic.end.java - - List field; -// ^^^^^^^^^^^^^^ meta.generic.java -// ^ punctuation.definition.generic.begin.java -// ^^^^^^^^^^^^ meta.path.java -// ^^^^ support.type.package.java -// ^ punctuation.accessor.dot.java -// ^^^ support.type.package.java -// ^ punctuation.accessor.dot.java -// ^^^ support.class.java - - void variableTypes() { - List x; -// ^^^^^^^^ meta.generic.java -// ^ punctuation.definition.generic.begin.java -// ^ punctuation.definition.generic.end.java - - List x; -// ^^^^^^^^^^^^^^^^^^ meta.generic.java -// ^^^^^^^^^^^^^^^^ meta.path.java -// ^^^^ support.type.package.java -// ^ punctuation.accessor.dot.java -// ^^^^ support.type.package.java -// ^ punctuation.accessor.dot.java -// ^^^^^^ support.class.java -// ^ punctuation.definition.generic.end.java - - List x; -// ^^^^^ meta.generic.java -// ^^^ support.class.java - - List x; -// ^^^^^^^^^^^^^^ meta.generic.java -// ^^^^^^^^^^^^ meta.path.java -// ^^^ support.class.java - - List x; -// ^^^^^^^ meta.generic.java -// ^^^ storage.type.primitive.java -// ^^ storage.modifier.array.java - - List x; -// ^^^^^^^^^^^^^^^^^^^^ meta.generic.java -// ^^^^^^^^^^^^^^^^ meta.path.java -// ^^ storage.modifier.array.java - - List x; -// ^^^^^^^ meta.generic.java -// ^^^ support.class.java -// ^^ storage.modifier.array.java - - List[][] x; -// ^^^^^^^^^ meta.generic.java -// ^^^ storage.type.primitive.java -// ^^^^ storage.modifier.array.java -// ^^^^ storage.modifier.array.java - } - - void instantiation() { - - new Foo(); -// ^^^^^ meta.generic.java -// ^^^ support.class.java -// ^ punctuation.definition.generic.begin.java -// ^ punctuation.definition.generic.end.java - - new Foo(); -// ^ keyword.operator.wildcard.java - - new Foo(); -// ^ keyword.operator.wildcard.java -// ^^^ support.class.java -// ^^^^^^^ keyword.declaration.extends.java -// ^ punctuation.separator.comma.java - // ^^^^^^ support.class.java - - new Foo(); -// ^ keyword.operator.wildcard.java -// ^^^^^ keyword.declaration.super.java - - new Foo(); -// ^^^ -storage.type.primitive - - new Foo(); -// ^^^^^^ support.class.java -// ^^^ -storage.type.primitive - - new Foo(); -// ^^^^^^^^^^^^ meta.generic.java -// ^^^^^^^^^^ meta.path.java -// ^ support.type.package.java -// ^ punctuation.accessor.dot.java -// ^ support.type.package.java -// ^ punctuation.accessor.dot.java - - new Foo[] { new Foo(1), new Foo(2) }; -// ^^^ meta.generic.java -// ^^ punctuation.section.brackets -// ^ punctuation.section.braces.begin -// ^^^ support.class.java -// ^ punctuation.separator.comma.java -// ^^^ support.class.java -// ^ punctuation.section.braces.end - - new ArrayList[] { new ArrayList(), new ArrayList() } -// ^^^^^^^^^^^^^^^ meta.generic.java -// ^^^^^^^^^^^^^ meta.path.java -// ^^^^^^ meta.generic.java - - new a. -// ^^ meta.path.java - b.Foo(); -// ^^^^^ meta.generic.java meta.path.java - } -} - -public class Test { - - void test1() { - Foo.abc(); -// ^ punctuation.accessor.dot.java -// ^^^ variable.function.java - Foo.class; -// ^ punctuation.accessor.dot.java -// ^^^^^ variable.language.java - storage.type.java -// ^ punctuation.terminator.java - } - - void test2() { -// ^^^^^ entity.name.function.java - } -} - -@ClassName.FixMethodOrder( MethodSorters.NAME_ASCENDING ) -// <- meta.annotation punctuation.definition.annotation -meta.annotation.identifier -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation -//^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation.identifier -//^^^^^^^^ variable.annotation.java -// ^ punctuation.accessor.dot.java -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation.parameters -// ^ punctuation.accessor.dot -// ^ constant -public class GrafoTest { - @Override -// ^^^^^^^^^ meta.annotation -// ^ punctuation.definition.annotation -// ^^^^^^^^ variable.annotation.java - void test1() { -// ^ entity.name.function - } - - @Author(first = "Oompah", last = "Loompah") -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation -// ^ punctuation.definition.annotation -// ^^^^^^ meta.annotation.identifier variable.annotation.java -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation.parameters -// ^ punctuation.section.parens.begin -// ^^^^^ variable.parameter.java -// ^ keyword.operator -// ^^^^^^^^ string -// ^ punctuation.separator.comma.java -// ^^^^ variable.parameter.java -// ^ keyword.operator -// ^^^^^^^^ string -// ^ punctuation.section.parens.end - void test2() { -// ^ entity.name.function - - Grafo grafo = new Grafo( true ); - final Grafo temposMaisCedo = new Grafo( true ); -// ^ storage.modifier -// ^ support.class - } - - - @Partial @Mock(type=Grafo.class) DataLoader inline; -// ^^^^^^^^ meta.annotation -// ^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation -// ^ support.class - - @Override public int inline() { -// ^^^^^^^^^ meta.annotation -// ^ punctuation.definition.annotation -// ^^^^^^^^ variable.annotation - } - - void annotatedArgs(@NonNull final String p1, -// ^^^^^^^^ meta.annotation -// ^ storage.modifier - meta.annotation - @Named(value = "") List p2, @NonNull final String p3) {} -// ^^^^^^^^^^^^^^^^^^ meta.annotation -// ^ support.class -// ^ meta.generic punctuation.definition.generic.begin -// ^ variable.parameter -// ^ punctuation.separator -// ^^^^^^^^ meta.annotation -// ^ storage.modifier - meta.annotation -// ^ support.class - - List<@NotBlank(message = "") String> annotationInGeneric; -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.generic -// ^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation -// ^^^^^^ support.class - -} - -public enum FooEnum { -// ^^^^ storage.type.java - FOO; -//^^^ constant.other.enum -} -// <- meta.class.java meta.class.body.java punctuation.section.block.end.java - -public enum FooBarEnum { -// ^^^^ storage.type.java - FOO, -//^^^ constant.other.enum - BAR; -//^^^ constant.other.enum -} - -public enum AbstractEnum { -// ^^^^ storage.type.java - FOO { -//^^^ constant.other.enum -// ^ meta.enum.java meta.enum.body.java meta.block.java punctuation.section.block.begin.java - public void doSomething() { return; } -// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.java - }, -//^ meta.enum.java meta.enum.body.java meta.block.java punctuation.section.block.end.java - BAR { -//^^^ constant.other.enum - public void doSomething() { return; } -// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.java - }; - - public abstract void doSomething(); -// ^^^^^^^^^^^^^ meta.method.java -} - -public final class SomeClass extends BaseClass { -// ^ punctuation.definition.generic.begin.java -// ^ punctuation.definition.generic.end.java -// ^ punctuation.separator.comma.java -// ^ support.class.java -// ^ punctuation.section.block.begin.java -} - -public @interface PublicAnnotation { -// ^^^^^^^^^^ storage.type.java - int numericValue() default 42; -// ^^^^^^^ keyword.declaration.default.java -// ^^ constant.numeric - boolean booleanValue() default true; -// ^^^^^^^ keyword.declaration.default.java -// ^^^^ constant.language - char charValue() default 'S'; -// ^^^^^^^ keyword.declaration.default.java -// ^^^ string.quoted.single.java - String value() default "Default value"; -// ^^^^^^^ keyword.declaration.default.java -// ^^^^^^^^^^^^^^^ string.quoted.double.java - Class classValue() default String.class; -// ^^^^^^^ keyword.declaration.default.java -// ^^^^^^ support.class.java -// ^^^^^ variable.language.java - String[] arrayValue() default {"Foo", "Bar"}; -// ^^^^^^^ keyword.declaration.default.java -// ^ punctuation.section.block.begin -// ^^^^^ string.quoted.double.java -// ^^^^^ string.quoted.double.java -// ^ punctuation.section.block.end -} - -@interface PackageAnnotation {} -//^^^^^^^^ storage.type.java - -@MultiLineAnnotation( -// <- meta.annotation.java -// <- punctuation.definition.annotation.java -//^^^^^^^^^^^^^^^^^^ variable.annotation.java -// ^ meta.annotation.java meta.annotation.parameters.java punctuation.section.parens.begin.java - foo = BAR, -//^^^ variable.parameter.java -// ^ keyword.operator.assignment.java -// ^ constant.other.java -// ^ punctuation.separator.comma.java - other = "foo" -//^^^^^ variable.parameter.java -// ^ keyword.operator.assignment.java -// ^ string -) -// <- meta.annotation.java meta.annotation.parameters.java punctuation.section.parens.end.java -@fully.qualified.Annotation -// <- punctuation.definition.annotation.java -//^^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation.java meta.annotation.identifier.java meta.path.java -//^^^^ variable.annotation.package.java -// ^ punctuation.accessor.dot.java -// ^^^^^^^^^ variable.annotation.package.java -// ^ punctuation.accessor.dot.java -// ^^^^^^^^^ variable.annotation.java -@fully.qualified.ParentClass.InnerAnnotation -// <- punctuation.definition.annotation.java -//^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation.java meta.annotation.identifier.java meta.path.java -//^^^^ variable.annotation.package.java -// ^ punctuation.accessor.dot.java -// ^^^^^^^^^ variable.annotation.package.java -// ^ punctuation.accessor.dot.java -// ^^^^^^^^^^^ variable.annotation.java -// ^ punctuation.accessor.dot.java -// ^^^^^^^^^^^^^^^ variable.annotation.java -@fully.qualified -//^^^^^^^^^^^^^^ meta.annotation.identifier.java meta.path.java - .multiline.Annotation -// ^^^^^^^^^^^^^^^^^^^^^ meta.annotation.identifier.java meta.path.java - (foo = "bar") -// ^^^^^^^^^^^^^ meta.annotation.parameters.java -meta.annotation.identifier.java -@FancyAnnotation({ -// <- punctuation.definition.annotation.java -// ^^ meta.annotation.parameters.java - Foo.class, -//^^^ support.class.java -// ^ punctuation.accessor.dot.java -// ^^^^^ variable.language.java -// ^ punctuation.separator.comma.java - Bar.class -//^^^ support.class.java -// ^ punctuation.accessor.dot.java -// ^^^^^ variable.language.java -}) -// <- punctuation.section.braces.end.java - // <- meta.annotation.java meta.annotation.parameters.java punctuation.section.parens.end.java -class Bàr { -// ^^^ entity.name.class.java - Bàr() {} -//^^^^^ meta.method.java -//^^^ entity.name.function.constructor.java -} - -@AnnotationAsParameterSingle( - @Parameter(name = "foo") -// ^ punctuation.definition.annotation.java -// ^^^^^^^^^ variable.annotation.java -// ^^^^ variable.parameter.java -) - -@AnnotationAsParameterSingleNamed( - value = @Parameter(name = "foo") -//^^^^^ variable.parameter.java -// ^ punctuation.definition.annotation.java -// ^^^^^^^^ variable.annotation.java -// ^^^^ variable.parameter.java -) - -@AnnotationAsParameterMultiple({ -// ^ punctuation.section.braces.begin.java - @Parameter(name = "foo"), -// ^ punctuation.definition.annotation.java -// ^^^^^^^^^ variable.annotation.java -// ^^^^ variable.parameter.java - - @Parameter(name = "bar") -// ^ punctuation.definition.annotation.java -// ^^^^^^^^^ variable.annotation.java -// ^^^^ variable.parameter.java -}) -// <- punctuation.section.braces.end.java - -@AnnotationAsParameterMultipleNamed( - first = {@Parameter(name = "foo"), @Parameter(name = "bar")}, -//^^^^^ variable.parameter.java -// ^ punctuation.definition.annotation.java -// ^^^^^^^^^ variable.annotation.java -// ^^^^ variable.parameter.java -// ^ punctuation.definition.annotation.java -// ^^^^^^^^^ variable.annotation.java -// ^^^^ variable.parameter.java - second = {@Parameter(name = "foo"), @Parameter(name = "bar")}, -//^^^^^^ variable.parameter.java - third = @Parameter(name = "foo") -//^^^^^ variable.parameter.java -// ^^^^^^^^^ variable.annotation.java -) - -@SomeInterface -// <- punctuation.definition.annotation.java -public class Foo { -// <- meta.class.java storage.modifier.java -// ^ meta.class.java meta.class.identifier.java storage.type.java -// ^ punctuation.section.block.begin.java - - FooBar MY_CONST = new FooBar(); -// ^^^^^^^^ entity.name.constant.java - - @Inject -//^^^^^^^ meta.annotation - public Foo( -//^ - meta.annotation -// ^ meta.method.java -// ^ entity.name.function.constructor - // Comment for annotation - @MyAnnotation FooType annotatedParam, -// ^ meta.annotation.java -// ^ - meta.annotation.java -// ^ support.class.java -// ^ variable.parameter.java - String unannotatedParam) { -// ^ support.class.java -// ^ variable.parameter.java - return; -// ^^^^^^ keyword.control.flow.return.java - } - - void bar$() {} -// ^^^^^^ meta.method.java -// ^^^^ entity.name.function - - void à() {} -// ^^ meta.method.java -// ^ entity.name.function - - public static void main(String[] args, String moreArgs, a.b.c.Foo bar) {} -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.parameters.java -// ^^^^^^ support.class.java -// ^^ storage.modifier.array.java -// ^^^^ variable.parameter.java -// ^ punctuation.separator.comma.java -// ^^^^^^ meta.generic.java -// ^^^^^^ support.class.java -// ^^^^ support.class.java -// ^^^^^^^^ variable.parameter.java -// ^ support.type.package.java -// ^ punctuation.accessor.dot.java -// ^ punctuation.accessor.dot.java -// ^^^ support.class.java -// ^^^ variable.parameter.java - - MyClass myClass = new MyClass( - SomeEnum.ENUM_VALUE, - new OtherNewClass(), - new OtherNestedClass( - SomeEnum.ENUM_VALUE, - new SuperNestedClass(param, 2)), - anotherParam); - - public static final MyObject MY_CONST = new MyObject(), -// ^ entity.name.constant - - _MY_ANOTHER_CONST = new MyObject(); -// ^^^^^^^^^^^^^^^^^ entity.name.constant - - Object foo = new TypeLiteral< - StandardReferenceNumberProcessor< - SimpleGenerateReferenceNumberOperation, - SimpleSyncReferenceNumberOperation>>() {}; - - Object bar = SomeStaticClass.newBuilder().doThings(1) -// ^ meta.function-call.java variable.function.java -// ^ meta.function-call.java variable.function.java -// ^ meta.function-call.java meta.number.integer.decimal.java constant.numeric.value.java - .withString("I am a string"); -// ^ meta.function-call.java variable.function.java -// ^ meta.function-call.java string.quoted.double.java - - Object bah = someStaticMethodCall(4) -// ^ meta.function-call.java variable.function.java -// ^ meta.function-call.java meta.number.integer.decimal.java constant.numeric.value.java - .withString("I am a string"); -// ^ meta.function-call.java variable.function.java -// ^ meta.function-call.java string.quoted.double.java - - private static final String DEFAULT_IDEMPOTENCY_KEY = 44493; -// ^ entity.name.constant -// ^^^^^ meta.number.integer.decimal.java constant.numeric.value.java - - - private MyGenric, and.fully.Qualified, -// ^ meta.generic.java support.class.java -// ^ meta.generic.java punctuation.accessor.dot.java -// ^^^^^^^^^^^^^^^^^^^ meta.path.java - and.fully.Qualified> myVariable; -// ^^^^^^^^^^^^^^^^^^^ meta.path.java -// ^ meta.generic.java meta.generic.java support.class.java - - private MyObject otherObject = MY_CONST; -// ^ constant.other.java - - private MyObject otherObject = SOME_CONST.FOO; -// ^ constant.other.java -// ^ constant.other.java - - private MyObject otherObject = SOME_CONST.get(); -// ^ constant.other.java -// ^ variable.function.java - - private MyObject object = a.b.ErrorCode.COMMUNICATION_ERROR; -// ^^^^^^^^^^^^^ meta.path.java -// ^ support.type.package.java -// ^ punctuation.accessor.dot.java -// ^ support.type.package.java -// ^ punctuation.accessor.dot.java -// ^^^^^^^^^ support.class.java -// ^ punctuation.accessor.dot.java -// ^ constant.other.java - - private static final UUID SECURE_ID = UUID.randomUUID(); -// ^ support.class.java -// ^ entity.name.constant -// ^ support.class.java -// ^ meta.function-call.java variable.function.java - - private URI uri = new URI(); -// ^^^ support.class.java -// ^^^ support.class.java - - private URI URI2 = new URI(); -// ^^^ support.class.java -// ^^^^ entity.name.constant.java -// ^^^ support.class.java - - - class SubClass extends AbstractClass.NestedClass { -// ^ entity.name.class.java -// ^^^^^^^^^^^^^ entity.other.inherited-class.java -// ^ punctuation.accessor.dot.java -// ^^^^^^^^^^^ entity.other.inherited-class.java -// ^ punctuation.section.block.begin.java - } - - class SubClass extends AbstractClass { -// ^ entity.name.class.java -// ^ entity.other.inherited-class.java - } - - class SubClass extends fully.qualified -// ^ entity.name.class.java -// ^^^^^^^^^^^^^^^ meta.path.java -// ^^^^^ entity.other.inherited-class.package.java -// ^ punctuation.accessor.dot.java -// ^^^^^^^^^ entity.other.inherited-class.package.java - .name.AbstractClass { -// ^^^^^^^^^^^^^^^^^^^ meta.path.java -// ^ punctuation.accessor.dot.java -// ^^^^ entity.other.inherited-class.package.java -// ^ punctuation.accessor.dot.java -// ^^^^^^^^^^^^^ entity.other.inherited-class.java - } - - Function BLOCK_LAMBDA = r -> { -// ^ entity.name.constant -// ^ keyword.operator.assignment.java -// ^ storage.type.function.anonymous.java -// ^ meta.block punctuation.section.block.begin - return 1; -// ^^^^^^ keyword.control.flow.return.java - }; -//^ meta.block punctuation.section.block.end -// ^ punctuation.terminator - - Supplier supplier = () -> true; -// ^ punctuation.section.parens.begin.java -// ^ punctuation.section.parens.end.java -// ^ keyword.operator.assignment.java -// ^ storage.type.function.anonymous.java -// ^ punctuation.terminator - - byte[] byteArray; -//^^^^ storage.type.primitive.java -// ^^ storage.modifier.array.java - - byte byteArray2[] = {1, 2}; -//^^^^ storage.type.primitive.java -// ^^ storage.modifier.array.java -// ^^^^^^^^ meta.assignment.rhs.java - - static { -// ^ meta.static.body.java punctuation.section.block.begin.java - StaticFlag.setFlag("Boo!"); - } -//^ meta.static.body.java punctuation.section.block.end.java - - int operators() { - - assert scale > -100 : foo == true; -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.assertion.java -// ^^^^^^ keyword.control.flow.assert.java -// ^ punctuation.separator.expressions.java -// - if (this.scale<0) { -// ^^ keyword.control.conditional.if.java -// ^^^^^^^^^^^^^^ meta.parens.java -// ^ punctuation.section.parens.begin -// ^ punctuation.accessor.dot.java -// ^ keyword.operator.comparison.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ - meta.parens.java - return foo<<32; -// ^^^^^^ keyword.control.flow.return.java -// ^^ keyword.operator.bitshift.java -// ^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.terminator.java - } -// ^ meta.block.java punctuation.section.block.end.java - - int foo = true ? 1 : 2; -// ^^^^ constant.language.java -// ^ keyword.operator.ternary.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ keyword.operator.ternary.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.terminator.java - - return foo>> (c | 2); -// ^ keyword.operator.bitwise -// ^^^ keyword.operator.bitshift -// ^ keyword.operator.bitwise - - z &= x; z ^= x; z *= x; z /= x; -// ^^ keyword.operator.assignment -// ^^ keyword.operator.assignment -// ^^ keyword.operator.assignment -// ^^ keyword.operator.assignment - - } - - boolean inst = a instanceof Object; -// ^^^^^^^^^^ keyword.operator.word.instanceof - } -//^ meta.method.java meta.method.body.java punctuation.section.block.end.java - -/****************************************************************************** - * Numeric Constants Tests - *****************************************************************************/ - - int numbersTests() { - - a = 0x1.; -// ^^ meta.number.float.hexadecimal.java constant.numeric.base.java -// ^^ meta.number.float.hexadecimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java - - a = 0x.1a2f; -// ^^ meta.number.float.hexadecimal.java constant.numeric.base.java -// ^^^^^ meta.number.float.hexadecimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java - - a = 0x1.a2f; -// ^^ meta.number.float.hexadecimal.java constant.numeric.base.java -// ^^^^^ meta.number.float.hexadecimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java - - a = 0x1ffp+1023 0x1ffp+_1023_; -// ^^ meta.number.float.hexadecimal.java constant.numeric.base.java -// ^^^^^^^^^ meta.number.float.hexadecimal.java constant.numeric.value.java -// ^^ meta.number.float.hexadecimal.java constant.numeric.base.java -// ^^^^^^^^^^^ meta.number.float.hexadecimal.java constant.numeric.value.java - - a = 0xd.aP-1074 0x_1_f_._a_d_P-_10_74_; -// ^^ meta.number.float.hexadecimal.java constant.numeric.base.java -// ^^^^^^^^^ meta.number.float.hexadecimal.java constant.numeric.value.java -// ^^ meta.number.float.hexadecimal.java constant.numeric.base.java -// ^^^^^^^^^^^^^^^^^^^^ meta.number.float.hexadecimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ punctuation.separator.decimal.java - -// decimal floats - - a = 0D + 12345D + 12345D + 12_34_5_D - _12_34_5D - 12a45D; -// ^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^^^ - constant.numeric -// ^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^^^^ - constant.numeric - - a = 0F + 12345F + 12345F + 12_34_5_F - _12_34_5F - 12a45F; -// ^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^^^ - constant.numeric -// ^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^^^^ - constant.numeric - - a = 1. + 1_. + 1_2. - _1.; -// ^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^ - constant.numeric - - a = 1.D + 1_.D + 1_2.D - _1.D; -// ^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^ - constant.numeric - - a = 1.2 + 1_.2_ + 1_2.3_4 + 1_2_._3_4_ - _1.5; -// ^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^ - constant.numeric -// ^ punctuation.separator.decimal.java -// ^^ meta.number.float.decimal constant.numeric.value.java - - a = 1.2d + 1_.2_d + 1_2.3_4d + 1_2_._3_4_d - _1.5d; -// ^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^ - constant.numeric -// ^ punctuation.separator.decimal.java -// ^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java - - a = 12e34 + 12e+3_ + 1_2e3_4 + 1_2_e3_4_ + 1_2_e_3_4 + 12e+34 + 12e-34 + 12e+3_4 - _12e34; -// ^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^^^^^^ - constant.numeric - - a = 12e34f + 12e+3_f + 1_2e3_4f + 1_2_e3_4_f + 1_2_e_3_4f + 12e+34f + 12e-34f + 12e+3_4f - _12e34f; -// ^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^ - constant.numeric - - a = 12.e34 + 12.e+3_ + 1_2.e3_4 + 1_2_.e3_4_ + 1_2_.e_3_4 + 12.e+34 + 12.e-34 + 12.e+3_4 - _12.e34; -// ^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^ - constant.numeric - - a = 12.e34f + 12.e+3_f + 1_2.e3_4f + 1_2_.e3_4_f + 1_2_.e_3_4f + 12.e+34f + 12.e-34f + 12.e+3_4f - _12.e34f; -// ^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^^ - constant.numeric - - a = 12.34e56 + 12_.34_e+5_ + 1_2.3_4e5_6 + 1_2_.3_4_e5_6_ + 1_2_._3_4e_5_6 + 12.34e+56 + 12.34e-56 + 12.34e+5_6 - _12.34e+5_6; -// ^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^ - constant.numeric -// ^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java - - a = 12.34e56f + 12_.34_e+5_f + 1_2.3_4e5_6f + 1_2_.3_4_e5_6_f + 1_2_._3_4e_5_6f + 12.34e+56f + 12.34e-56f + 12.34e+5_6f - _12.34e+5_6f; -// ^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^ - constant.numeric -// ^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java - - a = .2 + .2_ + .3_4 + ._3_4_; -// ^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java - - a = .2d + .2_d + .3_4d + ._3_4_d; -// ^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java - - a = .34e56 + .34_e+5_ + .3_4e5_6 + .3_4_e5_6_ + ._3_4e_5_6 + .34e+56 + .34e-56 + .34e+5_6; -// ^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java - - a = 23.45 + 23.45F + 23.45d; -// ^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java - - a = .01 + .02e3+.02e3F; -// ^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ punctuation.separator.decimal.java -// ^ keyword.operator -// ^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ keyword.operator -// ^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java - - a = 23.45e67+23.45e+6F+23.45e-67D; -// ^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ keyword.operator -// ^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java -// ^ keyword.operator -// ^^^^^^^^^ meta.number.float.decimal.java constant.numeric.value.java -// ^ meta.number.float.decimal.java constant.numeric.suffix.java - -// binary integers - - a = 0b101101 + 0b10_11_01 + 0b10_11_01_ + 0b_101101 - 0_b10_1101 + 0b; -// ^^ meta.number.integer.binary.java constant.numeric.base.java -// ^^^^^^ meta.number.integer.binary.java constant.numeric.value.java -// ^^ meta.number.integer.binary.java constant.numeric.base.java -// ^^^^^^^^ meta.number.integer.binary.java constant.numeric.value.java -// ^^ meta.number.integer.binary.java constant.numeric.base.java -// ^^^^^^^^^ meta.number.integer.binary.java constant.numeric.value.java -// ^^ meta.number.integer.binary.java constant.numeric.base.java -// ^^^^^^^ meta.number.integer.binary.java constant.numeric.value.java -// ^ meta.number.integer.octal.java constant.numeric.base.java -// ^ meta.number.integer.octal.java constant.numeric.value.java -// ^^^^^^^^ - constant.numeric -// ^^ meta.number.integer.binary.java constant.numeric.base.java - - a = 0b101101l + 0b10_11_01l + 0b10_11_01_l + 0b_101101l - 0_b10_1101l + 0bl; -// ^^ meta.number.integer.binary.java constant.numeric.base.java -// ^^^^^^ meta.number.integer.binary.java constant.numeric.value.java -// ^ meta.number.integer.binary.java constant.numeric.suffix.java -// ^^ meta.number.integer.binary.java constant.numeric.base.java -// ^^^^^^^^ meta.number.integer.binary.java constant.numeric.value.java -// ^ meta.number.integer.binary.java constant.numeric.suffix.java -// ^^ meta.number.integer.binary.java constant.numeric.base.java -// ^^^^^^^^^ meta.number.integer.binary.java constant.numeric.value.java -// ^ meta.number.integer.binary.java constant.numeric.suffix.java -// ^^ meta.number.integer.binary.java constant.numeric.base.java -// ^^^^^^^ meta.number.integer.binary.java constant.numeric.value.java -// ^ meta.number.integer.binary.java constant.numeric.suffix.java -// ^ meta.number.integer.octal.java constant.numeric.base.java -// ^ meta.number.integer.octal.java constant.numeric.value.java -// ^^^^^^^^^ - constant.numeric -// ^^ meta.number.integer.binary.java constant.numeric.base.java -// ^ meta.number.integer.binary.java constant.numeric.suffix.java - -// hexadecimal integers - - a = 0xABCD + 0xAB_CD + 0xAB_CD_ + 0x_AB_CD - 0_xAB_CD - 0x; -// ^^ meta.number.integer.hexadecimal.java constant.numeric.base.java -// ^^^^ meta.number.integer.hexadecimal.java constant.numeric.value.java -// ^ keyword.operator.arithmetic.java -// ^^ meta.number.integer.hexadecimal.java constant.numeric.base.java -// ^^^^^ meta.number.integer.hexadecimal.java constant.numeric.value.java -// ^ keyword.operator.arithmetic.java -// ^^ meta.number.integer.hexadecimal.java constant.numeric.base.java -// ^^^^^^ meta.number.integer.hexadecimal.java constant.numeric.value.java -// ^ keyword.operator.arithmetic.java -// ^^ meta.number.integer.hexadecimal.java constant.numeric.base.java -// ^^^^^^ meta.number.integer.hexadecimal.java constant.numeric.value.java -// ^ keyword.operator.arithmetic.java -// ^ meta.number.integer.octal.java constant.numeric.base.java -// ^ meta.number.integer.octal.java constant.numeric.value.java -// ^^^^^^ - constant.numeric -// ^ keyword.operator.arithmetic.java -// ^^ meta.number.integer.hexadecimal.java constant.numeric.base.java - - a = 0xABCDl + 0xAB_CDl + 0xAB_CD_l + 0x_AB_CDl - 0_xAB_CDl; -// ^^ meta.number.integer.hexadecimal.java constant.numeric.base.java -// ^^^^ meta.number.integer.hexadecimal.java constant.numeric.value.java -// ^ meta.number.integer.hexadecimal.java constant.numeric.suffix.java -// ^ keyword.operator.arithmetic.java -// ^^ meta.number.integer.hexadecimal.java constant.numeric.base.java -// ^^^^^ meta.number.integer.hexadecimal.java constant.numeric.value.java -// ^ meta.number.integer.hexadecimal.java constant.numeric.suffix.java -// ^ keyword.operator.arithmetic.java -// ^^ meta.number.integer.hexadecimal.java constant.numeric.base.java -// ^^^^^^ meta.number.integer.hexadecimal.java constant.numeric.value.java -// ^ meta.number.integer.hexadecimal.java constant.numeric.suffix.java -// ^ keyword.operator.arithmetic.java -// ^^ meta.number.integer.hexadecimal.java constant.numeric.base.java -// ^^^^^^ meta.number.integer.hexadecimal.java constant.numeric.value.java -// ^ meta.number.integer.hexadecimal.java constant.numeric.suffix.java -// ^ keyword.operator.arithmetic.java -// ^ meta.number.integer.octal.java constant.numeric.base.java -// ^ meta.number.integer.octal.java constant.numeric.value.java -// ^^^^^^^ - constant.numeric - -// octal integers - - a = 07 + 0_ + 0_7 + 07_ + 079 + 079_ + 0_79_ - 0a - 0_a; -// ^ meta.number.integer.octal.java constant.numeric.base.java -// ^ meta.number.integer.octal.java constant.numeric.value.java -// ^ meta.number.integer.octal.java constant.numeric.base.java -// ^ meta.number.integer.octal.java constant.numeric.value.java -// ^ meta.number.integer.octal.java constant.numeric.base.java -// ^^ meta.number.integer.octal.java constant.numeric.value.java -// ^ meta.number.integer.octal.java constant.numeric.base.java -// ^^ meta.number.integer.octal.java constant.numeric.value.java -// ^^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ invalid.illegal.numeric.java -// ^^^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ invalid.illegal.numeric.java -// ^^^^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^^ invalid.illegal.numeric.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ - constant.numeric -// ^ meta.number.integer.octal.java constant.numeric.base.java -// ^ meta.number.integer.octal.java constant.numeric.value.java -// ^ - constant.numeric - - a = 07l + 0_l + 0_7l + 07_l + 0792l + 079_2_l - 0al - 0_a_l; -// ^ meta.number.integer.octal.java constant.numeric.base.java -// ^ meta.number.integer.octal constant.numeric.value.java -// ^ meta.number.integer.octal.java constant.numeric.suffix.java -// ^ meta.number.integer.octal.java constant.numeric.base.java -// ^ meta.number.integer.octal.java constant.numeric.value.java -// ^ meta.number.integer.octal.java constant.numeric.suffix.java -// ^ meta.number.integer.octal.java constant.numeric.base.java -// ^^ meta.number.integer.octal.java constant.numeric.value.java -// ^ meta.number.integer.octal.java constant.numeric.suffix.java -// ^ meta.number.integer.octal.java constant.numeric.base.java -// ^^ meta.number.integer.octal.java constant.numeric.value.java -// ^ meta.number.integer.octal.java constant.numeric.suffix.java -// ^^^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ invalid.illegal.numeric.java -// ^ meta.number.integer.decimal.java constant.numeric.suffix.java -// ^^^^^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ invalid.illegal.numeric.java -// ^ meta.number.integer.decimal.java constant.numeric.suffix.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^^ - constant.numeric -// ^ meta.number.integer.octal.java constant.numeric.base.java -// ^ meta.number.integer.octal.java constant.numeric.value.java -// ^^^ - constant.numeric - -// decimal integers - - a = 0 + 0L; -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ meta.number.integer.decimal.java constant.numeric.suffix.java - - a = 12345 + 12_34_5 + 1_____5 + 12_34_5_ - _12_34_5 - 12a45; -// ^^^^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^^^^^^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^^^^^^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^^^^^^^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^^^^^^^^ - constant.numeric -// ^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^^^ - constant.numeric - - a = 12345l + 12345L + 12_34_5_L - _12_34_5L - 12a45L; -// ^^^^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ meta.number.integer.decimal.java constant.numeric.suffix.java -// ^^^^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ meta.number.integer.decimal.java constant.numeric.suffix.java -// ^^^^^^^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ meta.number.integer.decimal.java constant.numeric.suffix.java -// ^^^^^^^^^ - constant.numeric -// ^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^^^^ - constant.numeric - - a = 123_-_456; -// ^^^^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ keyword.operator -// ^^^^ - constant.numeric - } - - String stringAndChars() { - String doubleQuotes = "String with double quotes"; -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double -// ^ punctuation.definition.string.begin -// ^ punctuation.definition.string.end - - char singleQuotes = 'x'; -// ^^^ string.quoted.single -// ^ punctuation.definition.string.begin -// ^ punctuation.definition.string.end - - String escapes = "\b \t \n \f \r \" \' \\ \0 \12 \123 \u00e4 \uu00E4"; -// ^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double -// ^^ constant.character.escape -// ^^ constant.character.escape -// ^^ constant.character.escape -// ^^ constant.character.escape -// ^^ constant.character.escape -// ^^ constant.character.escape -// ^^ constant.character.escape -// ^^ constant.character.escape -// ^^ constant.character.escape.octal -// ^^^ constant.character.escape.octal -// ^^^^ constant.character.escape.octal -// ^^^^^^ constant.character.escape.unicode -// ^^^^^^^ constant.character.escape.unicode - - char escape = '\b' + '\t' + '\n' + '\f' + '\r' + '\"' + '\'' + '\\' + '\0' + '\12' + '\123' + '\u00e4' + '\uu00E4'; -// ^^^^ string.quoted.single -// ^^ constant.character.escape -// ^^^^ string.quoted.single -// ^^ constant.character.escape -// ^^^^ string.quoted.single -// ^^ constant.character.escape -// ^^^^ string.quoted.single -// ^^ constant.character.escape -// ^^^^ string.quoted.single -// ^^ constant.character.escape -// ^^^^ string.quoted.single -// ^^ constant.character.escape -// ^^^^ string.quoted.single -// ^^ constant.character.escape -// ^^^^ string.quoted.single -// ^^ constant.character.escape -// ^^^^ string.quoted.single -// ^^ constant.character.escape.octal -// ^^^^^ string.quoted.single -// ^^^ constant.character.escape.octal -// ^^^^^^ string.quoted.single -// ^^^^ constant.character.escape.octal -// ^^^^^^^^ string.quoted.single -// ^^^^^^ constant.character.escape.unicode -// ^^^^^^^^^ string.quoted.single -// ^^^^^^^ constant.character.escape.unicode - - String octalEscapesLimits = "\078 \456" -// ^^^ constant.character.escape.octal -// ^ -constant.character.escape.octal -// ^^^ constant.character.escape.octal -// ^ -constant.character.escape.octal - - String illegalEscapes = "\x \+ \8 \9" + '\x' + '\+' + '\8' + '\9' -// ^^^^^^^^^^^^^ string.quoted.double -// ^^ invalid.illegal.escape -// ^^ invalid.illegal.escape -// ^^ invalid.illegal.escape -// ^^ invalid.illegal.escape -// ^^^^ string.quoted.single -// ^^ invalid.illegal.escape -// ^^^^ string.quoted.single -// ^^ invalid.illegal.escape -// ^^^^ string.quoted.single -// ^^ invalid.illegal.escape -// ^^^^ string.quoted.single -// ^^ invalid.illegal.escape - - String text = "String without closing quote -// ^ invalid.illegal.newline - System.out.println(text); -// ^^^^^^ support.class - - char letter = 'z -// ^ invalid.illegal.newline - System.out.println(letter); -// ^^^^^^ support.class - } - - void varType() { - var x = "String"; -// ^^^ storage.type.var.java - - try (var in = new BufferedReader()) { -// ^^^ storage.type.var.java - var line = in.readLine(); -// ^^^ storage.type.var.java - } - } - - @Test -//^ punctuation.definition.annotation.java - public void someMethod(WithParam foo) throws Exception { -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.java -// ^^^^^^^^^^ meta.method.identifier.java entity.name.function.java -// ^ support.class.java -// ^ variable.parameter.java -// ^^^^^^^^^^^^^^^^ meta.method.throws.java -// ^^^^^^ keyword.declaration.throws.java -// ^^^^^^^^^ support.class.java -// ^ meta.method.java meta.method.body.java punctuation.section.block.begin.java - Object otherFoo = methodInvocation(foo); -// ^ support.class.java -// ^ keyword.operator.assignment.java -// ^ meta.function-call.java variable.function.java -// ^ punctuation.terminator.java - OtherObject bob = new OtherObject(foo); -// ^ keyword.other.storage.new.java -// ^ support.class.java - this.foo = new SubClass[0]; -// ^ keyword.other.storage.new.java -// ^ support.class.java -// ^^^ meta.brackets - - OuterClass.InnerClass foo = new OuterClass.InnerClass(); -// ^^^^^^^^^^ support.class.java -// ^ punctuation.accessor.dot.java -// ^^^^^^^^^^ support.class.java - - String[][] doubleStringArray; -// ^^^^^^ support.class.java -// ^^^^ storage.modifier.array.java - - String[] stringArray = new String[] {"foo", "bar"}; -// ^^^^^^ support.class.java -// ^^ storage.modifier.array.java -// ^ keyword.operator.assignment.java -// ^^^ keyword.other.storage.new.java -// ^^^^^^ support.class.java -// ^ punctuation.section.brackets.begin.java -// ^ punctuation.section.brackets.end.java -// ^^^^^^^^^^^^^^ meta.braces.array-initialization.java -// ^ punctuation.section.braces.begin.java -// ^^^^^ string.quoted.double.java -// ^ punctuation.separator.comma.java -// ^^^^^ string.quoted.double.java -// ^ punctuation.section.braces.end.java -// ^ punctuation.terminator.java - - int[] data = new int[]{0, 0, 0}; -// ^^^ storage.type.primitive.java -// ^^ storage.modifier.array.java -// ^^^ keyword.other.storage.new.java -// ^^^ storage.type.primitive.java -// ^ punctuation.section.brackets.begin.java -// ^ punctuation.section.brackets.end.java -// ^ punctuation.section.braces.begin.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.separator.comma.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.separator.comma.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.section.braces.end.java - - byte [] foo; -// ^^^^ storage.type.primitive.java -// ^^ storage.modifier.array.java - byte []b=new byte[size]; -// ^^^^ storage.type.primitive.java -// ^^ storage.modifier.array.java -// ^ keyword.operator.assignment.java -// ^^^ keyword.other.storage.new.java -// ^^^^ storage.type.primitive.java - - int[][][] threeDimArr = new int[][][] { -// ^^^ storage.type.primitive.java -// ^^^^^^ storage.modifier.array.java -// ^^^ storage.type.primitive.java -// ^ punctuation.section.brackets.begin.java -// ^ punctuation.section.brackets.end.java -// ^ punctuation.section.brackets.begin.java -// ^ punctuation.section.brackets.end.java -// ^ punctuation.section.brackets.begin.java -// ^ punctuation.section.brackets.end.java -// ^ punctuation.section.braces.begin.java - { { 1, 2 }, { 3, 4 } }, -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.separator.comma.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.section.braces.begin.java -// ^ punctuation.section.braces.end.java -// ^ punctuation.separator.comma.java - { { 5, 6 }, { 7, 8 } } -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.separator.comma.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.section.braces.begin.java -// ^ punctuation.section.braces.end.java - }; -// ^ punctuation.section.braces.end.java - - threeDimArr = new int[1][3][4]; -// ^^^ storage.type.primitive.java -// ^^^^^^^^^ meta.brackets.array-initialization.java -// ^ punctuation.section.brackets.begin.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.section.brackets.end.java -// ^ punctuation.section.brackets.begin.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.section.brackets.end.java -// ^ punctuation.section.brackets.begin.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.section.brackets.end.java - - bob = new some.path.to.MyObject[3]; -// ^^^^^^^^^^^^^^^^^^^^^ meta.path.java -// ^^^^^^^^ support.class.java -// ^^^ meta.brackets.array-initialization.java -// ^ punctuation.section.brackets.begin.java -// ^ meta.number.integer.decimal.java constant.numeric.value.java -// ^ punctuation.section.brackets.end.java - - foo.forEach((k, v) -> { -// ^ storage.type.function.anonymous.java -// ^ punctuation.section.block.begin - - return; -// ^^^^^^ keyword.control.flow.return.java -// ^ punctuation.terminator - }); -// ^ punctuation.section.block.end.java -// ^ punctuation.terminator - this.foo = new SubClass(new SubClass[0], true); -// ^ keyword.other.storage.new.java -// ^ support.class.java -// ^^^ meta.brackets -// ^ constant.language.java -/* We can't support this yet.*/ - some.other.path. -/* ^^^^^^^^^^^^^^^^ support.class.java */ - foo.MyClass.staticMethod(true); -/* ^^^^^^^^^^^ support.class.java */ - - some.other.path -/* ^^^^^^^^^^^^^^^ support.class.java */ - .foo.MyClass.staticMethod(true); -/* ^^^^^^^^^^^^ support.class.java */ - - @MyAnnotation -// ^ punctuation.definition.annotation.java -// ^^^^^^^^^^^^^ meta.annotation.java - int foo; - } -//^ meta.method.java meta.method.body.java punctuation.section.block.end.java - - void arrayMethod(byte [] [] a, int b, byte[] c) {} -//^^^^ storage.type.void.java -// ^^^^^^^^^^^ entity.name.function.java -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.parameters.java -// ^ - meta.method.parameters.java -// ^^^^ storage.type.primitive.java -// ^^ storage.modifier.array.java -// ^^ storage.modifier.array.java -// ^ variable.parameter.java -// ^^^ storage.type.primitive.java -// ^ variable.parameter.java -// ^^^^ storage.type.primitive.java -// ^^ storage.modifier.array.java -// ^ variable.parameter.java - - int[] arrayMethod2(int a[], String b[]) {} -//^^^ storage.type.primitive.java -// ^^ storage.modifier.array.java -// ^^^ storage.type.primitive.java -// ^ variable.parameter.java -// ^^ storage.modifier.array.java -// ^^^^^^ support.class.java -// ^ variable.parameter.java -// ^^ storage.modifier.array.java - - void arrayOfGenericMethod(Map[] mapping) {} -// ^^ storage.modifier.array.java -// ^^^^^^^ variable.parameter.java - - void primitiveVarArgs(int... values) {} -// ^^^ storage.type.primitive.java -// ^^^ keyword.operator.variadic.java -// ^^^ variable.parameter.java - - public class Foo {} - // ^^^^^^^^^^^^^^^ meta.generic.declaration.java - // ^ variable.parameter.type.java - // ^^^^^^^ keyword.declaration.extends.java - // ^^^ - storage.type.primitive.java - - @RunWith(JUnit4.class) -//^ punctuation.definition.annotation.java -// ^^^^^^^^^^^^^^ meta.annotation.parameters.java -// ^ support.class.java -// ^ variable.language.java - public void someReallyReallyLongMethodNameThatMakesTheBraceOverflowToTheNextLine( -// ^ meta.method.java meta.method.identifier.java entity.name.function.java -// ^ punctuation.section.parens.begin - WITHSOMEPARAMS foo, -// ^ meta.method.java meta.method.parameters.java support.class.java -// ^ meta.method.java meta.method.parameters.java variable.parameter.java - Generic bar) -// ^ meta.method.java meta.method.parameters.java support.class.java -// ^^^^^^^ meta.generic.java -// ^ meta.method.java meta.method.parameters.java variable.parameter.java -// ^ punctuation.section.parens.end - throws Exception { -// ^ meta.method.java meta.method.throws.java keyword.declaration.throws.java -// ^ meta.method.java meta.method.throws.java support.class.java - return someMethod(new Function() { -// ^ meta.class.body.anonymous.java punctuation.section.braces.begin.java - @Override - public V apply(V input) { -// ^ support.class.java -// ^^^^^^^^^ meta.method.parameters.java -// ^ support.class.java -// ^ variable.parameter.java -// ^ meta.method.body - return input; - } -// ^ meta.method.body - }, executor); -// ^ meta.class.body.anonymous.java punctuation.section.braces.end.java -// ^ meta.function-call.java punctuation.section.parens.end.java - } -//^ meta.method.body.java punctuation.section.block.end.java - - public static T writeAll(Collection, Sink) {} -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.java -// ^^^ meta.generic.declaration.java -// ^ variable.parameter.type.java -// ^ - meta.generic.java -// ^ support.class.java -// ^ support.class.java -// ^^^^^^^^^^^^^ meta.generic.java -// ^ punctuation.definition.generic.begin.java -// ^ keyword.operator.wildcard.java -// ^ keyword.declaration.extends.java -// ^ support.class.java -// ^ punctuation.definition.generic.end.java -// ^ punctuation.separator.comma.java - meta.generic.java -// ^^^ meta.generic.java - - public static > -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.generic.declaration.java -// ^ variable.parameter.type.java -// ^^^^^^^^^^ support.class.java -// ^ punctuation.definition.generic.begin.java -// ^ keyword.operator.wildcard.java -// ^ keyword.declaration.super.java -// ^ support.class.java -// ^ punctuation.definition.generic.end.java -// ^ punctuation.definition.generic.end.java -// ^^^^^^^^^^^ meta.generic.java - T max(Collection coll); -// ^ support.class.java - - public static Set unmodifiableSet(Set set); -// ^^^ meta.generic.declaration.java -// ^ variable.parameter.type.java - - public void -// ^ storage.type.void.java - methodNameOnDifferentLine(); -// ^ meta.method.identifier.java entity.name.function.java - - void myAbstractMethod(With foo); -// ^ meta.method.java meta.method.identifier.java entity.name.function.java - - private Long myOtherAbstractMethod(@WithAnnotation Blah blah); -// ^ meta.method.java meta.method.identifier.java entity.name.function.java -// ^ meta.method.java meta.method.parameters.java punctuation.definition.annotation.java - - public MyGeneric otherAbstractMethod(Foo bar); -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.generic.java -// ^ - meta.generic.java -// ^ support.class.java -// ^ support.class.java -// ^ support.class.java -// ^ support.class.java -// ^ support.class.java -// ^ meta.method.java meta.method.identifier.java entity.name.function.java - - public static void myGenericMethod(SomeType root) -// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.generic.declaration.java -// ^ punctuation.definition.generic.begin.java -// ^ variable.parameter.type.java -// ^ keyword.declaration.extends.java -// ^ support.class.java -// ^ storage.type.void.java -// ^entity.name.function.java - - throws Exception, IOException, SAXException { -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.throws -// ^ - meta.method.throws - } -}} -// <- meta.class.java meta.class.body.java punctuation.section.block.end.java - //<- invalid.illegal.stray-brace-end - -public -// <- storage.modifier.java -class IOException { } -// <- storage.type.java - -public class Generic implements fully.qualified.Other { -// ^^^^^^^^^^^^^^^^^^^^^ meta.path.java -// ^^^^^ entity.other.inherited-class.package.java -// ^ punctuation.accessor.dot.java -// ^^^^^^^^^ entity.other.inherited-class.package.java -// ^ punctuation.accessor.dot.java -// ^^^^^ entity.other.inherited-class.java -// ^^^ meta.generic.java -// ^ punctuation.definition.generic.begin.java -// ^ support.class.java -// ^ punctuation.definition.generic.end.java -} -// <- punctuation.section.block.end.java - -public class Generic extends iNtf implements iNterface { -// ^^^^ entity.other.inherited-class.java -// ^^^^^^^^^ entity.other.inherited-class.java -// ^^^ meta.generic.java -// ^ punctuation.definition.generic.begin.java -// ^ support.class.java -// ^ punctuation.definition.generic.end.java -} -// <- punctuation.section.block.end.java - -public class Bar { - public void missingSemiColon() { - boolean foo = foo -// ^^^^ meta.assignment.rhs.java - } -//^ punctuation.section.block.end.java - - private SomeClass methodWithBadParens( - CombinedServerSpec vendorManagementServerSpec; -// ^ invalid.illegal.missing-parameter-end - - public void strayParans() { -// ^ punctuation.section.block.begin.java - foo.bar(hello(world); -// ^ invalid.illegal.stray-terminator-end - } -//^ punctuation.section.block.end.java - - public void strayParansInBlock() { -// ^ punctuation.section.block.begin.java - if (hello(world) { -// ^ invalid.illegal -// ^ - meta.parens.java -// ^ meta.block.java - return false; - } - } - - public void strayParansInForLoop() { -// ^ punctuation.section.block.begin.java - for (;; { -// ^ invalid.illegal -// ^ meta.block.java - meta.parens.java - } - } -//^ punctuation.section.block.end.java - - public void strayParansInConstructor() { -// ^ punctuation.section.block.begin.java - return new Foo(; -// ^ invalid.illegal - } -//^ punctuation.section.block.end.java - - private boolean missingSemiColonForStaticAssignment = true -// ^^^^ meta.assignment.rhs.java - - public void strayParansInConstructor() { -//^^^^^^ meta.class.body.java storage.modifier.java - meta.assignment.rhs.java -// ^ meta.method.identifier.java entity.name.function.java -// ^ punctuation.section.block.begin.java - return; - } - - private boolean missingSemiColonForStaticAssignmentPackageProtected = true -// ^^^^ meta.assignment.rhs.java - - void strayParansInConstructor() { -//^^^^ storage.type.void.java - meta.assignment.rhs.java -// ^ meta.method.identifier.java entity.name.function.java -// ^ punctuation.section.block.begin.java - return; - } -//^ punctuation.section.block.end.java -} -// <- punctuation.section.block.end.java - -class Javadoc { - - /** This is javadoc, not a simple comment */ -//^^^ punctuation.definition.comment.begin.javadoc -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation.javadoc -// ^^ punctuation.definition.comment.end.javadoc - - /** -//^^^ comment.block.documentation.javadoc punctuation.definition.comment.begin.javadoc - * Description of some sort. -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation.javadoc - */ -// ^^ comment.block.documentation.javadoc punctuation.definition.comment.end.javadoc - - /** - *

Before tag -// ^ punctuation.definition.comment.javadoc - *{@value} Before inline tag -// ^ punctuation.definition.comment.javadoc - *@return Before block tag -// ^ punctuation.definition.comment.javadoc - */ - - /** - * Unclosed html tag:

  • - - - -// ^^^^^^^^^^^^^^^ meta.tag - - - <%@ include file="foo.bar" %> -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.directive -// ^^^ punctuation.section.directive -// ^^ punctuation.section.directive - - Plain text -// ^^^^^^^^^^ text.html.jsp - meta - - <%-- This is a comment --%> -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.jsp - <% -// ^^ punctuation.section.embedded.begin.jsp - source.java.embedded.html -// ^ source.java.embedded.html - if (!foo && !bar) { -// ^^ keyword.control.conditional.if.java -// ^ keyword.operator.logical.java -// ^^ keyword.operator.logical.java - %>
    <% -// ^^ punctuation.section.embedded.end.jsp - source.java.embedded.html -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag -// ^^ punctuation.section.embedded.begin.jsp - source.java.embedded.html - if (foot.shouldBe()) { -// ^^ keyword.control.conditional.if.java - boolean test = false; -// ^^^^^^^ storage.type -// ^^^^^ constant - %> -// ^^ punctuation.section.embedded.end.jsp - source.java.embedded.html -// ^ text.html.jsp - source.java.embedded.html - - <%-- This is a comment --%> -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.jsp - <% int aNumber = 0; // this scriptlet should close %> -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash.java -// ^^ punctuation.section.embedded.end.jsp - - -
    -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag - <% -// ^^ punctuation.section.embedded.begin.jsp - source.java.embedded.html - } -// ^ - invalid.illegal.stray-brace-end - } -// ^ - invalid.illegal.stray-brace-end - %> -// ^^ punctuation.section.embedded.end.jsp - source.java.embedded.html -// ^ text.html.jsp - source.java.embedded.html - - diff --git a/Java/tests/syntax_test_java.java b/Java/tests/syntax_test_java.java new file mode 100644 index 0000000000..3c3deda679 --- /dev/null +++ b/Java/tests/syntax_test_java.java @@ -0,0 +1,10549 @@ +// SYNTAX TEST "Packages/Java/Java.sublime-syntax" + +/****************************************************************************** + * Comment Tests + *****************************************************************************/ + +// Comment +// <- comment.line.double-slash.java punctuation.definition.comment.java + // <- comment.line.double-slash.java punctuation.definition.comment.java +//^^^^^^^^^ comment.line.double-slash.java - punctuation + +/////////////////////////////////////////////////////////////////////////////// +// <- comment.line.double-slash.java punctuation.definition.comment.java +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash.java punctuation.definition.comment.java + +/// Comment /////////////////////////////////////////////////////////////////// +// <- comment.line.double-slash.java punctuation.definition.comment.java +//^ comment.line.double-slash.java punctuation.definition.comment.java +// ^^^^^^^^^ comment.line.double-slash.java - punctuation +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash.java punctuation.definition.comment.java + + /**/ /***/ /****/ /* **/ +//^ - comment +// ^^^^ comment.block.empty.java punctuation.definition.comment.java +// ^ - comment +// ^^^^^ comment.block.empty.java punctuation.definition.comment.java +// ^ - comment +// ^^^^^^ comment.block.empty.java punctuation.definition.comment.java +// ^^ comment.block.java punctuation.definition.comment.begin.java +// ^ comment.block.java - punctuation +// ^^^ comment.block.java punctuation.definition.comment.end.java +// ^ - comment + + /* +//^ - comment +// ^^ comment.block.java punctuation.definition.comment.begin.java +// ^ comment.block.java - punctuation + * +// ^ comment.block.java punctuation.definition.comment.java +// ^ comment.block.java - punctuation + */ +// ^ comment.block.java - punctuation +// ^^ comment.block.java punctuation.definition.comment.end.java +// ^ - comment + +/****************************************************************************** + * JavaDoc Tests + *****************************************************************************/ + + /** This is javadoc, not a simple comment */ +//^^^ punctuation.definition.comment.begin.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation.java +// ^^ punctuation.definition.comment.end.java + + /** +//^^^ comment.block.documentation.java punctuation.definition.comment.begin.java + * Description of some sort. +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation.java + */ +// ^^ comment.block.documentation.java punctuation.definition.comment.end.java + + /** + *

    Description that starts with tag +// ^^^ comment.block.documentation.java meta.tag + */ + + /** One-liner with tags */ +// ^^^ comment.block.documentation.java meta.tag +// ^^^ comment.block.documentation.java meta.tag + + /** @param onFirstLine @param +//^^^ comment.block.documentation.java punctuation.definition.comment.begin.java +// ^^^^^^ meta.tag.block.javadoc entity.name.tag.documentation.javadoc +// ^^^^^^ - entity.name.tag.documentation.javadoc + * @param normal @param +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^^^^^^ meta.tag.block.javadoc entity.name.tag.documentation.javadoc +// ^^^^^^ - entity.name.tag.documentation.javadoc + * +// ^ comment.block.documentation.java punctuation.definition.comment.java + @param withoutAsterisk @param +// ^^^^^^ meta.tag.block.javadoc entity.name.tag.documentation.javadoc +// ^^^^^^ - entity.name.tag.documentation.javadoc + */ +// ^^ comment.block.documentation.java punctuation.definition.comment.end.java + + /** + * Parameters + * + * @param paramName Some description +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^^^^^^ meta.tag.block.javadoc entity.name.tag.documentation.javadoc +// ^^^^^^^^^ variable.parameter.javadoc + * that spans several lines. +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^^^ meta.tag +// ^^^^ meta.tag +// ^ punctuation.definition.comment.java + * + * @param + * paramName1 +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^^^^^^^^^^ variable.parameter.javadoc + * Parameter description + * + * @param + * paramName2 +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^^^^^^^^^^ variable.parameter.javadoc + * + * @param + * @param + * paramName3 +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^^^^^^^^^^ variable.parameter.javadoc + */ +// ^^ comment.block.documentation.java punctuation.definition.comment.end.java + + /** Not a @param tag */ +// ^^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation.java +// ^^^^^^ - entity.name.tag.documentation.javadoc + + /** + * Code blocks +// ^ comment.block.documentation.java punctuation.definition.comment.java + * + * {@code} {@literal} +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^ - meta.tag +// ^^^^^^^ meta.tag.inline.javadoc +// ^ - meta.tag +// ^^^^^^^^^^ meta.tag.inline.javadoc +// ^ - meta.tag +// ^ punctuation.definition.tag.begin.javadoc +// ^^^^^ entity.name.tag.documentation.javadoc +// ^ punctuation.definition.tag.end.javadoc +// ^ punctuation.definition.tag.begin.javadoc +// ^^^^^^^^ entity.name.tag.documentation.javadoc +// ^ punctuation.definition.tag.end.javadoc + * + * {@code List lst = new ArrayList<>()} +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^ - meta.tag +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.inline.javadoc +// ^ - meta.tag +// ^ punctuation.definition.tag.begin.javadoc +// ^^^^^ entity.name.tag.documentation.javadoc +// ^ - markup.raw.javadoc +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.raw.javadoc +// ^ punctuation.definition.tag.end.javadoc + * {@code text} +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^ - meta.tag +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.inline.javadoc +// ^ - meta.tag +// ^ punctuation.definition.tag.begin.javadoc +// ^^^^^ entity.name.tag.documentation.javadoc +// ^ - markup.raw.javadoc +// ^^^^^^^^^^^^^^^^^^^^^^^ markup.raw.javadoc +// ^ punctuation.definition.tag.end.javadoc + * + * Multiline, line break in content: {@code x + y +// ^^^^^^^^^^^^ meta.tag.inline.javadoc +// ^^^^^ markup.raw.javadoc +// ^ - meta.tag - markup.raw.javadoc + * = z} +// ^ comment.block.documentation.java punctuation.definition.comment.java +//^^^ - meta.tag - markup.raw.javadoc +// ^^^ meta.tag.inline.javadoc markup.raw.javadoc +// ^ meta.tag.inline.javadoc - markup.raw + * + * Multiline, line break before content: {@literal +// ^ - markup.raw.javadoc + * x + y = z} +// ^ comment.block.documentation.java punctuation.definition.comment.java +//^^^ - meta.tag - markup.raw.javadoc +// ^^^^^^^^^ meta.tag.inline.javadoc markup.raw.javadoc +// ^ meta.tag.inline.javadoc - markup.raw + * + * Bracket balancing: {@code int[][] a = {{1, 2, 3}, {4, 5}}} +// ^ punctuation.definition.tag.begin.javadoc +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.raw.javadoc +// ^ punctuation.definition.tag.end.javadoc + * + * Bracket balancing with line break: {@code int[][] a = { +// ^^^^^^^^^^^^^^^^^^^^ meta.tag.inline.javadoc +// ^ punctuation.definition.tag.begin.javadoc +// ^^^^^^^^^^^^^ markup.raw.javadoc +// ^ - markup.raw.javadoc + * {1, 2, 3}, {4, 5}}} +// ^ comment.block.documentation.java punctuation.definition.comment.java +//^^^ - meta.tag - markup.raw.javadoc +// ^^^^^^^^^^^^^^^^^^ meta.tag.inline.javadoc markup.raw.javadoc +// ^ meta.tag.inline.javadoc - markup.raw +// ^ - meta.tag +// ^ punctuation.definition.tag.end.javadoc + */ + + /** + * Inline tags with references + * + * {@link} {@linkplain} +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^ - meta.tag +// ^^^^^^^ meta.tag.inline.javadoc +// ^ - meta.tag +// ^^^^^^^^^^^^ meta.tag.inline.javadoc +// ^ - meta.tag +// ^ punctuation.definition.tag.begin.javadoc +// ^^^^^ entity.name.tag.documentation.javadoc +// ^ punctuation.definition.tag.end.javadoc +// ^ punctuation.definition.tag.begin.javadoc +// ^^^^^^^^^^ entity.name.tag.documentation.javadoc +// ^ punctuation.definition.tag.end.javadoc + * + * {@link Class} {@linkplain org.package.Class} {@link org.package.Class.NestedClass} +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^ - meta.tag +// ^^^^^^^^^^^^^ meta.tag.inline.javadoc +// ^ - meta.tag +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.inline.javadoc +// ^ - meta.tag +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.inline.javadoc +// ^ - meta.tag +// ^ punctuation.definition.tag.begin.javadoc +// ^^^^^ entity.name.tag.documentation.javadoc +// ^^^^^ markup.underline.link.javadoc +// ^ punctuation.definition.tag.end.javadoc +// ^ punctuation.definition.tag.begin.javadoc +// ^^^^^^^^^ entity.name.tag.documentation.javadoc +// ^^^^^^^^^^^^^^^^^ markup.underline.link.javadoc +// ^ punctuation.definition.tag.end.javadoc +// ^ punctuation.definition.tag.begin.javadoc +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.javadoc +// ^ punctuation.definition.tag.end.javadoc + * + * Method separator: + * {@link package.Class#method} {@linkplain #method} +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^ - meta.tag +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.inline.javadoc +// ^ - meta.tag +// ^^^^^^^^^^^^^^^^^^^^ meta.tag.inline.javadoc +// ^ - meta.tag +// ^^^^^^^^ - markup.underline +// ^^^^^^^^^^^^^^^^^^^^ markup.underline.link.javadoc +// ^^^^^^^^^^^^^^ - markup.underline +// ^^^^^^^ markup.underline.link.javadoc +// ^^ - markup.underline + * + * Brackets: + * {@link Class#method(Type, Type)} {@link #method(Type, Type) label} +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^ - meta.tag +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.inline.javadoc +// ^ - meta.tag +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.inline.javadoc +// ^ - meta.tag +// ^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.javadoc +// ^^^^^^^^^^^^^^^^^^^ markup.underline.link.javadoc +// ^^^^^ meta.label.javadoc - markup.underline.link.javadoc + * + * Line breaks: + * {@link Class#method(Type, + * Type, Type) label} +// ^ comment.block.documentation.java punctuation.definition.comment.java +//^^^ - meta.tag.inline - markup.underline +// ^^^^^^^^^^^^^^^^^^ meta.tag.inline.javadoc +// ^ - meta.tag +// ^^^^^^^^^^^ markup.underline.link.javadoc +// ^ - markup +// ^^^^^ meta.label.javadoc +// ^^ - markup + * + * {@link + * Class#method(Type, Type, Type) label} +// ^ comment.block.documentation.java punctuation.definition.comment.java +//^^^ - meta.tag.inline - markup.underline +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.inline.javadoc +// ^ - meta.tag +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.javadoc +// ^ - markup +// ^^^^^ meta.label.javadoc +// ^^ - markup + * + * {@link Class#method(Type, Type, Type) + * label} +// ^ comment.block.documentation.java punctuation.definition.comment.java +//^^^ - meta.tag.inline - markup.underline +// ^^^^^^ meta.tag.inline.javadoc +// ^ - meta.tag +// ^^^^^ meta.label.javadoc +// ^^ - markup + * + * Tags in label: + * {@link Class#method(Type, Type, Type) label} +// ^^^^^^^^^^^^ meta.label.javadoc +// ^^^ meta.tag +// ^^^^ meta.tag + * + * {@value} {@value #SOME_CONSTANT} {@value package.Class#SOME_CONSTANT} +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^ - meta.tag +// ^^^^^^^^ meta.tag.inline.javadoc +// ^ - meta.tag +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.inline.javadoc +// ^ - meta.tag +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.inline.javadoc +// ^ - meta.tag +// ^ punctuation.definition.tag.begin.javadoc +// ^^^^^^ entity.name.tag.documentation.javadoc +// ^ punctuation.definition.tag.end.javadoc +// ^ punctuation.definition.tag.begin.javadoc +// ^^^^^^ entity.name.tag.documentation.javadoc +// ^^^^^^^^^^^ markup.underline.link.javadoc +// ^ punctuation.definition.tag.end.javadoc +// ^ punctuation.definition.tag.begin.javadoc +// ^^^^^^ entity.name.tag.documentation.javadoc +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.javadoc +// ^ punctuation.definition.tag.end.javadoc + */ + + /** + * Block tags with reference + * + * @see Class#method(Type, Type) +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^^^^ meta.tag.block.javadoc entity.name.tag.documentation.javadoc +// ^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.javadoc + * + * @see java.util.stream +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^^^^ meta.tag.block.javadoc entity.name.tag.documentation.javadoc +// ^^^^^^^^^^^^^^^^^^^^^^^ - markup.underline.link.javadoc +// ^^^ meta.tag +// ^^^ meta.tag + * + * @see 'java.util.stream' +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^^^^ meta.tag.block.javadoc entity.name.tag.documentation.javadoc +// ^^^^^^^^^^^^^^^^^^ - markup.underline.link.javadoc + * + * @see https://wiki.xmldation.com/Support/Validator/ETagUnterminated +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^^^^ meta.tag.block.javadoc entity.name.tag.documentation.javadoc +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.javadoc + * + * @throws IOException +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^^^^^^^ meta.tag.block.javadoc entity.name.tag.documentation.javadoc +// ^^^^^^^^^^^ markup.underline.link.javadoc + + * @throws IOException because IOException +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^^^^^^^ meta.tag.block.javadoc entity.name.tag.documentation.javadoc +// ^^^^^^^^^^^ markup.underline.link.javadoc +// ^^^^^^^^^^^^^^^^^^^ - markup.underline.link.javadoc + * + * @unknown {@code test} +// ^ comment.block.documentation.java punctuation.definition.comment.java +// ^^^^^^^^ - keyword +// ^^^^^^^^^^^^ meta.tag.inline.javadoc + */ +// ^^ comment.block.documentation.java punctuation.definition.comment.end.java + + /** + * Leading asterisk with space +// ^ punctuation.definition.comment.java + *Without space +// ^ punctuation.definition.comment.java + *

    Before tag +// ^ punctuation.definition.comment.java + *{@value} Before inline tag +// ^ punctuation.definition.comment.java + *@return Before block tag +// ^ punctuation.definition.comment.java + */ + + /** + * class {@literal Set>} +// ^^^^^^ meta.tag.html +// ^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag.html +// ^^^^^^^ meta.tag.html + */ + + /** + * Levenshtein distance algorithm from http://www.merriampark.com/ld.htm +//^^^ comment.block.documentation.java - meta.tag +// ^ punctuation.definition.comment.java +// ^ meta.tag punctuation.definition.tag.end.html + * +//^^^^^^^^^^^^^ comment.block.documentation.java +// ^ punctuation.definition.comment.java +// ^^^^^^^^^ meta.tag + */ + + /** + * Unclosed html tag:

  • +//<- meta.class.java keyword.declaration.class.java +//^^^ meta.class.java - meta.class meta.class - meta.generic +// ^^^^^^^^^^^^ meta.class.identifier.java - meta.class meta.class - meta.generic +// ^^^^^^^^^^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java +// ^ punctuation.section.generic.begin.java +// ^^^^^^^ variable.parameter.type.java +// ^^^^^^^ storage.modifier.extends.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java + +class generictest +//<- meta.class.java keyword.declaration.class.java +//^^^ meta.class.java - meta.class meta.class - meta.generic +// ^^^^^^^^^^^^ meta.class.identifier.java - meta.class meta.class - meta.generic +// ^^^^^^^^^^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java +// ^ punctuation.section.generic.begin.java +// ^^^^^^^ variable.parameter.type.java +// ^^^^^^^ storage.modifier.extends.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java + +class GenericTest +//<- meta.class.java keyword.declaration.class.java +//^^^ meta.class.java - meta.class meta.class - meta.generic +// ^^^^^^^^^^^^ meta.class.identifier.java - meta.class meta.class - meta.generic +// ^^^^^^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java +// ^ punctuation.section.generic.begin.java +// ^^^ invalid.illegal.unexpected-keyword.java +// ^^^^^^^ storage.modifier.extends.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java + +class GenericTest +//<- meta.class.java keyword.declaration.class.java +//^^^ meta.class.java - meta.class meta.class - meta.generic +// ^^^^^^^^^^^^ meta.class.identifier.java - meta.class meta.class - meta.generic +// ^^^^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java +// ^ punctuation.section.generic.begin.java +// ^ invalid.illegal.unexpected-keyword.java +// ^^^^^^^ storage.modifier.extends.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java + +class GenericTest +//<- meta.class.java keyword.declaration.class.java +//^^^ meta.class.java - meta.class meta.class - meta.generic +// ^^^^^^^^^^^^ meta.class.identifier.java - meta.class meta.class - meta.generic +// ^^^^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java +// ^ punctuation.section.generic.begin.java +// ^ invalid.illegal.unexpected-keyword.java +// ^^^^^^^ storage.modifier.extends.java +// ^^^ invalid.illegal.unexpected-keyword.java +// ^ punctuation.section.generic.end.java + +class GenericTest +//<- meta.class.java keyword.declaration.class.java +//^^^ meta.class.java - meta.class meta.class - meta.generic +// ^^^^^^^^^^^^ meta.class.identifier.java - meta.class meta.class - meta.generic +// ^^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java +// ^ punctuation.section.generic.begin.java +// ^ variable.parameter.type.java +// ^^^^^ invalid.illegal.unexpected-keyword.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java + +class GenericTest +//<- meta.class.java keyword.declaration.class.java +//^^^ meta.class.java - meta.class meta.class - meta.generic +// ^^^^^^^^^^^^ meta.class.identifier.java - meta.class meta.class - meta.generic +// ^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java +// ^ punctuation.section.generic.begin.java +// ^^^^^ invalid.illegal.unexpected-keyword.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java + +class GenericTest<@Anno A extends @Anno com . @Anno Foo & @Anno Foo . @Anno Bar> +//<- meta.class.java keyword.declaration.class.java +//^^^ meta.class.java - meta.class meta.class - meta.generic +// ^^^^^^^^^^^^ meta.class.identifier.java - meta.class meta.class - meta.generic +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java - meta.generic meta.generic +// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java meta.generic.java +// ^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java - meta.generic meta.generic +// ^^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java meta.generic.java +// ^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java - meta.generic meta.generic +// ^^^^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java meta.generic.java +// ^ meta.class.identifier.java meta.generic.declaration.java - meta.generic meta.generic +// ^ meta.class.identifier.java - meta.generic +// ^ punctuation.section.generic.begin.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^ variable.parameter.type.java +// ^^^^^^^ storage.modifier.extends.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.separator.comma.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ keyword.operator.logical.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ variable.language.wildcard.java +// ^^^^^ keyword.declaration.super.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^^^^^^^ invalid.illegal.unexpected-keyword.java +// ^^^ storage.type.class.java +// ^^ punctuation.section.generic.end.java + +class generictest<@anno a extends @anno com . @anno foo & @anno foo . @anno bar> +//<- meta.class.java keyword.declaration.class.java +//^^^ meta.class.java - meta.class meta.class - meta.generic +// ^^^^^^^^^^^^ meta.class.identifier.java - meta.class meta.class - meta.generic +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java - meta.generic meta.generic +// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java meta.generic.java +// ^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java - meta.generic meta.generic +// ^^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java meta.generic.java +// ^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java - meta.generic meta.generic +// ^^^^^^^^^^^^^^^ meta.class.identifier.java meta.generic.declaration.java meta.generic.java +// ^ meta.class.identifier.java meta.generic.declaration.java - meta.generic meta.generic +// ^ meta.class.identifier.java - meta.generic +// ^ punctuation.section.generic.begin.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^ variable.parameter.type.java +// ^^^^^^^ storage.modifier.extends.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.separator.comma.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ keyword.operator.logical.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ variable.language.wildcard.java +// ^^^^^ keyword.declaration.super.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^^^^^^^ invalid.illegal.unexpected-keyword.java +// ^^^ storage.type.class.java +// ^^ punctuation.section.generic.end.java + +class GenericTest extends Foo {} +//<- meta.class.java keyword.declaration.class.java +//^^^ meta.class.java - meta.class meta.class +// ^^^^^^^^^^^^ meta.class.identifier.java - meta.generic - meta.class meta.class +// ^^^ meta.class.identifier.java meta.generic.declaration.java - meta.class meta.class +// ^ meta.class.identifier.java - meta.generic - meta.class meta.class +// ^^^^^^^^^^^ meta.class.extends.java - meta.generic - meta.class meta.class +// ^^^^^^^^^^^^^ meta.class.extends.java meta.generic.java - meta.class meta.class +// ^ meta.class.extends.java - meta.generic - meta.class meta.class +// ^^ meta.class.java meta.block.java - meta.class meta.class +//^^^ keyword.declaration.class.java +// ^ - entity - keyword - storage +// ^^^^^^^^^^^ entity.name.class.java +// ^^^^ - entity - keyword - storage +// ^ punctuation.section.generic.begin.java +// ^ variable.parameter.type.java +// ^ punctuation.section.generic.end.java +// ^^^^^^^ storage.modifier.extends.java +// ^ - entity - keyword - storage +// ^^^ entity.other.inherited-class.java +// ^ punctuation.section.generic.begin.java +// ^ variable.language.wildcard.java +// ^^^^^^^ storage.modifier.extends.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ - entity - keyword - storage +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + +class GenericTest extends @Anno com . @Anno Foo<@Anno ? extends @Anno SuperClass . @Anno SubClass & @Anno OtherClass>, @Anno OuterClass {} +//^^^ meta.class.java - meta.class meta.class +// ^^^^^^^^^^^^ meta.class.identifier.java - meta.generic - meta.class meta.class +// ^^^ meta.class.identifier.java meta.generic.declaration.java - meta.class meta.class +// ^ meta.class.identifier.java - meta.generic - meta.class meta.class +// ^^^^^^^^^^^^^^ meta.class.extends.java - meta.class meta.class - meta.generic - meta.path +// ^^^^^^^^^^^^^^^ meta.class.extends.java meta.path.java - meta.class meta.class +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.extends.java meta.generic.java - meta.class meta.class +// ^^^^^^^^^^^^^^^^^^^ meta.class.extends.java - meta.class meta.class - meta.generic +// ^^ meta.class.java meta.block.java - meta.class meta.class +//^^^ keyword.declaration.class.java +// ^ - entity - keyword - storage +// ^^^^^^^^^^^ entity.name.class.java +// ^^^^ - entity - keyword - storage +// ^ punctuation.section.generic.begin.java +// ^ variable.parameter.type.java +// ^ punctuation.section.generic.end.java +// ^^^^^^^ storage.modifier.extends.java +// ^ - entity - keyword - storage +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^ entity.other.inherited-class.java +// ^ punctuation.section.generic.begin.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^ variable.language.wildcard.java +// ^^^^^^^ storage.modifier.extends.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^^^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^^^^^^ storage.type.class.java +// ^ keyword.operator.logical.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.separator.comma.java +// ^ - entity - keyword - storage - variable +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^ - entity - keyword - storage - variable +// ^^^^^^^^^^ entity.other.inherited-class.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + +class ImplementsTest implements +//^^^ meta.class.java - meta.class meta.class +// ^^^^^^^^^^^^^^^^ meta.class.identifier.java - meta.class meta.class +// ^^^^^^^^^^^ meta.class.implements.java - meta.class meta.class +//^^^ keyword.declaration.class.java +// ^ - entity - keyword - storage +// ^^^^^^^^^^^^^^ entity.name.class.java +// ^ - entity - keyword - storage +// ^^^^^^^^^^ storage.modifier.implements.java + +class ImplementsTest implements Foo {} +//^^^ meta.class.java - meta.class meta.class +// ^^^^^^^^^^^^^^^^ meta.class.identifier.java - meta.class meta.class +// ^^^^^^^^^^^^^^^ meta.class.implements.java - meta.class meta.class +// ^^ meta.class.java meta.block.java - meta.class meta.class +//^^^ keyword.declaration.class.java +// ^ - entity - keyword - storage +// ^^^^^^^^^^^^^^ entity.name.class.java +// ^ - entity - keyword - storage +// ^^^^^^^^^^ storage.modifier.implements.java +// ^^^ entity.other.inherited-class.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + +class lowercasetest implements fully.qualified.other { +//^^^ meta.class.java - meta.class meta.class +// ^^^^^^^^^^^^^^^^^^ meta.class.identifier.java - meta.class meta.class +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.implements.java - meta.class meta.class +// ^^^^^^^^^^^^^^^^^^^^^ meta.path.java +// ^^ meta.class.java meta.block.java - meta.class meta.class +//^^^ keyword.declaration.class.java +// ^ - entity - keyword - storage +// ^^^^^^^^^^^^^ entity.name.class.java +// ^ punctuation.section.generic.begin.java +// ^ variable.parameter.type.java +// ^ punctuation.section.generic.end.java +// ^ - entity - keyword - storage +// ^^^^^^^^^^ storage.modifier.implements.java +// ^^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^ entity.other.inherited-class.java +// ^^^ meta.generic.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +} +// <- punctuation.section.block.end.java + +volatile class extends implements {} +//<- meta.class.java invalid.illegal.unexpected-keyword.java +//^^^^^^^^^^^^ meta.class.java - meta.class meta.class +//^^^^^^ invalid.illegal.unexpected-keyword.java +// ^ meta.class.identifier.java - meta.class meta.class +// ^^^^^^^^ meta.class.extends.java - meta.class meta.class +// ^^^^^^^^^^^ meta.class.implements.java - meta.class meta.class +// ^^ meta.class.java meta.block.java - meta.class meta.class +// ^^^ +// ^ - entity - keyword - storage +// ^^^^^^^ storage.modifier.extends.java +// ^ - entity - keyword - storage +// ^^^^^^^^^^ storage.modifier.implements.java +// ^ - entity - keyword - storage +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + +class ExtendsAndImplementsTest extends Foo implements Bar, OtherBar {} +//^^^ meta.class.java - meta.class meta.class +// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.identifier.java - meta.class meta.class +// ^^^^^^^^^^^^ meta.class.extends.java - meta.class meta.class +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.implements.java - meta.class meta.class +// ^^ meta.class.java meta.block.java - meta.class meta.class +//^^^ keyword.declaration.class.java +// ^ - entity - keyword - storage +// ^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.class.java +// ^ - entity - keyword - storage +// ^^^^^^^ storage.modifier.extends.java +// ^ - entity - keyword - storage +// ^^^ entity.other.inherited-class.java +// ^ - entity - keyword - storage +// ^^^^^^^^^^ storage.modifier.implements.java +// ^ - entity - keyword - storage +// ^^^ entity.other.inherited-class.java +// ^^^^^ meta.generic.java +// ^ punctuation.separator.comma.java +// ^^ - entity - keyword - storage +// ^^^^^^^^ entity.other.inherited-class.java +// ^ - entity - keyword - storage +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + +class ExtendsAndImplementsTest extends Foo, bar implements bar, OtherBar {} +//^^^ meta.class.java - meta.class meta.class +// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.identifier.java - meta.class meta.class +// ^^^^^^^^^^^^^^^^^ meta.class.extends.java - meta.class meta.class +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.implements.java - meta.class meta.class +// ^^ meta.class.java meta.block.java - meta.class meta.class +//^^^ keyword.declaration.class.java +// ^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.class.java +// ^^^^^^^ storage.modifier.extends.java +// ^^^ entity.other.inherited-class.java +// ^ punctuation.separator.comma.java +// ^^^ entity.other.inherited-class.java +// ^^^^^^^^^^ storage.modifier.implements.java +// ^^^ entity.other.inherited-class.java +// ^^^^^ meta.generic.java +// ^ punctuation.separator.comma.java +// ^^^^^^^^ entity.other.inherited-class.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + +class AnyClass{AnyClass(){}} +//^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.class meta.class +//^^^ meta.class.java +// ^^^^^^^^^ meta.class.identifier.java +// ^^^^^^^^^^^^^^ meta.class.java meta.block.java +// ^^^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java meta.group.java +// ^^ meta.function.java meta.block.java +//^^^ keyword.declaration.class.java +// ^^^^^^^^ entity.name.class.java +// ^ punctuation.section.block.begin.java +// ^^^^^^^^ entity.name.function.constructor.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^^ punctuation.section.block.end.java + +class anyclass{anyclass(){}} +//^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.class meta.class +//^^^ meta.class.java +// ^^^^^^^^^ meta.class.identifier.java +// ^^^^^^^^^^^^^^ meta.class.java meta.block.java +// ^^^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java meta.group.java +// ^^ meta.function.java meta.block.java +//^^^ keyword.declaration.class.java +// ^^^^^^^^ entity.name.class.java +// ^ punctuation.section.block.begin.java +// ^^^^^^^^ entity.name.function.constructor.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^^ punctuation.section.block.end.java + +class AnyClass { // comment +//^^^ meta.class.java keyword.declaration.class.java +// ^^^^^^^^^^ meta.class.identifier.java +// ^^^^^^^^^^^^^ meta.class.java meta.block.java +// ^^^^^^^^ entity.name.class.java +// ^ punctuation.section.block.begin.java +// ^^^^^^^^^^^^ comment.line.double-slash.java + + const class NestedClass { +// ^^^^^ invalid.illegal.keyword.java +// ^^^^^ meta.class.java meta.block.java meta.class.java keyword.declaration.class.java +// ^^^^^^^^^^^^^ meta.class.java meta.block.java meta.class.identifier.java +// ^^ meta.class.java meta.block.java meta.class.java meta.block.java +// ^^^^^^^^^^^ entity.name.class.java +// ^ punctuation.section.block.begin.java + + void declareLocalClasses() { + + class +// ^^^^^ meta.class.java meta.class.java meta.class.java +// ^ meta.class.java meta.class.java meta.class.identifier.java +// ^^^^^ keyword.declaration.class.java + + class LocalClass +// ^^^^^ meta.class.java meta.class.java meta.class.java +// ^^^^^^^^^^^^ meta.class.java meta.class.java meta.class.identifier.java +// ^^^^^ keyword.declaration.class.java +// ^^^^^^^^^^ entity.name.class.java + + static class LocalClass +// ^^^^^^^^^^^^ meta.class.java meta.class.java meta.class.java +// ^^^^^^^^^^^^ meta.class.java meta.class.java meta.class.identifier.java +// ^^^^^^ storage.modifier.java +// ^^^^^ keyword.declaration.class.java +// ^^^^^^^^^^ entity.name.class.java + + final class LocalClass extends OtherClass { +// ^^^^^^^^^^^ meta.class.java meta.class.java meta.class.java +// ^^^^^^^^^^^^ meta.class.java meta.class.java meta.class.identifier.java +// ^^^^^^^^^^^^^^^^^^^ meta.class.java meta.class.java meta.class.extends.java +// ^^ meta.class.java meta.class.java meta.class.java meta.block.java +// ^^^^^ storage.modifier.java +// ^^^^^ keyword.declaration.class.java +// ^^^^^^^^^^ entity.name.class.java +// ^^^^^^^ storage.modifier.extends.java +// ^^^^^^^^^^ entity.other.inherited-class.java +// ^ punctuation.section.block.begin.java + public class LocalNestedClass; +// ^^^^^^^^^^^^ meta.class.java meta.class.java meta.class.java meta.class.java +// ^^^^^^^^^^^^^^^^^ meta.class.java meta.class.java meta.class.java meta.class.identifier.java +// ^^^^^^ storage.modifier.java +// ^^^^^ keyword.declaration.class.java +// ^^^^^^^^^^^^^^^^ entity.name.class.java +// ^ punctuation.terminator.java + } +// ^ punctuation.section.block.end.java + } +// ^ punctuation.section.block.end.java + + void classReferences() { + Foo.class; // comment +// ^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^^ variable.language.class.java - storage.type.java +// ^ punctuation.terminator.java +// ^^^^^^^^^^^ comment.line.double-slash.java + super.class; +// ^^^^^ variable.language.super.java +// ^ punctuation.accessor.dot.java +// ^^^^^ variable.language.class.java - storage.type.java +// ^ punctuation.terminator.java + + this.class; +// ^^^^ variable.language.this.java +// ^ punctuation.accessor.dot.java +// ^^^^^ variable.language.class.java - storage.type.java +// ^ punctuation.terminator.java + + this +// ^^^^ variable.language.this.java + /**/ . +// ^^^^ comment.block.empty.java +// ^ punctuation.accessor.dot.java + /**/ class +// ^^^^ comment.block.empty.java +// ^^^^^ variable.language.class.java - storage.type.java + /**/ ; +// ^^^^ comment.block.empty.java +// ^ punctuation.terminator.java + } + } +// ^ meta.class.java meta.block.java meta.class.java meta.block.java punctuation.section.block.end.java +// ^ meta.class.java meta.block.java - meta.class meta.class + + class SubClass extends AbstractClass { +// ^^^^^ meta.class.java meta.block.java meta.class.java +// ^^^^^^^^^^ meta.class.java meta.block.java meta.class.identifier.java +// ^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.class.extends.java +// ^^ meta.class.java meta.block.java meta.class.java meta.block.java +// ^^^^^ keyword.declaration.class.java +// ^^^^^^^^ entity.name.class.java +// ^^^^^^^ storage.modifier.extends.java +// ^^^^^^^^^^^^^ entity.other.inherited-class.java +// ^ punctuation.section.block.begin.java + } +// ^ meta.class.java meta.block.java meta.class.java meta.block.java punctuation.section.block.end.java + + class subclass extends abstractclass { +// ^^^^^ meta.class.java meta.block.java meta.class.java +// ^^^^^^^^^^ meta.class.java meta.block.java meta.class.identifier.java +// ^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.class.extends.java +// ^^ meta.class.java meta.block.java meta.class.java meta.block.java +// ^^^^^ keyword.declaration.class.java +// ^^^^^^^^ entity.name.class.java +// ^^^^^^^ storage.modifier.extends.java +// ^^^^^^^^^^^^^ entity.other.inherited-class.java +// ^ punctuation.section.block.begin.java + } +// ^ meta.class.java meta.block.java meta.class.java meta.block.java punctuation.section.block.end.java + + class SubClass extends AbstractClass.NestedClass { +// ^^^^^ meta.class.java meta.block.java meta.class.java +// ^^^^^^^^^^ meta.class.java meta.block.java meta.class.identifier.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.class.extends.java +// ^^ meta.class.java meta.block.java meta.class.java meta.block.java +// ^^^^^ keyword.declaration.class.java +// ^^^^^^^^ entity.name.class.java +// ^^^^^^^ storage.modifier.extends.java +// ^^^^^^^^^^^^^ entity.other.inherited-class.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^^^ entity.other.inherited-class.java +// ^ punctuation.section.block.begin.java + } +// ^ meta.class.java meta.block.java meta.class.java meta.block.java punctuation.section.block.end.java + + class subclass extends abstractclass.nestedclass { +// ^^^^^ meta.class.java meta.block.java meta.class.java +// ^^^^^^^^^^ meta.class.java meta.block.java meta.class.identifier.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.class.extends.java +// ^^ meta.class.java meta.block.java meta.class.java meta.block.java +// ^^^^^ keyword.declaration.class.java +// ^^^^^^^^ entity.name.class.java +// ^^^^^^^ storage.modifier.extends.java +// ^^^^^^^^^^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^^^ entity.other.inherited-class.java +// ^ punctuation.section.block.begin.java + } +// ^ meta.class.java meta.block.java meta.class.java meta.block.java punctuation.section.block.end.java + + protected class SubClass extends fully.qualified +// ^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.class.java +// ^^^^^^^^^^ meta.class.java meta.block.java meta.class.identifier.java +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.class.extends.java +// ^^^^^^^^^^^^^^^^ meta.path.java +// ^^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^ variable.namespace.java + .name.AbstractClass { +// ^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.class.extends.java +// ^^^^^^^^^^^^^^^^^^^ meta.path.java +// ^ punctuation.accessor.dot.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^^^^^ entity.other.inherited-class.java + } +// ^ meta.class.java meta.block.java meta.class.java meta.block.java punctuation.section.block.end.java +} +//<- meta.class.java meta.block.java punctuation.section.block.end.java + +@Anno // comment +//<- meta.class.java meta.annotation.identifier.java punctuation.definition.annotation.java +public // comment +//<- meta.class.java storage.modifier.java +class // comment +//<- meta.class.java +TestClass // comment +//<- meta.class.identifier.java entity.name.class.java +extends // comment +//<- meta.class.extends.java storage.modifier.extends.java +MyClass, // comment +//<- meta.class.extends.java entity.other.inherited-class.java +FooBaz // comment +//<- meta.class.extends.java entity.other.inherited-class.java +implements // comment +//<- meta.class.implements.java storage.modifier.implements.java +Foo, // comment +//<- meta.class.implements.java entity.other.inherited-class.java +Bar // comment +//<- meta.class.implements.java entity.other.inherited-class.java +{ +//<- meta.class.java meta.block.java punctuation.section.block.begin.java +} +//<- meta.class.java meta.block.java punctuation.section.block.end.java + + +/****************************************************************************** + * Eumeration Declaration Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.9 + *****************************************************************************/ + +enum$ ; +// <- meta.variable.identifier.java variable.other.java +//^^^ meta.variable.identifier.java variable.other.java + +$enum ; +// <- meta.variable.identifier.java variable.other.java +//^^^ meta.variable.identifier.java variable.other.java + +enum +//<- meta.enum.java keyword.declaration.enum.java +//^^ meta.enum.java keyword.declaration.enum.java + +enum EnumTest +//<- meta.enum.java keyword.declaration.enum.java +//^^ meta.enum.java keyword.declaration.enum.java +// ^^^^^^^^^^ meta.enum.identifier.java +// ^ - entity - keyword - storage +// ^^^^^^^^ entity.name.enum.java +// ^ - entity + +enum EnumTest {} +//<- meta.enum.java keyword.declaration.enum.java +//^^ meta.enum.java keyword.declaration.enum.java +// ^^^^^^^^^^ meta.enum.identifier.java +// ^^ meta.enum.java meta.block.java +// ^ - entity - keyword - storage +// ^^^^^^^^ entity.name.enum.java +// ^ - entity +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + +public enum EnumTest { int {} } +//^^^^^^^^^ meta.enum.java +// ^^^^^^^^^^ meta.enum.identifier.java +// ^^^^^^^^^^ meta.enum.java meta.block.java +// ^^^^ +// ^ - entity - keyword - storage +// ^^^^^^^^ entity.name.enum.java +// ^ - entity - punctuation +// ^ punctuation.section.block.begin.java +// ^^^ storage.type.primitive.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java +// ^ punctuation.section.block.end.java + +public enum EnumTest {FOO, BAR} +//^^^^^^^^^ meta.enum.java +// ^^^^^^^^^^ meta.enum.identifier.java +// ^^^^^^^^^^ meta.enum.java meta.block.java +// ^^^^ +// ^ - entity - keyword - storage +// ^^^^^^^^ entity.name.enum.java +// ^ - entity - punctuation +// ^ punctuation.section.block.begin.java +// ^^^ meta.constant.identifier.java entity.name.constant.java +// ^ punctuation.separator.comma.java +// ^^^ meta.constant.identifier.java entity.name.constant.java +// ^ punctuation.section.block.end.java + +public enum EnumTest permits OtherClass {FOO, BAR} +//^^^^^^^^^ meta.enum.java +// ^^^^^^^^^^ meta.enum.identifier.java +// ^^^^^^^^^^^^^^^^^^^ meta.enum.permits.java +// ^^^^^^^^^^ meta.enum.java meta.block.java +// ^^^^ +// ^ - entity - keyword - storage +// ^^^^^^^^ entity.name.enum.java +// ^ - entity - punctuation +// ^^^^^^^ invalid.illegal.unexpected-keyword.java +// ^^^^^^^^^^ entity.other.inherited-class.java +// ^ punctuation.section.block.begin.java +// ^^^ meta.constant.identifier.java entity.name.constant.java +// ^ punctuation.separator.comma.java +// ^^^ meta.constant.identifier.java entity.name.constant.java +// ^ punctuation.section.block.end.java + +public enum FooEnum { +//^^^^^^^^^ meta.enum.java +// ^^^^^^^^^ meta.enum.identifier.java +// ^^ meta.enum.java meta.block.java +//^^^^ storage.modifier.java +// ^^^^ +// ^^^^^^^ entity.name.enum.java +// ^ punctuation.section.block.begin.java + FOO; +//^^^ meta.constant.identifier.java entity.name.constant.java +// ^ punctuation.terminator.java - meta.constant +} +// <- meta.enum.java punctuation.section.block.end.java + +public enum FooBarEnum { +//^^^^^^^^^ meta.enum.java +// ^^^^^^^^^^^^ meta.enum.identifier.java +// ^^ meta.enum.java meta.block.java +// ^^^^ +// ^^^^^^^^^^ entity.name.enum.java +// ^ punctuation.section.block.begin.java + FOO, +//^^^ meta.constant.identifier.java entity.name.constant.java +// ^ punctuation.separator.comma.java + BAR; +//^^^ meta.constant.identifier.java entity.name.constant.java +// ^ punctuation.terminator.java - meta.constant +} +// <- meta.enum.java punctuation.section.block.end.java + +public enum FooBarBazEnum { +//^^^^^^^^^ meta.enum.java +// ^^^^^^^^^^^^^^^ meta.enum.identifier.java +// ^^ meta.enum.java meta.block.java +// ^^^^ +// ^^^^^^^^^^^^^ entity.name.enum.java +// ^ punctuation.section.block.begin.java + FOO, // comment +//^^^ meta.constant.identifier.java entity.name.constant.java +// ^ punctuation.separator.comma.java +// ^^^^^^^^^^^ comment.line.double-slash.java + BAR, /* comment */ +//^^^ meta.constant.identifier.java entity.name.constant.java +// ^ punctuation.separator.comma.java +// ^^^^^^^^^^^^^ comment.block.java + BAZ // comment +//^^^ meta.constant.identifier.java entity.name.constant.java +// ^^^^^^^^^^^ comment.line.double-slash.java +} +// <- meta.enum.java punctuation.section.block.end.java + +protected enum IllegalTypeParam & T> {} +//<- meta.enum.java storage.modifier.java +//^^^^^^^^^^^^ meta.enum.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.enum.identifier.java +// ^^ meta.enum.java meta.block.java +//^^^^^^^ storage.modifier.java +// ^^^^ keyword.declaration.enum.java +// ^^^^^^^^^^^^^^^^ entity.name.enum.java +// ^^^^^^^^^^^^^^^^^^^^^^^ invalid.illegal.unexpected-type-parameters.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + +public enum TokenKind extends MyEnum, FooBaz> implements Foo, Bar { +//<- meta.enum.java storage.modifier.java +//^^^^^^^^^ meta.enum.java +// ^^^^^^^^^^^^^^ meta.enum.identifier.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.enum.extends.java +// ^^^^^^^^^^^^^^^^^^^^ meta.enum.implements.java +// ^^ meta.enum.java meta.block.java +//^^^^ storage.modifier.java +// ^^^^ +// ^^^^^^^^^ entity.name.enum.java +// ^^^ invalid.illegal.unexpected-type-parameters.java +// ^^^^^^^ invalid.illegal.unexpected-keyword.java +// ^^^^^^ entity.other.inherited-class.java +// ^ punctuation.separator.comma.java +// ^^^^^^ entity.other.inherited-class.java +// ^ punctuation.section.generic.begin.java +// ^^^^^^^^^^ meta.generic.java - meta.generic meta.generic +// ^ variable.language.wildcard.java +// ^^^^^ keyword.declaration.super.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^ meta.generic.java meta.generic.java +// ^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ meta.generic.java punctuation.section.generic.end.java - meta.generic meta.generic +// ^^^^^^^^^^ storage.modifier.implements.java +// ^^^ entity.other.inherited-class.java +// ^ punctuation.separator.comma.java +// ^^^ entity.other.inherited-class.java +// ^ punctuation.section.block.begin.java + + a, +// ^ meta.constant.identifier.java entity.name.constant.java - meta.constant meta.constant +// ^ punctuation.separator.comma.java - meta.constant + + a(1, 2, 3), +// ^ meta.constant.identifier.java entity.name.constant.java - meta.constant meta.constant +// ^^^^^^^^^ meta.constant.arguments.java meta.group.java - meta.constant meta.constant +// ^ punctuation.section.group.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.group.end.java +// ^ punctuation.separator.comma.java + + a +// ^ meta.constant.identifier.java entity.name.constant.java + (), +// ^ meta.constant.arguments.java meta.group.java punctuation.section.group.begin.java +// ^ meta.constant.arguments.java meta.group.java punctuation.section.group.end.java +// ^ punctuation.separator.comma.java + + a +// ^ meta.constant.identifier.java entity.name.constant.java + { +// ^^ meta.constant.java meta.block.java +// ^ punctuation.section.block.begin.java + }, +//^^^ meta.constant.java meta.block.java +// ^ punctuation.section.block.end.java +// ^ punctuation.separator.comma.java + + a { public void doSomething() { return; } }, +// ^^ meta.constant.identifier.java - meta.constant meta.constant +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.constant.java meta.block.java - meta.constant meta.constant +// ^^^^^^^ meta.function.modifier.java +// ^^^^^ meta.function.return-type.java +// ^^^^^^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java meta.group.java +// ^ meta.function.java +// ^^^^^^^^^^^ meta.function.java meta.block.java +// ^ entity.name.constant.java +// ^ punctuation.section.block.begin.java +// ^^^^^^ storage.modifier.java +// ^^^^ meta.function.return-type.java +// ^^^^^^ storage.modifier.java +// ^^^^ storage.type.void.java +// ^^^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^^^^^^ keyword.control.flow.return.java +// ^ punctuation.terminator.java +// ^ punctuation.section.block.end.java +// ^ punctuation.section.block.end.java +// ^ punctuation.separator.comma.java + + a ( 1 , 2 , 3 ) { public void doSomething() { return; } }, +// ^^ meta.constant.identifier.java - meta.constant meta.constant +// ^^^^^^^^^^^^^ meta.constant.arguments.java meta.group.java - meta.constant meta.constant +// ^ meta.constant.java - meta.constant meta.constant +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.constant.java meta.block.java - meta.constant meta.constant +// ^^^^^^^ meta.function.modifier.java +// ^^^^^ meta.function.return-type.java +// ^^^^^^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java meta.group.java +// ^ meta.function.java +// ^^^^^^^^^^^ meta.function.java meta.block.java +// ^ entity.name.constant.java +// ^ punctuation.section.group.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^^^^^^ storage.modifier.java +// ^^^^ storage.type.void.java +// ^^^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^^^^^^ keyword.control.flow.return.java +// ^ punctuation.terminator.java +// ^ punctuation.section.block.end.java +// ^ punctuation.section.block.end.java +// ^ punctuation.separator.comma.java + + A, +// ^ meta.constant.identifier.java entity.name.constant.java +// ^ punctuation.separator.comma.java + + A(1), +// ^ meta.constant.identifier.java entity.name.constant.java +// ^ meta.constant.arguments.java meta.group.java punctuation.section.group.begin.java +// ^ meta.constant.arguments.java meta.group.java meta.number.integer.decimal.java constant.numeric.value.java +// ^ meta.constant.arguments.java meta.group.java punctuation.section.group.end.java +// ^ punctuation.separator.comma.java + + A {}, +// ^^ meta.constant.identifier.java +// ^ entity.name.constant.java +// ^ meta.constant.java meta.block.java punctuation.section.block.begin.java +// ^ meta.constant.java meta.block.java punctuation.section.block.end.java +// ^ punctuation.separator.comma.java + + integerToken, +// ^^^^^^^^^^^^ meta.constant.identifier.java entity.name.constant.java +// ^ punctuation.separator.comma.java + + integerToken("integer literal"), +// ^^^^^^^^^^^^ meta.constant.identifier.java entity.name.constant.java +// ^^^^^^^^^^^^^^^^^^^ meta.constant.arguments.java meta.group.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^^^^^^^^^ string.quoted.double.java +// ^ punctuation.section.group.end.java +// ^ punctuation.separator.comma.java + + integerToken {}; +// ^^^^^^^^^^^^ meta.constant.identifier.java entity.name.constant.java +// ^ meta.constant.identifier.java - constant +// ^ meta.constant.java meta.block.java punctuation.section.block.begin.java +// ^ meta.constant.java meta.block.java punctuation.section.block.end.java +// ^ punctuation.terminator.java + + int {} +// ^^^ storage.type.primitive.java + + const {} +// ^^^^^ invalid.illegal.keyword.java + + static {} +// ^^^^^^ storage.modifier.java + + String image = ""; +// ^^^^^^ storage.type.class.java +// ^^^^^ variable.other.member.java +// ^ keyword.operator.assignment.java +// ^^ string.quoted.double.java +// ^ punctuation.terminator.java + + TokenKind(String s) {} +// ^^^^^^^^^^^^^^^^^^^^^^ meta.enum.java meta.block.java meta.function - meta.function meta.function +// ^^^^^^^^^ meta.function.identifier.java +// ^^^^^^^^^^ meta.function.parameters.java meta.group.java +// ^^^ meta.function.java - meta.function meta.function +// ^^^^^^^^^ entity.name.function.constructor.java +// ^ punctuation.section.group.begin.java +// ^^^^^^ storage.type.class.java +// ^ variable.parameter.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + final int attribAfterConstructor; +// ^^^^^^ meta.field.modifier.java +// ^^^^ meta.field.type.java +// ^^^^^^^^^^^^^^^^^^^^^^ meta.field.identifier.java +// ^ - meta.field +// ^^^^^ storage.modifier.java +// ^^^ storage.type.primitive.java +// ^^^^^^^^^^^^^^^^^^^^^^ variable.other.member.java +// ^ punctuation.terminator.java + + public static void main(String[]a){} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.enum.java meta.block.java meta.function - meta.function meta.function +// ^^^^^^^^^^^^^^ meta.function.modifier.java +// ^^^^^ meta.function.return-type.java +// ^^^^ meta.function.identifier.java +// ^^^^^^^^^^^ meta.function.parameters.java meta.group.java +// ^^ meta.function.java +// ^^^^^^ storage.modifier.java +// ^^^^^^ storage.modifier.java +// ^^^^ storage.type.void.java +// ^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^^^^^^ storage.type.class.java +// ^^ storage.modifier.array.java +// ^ variable.parameter.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + final int attribAfterMember; +// ^^^^^^ meta.field.modifier.java +// ^^^^ meta.field.type.java +// ^^^^^^^^^^^^^^^^^ meta.field.identifier.java +// ^ - meta.field +// ^^^^^ storage.modifier.java +// ^^^ storage.type.primitive.java +// ^^^^^^^^^^^^^^^^^ variable.other.member.java +// ^ punctuation.terminator.java + + private class SubClass {} +// ^^^^^^^^^^^^^ meta.class.java +// ^^^^^^^^^^ meta.class.identifier.java +// ^^ meta.class.java meta.block.java +// ^^^^^^^ storage.modifier.java +// ^^^^^ keyword.declaration.class.java +// ^^^^^^^^ entity.name.class.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + private final int attribAfterClass; +// ^^^^^^^^^^^^^^ meta.field.modifier.java +// ^^^^ meta.field.type.java +// ^^^^^^^^^^^^^^^^ meta.field.identifier.java +// ^ - meta.field +// ^^^^^^^ storage.modifier.java +// ^^^^^ storage.modifier.java +// ^^^ storage.type.primitive.java +// ^^^^^^^^^^^^^^^^ variable.other.member.java +// ^ punctuation.terminator.java +} +//<- meta.enum.java meta.block.java punctuation.section.block.end.java + +@Anno // comment +// <- meta.enum.java meta.annotation.identifier.java meta.path.java punctuation.definition.annotation.java +. // comment +// <- meta.enum.java meta.annotation.identifier.java meta.path.java punctuation.accessor.dot.java +Anno // comment +// <- meta.annotation.identifier.java meta.path.java variable.annotation.java +( // comment +// <- meta.annotation.parameters.java meta.group.java punctuation.section.group.begin.java + par // comment +// ^^^ meta.enum.java meta.annotation.parameters.java meta.group.java variable.parameter.java + = // comment +// ^ meta.enum.java meta.annotation.parameters.java meta.group.java keyword.operator.assignment.java + 1 // comment +// ^ meta.enum.java meta.annotation.parameters.java meta.group.java meta.number.integer.decimal.java constant.numeric.value.java +) // comment +// <- meta.annotation.parameters.java meta.group.java punctuation.section.group.end.java +public // comment +//<- meta.enum.java storage.modifier.java +enum // comment +//<- meta.enum.java +TokenKind // comment +//<- meta.enum.identifier.java entity.name.enum.java +extends // comment +//<- meta.enum.extends.java invalid.illegal.unexpected-keyword.java +MyEnum, // comment +//<- meta.enum.extends.java entity.other.inherited-class.java +FooBaz // comment +//<- meta.enum.extends.java entity.other.inherited-class.java +implements // comment +//<- meta.enum.implements.java storage.modifier.implements.java +Foo, // comment +//<- meta.enum.implements.java entity.other.inherited-class.java +Bar // comment +//<- meta.enum.implements.java entity.other.inherited-class.java +{ +//<- meta.enum.java meta.block.java punctuation.section.block.begin.java +} +//<- meta.enum.java meta.block.java punctuation.section.block.end.java + + +/****************************************************************************** + * Interface Declaration Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-9.html#jls-9.1 + *****************************************************************************/ + +interface$ ; +// <- meta.variable.identifier.java variable.other.java +//^^^^^^^^ meta.variable.identifier.java variable.other.java + +$interface ; +// <- meta.variable.identifier.java variable.other.java +//^^^^^^^^ meta.variable.identifier.java variable.other.java + +interface +//<- meta.interface.java keyword.declaration.interface.java +//^^^^^^^ meta.interface.java keyword.declaration.interface.java +// ^ meta.interface.identifier.java + +interface TestIntf +//<- meta.interface.java keyword.declaration.interface.java +//^^^^^^^ meta.interface.java +// ^^^^^^^^^^ meta.interface.identifier.java +//^^^^^^^ keyword.declaration.interface.java +// ^^^^^^^^ entity.name.interface.java + +interface TestIntf extends +//<- meta.interface.java keyword.declaration.interface.java +//^^^^^^^ meta.interface.java +// ^^^^^^^^^^ meta.interface.identifier.java +// ^^^^^^^^ meta.interface.extends.java +//^^^^^^^ keyword.declaration.interface.java +// ^^^^^^^^ entity.name.interface.java +// ^^^^^^^ storage.modifier.extends.java + +interface TestIntf extends A, BB {} +//<- meta.interface.java keyword.declaration.interface.java +//^^^^^^^ meta.interface.java +// ^^^^^^^^^^ meta.interface.identifier.java +// ^^^^^^^^^^^^^^ meta.interface.extends.java +// ^^ meta.interface.java meta.block.java +//^^^^^^^ keyword.declaration.interface.java +// ^^^^^^^^ entity.name.interface.java +// ^^^^^^^ storage.modifier.extends.java +// ^ entity.other.inherited-class.java +// ^ punctuation.separator.comma.java +// ^^ entity.other.inherited-class.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + +public interface /**/ TestIntf /**/ extends /**/ A /**/, /**/ BB /**/ {} +//<- meta.interface.java storage.modifier.java +//^^^^^^^^^^^^^^ meta.interface.java +// ^^^^^^^^^^^^^^^ meta.interface.identifier.java - meta.generic +// ^^^^^^^^ meta.interface.identifier.java meta.generic.declaration.java +// ^^^^^^ meta.interface.identifier.java - meta.generic +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interface.extends.java +// ^^ meta.interface.java meta.block.java +//^^^^ storage.modifier.java +// ^^^^^^^^^ keyword.declaration.interface.java +// ^^^^ comment.block.empty.java +// ^^^^^^^^ entity.name.interface.java +// ^ punctuation.section.generic.begin.java +// ^^ variable.parameter.type.java +// ^ punctuation.separator.comma.java +// ^^ variable.parameter.type.java +// ^ punctuation.section.generic.end.java +// ^^^^ comment.block.empty.java +// ^^^^^^^ storage.modifier.extends.java +// ^^^^ comment.block.empty.java +// ^ entity.other.inherited-class.java +// ^^^^ comment.block.empty.java +// ^ punctuation.separator.comma.java +// ^^^^ comment.block.empty.java +// ^^ entity.other.inherited-class.java +// ^^^^ comment.block.empty.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + +public abstract sealed interface SealedInterfaceTest permits +// <- meta.interface.java storage.modifier.java +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interface.java +// ^^^^^^^^^^^^^^^^^^^^ meta.interface.identifier.java +// ^^^^^^^^ meta.interface.permits.java +//^^^^ storage.modifier.java +// ^^^^^^^^ storage.modifier.java +// ^^^^^^ storage.modifier.java +// ^^^^^^^^^ keyword.declaration.interface.java +// ^^^^^^^^^^^^^^^^^^^ entity.name.interface.java +// ^^^^^^^ storage.modifier.permits.java + +public abstract sealed interface SealedInterfaceTest permits Foo, bar.Baz {} +// <- meta.interface.java storage.modifier.java +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interface.java +// ^^^^^^^^^^^^^^^^^^^^^ meta.interface.identifier.java +// ^^^^^^^^^^^^^^^^^^^^^ meta.interface.permits.java +// ^^ meta.interface.java meta.block.java +//^^^^ storage.modifier.java +// ^^^^^^^^ storage.modifier.java +// ^^^^^^ storage.modifier.java +// ^^^^^^^^^ keyword.declaration.interface.java +// ^^^^^^^^^^^^^^^^^^^ entity.name.interface.java +// ^^^^^^^ storage.modifier.permits.java +// ^^^ entity.other.inherited-class.java +// ^ punctuation.separator.comma.java +// ^^^^^^^ meta.path.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ entity.other.inherited-class.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + +@Anno // comment +//<- meta.interface.java meta.annotation.identifier.java punctuation.definition.annotation.java +public // comment +//<- meta.interface.java storage.modifier.java +interface // comment +//<- meta.interface.java +TestIntf // comment +//<- meta.interface.identifier.java entity.name.interface.java + +//<- meta.interface.identifier.java meta.generic.declaration.java +extends // comment +//<- meta.interface.extends.java storage.modifier.extends.java +MyEnum, // comment +//<- meta.interface.extends.java entity.other.inherited-class.java +FooBaz // comment +//<- meta.interface.extends.java entity.other.inherited-class.java +implements // comment +//<- meta.interface.implements.java invalid.illegal.unexpected-keyword.java +Foo, // comment +//<- meta.interface.implements.java entity.other.inherited-class.java +Bar // comment +//<- meta.interface.implements.java entity.other.inherited-class.java +{ +//<- meta.interface.java meta.block.java punctuation.section.block.begin.java +} +//<- meta.interface.java meta.block.java punctuation.section.block.end.java + + +/****************************************************************************** + * Annotation Declaration Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-9.html#jls-9.6 + *****************************************************************************/ + +@interface$ ; +//<- meta.annotation.identifier.java punctuation.definition.annotation.java +//^^^^^^^^^ meta.annotation.identifier.java variable.annotation.java + +@$interface ; +//<- meta.annotation.identifier.java punctuation.definition.annotation.java +//^^^^^^^^^ meta.annotation.identifier.java variable.annotation.java + +@interface +//<- meta.interface.java keyword.declaration.interface.java +//^^^^^^^^ meta.interface.java keyword.declaration.interface.java +// ^ meta.interface.identifier.java + +@interface AnnotationType +//<- meta.interface.java keyword.declaration.interface.java +//^^^^^^^^ meta.interface.java +// ^^^^^^^^^^^^^^^^ meta.interface.identifier.java +//^^^^^^^^ keyword.declaration.interface.java +// ^^^^^^^^^^^^^^ entity.name.interface.java + +// Note: The extends is actually not allowed here, but the syntax definition does +// not yet distiguish between interface types and annotation types +@interface AnnotationType extends +//<- meta.interface.java keyword.declaration.interface.java +//^^^^^^^^ meta.interface.java +// ^^^^^^^^^^^^^^^^ meta.interface.identifier.java +// ^^^^^^^^ meta.interface.extends.java +//^^^^^^^^ keyword.declaration.interface.java +// ^^^^^^^^^^^^^^ entity.name.interface.java +// ^^^^^^^ storage.modifier.extends.java + +@interface AnnotationType { +//<- meta.interface.java keyword.declaration.interface.java +//^^^^^^^^ meta.interface.java +// ^^^^^^^^^^^^^^^^ meta.interface.identifier.java +// ^^ meta.interface.java meta.block.java +//^^^^^^^^ keyword.declaration.interface.java +// ^^^^^^^^^^^^^^ entity.name.interface.java +// ^ punctuation.section.block.begin.java + + int numericValue() default 42; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interface.java meta.block.java meta.function - meta.function meta.function +//^^^^ meta.function.return-type.java +// ^^^^^^^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java meta.group.java +// ^ meta.function.java +// ^^^^^^^^^^ meta.function.default.java +// ^ - meta.function +// ^^^^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^^^^^^^ keyword.declaration.default.java +// ^^ constant.numeric + + boolean booleanValue() default true; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interface.java meta.block.java meta.function - meta.function meta.function +//^^^^^^^^ meta.function.return-type.java +// ^^^^^^^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java meta.group.java +// ^ meta.function.java +// ^^^^^^^^^^^^ meta.function.default.java +// ^ - meta.function +// ^^^^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^^^^^^^ keyword.declaration.default.java +// ^^^^ constant.language + + char charValue() default 'S'; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interface.java meta.block.java meta.function - meta.function meta.function +//^^^^^ meta.function.return-type.java +// ^^^^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java meta.group.java +// ^ meta.function.java +// ^^^^^^^^^^^ meta.function.default.java +// ^ - meta.function +// ^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^^^^^^^ keyword.declaration.default.java +// ^^^ string.quoted.single.java + + String value() default "Default value"; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interface.java meta.block.java meta.function - meta.function meta.function +//^^^^^^^ meta.function.return-type.java +// ^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java meta.group.java +// ^ meta.function.java +// ^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.function.default.java +// ^ - meta.function +// ^^^^^^^ keyword.declaration.default.java +// ^^^^^^^^^^^^^^^ string.quoted.double.java + + Class classValue() default String.class; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interface.java meta.block.java meta.function - meta.function meta.function +//^^^^^^^^^ meta.function.return-type.java +// ^^^^^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java meta.group.java +// ^ meta.function.java +// ^^^^^^^^^^^^^^^^^^^^ meta.function.default.java +// ^ - meta.function +// ^^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^^^^^^^ keyword.declaration.default.java +// ^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^^ variable.language.class.java - storage.type.java + + String[] arrayValue()[] default {"Foo", "Bar"}; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interface.java meta.block.java meta.function - meta.function meta.function +//^^^^^^^^^ meta.function.return-type.java +// ^^^^^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java meta.group.java +// ^^^ meta.function.java +// ^^^^^^^^ meta.function.default.java - meta.braces +// ^^^^^^^^^^^^^^ meta.function.default.java meta.braces.java +// ^ - meta.function +// ^^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^^ storage.modifier.array.java +// ^^^^^^^ keyword.declaration.default.java +// ^ punctuation.section.braces.begin.java +// ^^^^^ string.quoted.double.java +// ^ punctuation.separator.comma.java +// ^^^^^ string.quoted.double.java +// ^ punctuation.section.braces.end.java +} + +/****************************************************************************** + * Record Class Tests + * https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-8.10 + *****************************************************************************/ + +record +// <- meta.class.java keyword.declaration.record.java +//^^^^ meta.class.java keyword.declaration.record.java +// ^ meta.class.identifier.java + +record RecordTest +// <- meta.class.java keyword.declaration.record.java +//^^^^ meta.class.java keyword.declaration.record.java +// ^^^^^^^^^^^^ meta.class.identifier.java +// ^^^^^^^^^^ entity.name.class.java + +record RecordTest<> +// <- meta.class.java keyword.declaration.record.java +//^^^^ meta.class.java keyword.declaration.record.java +// ^^^^^^^^^^^ meta.class.identifier.java - meta.generic +// ^^ meta.class.identifier.java meta.generic.declaration.java +// ^ meta.class.identifier.java - meta.generic +// ^^^^^^^^^^ entity.name.class.java +// ^ punctuation.section.generic.begin.java +// ^ punctuation.section.generic.end.java + +record RecordTest +// <- meta.class.java keyword.declaration.record.java +//^^^^ meta.class.java keyword.declaration.record.java +// ^^^^^^^^^^^ meta.class.identifier.java - meta.generic +// ^^^ meta.class.identifier.java meta.generic.declaration.java +// ^ meta.class.identifier.java - meta.generic +// ^^^^^^^^^^ entity.name.class.java +// ^ punctuation.section.generic.begin.java +// ^ variable.parameter.type.java +// ^ punctuation.section.generic.end.java + +record RecordTest( { } +// <- meta.class.java keyword.declaration.record.java +//^^^^ meta.class.java keyword.declaration.record.java +// ^^^^^^^^^^^ meta.class.identifier.java +// ^^ meta.class.parameters.java meta.group.java +// ^^^^ meta.class.java meta.block.java +// ^^^^^^^^^^ entity.name.class.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + +record RecordTest<>( { } +// <- meta.class.java keyword.declaration.record.java +//^^^^ meta.class.java keyword.declaration.record.java +// ^^^^^^^^^^^ meta.class.identifier.java - meta.generic +// ^^ meta.class.identifier.java meta.generic.declaration.java +// ^^ meta.class.parameters.java meta.group.java +// ^^^^ meta.class.java meta.block.java +// ^^^^^^^^^^ entity.name.class.java +// ^ punctuation.section.generic.begin.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + +record RecordTest(int x, int y) { } +// <- meta.class.java keyword.declaration.record.java +//^^^^ meta.class.java keyword.declaration.record.java +// ^^^^^^^^^^^ meta.class.identifier.java +// ^^^^^^^^^^^^^^ meta.class.parameters.java meta.group.java +// ^ meta.class.java +// ^^^ meta.class.java meta.block.java +// ^^^^^^^^^^ entity.name.class.java +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.primitive.java +// ^ variable.parameter.java +// ^ punctuation.separator.comma.java +// ^^^ storage.type.primitive.java +// ^ variable.parameter.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + +record RecordTest(int x, @notnull foo bar) implements Foo, Bar { } +// <- meta.class.java keyword.declaration.record.java +//^^^^ meta.class.java keyword.declaration.record.java +// ^^^^^^^^^^^^^^ meta.class.identifier.java +// ^^^ meta.generic.declaration.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.parameters.java meta.group.java +// ^^^^^^^^ meta.annotation.identifier.java +// ^ meta.class.java +// ^^^^^^^^^^^^^^^^^^^^ meta.class.implements.java +// ^^^ meta.class.java meta.block.java +// ^^^^^^^^^^ entity.name.class.java +// ^ punctuation.section.generic.begin.java +// ^ variable.parameter.type.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.primitive.java +// ^ variable.parameter.java +// ^ punctuation.separator.comma.java +// ^ punctuation.definition.annotation.java +// ^^^^^^^ variable.annotation.java +// ^^^ storage.type.class.java +// ^^^ variable.parameter.java +// ^ punctuation.section.group.end.java +// ^^^^^^^^^^ storage.modifier.implements.java +// ^^^ entity.other.inherited-class.java +// ^ punctuation.separator.comma.java +// ^^^ entity.other.inherited-class.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + +record CompactConstructorTests(int foo) { + CompactConstructorTests { +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.identifier.java +// ^^ meta.class.java meta.block.java meta.function.java meta.block.java +// ^ punctuation.section.block.begin.java + foo = 20; +// ^^^^^^^^^^^ meta.function.java meta.block.java +// ^^^ variable.other.java +// ^ keyword.operator.assignment.java +// ^^ constant.numeric.value.java +// ^ punctuation.terminator.java + } +// ^ meta.class.java meta.block.java meta.function.java meta.block.java punctuation.section.block.end.java +} +// <- meta.class.java meta.block.java punctuation.section.block.end.java + +/****************************************************************************** + * Field Declaration Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.4 + *****************************************************************************/ + +class FieldDeclarationTests { + + const int bar; // this comment() is recognized as code +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^ - meta.field +// ^^^^ meta.field.type.java +// ^^^ meta.field.identifier.java +// ^ - meta.field +//^^^^^ invalid.illegal.keyword.java +// ^^^ storage.type.primitive.java +// ^^^ variable.other.member.java +// ^ punctuation.terminator.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line +// ^^ punctuation.definition.comment.java + + int +//^^^^ meta.field.type.java - meta.field meta.field +//^^^ storage.type.primitive.java + + int foo +//^^^^^^^^ - meta.field meta.field +//^^^^ meta.field.type.java +// ^^^^ meta.field.identifier.java +//^^^ storage.type.primitive.java +// ^^^ variable.other.member.java + + int foo = +//^^^^^^^^^^ - meta.field meta.field +//^^^^ meta.field.type.java +// ^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^ meta.field.value.java +//^^^ storage.type.primitive.java +// ^^^ variable.other.member.java +// ^ keyword.operator.assignment.java + + int foo = 0 +//^^^^^^^^^^^^ - meta.field meta.field +//^^^^ meta.field.type.java +// ^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^^^ meta.field.value.java +//^^^ storage.type.primitive.java +// ^^^ variable.other.member.java +// ^ keyword.operator.assignment.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java + + int foo = 0 , +//^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^ meta.field.type.java +// ^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^^^ meta.field.value.java +// ^ meta.field.java +// ^ meta.field.identifier.java +//^^^ storage.type.primitive.java +// ^^^ variable.other.member.java +// ^ keyword.operator.assignment.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java + + int foo = 0 , bar ; +//^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^ meta.field.type.java +// ^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^^^ meta.field.value.java +// ^ meta.field.java +// ^^^^^ meta.field.identifier.java +// ^ - meta.field +//^^^ storage.type.primitive.java +// ^^^ variable.other.member.java +// ^ keyword.operator.assignment.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^^^ variable.other.member.java +// ^ punctuation.terminator.java + + int = +//^^^^^^ - meta.field meta.field +//^^^^ meta.field.type.java +// ^ meta.field.java +// ^ meta.field.value.java +//^^^ storage.type.primitive.java +// ^ keyword.operator.assignment.java + + public +//^^^^^^^ meta.field.modifier.java +//^^^^^^ storage.modifier.java +// ^ - storage + int foo , bar +//<- meta.field.modifier.java - meta.field meta.field - storage +//^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^ meta.field.type.java +// ^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^^^^^ meta.field.identifier.java +//^^^ storage.type.primitive.java +// ^^^ variable.other.member.java +// ^ punctuation.separator.comma.java +// ^^^ variable.other.member.java + , baz +//^^^^^^^^ - meta.field meta.field +//^^ meta.field.identifier.java +// ^ meta.field.java +// ^^^^ meta.field.identifier.java +// ^ punctuation.separator.comma.java +// ^^^ variable.other.member.java + = 10 , +//^^^^^^^^^^^ - meta.field meta.field +//^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^^^^ meta.field.value.java +// ^ meta.field.java +// ^ keyword.operator.assignment.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java + , = 20 +//^^^^^^^^^ - meta.field meta.field +//^^ meta.field.identifier.java +// ^ meta.field.java +// ^ meta.field.identifier.java +// ^ meta.field.java +// ^^^^ meta.field.value.java +// ^ punctuation.separator.comma.java +// ^ keyword.operator.assignment.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java + , , ; +//^^^^^^ - meta.field meta.field +//^^ meta.field.value.java +// ^ meta.field.java punctuation.separator.comma.java +// ^ meta.field.identifier.java +// ^ meta.field.java punctuation.separator.comma.java +// ^ meta.field.identifier.java +// ^ punctuation.terminator.java - meta.field + + int[] +//^^^^^^ - meta.field meta.field +//^^^^^^ meta.field.type.java +//^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java + + int [] +//^^^^^^ - meta.field meta.field +//^^^^^^ meta.field.type.java +//^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java + + int[] foo +//^^^^^^^^^ - meta.field meta.field +//^^^^^^ meta.field.type.java +// ^^^ meta.field.identifier.java +//^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java +// ^^^ variable.other.member.java + + int foo[], [] +//^^^^^^^^^^^^^ - meta.field meta.field +//^^^^ meta.field.type.java +// ^^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^^^ meta.field.identifier.java +//^^^ storage.type.primitive.java +// ^^^ variable.other.member.java +// ^^ storage.modifier.array.java +// ^ punctuation.separator.comma.java +// ^^ storage.modifier.array.java + + public protected private static final transient volatile int foo +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.field.modifier.java +// ^^^^ meta.field.type.java +// ^^^^ meta.field.identifier.java +//^^^^^^ storage.modifier.java +// ^ - storage +// ^^^^^^^^^ storage.modifier.java +// ^ - storage +// ^^^^^^^ storage.modifier.java +// ^ - storage +// ^^^^^^ storage.modifier.java +// ^ - storage +// ^^^^^ storage.modifier.java +// ^ - storage +// ^^^^^^^^^ storage.modifier.java +// ^ - storage +// ^^^^^^^^ storage.modifier.java +// ^ - storage +// ^^^ storage.type.primitive.java +// ^ - storage - variable +// ^^^ variable.other.member.java +// ^ - variable + + abstract native synchronized strictfp default int foo.bar +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.field.modifier.java - storage +// ^^^^ meta.field.type.java +// ^^^^^^^^ meta.field.identifier.java +//^^^^^^^^ invalid.illegal.unexpected-keyword.java +// ^ - invalid +// ^^^^^^ invalid.illegal.unexpected-keyword.java +// ^ - invalid +// ^^^^^^^^^^^^ invalid.illegal.unexpected-keyword.java +// ^ - invalid +// ^^^^^^^^ invalid.illegal.unexpected-keyword.java +// ^ - invalid +// ^^^^^^^ invalid.illegal.unexpected-keyword.java +// ^ - invalid +// ^^^ storage.type.primitive.java +// ^ - storage - variable +// ^^^ variable.other.member.java +// ^ invalid.illegal.unexpected-accessor.java +// ^^^ invalid.illegal.unexpected-member.java + + private String +//^^^^^^^^ meta.field.modifier.java +// ^^^^^^^ meta.field.type.java +//^^^^^^^ storage.modifier.java +// ^^^^^^ storage.type.class.java + + private string +//^^^^^^^^ meta.field.modifier.java +// ^^^^^^^ meta.field.type.java +//^^^^^^^ storage.modifier.java +// ^^^^^^ storage.type.class.java + + private String memberString1 = "Hello"; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^ meta.field.modifier.java +// ^^^^^^^ meta.field.type.java +// ^^^^^^^^^^^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^^^^^^^^ meta.field.value.java +// ^ - meta.field +//^^^^^^^ storage.modifier.java +// ^^^^^^ storage.type.class.java +// ^^^^^^^^^^^^^ variable.other.member.java +// ^ keyword.operator.assignment.java +// ^^^^^^^ string.quoted.double.java +// ^ punctuation.terminator.java + + private String memberString2 = @Anno new String("Hello"); +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^ meta.field.modifier.java +// ^^^^^^^ meta.field.type.java +// ^^^^^^^^^^^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^ meta.field.value.java - meta.instantiation - meta.annotation +// ^^^^^ meta.field.value.java meta.annotation.identifier.java +// ^ meta.field.value.java - meta.annotation - meta.instantiation +// ^^^^^^^^^^^^^^^^^^^ meta.field.value.java meta.instantiation.java - meta.annotation +// ^ - meta.field +//^^^^^^^ storage.modifier.java +// ^^^^^^ storage.type.class.java +// ^^^^^^^^^^^^^ variable.other.member.java +// ^ keyword.operator.assignment.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^ string.quoted.double.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + private String memberString3 = String.valueOf("Hello"); +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^ meta.field.modifier.java +// ^^^^^^^ meta.field.type.java +// ^^^^^^^^^^^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.field.value.java +// ^^^^^^^ meta.function-call.identifier.java +// ^^^^^^^^^ meta.function-call.arguments.java meta.group.java +// ^ - meta.field +//^^^^^^^ storage.modifier.java +// ^^^^^^ storage.type.class.java +// ^^^^^^^^^^^^^ variable.other.member.java +// ^ keyword.operator.assignment.java +// ^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^ string.quoted.double.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + private int memberLpos = memberString3.indexOf("l"); +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^ meta.field.modifier.java +// ^^^^ meta.field.type.java +// ^^^^^^^^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.field.value.java +// ^^^^^^^ meta.function-call.identifier.java +// ^^^^^ meta.function-call.arguments.java meta.group.java +// ^ - meta.field +//^^^^^^^ storage.modifier.java +// ^^^ storage.type.primitive.java +// ^^^^^^^^^^ variable.other.member.java +// ^ keyword.operator.assignment.java +// ^^^^^^^^^^^^^ variable.other.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^^^ string.quoted.double.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + public var MY_CONST = 0x4002; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^ meta.field.modifier.java +// ^^^^ meta.field.type.java +// ^^^^^^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^^^^^^^ meta.field.value.java +// ^ - meta.field +//^^^^^^ storage.modifier.java +// ^^^ invalid.illegal.unexpected-keyword.java +// ^^^^^^^^ entity.name.constant.java +// ^ keyword.operator.assignment.java +// ^^^^^^ constant.numeric +// ^ punctuation.terminator.java + + private static final string DEFAULT_IDEMPOTENCY_KEY = "44493"; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^^^^^^^^^^^^^^ meta.field.modifier.java +// ^^^^^^^ meta.field.type.java +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^^^^^^^^ meta.field.value.java +// ^ - meta.field +//^^^^^^^ storage.modifier.java +// ^^^^^^ storage.modifier.java +// ^^^^^ storage.modifier.java +// ^^^^^^ storage.type.class.java +// ^^^^^^^^^^^^^^^^^^^^^^^ entity.name.constant.java +// ^ keyword.operator.assignment.java +// ^^^^^^^ string.quoted.double.java +// ^ punctuation.terminator.java +// + + public static +//^^^^^^^^^^^^^^ meta.field.modifier.java +//^^^^^^ storage.modifier.java +// ^^^^^^ storage.modifier.java + final MyObject +//^^^^^^ meta.field.modifier.java +// ^^^^^^^^^ meta.field.type.java +//^^^^^ storage.modifier.java +// ^^^^^^^^ storage.type.class.java + MY_CONST = new MyObject(), +//^^ meta.field.type.java +// ^^^^^^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^^^^^^^^^^^^^^^ meta.field.value.java +// ^ meta.field.java +// ^^^^^^^^ entity.name.constant.java +// ^ keyword.operator.assignment.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.separator.comma.java + + _MY_ANOTHER_CONST = new MyObject(); +//^^^^^^^^^^^^^^^^^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^^^^^^^^^^^^^^^ meta.field.value.java +// ^ - meta.field +// ^^^^^^^^^^^^^^^^^ entity.name.constant +// ^ keyword.operator.assignment.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + private MyObject otherObject = MY_CONST; +// ^^^^^^^^ constant.other.java +// ^ punctuation.terminator.java + + private MyObject otherObject = SOME_CONST.FOO; +// ^^^^^^^^^^ constant.other.java +// ^ punctuation.accessor.dot.java +// ^^^ constant.other.java +// ^ punctuation.terminator.java + + private MyObject otherObject = SOME_CONST.get(); +// ^^^^^^^^^^ constant.other.java +// ^ punctuation.accessor.dot.java +// ^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + private a.b.myerror error = a.b.ErrorCode.COMMUNICATION_ERROR; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^ meta.field.modifier.java +// ^^^^^^^^^^^^ meta.field.type.java +// ^^^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.field.value.java +// ^ - meta.field +//^^^^^^^^ - meta.path +// ^^^^^^^^^^^ meta.path.java +// ^^^^^^^^^ - meta.path +// ^^^^^^^^^^^^^ meta.path.java +//^^^^^^^ storage.modifier.java +// ^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^ storage.type.class.java +// ^^^^^ variable.other.member.java +// ^ keyword.operator.assignment.java +// ^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^^^^^^^^^^^ constant.other.java +// ^ punctuation.terminator.java + + private a /**/ . /**/ b /**/ . /**/ myerror /**/ error /**/ = /**/ a.b.ErrorCode.COMMUNICATION_ERROR; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^ meta.field.modifier.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.field.type.java +// ^^^^^^^^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.field.value.java +// ^ - meta.field +//^^^^^^^^ - meta.path +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.path.java +// ^^^^^^^^^^^^^^^^^^^^^^^^ - meta.path +// ^^^^^^^^^^^^^ meta.path.java +//^^^^^^^ storage.modifier.java +// ^ variable.namespace.java +// ^^^^ comment.block.empty.java punctuation.definition.comment.java +// ^ punctuation.accessor.dot.java +// ^^^^ comment.block.empty.java punctuation.definition.comment.java +// ^ variable.namespace.java +// ^^^^ comment.block.empty.java punctuation.definition.comment.java +// ^ punctuation.accessor.dot.java +// ^^^^ comment.block.empty.java punctuation.definition.comment.java +// ^^^^^^^ storage.type.class.java +// ^^^^ comment.block.empty.java punctuation.definition.comment.java +// ^^^^^ variable.other.member.java +// ^^^^ comment.block.empty.java punctuation.definition.comment.java +// ^ keyword.operator.assignment.java +// ^^^^ comment.block.empty.java punctuation.definition.comment.java +// ^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^^^^^^^^^^^ constant.other.java +// ^ punctuation.terminator.java + + private static final UUID SECURE_ID = UUID.randomUUID(); +// ^^^^ storage.type.class.java +// ^^^^^^^^^ entity.name.constant +// ^^^^ storage.type.class.java +// ^^^^^^^^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + private URI uri = new URI(); +// ^^^ storage.type.class.java +// ^^^ variable.other.member.java +// ^^^ storage.type.class.java + + private URI URI2 = new URI(); +// ^^^ storage.type.class.java +// ^^^^ entity.name.constant.java +// ^^^ storage.type.class.java + + byte[] byteArray; +//^^^^^^^ meta.field.type.java +// ^^^^^^^^^ meta.field.identifier.java +// ^ - meta.field +//^^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java +// ^^^^^^^^^ variable.other.member.java +// ^ punctuation.terminator.java + + byte byteArray2[] = {1, 2}; +//^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^ meta.field.type.java +// ^^^^^^^^^^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^^^^^^^ meta.field.value.java +// ^ - meta.field +//^^^^ storage.type.primitive.java +// ^^^^^^^^^^ variable.other.member.java +// ^^ storage.modifier.array.java +// ^ keyword.operator.assignment.java +// ^ punctuation.section.braces.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.braces.end.java +// ^ punctuation.terminator.java + + byte byteArray3[] = condition ? {1, 2} : {4, 5}; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^ meta.field.type.java +// ^^^^^^^^^^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.field.value.java +// ^ - meta.field +//^^^^ storage.type.primitive.java +// ^^^^^^^^^^ variable.other.member.java +// ^^ storage.modifier.array.java +// ^ keyword.operator.assignment.java +// ^^^^^^^^^ variable.other.java +// ^ keyword.operator.ternary.java +// ^ punctuation.section.braces.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.braces.end.java +// ^ keyword.operator.ternary.java +// ^ punctuation.section.braces.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.braces.end.java +// ^ punctuation.terminator.java + + byte byteArray4[] = condition ? fun() ? {1, 2} : {3, 0} : {4, 5}; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^ meta.field.type.java +// ^^^^^^^^^^^^^ meta.field.identifier.java +// ^ meta.field.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.field.value.java +// ^ - meta.field +//^^^^ storage.type.primitive.java +// ^^^^^^^^^^ variable.other.member.java +// ^^ storage.modifier.array.java +// ^ keyword.operator.assignment.java +// ^^^^^^^^^ variable.other.java +// ^ keyword.operator.ternary.java +// ^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ keyword.operator.ternary.java +// ^ punctuation.section.braces.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.braces.end.java +// ^ keyword.operator.ternary.java +// ^ punctuation.section.braces.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.braces.end.java +// ^ keyword.operator.ternary.java +// ^ punctuation.section.braces.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.braces.end.java +// ^ punctuation.terminator.java + + String[][] doubleStringArray; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^^^^ meta.field.type.java +// ^^^^^^^^^^^^^^^^^ meta.field.identifier.java +// ^ - meta.field +//^^^^^^ storage.type.class.java +// ^^^^ storage.modifier.array.java +// ^^^^^^^^^^^^^^^^^ variable.other.member.java +// ^ punctuation.terminator.java + + @NotNull final String @Anno [ ] @Anno [ ] doubleStringArray @Anno [ ] [ ]; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^^^^^^^^ meta.field.modifier.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.field.type.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.field.identifier.java +// ^ - meta.field +//^^^^^^^^ meta.annotation.identifier.java +// ^^^^^^^^^^^^^^ - meta.annotation +// ^^^^^ meta.annotation.identifier.java +// ^^^^^ - meta.annotation +// ^^^^^ meta.annotation.identifier.java +// ^^^^^^^^^^^^^^^^^^^^^^^ - meta.annotation +// ^^^^^ meta.annotation.identifier.java +// ^^^^^^^^^ - meta.annotation +// ^^^^^ storage.modifier.java +// ^^^^^^ storage.type.class.java +// ^^^ storage.modifier.array.java +// ^^^ storage.modifier.array.java +// ^^^^^^^^^^^^^^^^^ variable.other.member.java +// ^^^ storage.modifier.array.java +// ^^^ storage.modifier.array.java +// ^ punctuation.terminator.java + + qualified.String[][] doubleStringArray; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^^^^^^^^^^^^^^ meta.field.type.java +// ^^^^^^^^^^^^^^^^^ meta.field.identifier.java +// ^ - meta.field +//^^^^^^^^^^^^^^^^ meta.path.java +// ^^^^^^^^^^^^^^^^^^^^^^^ - meta.path +//^^^^^^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^ storage.type.class.java +// ^^^^ storage.modifier.array.java +// ^^^^^^^^^^^^^^^^^ variable.other.member.java +// ^ punctuation.terminator.java + + fully.qualified.string[][] doubleStringArray; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.field.type.java +// ^^^^^^^^^^^^^^^^^ meta.field.identifier.java +// ^ - meta.field +//^^^^^^^^^^^^^^^^^^^^^^ meta.path.java +// ^^^^^^^^^^^^^^^^^^^^^^^ - meta.path +//^^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^ storage.type.class.java +// ^^^^ storage.modifier.array.java +// ^^^^^^^^^^^^^^^^^ variable.other.member.java +// ^ punctuation.terminator.java + + @anno /**/ fully // comment +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^ meta.field.modifier.java meta.annotation.identifier.java +// ^^^^^^ meta.field.modifier.java - meta.annotation - meta.pth +// ^^^^^^^^^^^^^^^^^ meta.field.type.java meta.path.java +//^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^^ comment.block.empty.java +// ^^^^^ variable.namespace.java +// ^^^^^^^^^^^ comment.line.double-slash.java + . @anno qualified//comment +//^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.field.type.java meta.path.java - meta.field meta.field +// ^^^^^ meta.annotation.identifier.java +//^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^^^^^^^ variable.namespace.java +// ^^^^^^^^^^ comment.line.double-slash.java + /**/ . /**/ +//^^^^^^^^^^^^ meta.field.type.java meta.path.java +//^^^^ comment.block.empty.java +// ^ punctuation.accessor.dot.java +// ^^^^ comment.block.empty.java + @anno /**/ object @anno() [] +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^^^^^^^^^^ meta.field.type.java meta.path.java +// ^^^^^^^^^^^^ meta.field.type.java - meta.path +//^^^^^ meta.annotation.identifier.java +// ^^^^^ meta.annotation.identifier.java +// ^^ meta.annotation.parameters.java meta.group.java +//^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^^ comment.block.empty.java +// ^^^^^^ storage.type.class.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^^ storage.modifier.array.java + + /**/ @anno /**/ [] /**/ doubleObjectArray; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^^^^^^^^^^^^^^^^^ meta.field.type.java - meta.path +// ^^^^^^^^^^^^^^^^^ meta.field.identifier.java - meta.path +// ^ - meta.field +//^^^^ comment.block.empty.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^^ comment.block.empty.java +// ^^ storage.modifier.array.java +// ^^^^ comment.block.empty.java +// ^^^^^^^^^^^^^^^^^ variable.other.member.java +// ^ punctuation.terminator.java + + List field; +//^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^ meta.field.type.java - meta.generic +// ^^^^^ meta.field.type.java meta.generic.java +// ^ meta.field.type.java - meta.generic +// ^^^^^ meta.field.identifier.java +// ^ - meta.field +//^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^ invalid.illegal.unexpected-keyword.java +// ^ punctuation.section.generic.end.java +// ^^^^^ variable.other.member.java +// ^ punctuation.terminator.java + + list field; +//^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^ meta.field.type.java - meta.generic +// ^^^^^ meta.field.type.java meta.generic.java +// ^ meta.field.type.java - meta.generic +// ^^^^^ meta.field.identifier.java +// ^ - meta.field +//^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^ invalid.illegal.unexpected-keyword.java +// ^ punctuation.section.generic.end.java +// ^^^^^ variable.other.member.java +// ^ punctuation.terminator.java + + List field; +//^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^ meta.field.type.java - meta.generic +// ^^^^^^^^ meta.field.type.java meta.generic.java +// ^ meta.field.type.java - meta.generic +// ^^^^^ meta.field.identifier.java +// ^ - meta.field +//^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^^^^ variable.other.member.java +// ^ punctuation.terminator.java + + list field; +//^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^ meta.field.type.java - meta.generic +// ^^^^^^^^ meta.field.type.java meta.generic.java +// ^ meta.field.type.java - meta.generic +// ^^^^^ meta.field.identifier.java +// ^ - meta.field +//^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^^^^ variable.other.member.java +// ^ punctuation.terminator.java + + java.base.List field; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^^^^^^^ meta.field.type.java meta.path.java - meta.generic +// ^ meta.field.type.java meta.path.java meta.generic.java - meta.path meta.path +// ^^^^^^^^^^^^ meta.field.type.java meta.path.java meta.generic.java meta.path.java +// ^ meta.field.type.java meta.path.java meta.generic.java - meta.path meta.path +// ^ meta.field.type.java - meta.path.java - meta.generic +// ^^^^^ meta.field.identifier.java +// ^ - meta.field +//^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^^^^ variable.other.member.java +// ^ punctuation.terminator.java + + java.base.list field; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^^^^^^^ meta.field.type.java meta.path.java - meta.generic +// ^ meta.field.type.java meta.path.java meta.generic.java - meta.path meta.path +// ^^^^^^^^^^^^ meta.field.type.java meta.path.java meta.generic.java meta.path.java +// ^ meta.field.type.java meta.path.java meta.generic.java - meta.path meta.path +// ^ meta.field.type.java - meta.path.java - meta.generic +// ^^^^^ meta.field.identifier.java +// ^ - meta.field +//^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^^^^ variable.other.member.java +// ^ punctuation.terminator.java + + java.tmpl<>.list field; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^^ meta.field.type.java meta.path.java - meta.generic +// ^^ meta.field.type.java meta.path.java meta.generic.java +// ^^^^^ meta.field.type.java meta.path.java - meta.generic +// ^ meta.field.type.java meta.path.java meta.generic.java - meta.path meta.path +// ^^^^^^^^^^^^ meta.field.type.java meta.path.java meta.generic.java meta.path.java +// ^ meta.field.type.java meta.path.java meta.generic.java - meta.path meta.path +// ^ meta.field.type.java - meta.path.java - meta.generic +// ^^^^^ meta.field.identifier.java +// ^ - meta.field +//^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^ storage.type.class.java +// ^^ punctuation.section.generic.diamond.java +// ^ punctuation.accessor.dot.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^^^^ variable.other.member.java +// ^ punctuation.terminator.java + + private MyGenric, and.fully.Qualified, +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^ meta.field.modifier.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.field.type.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.generic.java - meta.generic meta.generic +// ^^^^^^^^^ meta.generic.java meta.generic.java +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.generic.java - meta.generic meta.generic +// ^^^^^^^^^^^^^^^^^^^ meta.path.java + and.fully.Qualified> myVariable; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.field meta.field +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.field.type.java +//^^^^^^^^^^^^^^^^^^^^^^^ meta.generic.java - meta.generic meta.generic +// ^^^^^^^^^^^^^^^^^^^ meta.path.java +// ^^^^^^^^^ meta.generic.java meta.generic.java +// ^ meta.generic.java - meta.generic meta.generic +// ^ - meta.generic +// ^^^^^^^^^^ meta.field.identifier.java +// ^ - meta.field +} + + +/****************************************************************************** + * Global Method Declaration Tests + * Global methods are not valid in Java, but are supported to maintain + * syntax highlighting in JSP or incomplete code. + * + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.4 + *****************************************************************************/ + +void globalMethodDeclarationTests() {} +// <- meta.function.return-type.java storage.type.void.java +//^^^ meta.function.return-type.java +//^^ storage.type.void.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.identifier.java entity.name.function.java +// ^^ meta.function.parameters.java meta.group.java +// ^ meta.function.java - meta.group - meta.block +// ^^ meta.function.java meta.block.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java +// + +int globalMethodDeclarationTests() {} +// <- meta.function.return-type.java storage.type.primitive.java +//^^ meta.function.return-type.java +//^ storage.type.primitive.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.identifier.java entity.name.function.java +// ^^ meta.function.parameters.java meta.group.java +// ^ meta.function.java - meta.group - meta.block +// ^^ meta.function.java meta.block.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java +// + + +/****************************************************************************** + * Method Declaration Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.4 + *****************************************************************************/ + +class MethodDelcarationTests { + + void +//^^^^^ meta.function.return-type.java +//^^^^ storage.type.void.java + + void method +//^^^^^ meta.function.return-type.java +// ^^^^^^^ meta.function.identifier.java +//^^^^ storage.type.void.java +// ^^^^^^ entity.name.function.java + + void method( ; +//^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^ meta.function.return-type.java +// ^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java meta.group.java +// ^ - meta.function +//^^^^ storage.type.void.java +// ^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.terminator.java + + void method() +//^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^ meta.function.return-type.java +// ^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java meta.group.java +// ^ meta.function.java +//^^^^ storage.type.void.java +// ^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java + + void method(foo bar ; +//^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^ meta.function.return-type.java +// ^^^^^^ meta.function.identifier.java +// ^^^^^^^^^ meta.function.parameters.java meta.group.java +// ^ - meta.function +//^^^^ storage.type.void.java +// ^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.class.java +// ^^^ variable.parameter.java +// ^ punctuation.terminator.java + + static void method() +//^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^^^ meta.function.modifier.java +// ^^^^^ meta.function.return-type.java +// ^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java meta.group.java +// ^ meta.function.java +//^^^^^^ storage.modifier.java +// ^^^^ storage.type.void.java +// ^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java + + native strictfp transient volatile void method() {private} +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.modifier.java +// ^^^^^ meta.function.return-type.java +// ^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java meta.group.java +// ^ meta.function.java +// ^^^^^^^^^ meta.function.java meta.block.java +//^^^^^^ storage.modifier.java +// ^ - invalid +// ^^^^^^^^ storage.modifier.java +// ^ - invalid +// ^^^^^^^^^ invalid.illegal.unexpected-keyword.java +// ^ - invalid +// ^^^^^^^^ invalid.illegal.unexpected-keyword.java +// ^ - invalid - storage +// ^^^^ storage.type.void.java +// ^ - entity - storage +// ^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^^^^^^^ storage.modifier.java +// ^ punctuation.section.block.end.java + + void à ( ) {} +//^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^ meta.function.return-type.java +// ^^ meta.function.identifier.java +// ^^^ meta.function.parameters.java meta.group.java +// ^ meta.function.java +// ^^ meta.function.java meta.block.java +//^^^^ storage.type.void.java +// ^ entity.name.function +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + void bar$ () {} +//^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^ meta.function.return-type.java +// ^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java meta.group.java +// ^ meta.function.java +// ^^ meta.function.java meta.block.java +//^^^^ storage.type.void.java +// ^^^^ entity.name.function +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + // It looks like a function definition then highlight it as such, even in function bodies. + int localMethodTest() { boolean bar() { void baz(); } } +//^^^^ meta.function.return-type.java +// ^^^^^^^^^^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java meta.group.java +// ^ meta.function.java +// ^^ meta.function.java meta.block.java +// ^^^^^^^^ meta.function.java meta.block.java meta.function.return-type.java +// ^^^ meta.function.java meta.block.java meta.function.identifier.java +// ^^ meta.function.java meta.block.java meta.function.parameters.java meta.group.java +// ^ meta.function.java meta.block.java meta.function.java +// ^^^^^^^^^^^^^^^ meta.function.java meta.block.java meta.function.java meta.block.java +// ^^ meta.function.java meta.block.java +//^^^ storage.type.primitive.java +// ^^^^^^^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^^^^^^^ storage.type.primitive.java +// ^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^^^^ storage.type.void.java +// ^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java +// ^ punctuation.section.block.end.java +// ^ punctuation.section.block.end.java + + public +//^^^^^^^ meta.function.modifier.java - meta.function meta.function +//^^^^^^ storage.modifier.java + void +//^^^^^ meta.function.return-type.java - meta.function meta.function +//^^^^ storage.type.void.java + methodNameOnDifferentLine(); +//^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.identifier.java entity.name.function.java + + abstract void myAbstractMethod (With foo); +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^^^^^ meta.function.modifier.java +// ^^^^^ meta.function.return-type.java +// ^^^^^^^^^^^^^^^^^ meta.function.identifier.java +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java +// ^^^^^^^^^^^^^^ meta.generic.java +// ^ - meta.function +//^^^^^^^^ storage.modifier.java +// ^^^^ storage.type.void.java +// ^^^^^^^^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^^ variable.parameter.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + private Long myOtherAbstractMethod(@WithAnnotation Blah blah); +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^^^^ meta.function.modifier.java +// ^^^^^ meta.function.return-type.java +// ^^^^^^^^^^^^^^^^^^^^^ meta.function.identifier.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java +// ^^^^^^^^^^^^^^^ meta.annotation.identifier.java +// ^ - meta.function +// ^^^^^^^^^^^^^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.definition.annotation.java +// ^^^^^^^^^^^^^^ variable.annotation.java +// ^^^^ storage.type.class.java +// ^^^^ variable.parameter.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + protected static void methodList(List args) {} +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^^^^^^^^^^^^^ meta.function.modifier.java +// ^^^^^ meta.function.return-type.java +// ^^^^^^^^^^ meta.function.identifier.java - meta.function meta.function +// ^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java - meta.function meta.function +// ^ meta.function.java - meta.function meta.function +// ^^ meta.function.java - meta.function meta.function +//^^^^^^^^^ storage.modifier.java +// ^^^^^^ storage.modifier.java +// ^^^^ storage.type +// ^^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^^^ variable.parameter.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + public MyGeneric ABSTRACTMETHOD(Foo bar); +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^^^ meta.function.modifier.java +// ^^^^^^^^^ meta.function.return-type.java - meta.generic +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.return-type.java meta.generic.java +// ^ meta.function.return-type.java - meta.generic +// ^^^^^^^^^^^^^^ meta.function.identifier.java +// ^^^^ meta.function.parameters.java meta.group.java - meta.generic +// ^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java meta.generic.java +// ^^^^^ meta.function.parameters.java meta.group.java - meta.generic +//^^^^^^ storage.modifier.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^^ storage.type.class.java +// ^ punctuation.separator.comma.java +// ^^^^ storage.type.class.java +// ^ punctuation.separator.comma.java +// ^^^^^^^^ storage.type.class.java +// ^ punctuation.separator.comma.java +// ^^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^^^^^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^ storage.type.class.java +// ^ punctuation.separator.comma.java +// ^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^^ variable.parameter.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + private static int methodThrows() throws MyException { +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^^^^^^^^^^^ meta.function.modifier.java +// ^^^^ meta.function.return-type.java +// ^^^^^^^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java +// ^ meta.function.java +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.throws.java +// ^^^^^ meta.generic.java +// ^^ meta.function.java +//^^^^^^^ storage.modifier.java +// ^^^^^^ storage.modifier.java +// ^^^ storage.type.primitive.java +// ^^^^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^^^^^^ keyword.declaration.throws.java +// ^^^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.block.begin.java + throw +//^^^^^^^^ meta.function.java meta.block.java +// ^^^^^^ meta.statement.flow.throw.java +// ^^^^^ keyword.control.flow.throw.java + new +//^^^^^^^^^^ meta.function.java meta.block.java +// ^ meta.statement.flow.throw.java - meta.instantiation +// ^^^^ meta.statement.flow.throw.java meta.instantiation.java +// ^^^ keyword.other.storage.new.java + MyException +//^^^^^^^^^^^^^^^^^^ meta.function.java meta.block.java +// ^^^^^^^^^^^^^ meta.statement.flow.throw.java meta.instantiation.java +// ^^^^^^^^^^^ storage.type.class.java + ("hello (world)"); +//^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.java meta.block.java +// ^^^^^^^^^^^^^^^^^ meta.statement.flow.throw.java meta.instantiation.java meta.group.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^^^^^^^ string.quoted.double.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + } +//^ meta.function.java meta.block.java punctuation.section.block.end.java +// ^ - meta.function + + private static int methodthrows() throws int {} +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^^^^^^^^^^^ meta.function.modifier.java +// ^^^^ meta.function.return-type.java +// ^^^^^^^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java +// ^ meta.function.java +// ^^^^^^^^^^^ meta.function.throws.java +// ^^ meta.function.java +// ^ - meta.function +//^^^^^^^ storage.modifier.java +// ^^^^^^ storage.modifier.java +// ^^^ storage.type.primitive.java +// ^^^^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^^^^^^ keyword.declaration.throws.java +// ^^^ invalid.illegal.unexpected-keyword.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + private static int methodthrows() throws array[] {} +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^^^^^^^^^^^ meta.function.modifier.java +// ^^^^ meta.function.return-type.java +// ^^^^^^^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java +// ^ meta.function.java +// ^^^^^^^^^^^^^^^ meta.function.throws.java +// ^^ meta.function.java +// ^ - meta.function +//^^^^^^^ storage.modifier.java +// ^^^^^^ storage.modifier.java +// ^^^ storage.type.primitive.java +// ^^^^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^^^^^^ keyword.declaration.throws.java +// ^^^^^ storage.type.class.java +// ^^ invalid.illegal.unexpected-modifier.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + private static int methodthrows() throws myexception {} +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^^^^^^^^^^^ meta.function.modifier.java +// ^^^^ meta.function.return-type.java +// ^^^^^^^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java +// ^ meta.function.java +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.throws.java +// ^^^^^ meta.generic.java +// ^^ meta.function.java +// ^ - meta.function +//^^^^^^^ storage.modifier.java +// ^^^^^^ storage.modifier.java +// ^^^ storage.type.primitive.java +// ^^^^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^^^^^^ keyword.declaration.throws.java +// ^^^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + private static int methodthrows() throws java.myexception {} +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^^^^^^^^^^^ meta.function.modifier.java +// ^^^^ meta.function.return-type.java +// ^^^^^^^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java +// ^ meta.function.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.throws.java +// ^^^^^^^^^^ meta.generic.java +// ^^ meta.function.java +// ^ - meta.function +// ^^^^^^^^^^^^^^^^^ meta.path.java - meta.path meta.path +// ^^^^^^^^ meta.path.java meta.path.java +// ^ meta.path.java - meta.path meta.path +// ^ - meta.path +//^^^^^^^ storage.modifier.java +// ^^^^^^ storage.modifier.java +// ^^^ storage.type.primitive.java +// ^^^^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^^^^^^ keyword.declaration.throws.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + void primitiveVarArgs(char... values) {} +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +// ^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java +// ^^^^ storage.type.primitive.java +// ^^^ keyword.operator.variadic.java +// ^^^^^^ variable.parameter.java + + void finalPrimitiveVarArgs(final int... values) {} +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +// ^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java +// ^^^^^ storage.modifier.java +// ^^^ storage.type.primitive.java +// ^^^ keyword.operator.variadic.java +// ^^^^^^ variable.parameter.java + + void annotatedPrimitiveVarArgs(@anno int @foo.anno... values) {} +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java +// ^^^^^ meta.annotation.identifier.java +// ^^^ storage.type.primitive.java +// ^^^^^^^^^ meta.annotation.identifier.java +// ^^^ keyword.operator.variadic.java +// ^^^^^^ variable.parameter.java + + void classVarArgs(String... values) {} +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +// ^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java +// ^^^^^^ storage.type.class.java +// ^^^ keyword.operator.variadic.java +// ^^^^^^ variable.parameter.java + + void invalidPrivateClassVarArgs(private String... values) {} +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java +// ^ - meta.function.parameters.java +// ^^^^^^^ invalid.illegal.unexpected-keyword.java +// ^^^^^^ storage.type.class.java +// ^^^ keyword.operator.variadic.java +// ^^^^^^ variable.parameter.java + + void invalidVarArgs(var... values) {} +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +// ^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java +// ^^^ invalid.illegal.unexpected-keyword.java +// ^^^ keyword.operator.variadic.java +// ^^^ variable.parameter.java + + void arrayMethod(byte [] [] a, int b, byte[] c) {} +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java +// ^ - meta.function.parameters.java +// ^^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java +// ^^ storage.modifier.array.java +// ^ variable.parameter.java +// ^^^ storage.type.primitive.java +// ^ variable.parameter.java +// ^^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java +// ^ variable.parameter.java + + int[] arrayMethod(int a[], String b[])[] {} +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^^ meta.function.return-type.java +// ^^^^^^^^^^^ meta.function.identifier.java +// ^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java +// ^^^ meta.function.java - meta.function meta.group - meta.function meta.block +// ^^ meta.function.java meta.block.java +//^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java +// ^^^ storage.type.primitive.java +// ^ variable.parameter.java +// ^^ storage.modifier.array.java +// ^^^^^^ storage.type.class.java +// ^ variable.parameter.java +// ^^ storage.modifier.array.java + + @anno public int[][] arrayMethod( +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^^^^^^^^^ meta.function.modifier.java +// ^^^^^^^^ meta.function.return-type.java +// ^^^^^^^^^^^ meta.function.identifier.java entity.name.function.java +// ^^ meta.function.parameters.java meta.group.java +//^^^^^ meta.annotation.identifier.java +// ^^^^^^ storage.modifier.java +// ^^^ storage.type.primitive.java +// ^^^^ storage.modifier.array.java +// ^ punctuation.section.group.begin.java + + Map[] mapping, +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java - meta.function meta.function +// ^^^ storage.type.class.java +// ^^^^^^^^^^^^ meta.generic.java +// ^ punctuation.section.generic.begin.java +// ^^^^ storage.type.class.java +// ^ punctuation.separator.comma.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^ storage.modifier.array.java +// ^^^^^^^ variable.parameter.java +// ^ punctuation.separator.comma.java + + @Anno int[] arg[], +// ^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java - meta.function meta.function +// ^^^^^ meta.annotation.identifier.java +// ^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java +// ^^^ variable.parameter.java +// ^^ storage.modifier.array.java +// ^ punctuation.separator.comma.java + + final int @Anno [] @Anno [] arg @Anno [] @Anno [], +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java - meta.function meta.function +// ^^^^^ storage.modifier.java +// ^^^ storage.type.primitive.java +// ^^^^^ meta.annotation.identifier.java +// ^^ storage.modifier.array.java +// ^^^^^ meta.annotation.identifier.java +// ^^ storage.modifier.array.java +// ^^^ variable.parameter.java +// ^^^^^ meta.annotation.identifier.java +// ^^ storage.modifier.array.java +// ^^^^^ meta.annotation.identifier.java +// ^^ storage.modifier.array.java + + String@Anno[]@Anno[]arg@Anno[]@Anno[] +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java - meta.function meta.function +// ^^^^^^ storage.type.class.java +// ^^^^^^^^^^^^^^^^ meta.generic.java +// ^ punctuation.section.generic.begin.java +// ^^^ invalid.illegal.unexpected-keyword.java +// ^ punctuation.separator.comma.java +// ^^^ storage.type.primitive.java +// ^^^^^ meta.annotation.identifier.java +// ^^ storage.modifier.array.java +// ^ punctuation.section.generic.end.java +// ^^^^^ meta.annotation.identifier.java +// ^^ storage.modifier.array.java +// ^^^^^ meta.annotation.identifier.java +// ^^ storage.modifier.array.java +// ^^^ variable.parameter.java +// ^^^^^ meta.annotation.identifier.java +// ^^ storage.modifier.array.java +// ^^^^^ meta.annotation.identifier.java +// ^^ storage.modifier.array.java + ) @Anno [] @ path . Anno (param = value) [] {} +//^ meta.function.parameters.java meta.group.java punctuation.section.group.end.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.java - meta.function meta.function +// ^^ meta.function.java meta.block.java - meta.function meta.function +// ^ - meta.function +// ^^^^^ meta.annotation.identifier.java +// ^^ storage.modifier.array.java + + void genericTypeMethod(T obj); +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^ meta.function.modifier.java meta.generic.declaration.java +// ^ meta.function.modifier.java - meta.generic +// ^^^^^ meta.function.return-type.java +// ^^^^^^^^^^^^^^^^^ meta.function.identifier.java +// ^^^^^^^ meta.function.parameters.java meta.group.java +// ^ - meta.function +//^ punctuation.section.generic.begin.java +// ^ variable.parameter.type +// ^ punctuation.section.generic.end.java +// ^^^^ storage.type.void.java +// ^^^^^^^^^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ storage.type.class.java +// ^^^ variable.parameter.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + public static Set unmodifiableSet(Set set); +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^ meta.function.modifier.java meta.generic.declaration.java +// ^^^^^^^^^^^^^^^ meta.function.modifier.java - meta.generic +// ^^^ meta.function.return-type.java - meta.generic +// ^^^ meta.function.return-type.java meta.generic.java +// ^ meta.function.return-type.java - meta.generic +// ^^^^^^^^^^^^^^^ meta.function.identifier.java +// ^^^^ meta.function.parameters.java meta.group.java - meta.generic +// ^^^ meta.function.parameters.java meta.group.java meta.generic.java +// ^^^^^ meta.function.parameters.java meta.group.java - meta.generic +// ^ - meta.function +//^ punctuation.section.generic.begin.java +// ^ variable.parameter.type +// ^ punctuation.section.generic.end.java +// ^^^^^^ storage.modifier.java +// ^^^^^^ storage.modifier.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^^^^^^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^^ variable.parameter.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + public static T genericTypeMethod(Collection, Sink) {} +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^^^^^^^^^^ meta.function.modifier.java - meta.generic +// ^^^ meta.function.modifier.java meta.generic.declaration.java +// ^ meta.function.modifier.java - meta.generic +// ^^ meta.function.return-type.java - meta.generic +// ^^^^^^^^^^^^^^^^^ meta.function.identifier.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java +// ^^^^^^^^^^^^^ meta.generic.java +// ^^^ meta.generic.java +// ^ meta.function.java +// ^^ meta.function.java meta.block.java +// ^ - meta.function +//^^^^^^ storage.modifier.java +// ^^^^^^ storage.modifier.java +// ^ variable.parameter.type.java +// ^ storage.type.class.java +// ^^^^^^^^^^^^^^^^^ entity.name.function.java +// ^^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ variable.language.wildcard.java +// ^^^^^^^ storage.modifier.extends.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.separator.comma.java - meta.generic.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + protected static > +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^^^^^^^^^^^^^ meta.function.modifier.java - meta.generic +// ^^^^^^^^^^^^^^^^^^^^^ meta.function.modifier.java meta.generic.declaration.java - meta.generic meta.generic +// ^^^^^^^^^^^ meta.function.modifier.java meta.generic.declaration.java meta.generic.java +// ^ meta.function.modifier.java meta.generic.declaration.java - meta.generic meta.generic +// ^ meta.function.modifier.java - meta.generic +//^^^^^^^^^ storage.modifier.java +// ^^^^^^ storage.modifier.java +// ^ punctuation.section.generic.begin.java +// ^ variable.parameter.type.java +// ^^^^^^^ storage.modifier.extends.java +// ^^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ variable.language.wildcard.java +// ^^^^^ keyword.declaration.super.java +// ^ storage.type.class.java +// ^^ punctuation.section.generic.end.java + T max(Collection coll); +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^^ meta.function.modifier.java +// ^^ meta.function.return-type.java +// ^^^ meta.function.identifier.java +// ^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java +// ^ - meta.function +// ^ storage.type.class.java +// ^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^^^ variable.parameter.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + @RunWith(JUnit4.class) +//^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function - meta.annotation meta.annotation +//^^^^^^^^ meta.function.modifier.java meta.annotation.identifier.java +// ^^^^^^^^^^^^^^ meta.function.modifier.java meta.annotation.parameters.java meta.group.java +// ^ meta.function.modifier.java - meta.annotation +//^ punctuation.definition.annotation.java +// ^^^^^^^ variable.annotation.java +// ^ punctuation.section.group.begin.java +// ^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^^ variable.language.class.java - storage.type.java +// ^ punctuation.section.group.end.java + public +//^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^^ meta.function.modifier.java storage.modifier.java +// ^ meta.function.modifier.java - storage + static +//^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^ meta.function.modifier.java - storage +// ^^^^^^ meta.function.modifier.java storage.modifier.java +// ^ meta.function.modifier.java - storage + +//^^^^ - meta.function meta.function +//^^^ meta.function.modifier.java meta.generic.declaration.java +// ^ meta.function.modifier.java - meta.generic +// ^ punctuation.section.generic.end.java + void +//^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^ meta.function.modifier.java +// ^^^^ meta.function.return-type.java storage.type.void.java +// ^^ meta.function.return-type.java - storage + genericMethod +//^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^ meta.function.return-type.java - storage - entity +// ^^^^^^^^^^^^^ meta.function.identifier.java entity.name.function.java +// ^ meta.function.identifier.java - entity + ( +//^^^^ - meta.function meta.function +//^^ meta.function.identifier.java +// ^^ meta.function.parameters.java meta.group.java +// ^ punctuation.section.group.begin.java + SomeType root +//^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java - meta.function meta.function +// ^^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^^^ variable.parameter.java + ) +//^^^^ - meta.function meta.function +//^^^ meta.function.parameters.java meta.group.java +// ^ meta.function.java +// ^ punctuation.section.group.end.java + throws +//^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^ meta.function.java +// ^^^^^^^ meta.function.throws.java +// ^^^^^^ keyword.declaration.throws.java + Exception +//^^^^^^^^^^^^^^^^ meta.function.throws.java - meta.function meta.function +// ^^^^^^^^^ storage.type.class.java + , IOException, +//^^^^^^^^^^^^^^^^^^^^^ meta.function.throws.java - meta.function meta.function +// ^ punctuation.separator.comma.java +// ^^^^^^^^^^^ storage.type.class.java +// ^ punctuation.separator.comma.java + SAXException +//^^^^^^^^^^^^^^^^^^^ meta.function.throws.java - meta.function meta.function +// ^^^^^^^^^^^^ storage.type.class.java + { +//<- meta.function.throws.java - meta.function meta.function +//^^ meta.function.java meta.block.java - meta.function meta.function +//^ punctuation.section.block.begin.java + } +//^ meta.function.java meta.block.java punctuation.section.block.end.java +// ^ - meta.function + + @RunWith(JUnit4.class) +//^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function - meta.annotation meta.annotation +//^^^^^^^^ meta.function.modifier.java meta.annotation.identifier.java +// ^^^^^^^^^^^^^^ meta.function.modifier.java meta.annotation.parameters.java meta.group.java +// ^ meta.function.modifier.java - meta.annotation +//^ punctuation.definition.annotation.java +// ^^^^^^^ variable.annotation.java +// ^ punctuation.section.group.begin.java +// ^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^^ variable.language.class.java - storage.type.java +// ^ punctuation.section.group.end.java + public void someReallyReallyLongMethodNameThatMakesTheBraceOverflowToTheNextLine( +//^^^^^^^ meta.function.modifier.java +// ^^^^^ meta.function.return-type.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.identifier.java entity.name.function.java +// ^ meta.function.parameters.java meta.group.java punctuation.section.group.begin.java + WITHSOMEPARAMS foo, +// ^ meta.function.parameters.java storage.type.class.java +// ^ meta.function.parameters.java variable.parameter.java + Generic bar) +// ^ meta.function.parameters.java storage.type.class.java +// ^^^^^^^ meta.generic.java +// ^ meta.function.parameters.java variable.parameter.java +// ^ punctuation.section.group.end + throws Exception { +// ^ meta.function.throws.java keyword.declaration.throws.java +// ^ meta.function.throws.java storage.type.class.java + return someMethod (new Function() { +// ^ - meta.function-call +// ^^^^^^^^^^^ meta.function-call.identifier.java - meta.function-call meta.function-call +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.java meta.group.java - meta.function-call meta.function-call +// ^ meta.class.java punctuation.section.block.begin.java +// ^ - variable +// ^^^^^^^^^^ variable.function.java +// ^ - variable + @Override + public V apply(V input) { +// ^ storage.type.class.java +// ^^^^^^^^^ meta.function.parameters.java +// ^ storage.type.class.java +// ^ variable.parameter.java +// ^ meta.function + return input; + } +// ^ meta.function + }, executor); +// ^^^^^^^^^^^^^ meta.function-call.arguments.java meta.group.java +// ^ meta.class.java punctuation.section.block.end.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java - meta.function-call + } +//^ meta.function.java punctuation.section.block.end.java + +} +// <- meta.class.java punctuation.section.block.end.java + + +/****************************************************************************** + * Method Declaration With Receiver Arguments Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.4 + *****************************************************************************/ + +class ReceiverArgTests { + + // Illegal: Top-level constructors can't contain receiver parameters, + // but the syntax does not destinguish top-level and nested classses + ReceiverArgTests(ReceiverArgTests this, A this) {} +//^^^^^^^^^^^^^^^^ meta.function.identifier.java - meta.function meta.function +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java - meta.function meta.function +//^^^^^^^^^^^^^^^^ entity.name.function.constructor.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^^^^^^^^ storage.type.class.java +// ^^^^ variable.parameter.this.java +// ^ punctuation.separator.comma.java +// ^ storage.type.class.java +// ^^^^ invalid.illegal.identifier.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + void method(ReceiverArgTests this, A this, B super, C par)[] {} +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^ meta.function.return-type.java +// ^^^^^^ meta.function.identifier.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java +// ^^^ meta.function.java +// ^^ meta.function.java meta.block.java +//^^^^ storage.type.void.java +// ^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^^^^^^^^ storage.type.class.java +// ^^^^ variable.parameter.this.java +// ^ punctuation.separator.comma.java +// ^ storage.type.class.java +// ^^^^ invalid.illegal.identifier.java +// ^ punctuation.separator.comma.java +// ^ storage.type.class.java +// ^^^^^ invalid.illegal.identifier.java +// ^ punctuation.separator.comma.java +// ^ storage.type.class.java +// ^^^ variable.parameter.java +// ^ punctuation.section.group.end.java +// ^^ storage.modifier.array.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + // Illegal: Static methods can't contain receiver parameters, + // but the syntax does not destinguish them. + static void method(ReceiverArgTests this) {} +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function - meta.function meta.function +//^^^^^^^ meta.function.modifier.java +// ^^^^^ meta.function.return-type.java +// ^^^^^^ meta.function.identifier.java +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java +//^^^^^^ storage.modifier.java +// ^^^^ storage.type.void.java +// ^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^^^^^^^^ storage.type.class.java +// ^^^^ variable.parameter.this.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + class A { + A(ReceiverArgTests ReceiverArgTests.this, A ReceiverArgTests.this) {} +// ^ entity.name.function.constructor.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^^^^^^^^ storage.type.class.java +// ^^^^^^^^^^^^^^^^^^^^^ meta.path.java +// ^^^^^^^^^^^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^ variable.parameter.this.java +// ^ punctuation.separator.comma.java +// ^ storage.type.class.java +// ^^^^^^^^^^^^^^^^ variable.parameter.java +// ^ invalid.illegal.unexpected-accessor.java +// ^^^^ invalid.illegal.unexpected-member.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + A( +// ^ entity.name.function.constructor.java +// ^ punctuation.section.group.begin.java + /**/ ReceiverArgTests +// ^^^^ comment.block.empty.java +// ^^^^^^^^^^^^^^^^ storage.type.class.java + /**/ ReceiverArgTests +// ^^^^ comment.block.empty.java +// ^ - meta.path +// ^^^^^^^^^^^^^^^^^ meta.path.java +// ^^^^^^^^^^^^^^^^ storage.type.class.java + /**/ . +// ^^^^^^^^ meta.path.java +// ^^^^ comment.block.empty.java +// ^ punctuation.accessor.dot.java - support - variable + /**/ this [] . illegal, +// ^^^^^^^^^ meta.path.java +// ^^^^^^^^^^^^^^^ - meta.path +// ^^^^ comment.block.empty.java +// ^^^^ variable.parameter.this.java - support +// ^^ invalid.illegal.unexpected-modifier.java +// ^ invalid.illegal.unexpected-accessor.java +// ^^^^^^^ invalid.illegal.unexpected-member.java +// ^ punctuation.separator.comma.java + /**/ , +// ^^^^ comment.block.empty.java +// ^ punctuation.separator.comma.java + /**/ A +// ^^^^ comment.block.empty.java +// ^ storage.type.class.java - meta.path + /**/ ReceiverArgTests +// ^^^^ comment.block.empty.java +// ^^^^^^^^^^^^^^^^ variable.parameter.java - meta.path - support + /**/ . +// ^^^^^^^ - meta.path +// ^^^^ comment.block.empty.java +// ^ invalid.illegal.unexpected-accessor.java - meta.path + /**/ this[].foo[][].bar +// ^^^^^^^^^^^^^^^^^^^^^^^ - meta.path +// ^^^^ comment.block.empty.java +// ^^^^ invalid.illegal.unexpected-member.java - meta.path +// ^^ invalid.illegal.unexpected-modifier.java +// ^ invalid.illegal.unexpected-accessor.java +// ^^^ invalid.illegal.unexpected-member.java +// ^^^^ invalid.illegal.unexpected-modifier.java +// ^ invalid.illegal.unexpected-accessor.java +// ^^^ invalid.illegal.unexpected-member.java + /**/ ) {} +// ^^^^ comment.block.empty.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + // OK: the ReceiverArgTests parameter represents the instance + // of A for which A.m() is invoked. + void method(A this) {} +// ^^^^^ meta.function.return-type.java - meta.function meta.function +// ^^^^^^ meta.function.identifier.java - meta.function meta.function +// ^^^^^^^^ meta.function.parameters.java meta.group.java - meta.function meta.function +// ^^^^ storage.type.void.java +// ^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ storage.type.class.java +// ^^^^ variable.parameter.this.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + class B { + // OK: the ReceiverArgTests parameter represents the instance + // of A which immediately encloses the instance of B being constructed. + B(ReceiverArgTests.A A.this) {} +// ^ entity.name.function.constructor.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^^^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^ storage.type.class.java +// ^^^^^^ meta.path.java +// ^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^ variable.parameter.this.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + // FAIL: qualified parameter is a receiver and must end with "this". + B(ReceiverArgTests.A A.fail) {} +// ^ entity.name.function.constructor.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^^^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^ storage.type.class.java +// ^^^^^^ meta.path.java +// ^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^ invalid.illegal.identifier.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + // OK: the receiver parameter represents the instance + // of B for which B.m() is invoked. + void method(ReceiverArgTests.A.B this) {} +// ^^^^^ meta.function.return-type.java - meta.function meta.function +// ^^^^^^ meta.function.identifier.java - meta.function meta.function +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java - meta.function meta.function +// ^ - meta.path +// ^^^^^^^^^^^^^^^^^^^^ meta.path.java +// ^^^^^^ - meta.path +// ^^^^ storage.type.void.java +// ^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^^^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^ storage.type.class.java +// ^^^^ variable.parameter.this.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + void method(ReceiverArgTests.A.B A.B.this) {} +// ^^^^^ meta.function.return-type.java - meta.function meta.function +// ^^^^^^ meta.function.identifier.java - meta.function meta.function +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java - meta.function meta.function +// ^ - meta.path +// ^^^^^^^^^^^^^^^^^^^^ meta.path.java +// ^ - meta.path +// ^^^^^^^^ meta.path.java +// ^ - meta.path +// ^^^^ storage.type.void.java +// ^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^^^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^ storage.type.class.java +// ^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^ variable.parameter.this.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + void method(receiverargtests.a.b a.b.this) {} +// ^^^^^ meta.function.return-type.java - meta.function meta.function +// ^^^^^^ meta.function.identifier.java - meta.function meta.function +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java - meta.function meta.function +// ^ - meta.path +// ^^^^^^^^^^^^^^^^^^^^ meta.path.java +// ^ - meta.path +// ^^^^^^^^ meta.path.java +// ^ - meta.path +// ^^^^ storage.type.void.java +// ^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^^^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^ storage.type.class.java +// ^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^ variable.parameter.this.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + void method(@á receiverargtests . @ß a . @µ.c b @a a . @b.c b . @d . e(f="") this) {} +// ^^^^^ meta.function.return-type.java - meta.function meta.function +// ^^^^^^ meta.function.identifier.java - meta.function meta.function +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java meta.group.java - meta.function meta.function +// ^^^^ - meta.path +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.path.java - meta.path meta.path +// ^^^^ meta.path.java meta.path.java +// ^^ meta.path.java - meta.path meta.path +// ^ - meta.path +// ^^^^^^^ meta.path.java - meta.path meta.path +// ^^^^ meta.path.java meta.path.java +// ^^^^^ meta.path.java - meta.path meta.path +// ^^^^^^ meta.path.java meta.path.java +// ^^^^^^^^^^^ meta.path.java - meta.path meta.path +// ^^^^^ - meta.path +// ^^^^ storage.type.void.java +// ^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^^ meta.annotation.identifier.java +// ^^^^^^^^^^^^^^^^ storage.type.class.java +// ^^^ meta.generic.java +// ^ punctuation.accessor.dot.java +// ^^ meta.annotation.identifier.java +// ^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^ meta.annotation.identifier.java +// ^ storage.type.class.java +// ^^ meta.annotation.identifier.java +// ^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^ meta.annotation.identifier.java +// ^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^^^ meta.annotation.identifier.java +// ^^^^^^ meta.annotation.parameters.java meta.group.java +// ^^^^ variable.parameter.this.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + } +// ^ meta.class.java meta.block.java meta.class.java meta.block.java meta.class.java meta.block.java punctuation.section.block.end.java + } +//^ meta.class.java meta.block.java meta.class.java meta.block.java punctuation.section.block.end.java +} +//<- meta.class.java meta.block.java punctuation.section.block.end.java + + +/****************************************************************************** + * Invalid Class Member Fallback Tests + * Things that are not supported by Java but might need to be handled by the + * syntax to prevent highligthing from breaking due to incomplete code blocks. + * + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.4 + *****************************************************************************/ + +class InvalidMemberTests { + + int if(true) +//^^^^^^^^^^^^ - meta.function +//^^^ storage.type.primitive.java +// ^^ - entity + + int class MyClass +//^^^^^^^^^^^^^^^^^ - meta.function +//^^^ storage.type.primitive.java +// ^^ - entity + + int package dump +//^^^^^^^^^^^^^^^^ - meta.function +//^^^ storage.type.primitive.java +// ^^ - entity + +} +// <- meta.class.java punctuation.section.block.end.java + + +/****************************************************************************** + * Local Variable Declaration Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.4 + *****************************************************************************/ + +class LocalVariableDeclarationTests { + + void declarePrimitiveTypes() { + + int +// ^^^^^ - meta.declaration +// ^^^ storage.type.primitive.java + + int foo +// ^^^^ meta.declaration.type.java +// ^^^^ meta.declaration.identifier.java +// ^^^ storage.type.primitive.java +// ^^^ variable.other.java + + int foo; +// ^^^^ meta.declaration.type.java +// ^^^ meta.declaration.identifier.java +// ^ - meta.declaration +// ^^^ storage.type.primitive.java +// ^^^ variable.other.java +// ^ punctuation.terminator.java + + int FOO; +// ^^^^ meta.declaration.type.java +// ^^^ meta.declaration.identifier.java +// ^ - meta.declaration +// ^^^ storage.type.primitive.java +// ^^^ constant.other.java +// ^ punctuation.terminator.java + + int foo, bar; +// ^ - meta.declaration +// ^^^^ meta.declaration.type.java +// ^^^ meta.declaration.identifier.java +// ^ meta.declaration.java +// ^^^^ meta.declaration.identifier.java +// ^ - meta.declaration +// ^^^ storage.type.primitive.java +// ^^^ variable.other.java +// ^ punctuation.separator.comma.java +// ^^^ variable.other.java +// ^ punctuation.terminator.java + + int foo =, bar =; +// ^ - meta.declaration +// ^^^^ meta.declaration.type.java +// ^^^^ meta.declaration.identifier.java +// ^^ meta.declaration.java +// ^^^^^ meta.declaration.identifier.java +// ^ meta.declaration.java +// ^ - meta.declaration +// ^^^ storage.type.primitive.java +// ^^^ variable.other.java +// ^ keyword.operator.assignment.java +// ^ punctuation.separator.comma.java +// ^^^ variable.other.java +// ^ keyword.operator.assignment.java +// ^ punctuation.terminator.java + + int foo = 0, bar = CONST; +// ^ - meta.declaration +// ^^^^ meta.declaration.type.java +// ^^^^ meta.declaration.identifier.java +// ^ meta.declaration.java +// ^^ meta.declaration.value.java +// ^^^^^ meta.declaration.identifier.java +// ^ meta.declaration.java +// ^^^^^^ meta.declaration.value.java +// ^ - meta.declaration +// ^^^ storage.type.primitive.java +// ^^^ variable.other.java +// ^ keyword.operator.assignment.java +// ^ constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^^^ variable.other.java +// ^ keyword.operator.assignment.java +// ^^^^^ constant.other.java +// ^ punctuation.terminator.java + + int[] +// ^^^^^^ - meta.declaration +// ^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java + + int [] +// ^^^^^^^ - meta.declaration +// ^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java + + int[] foo +// ^^^^^^ meta.declaration.type.java +// ^^^^ meta.declaration.identifier.java +// ^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java +// ^^^ variable.other.java + + int foo[], [] ; +// ^^^^ meta.declaration.type.java +// ^^^^^ meta.declaration.identifier.java +// ^ meta.declaration.java +// ^^^^ meta.declaration.identifier.java +// ^ - meta.declaration +// ^^^ storage.type.primitive.java +// ^^^ variable.other.java +// ^^ storage.modifier.array.java +// ^ punctuation.separator.comma.java +// ^^ storage.modifier.array.java +// ^ punctuation.terminator.java + + final int[] y = 10, z[] = 5; +// ^ - meta.declaration +// ^^^^^^^^^^^^ meta.declaration.type.java +// ^^ meta.declaration.identifier.java +// ^ meta.declaration.java +// ^^^ meta.declaration.value.java +// ^^^^^ meta.declaration.identifier.java +// ^ meta.declaration.java +// ^^ meta.declaration.value.java +// ^ - meta.declaration +// ^^^^^ storage.modifier.java +// ^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java +// ^ variable.other.java +// ^ keyword.operator.assignment.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ variable.other.java +// ^^ storage.modifier.array.java +// ^ keyword.operator.assignment.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.terminator.java + + @Number final int y @Dim1 [] @Dim2 [] = { {10, 1}, {5, 2} }; +// ^ - meta.declaration +// ^^^^^^^^^^^^^^^^^^ meta.declaration.type.java +// ^^^^^^^^^^^^^^^^^^^^ meta.declaration.identifier.java +// ^ meta.declaration.java +// ^^^^^^^^^^^^^^^^^^^^ meta.declaration.value.java +// ^ - meta.declaration +// ^^^^^^^ meta.annotation.identifier.java +// ^^^^^ storage.modifier.java +// ^^^ storage.type.primitive.java +// ^ variable.other.java +// ^^^^^ meta.annotation.identifier.java +// ^^ storage.modifier.array.java +// ^^^^^ meta.annotation.identifier.java +// ^^ storage.modifier.array.java +// ^ keyword.operator.assignment.java + + @Number +// ^^^^^^^ meta.declaration.type.java meta.annotation.identifier.java +// ^ meta.declaration.type.java - meta.annotation + final +// ^^^^^ meta.declaration.type.java storage.modifier.java + int +// ^^^ meta.declaration.type.java storage.type.primitive.java + foo +// ^^^ meta.declaration.identifier.java variable.other.java + @Dim1 +// ^^^^^ meta.declaration.identifier.java meta.annotation.identifier.java +// ^ meta.declaration.identifier.java - meta.annotation + [] +// ^^ meta.declaration.identifier.java storage.modifier.array.java + = +// ^ meta.declaration.java keyword.operator.assignment.java + {0, 1} +// ^^^^^^ meta.declaration.value.java meta.braces.java + } +//^ meta.class.java meta.block.java meta.function.java meta.block.java punctuation.section.block.end.java +// ^ meta.class.java meta.block.java - meta.function + + void declareObjectTypes() { + + TestClass ; +// ^^^^^^^^^ storage.type.class.java + + testclass ; +// ^^^^^^^^^ variable.other.java + + TestClass foo +// ^^^^^^^^^^ meta.declaration.type.java +// ^^^^ meta.declaration.identifier.java +// ^^^^^^^^^ storage.type.class.java +// ^^^ variable.other.java + + testclass foo +// ^^^^^^^^^^ meta.declaration.type.java +// ^^^^ meta.declaration.identifier.java +// ^^^^^^^^^ storage.type.class.java +// ^^^ variable.other.java + + TestClass foo; +// ^^^^^^^^^^ meta.declaration.type.java +// ^^^ meta.declaration.identifier.java +// ^ - meta.declaration +// ^^^^^^^^^ storage.type.class.java +// ^^^ variable.other.java +// ^ punctuation.terminator.java + + TestClass foo, bar; +// ^ - meta.declaration +// ^^^^^^^^^^ meta.declaration.type.java +// ^^^ meta.declaration.identifier.java +// ^ meta.declaration.java +// ^^^^ meta.declaration.identifier.java +// ^ - meta.declaration +// ^^^^^^^^^ storage.type.class.java +// ^^^ variable.other.java +// ^ punctuation.separator.comma.java +// ^^^ variable.other.java +// ^ punctuation.terminator.java + + TestClass foo =, bar =; +// ^ - meta.declaration +// ^^^^^^^^^^ meta.declaration.type.java +// ^^^^ meta.declaration.identifier.java +// ^^ meta.declaration.java +// ^^^^^ meta.declaration.identifier.java +// ^ meta.declaration.java +// ^ - meta.declaration +// ^^^^^^^^^ storage.type.class.java +// ^^^ variable.other.java +// ^ keyword.operator.assignment.java +// ^ punctuation.separator.comma.java +// ^^^ variable.other.java +// ^ keyword.operator.assignment.java +// ^ punctuation.terminator.java + + TestClass foo = 0, bar = 10; +// ^ - meta.declaration +// ^^^^^^^^^^ meta.declaration.type.java +// ^^^^ meta.declaration.identifier.java +// ^ meta.declaration.java +// ^^ meta.declaration.value.java +// ^ meta.declaration.java +// ^^^^^ meta.declaration.identifier.java +// ^ meta.declaration.java +// ^^^ meta.declaration.value.java +// ^ - meta.declaration +// ^^^^^^^^^ storage.type.class.java +// ^^^ variable.other.java +// ^ keyword.operator.assignment.java +// ^ constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^^^ variable.other.java +// ^ keyword.operator.assignment.java +// ^^ constant.numeric.value.java +// ^ punctuation.terminator.java + + final TestClass[] y = 10, z[] = 5; +// ^ - meta.declaration +// ^^^^^^^^^^^^^^^^^^ meta.declaration.type.java +// ^^ meta.declaration.identifier.java +// ^ meta.declaration.java +// ^^^ meta.declaration.value.java +// ^ meta.declaration.java +// ^^^^^ meta.declaration.identifier.java +// ^ meta.declaration.java +// ^^ meta.declaration.value.java +// ^ - meta.declaration +// ^^^^^ storage.modifier.java +// ^^^^^^^^^ storage.type.class.java +// ^^ storage.modifier.array.java +// ^ variable.other.java +// ^ keyword.operator.assignment.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ variable.other.java +// ^^ storage.modifier.array.java +// ^ keyword.operator.assignment.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.terminator.java + + @Number final TestClass y @Dim1 [] @Dim2 [] = { {10, 1}, {5, 2} }; +// ^ - meta.declaration +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.type.java +// ^^^^^^^^^^^^^^^^^^^^ meta.declaration.identifier.java +// ^ meta.declaration.java +// ^^^^^^^^^^^^^^^^^^^^ meta.declaration.value.java +// ^ - meta.declaration +// ^^^^^^^ meta.annotation.identifier.java +// ^^^^^ storage.modifier.java +// ^^^^^^^^^ storage.type.class.java +// ^ variable.other.java +// ^^^^^ meta.annotation.identifier.java +// ^^ storage.modifier.array.java +// ^^^^^ meta.annotation.identifier.java +// ^^ storage.modifier.array.java +// ^ keyword.operator.assignment.java + + @number final testclass y @dim1 [] @dim2 [] = { {10, 1}, {5, 2} }; +// ^ - meta.declaration +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.type.java +// ^^^^^^^^^^^^^^^^^^^^ meta.declaration.identifier.java +// ^ meta.declaration.java +// ^^^^^^^^^^^^^^^^^^^^ meta.declaration.value.java +// ^ - meta.declaration +// ^^^^^^^ meta.annotation.identifier.java +// ^^^^^ storage.modifier.java +// ^^^^^^^^^ storage.type.class.java +// ^ variable.other.java +// ^^^^^ meta.annotation.identifier.java +// ^^ storage.modifier.array.java +// ^^^^^ meta.annotation.identifier.java +// ^^ storage.modifier.array.java +// ^ keyword.operator.assignment.java + + foo.TestClass bar.baz; +// ^ - meta.declaration +// ^^^^^^^^^^^^^ meta.declaration.type.java meta.path.java +// ^ meta.declaration.type.java - meta.path +// ^^^^^^^ meta.declaration.identifier.java - meta.path +// ^ - meta.declaration +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^ storage.type.class.java +// ^^^ variable.other.java +// ^ invalid.illegal.unexpected-accessor.java +// ^^^ invalid.illegal.unexpected-member.java + + foo.testclass bar.baz; +// ^ - meta.declaration +// ^^^^^^^^^^^^^ meta.declaration.type.java meta.path.java +// ^ meta.declaration.type.java - meta.path +// ^^^^^^^ meta.declaration.identifier.java - meta.path +// ^ - meta.declaration +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^ storage.type.class.java +// ^^^ variable.other.java +// ^ invalid.illegal.unexpected-accessor.java +// ^^^ invalid.illegal.unexpected-member.java + + a e = new a(){}; +// ^^^^^^ - meta.instantiation +// ^^ meta.declaration.type.java +// ^^ meta.declaration.identifier.java +// ^ meta.declaration.java +// ^ meta.declaration.value.java +// ^^^^^^^^^ meta.declaration.value.java meta.instantiation.java +// ^ - meta.declaration - meta.instantiation +// ^ storage.type.class.java +// ^ variable.other.java +// ^ keyword.operator.assignment.java +// ^^^ keyword.other.storage.new.java +// ^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java +// ^ punctuation.terminator.java + } + + + void declareGenericTypes() { + + List x; +// ^^^^ meta.declaration.type.java - meta.generic - meta.path +// ^^^^^^^^ meta.declaration.type.java meta.generic.java - meta.path +// ^ meta.declaration.type.java - meta.generic - meta.path +// ^ meta.declaration.identifier.java - meta.generic - meta.path +// ^ - meta.declaration +// ^^^^ storage.type.class.java +// ^^^^^^^^ meta.generic.java +// ^ punctuation.section.generic.begin.java +// ^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ variable.other.java +// ^ punctuation.terminator.java + + List x; +// ^^^^ meta.declaration.type.java - meta.generic - meta.path +// ^ meta.declaration.type.java meta.generic.java - meta.path +// ^^^^^^^^^^^^^^^^ meta.declaration.type.java meta.generic.java meta.path.java +// ^ meta.declaration.type.java meta.generic.java - meta.path +// ^ meta.declaration.type.java - meta.generic - meta.path +// ^ meta.declaration.identifier.java - meta.generic - meta.path +// ^ - meta.declaration +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ variable.other.java +// ^ punctuation.terminator.java + + List x; +// ^^^^ meta.declaration.type.java - meta.generic - meta.path +// ^^^^^ meta.declaration.type.java meta.generic.java - meta.path +// ^ meta.declaration.type.java - meta.generic - meta.path +// ^ meta.declaration.identifier.java - meta.generic - meta.path +// ^ - meta.declaration +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ variable.other.java +// ^ punctuation.terminator.java + + List x; +// ^^^^ meta.declaration.type.java - meta.generic - meta.path +// ^ meta.declaration.type.java meta.generic.java - meta.path +// ^^^^^^^^^^^^ meta.declaration.type.java meta.generic.java meta.path.java +// ^ meta.declaration.type.java meta.generic.java - meta.path +// ^ meta.declaration.type.java - meta.generic - meta.path +// ^ meta.declaration.identifier.java - meta.generic - meta.path +// ^ - meta.declaration +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ variable.other.java +// ^ punctuation.terminator.java + + List x; +// ^^^^ meta.declaration.type.java - meta.generic - meta.path +// ^^^^^^^ meta.declaration.type.java meta.generic.java - meta.path +// ^ meta.declaration.type.java - meta.generic - meta.path +// ^ meta.declaration.identifier.java - meta.generic - meta.path +// ^ - meta.declaration +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java +// ^ punctuation.section.generic.end.java +// ^ variable.other.java +// ^ punctuation.terminator.java + + List x; +// ^^^^ meta.declaration.type.java - meta.generic - meta.path +// ^ meta.declaration.type.java meta.generic.java - meta.path +// ^^^^^^^^^^^^^^^^ meta.declaration.type.java meta.generic.java meta.path.java +// ^^^ meta.declaration.type.java meta.generic.java - meta.path +// ^ meta.declaration.type.java - meta.generic - meta.path +// ^ meta.declaration.identifier.java - meta.generic - meta.path +// ^ - meta.declaration +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^ storage.type.class.java +// ^^ storage.modifier.array.java +// ^ punctuation.section.generic.end.java +// ^ variable.other.java +// ^ punctuation.terminator.java + + List x; +// ^^^^ meta.declaration.type.java - meta.generic - meta.path +// ^^^^^^^ meta.declaration.type.java meta.generic.java - meta.path +// ^ meta.declaration.type.java - meta.generic - meta.path +// ^ meta.declaration.identifier.java - meta.generic - meta.path +// ^ - meta.declaration +// ^^^^ storage.type.class.java +// ^^^^^^^ meta.generic.java +// ^^^ storage.type.class.java +// ^^ storage.modifier.array.java + + List[][] x; +// ^^^^ meta.declaration.type.java - meta.generic - meta.path +// ^^^^^^^^^ meta.declaration.type.java meta.generic.java - meta.path +// ^^^^^ meta.declaration.type.java - meta.generic - meta.path +// ^ meta.declaration.identifier.java - meta.generic - meta.path +// ^ - meta.declaration +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^ storage.type.primitive.java +// ^^^^ storage.modifier.array.java +// ^ punctuation.section.generic.end.java +// ^^^^ storage.modifier.array.java +// ^ variable.other.java +// ^ punctuation.terminator.java + + List x; +// ^^^^ meta.declaration.type.java - meta.generic - meta.path +// ^^^^^^^^^^^^^^^ meta.declaration.type.java meta.generic.java - meta.path +// ^ meta.declaration.type.java - meta.generic - meta.path +// ^ meta.declaration.identifier.java - meta.generic - meta.path +// ^ - meta.declaration +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ variable.language.wildcard.java +// ^^^^^^^ storage.modifier.extends.java +// ^^^ invalid.illegal.unexpected-keyword.java +// ^ punctuation.section.generic.end.java +// ^ variable.other.java +// ^ punctuation.terminator.java + + @anno foo . @anno TestClass @anno . anno [] bar . baz; +// ^ - meta.declaration +// ^^^^^ meta.declaration.type.java meta.annotation.identifier.java - meta.path +// ^ meta.declaration.type.java - meta.annotation - meta.path +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.type.java meta.path.java +// ^ meta.declaration.type.java - meta.path +// ^^^^^^^^^^^^ meta.declaration.type.java meta.annotation.identifier.java meta.path.java +// ^^^^ meta.declaration.type.java - meta.annotation - meta.path +// ^^^^^^^^^ meta.declaration.identifier.java - meta.annotation - meta.path +// ^ - meta.declaration +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^ variable.annotation.java +// ^^ storage.modifier.array.java +// ^^^ variable.other.java +// ^ invalid.illegal.unexpected-accessor.java +// ^^^ invalid.illegal.unexpected-member.java +// ^ punctuation.terminator.java + + @anno foo . @anno testclass @anno . anno [] bar . baz; +// ^ - meta.declaration +// ^^^^^ meta.declaration.type.java meta.annotation.identifier.java - meta.path +// ^ meta.declaration.type.java - meta.annotation - meta.path +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.type.java meta.path.java +// ^ meta.declaration.type.java - meta.path +// ^^^^^^^^^^^^ meta.declaration.type.java meta.annotation.identifier.java meta.path.java +// ^^^^ meta.declaration.type.java - meta.annotation - meta.path +// ^^^^^^^^^ meta.declaration.identifier.java - meta.annotation - meta.path +// ^ - meta.declaration +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^ variable.annotation.java +// ^^ storage.modifier.array.java +// ^^^ variable.other.java +// ^ invalid.illegal.unexpected-accessor.java +// ^^^ invalid.illegal.unexpected-member.java +// ^ punctuation.terminator.java + + class a{{ +// ^^^^^ meta.function.java meta.class.java +// ^^ meta.function.java meta.class.identifier.java - meta.generic +// ^^^ meta.function.java meta.class.identifier.java meta.generic.declaration.java +// ^^ meta.function.java meta.class.java meta.block.java - meta.generic +// ^^^^^ keyword.declaration.class.java +// ^ entity.name.class.java +// ^ punctuation.section.generic.begin.java +// ^ variable.parameter.type.java +// ^ punctuation.section.generic.end.java +// ^^ punctuation.section.block.begin.java + aa; +// ^ meta.declaration.type.java - meta.generic +// ^^^ meta.declaration.type.java meta.generic.java +// ^ meta.declaration.identifier.java - meta.generic +// ^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ variable.other.java +// ^ punctuation.terminator.java + }} +// ^^ punctuation.section.block.end.java + } + + void declareVarTypes() { + + var +// ^^^ storage.type.variant.java + + var x, y; +// ^^^ storage.type.variant.java +// ^ variable.other.java +// ^ punctuation.separator.comma.java +// ^ variable.other.java +// ^ punctuation.terminator.java + + var x = "String"; +// ^^^ storage.type.variant.java +// ^ variable.other.java +// ^ keyword.operator.assignment.java + + final var y = 10; +// ^^^^^ storage.modifier.java +// ^^^ storage.type.variant.java +// ^ variable.other.java +// ^ keyword.operator.assignment.java + + final var y.b = 10; +// ^^^^^ storage.modifier.java +// ^^^ storage.type.variant.java +// ^ variable.other.java +// ^ invalid.illegal.unexpected-accessor.java +// ^ invalid.illegal.unexpected-member.java +// ^ keyword.operator.assignment.java + + final var[] y = 10, z[] = 5; +// ^^^^^ storage.modifier.java +// ^^^ storage.type.variant.java +// ^^ invalid.illegal.unexpected-modifier.java +// ^ variable.other.java +// ^ keyword.operator.assignment.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ punctuation.terminator.java + + @Number final var y @Dim1 [] @Dim2 [] = { {10, 1}, {5, 2} }; +// ^^^^^^^ meta.annotation.identifier.java +// ^^^^^ storage.modifier.java +// ^^^ storage.type.variant.java +// ^ variable.other.java +// ^^^^^ meta.annotation.identifier.java +// ^^ storage.modifier.array.java +// ^^^^^ meta.annotation.identifier.java +// ^^ storage.modifier.array.java + } +} + + +/****************************************************************************** + * Labeled Statement Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.7 + *****************************************************************************/ + +class LabeledStatementTests { + + void run() { + + label: +// ^^^^^ entity.name.label.java +// ^ punctuation.separator.colon.java + + label: if () {} else {} +// ^^^^^ entity.name.label.java +// ^ punctuation.separator.colon.java +// ^^^^^^^^ meta.statement.conditional.if.java +// ^^^^^^^ meta.statement.conditional.else.java + + label: run(); +// ^^^^^ entity.name.label.java +// ^ punctuation.separator.colon.java +// ^^^^^ meta.function-call + + label: a = b; +// ^^^^^ entity.name.label.java +// ^ punctuation.separator.colon.java + } +} + + + +/****************************************************************************** + * If Statement Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.9 + *****************************************************************************/ + +class IfStatementTests { + + void run() { + + if$ ; +// ^^^ variable.other.java - keyword + + $if ; +// ^^^ variable.other.java - keyword + + if +// ^^^ meta.statement.conditional.if.java +// ^^ keyword.control.conditional.if.java + + if foo +// ^^^^^^^ meta.statement.conditional.if.java +// ^^ keyword.control.conditional.if.java +// ^^^ variable.other.java + + if (foo) +// ^^^ meta.statement.conditional.if.java - meta.group +// ^^^^^ meta.statement.conditional.if.java meta.group.java +// ^ meta.statement.conditional.if.java - meta.group +// ^^ keyword.control.conditional.if.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ punctuation.section.group.end.java + + if (foo) {} +// ^^^ meta.statement.conditional.if.java - meta.statement.conditional.if meta.group +// ^^^^^ meta.statement.conditional.if.java meta.group.java +// ^ meta.statement.conditional.if.java - meta.statement.conditional.if meta.block - meta.statement.conditional.if meta.group +// ^^ meta.statement.conditional.if.java meta.block.java +// ^ - meta.statement.conditional.if +// ^^ keyword.control.conditional.if.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + if (foo {} +// ^^^ meta.statement.conditional.if.java - meta.statement.conditional.if meta.group +// ^^^^^ meta.statement.conditional.if.java meta.group.java +// ^^ meta.statement.conditional.if.java meta.block.java +// ^ - meta.statement.conditional.if +// ^^ keyword.control.conditional.if.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + if (hello(world) { return false } +// ^^^ meta.statement.conditional.if.java - meta.statement.conditional.if meta.group +// ^^^^^^^^^^^^^^ meta.statement.conditional.if.java meta.group.java +// ^^^^^^^^^^^^^^^^ meta.statement.conditional.if.java meta.block.java +// ^ - meta.statement.conditional.if +// ^ punctuation.section.block.begin.java +// ^^^^^^ keyword.control.flow.return.java +// ^^^^^ constant.language.boolean.java +// ^ punctuation.section.block.end.java + + if (foo) else +// ^^^^^^^^^ - meta.statement.conditional.else +// ^^^ meta.statement.conditional.if.java - meta.statement.conditional.if meta.group +// ^^^^^ meta.statement.conditional.if.java meta.group.java +// ^ meta.statement.conditional.if.java - meta.statement.conditional.if meta.block - meta.statement.conditional.if meta.group +// ^^^^^ meta.statement.conditional.else.java - meta.statement.conditional.if +// ^^ keyword.control.conditional.if.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ punctuation.section.group.end.java +// ^^^^ keyword.control.conditional.else.java + + if (foo) {} else {} +// ^^^^^^^^^^^^ - meta.statement.conditional.else +// ^^^ meta.statement.conditional.if.java - meta.group +// ^^^^^ meta.statement.conditional.if.java meta.group.java +// ^ meta.statement.conditional.if.java - meta.statement.conditional.if meta.block - meta.statement.conditional.if meta.group +// ^^ meta.statement.conditional.if.java meta.block.java +// ^^^^^^^^ - meta.statement.conditional.if +// ^^^^^ meta.statement.conditional.else.java - meta.statement.conditional.else meta.block +// ^^ meta.statement.conditional.else.java meta.block.java +// ^ - meta.statement.conditional.if - meta.statement.conditional.else +// ^^ keyword.control.conditional.if.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java +// ^^^^ keyword.control.conditional.else.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + if (foo) else if (bar) else +// ^^^^^^^^^ - meta.statement.conditional.else +// ^^^ meta.statement.conditional.if.java - meta.statement.conditional.if meta.group +// ^^^^^ meta.statement.conditional.if.java meta.group.java +// ^ meta.statement.conditional.if.java - meta.statement.conditional.if meta.block - meta.statement.conditional.if meta.group +// ^^^^^ meta.statement.conditional.else.java - meta.statement.conditional.if +// ^^ keyword.control.conditional.if.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ punctuation.section.group.end.java +// ^^^^ keyword.control.conditional.else.java +// ^^^^^^^^^ - meta.statement.conditional.else +// ^^^ meta.statement.conditional.if.java - meta.statement.conditional.if meta.group +// ^^^^^ meta.statement.conditional.if.java meta.group.java +// ^ meta.statement.conditional.if.java - meta.statement.conditional.if meta.block - meta.statement.conditional.if meta.group +// ^^^^^ meta.statement.conditional.else.java - meta.statement.conditional.if +// ^^ keyword.control.conditional.if.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ punctuation.section.group.end.java +// ^^^^ keyword.control.conditional.else.java + + if (foo() == true) fun() else if (bar != 0) bar = 1 else baz++ +// ^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.statement.conditional.else +// ^^^ meta.statement.conditional.if.java - meta.statement.conditional.if meta.group +// ^^^^^^^^^^^^^^^ meta.statement.conditional.if.java meta.group.java +// ^ meta.statement.conditional.if.java - meta.statement.conditional.if meta.group +// ^^^^^^ meta.statement.conditional.if.java +// ^^^^^ meta.statement.conditional.else.java - meta.statement.conditional.if +// ^^^^^^^^^^^^^^^^^^^^^^ - meta.statement.conditional.else +// ^^^ meta.statement.conditional.if.java - meta.statement.conditional.if meta.group +// ^^^^^^^^^^ meta.statement.conditional.if.java meta.group.java +// ^^^^^ meta.statement.conditional.else.java - meta.statement.conditional.if +// ^^ keyword.control.conditional.if.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.function.java +// ^^ keyword.operator.comparison.java +// ^^^^ constant.language.boolean.java +// ^ punctuation.section.group.end.java +// ^^^ variable.function.java +// ^^^^ keyword.control.conditional.else.java + } +} + + +/****************************************************************************** + * Assert Statement Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.10 + *****************************************************************************/ + +class AssertStatementTests { + + void run() { + + assert0; +// ^^^^^^^ variable.other.java - keyword + + assert$; +// ^^^^^^^ variable.other.java - keyword + + $assert; +// ^^^^^^^ variable.other.java - keyword + + assert +// ^ - meta.statement.conditional.assertion +// ^^^^^^^ meta.statement.conditional.assertion.java +// ^ - keyword +// ^^^^^^ keyword.control.flow.assert.java +// ^ - keyword + + assert ; +// ^^^^^^^^ meta.statement.conditional.assertion.java +// ^ - meta.statement.conditional.assertion +// ^ - keyword +// ^^^^^^ keyword.control.flow.assert.java +// ^^ - keyword +// ^ punctuation.terminator.java + + assert true; +// ^ - meta.statement.conditional.assertion +// ^^^^^^^ meta.statement.conditional.assertion.java +// ^ - meta.statement.conditional.assertion +// ^ - keyword +// ^^^^^^ keyword.control.flow.assert.java +// ^ - keyword - constant +// ^^^^ constant.language.boolean.java +// ^ punctuation.terminator.java + + assert : +// ^ - meta.statement.conditional.assertion +// ^^^^^^^^^ meta.statement.conditional.assertion.java +// ^ - keyword +// ^^^^^^ keyword.control.flow.assert.java +// ^ - keyword - punctuation +// ^ punctuation.separator.expressions.java + + assert : ; +// ^^^^^^^^^^ meta.statement.conditional.assertion.java +// ^ - meta.statement.conditional.assertion +// ^ - keyword +// ^^^^^^ keyword.control.flow.assert.java +// ^ - keyword - punctuation +// ^ punctuation.separator.expressions.java +// ^ - punctuation +// ^ punctuation.terminator.java + +// Note: Only two expressions are allowed, but we don't care here. + assert : : ; +// ^ - meta.statement.conditional.assertion +// ^^^^^^^^^^^ meta.statement.conditional.assertion.java +// ^ - meta.statement.conditional.assertion +// ^ - keyword +// ^^^^^^ keyword.control.flow.assert.java +// ^ - keyword - punctuation +// ^ punctuation.separator.expressions.java +// ^ - punctuation +// ^ punctuation.separator.expressions.java +// ^ punctuation.terminator.java + + assert foo():bar.baz(); +// ^ - meta.statement.conditional.assertion +// ^^^^^^^^^^^^^^^^^^^^^^ meta.statement.conditional.assertion.java +// ^ - meta.statement.conditional.assertion +// ^ - keyword +// ^^^^^^ keyword.control.flow.assert.java +// ^ - keyword - variable +// ^^^ variable.function.java +// ^ punctuation.separator.expressions.java +// ^^^ variable.other.java +// ^ punctuation.accessor.dot.java +// ^^^ variable.function.java +// ^ punctuation.terminator.java + + assert scale > -100 : foo == true; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.conditional.assertion.java +// ^^^^^^ keyword.control.flow.assert.java +// ^^^^^ variable.other.java +// ^ keyword.operator.comparison.java +// ^ keyword.operator.arithmetic.java +// ^^^ constant.numeric.value.java +// ^ punctuation.separator.expressions.java +// ^^^ variable.other.java +// ^^ keyword.operator.comparison.java +// ^^^^ constant.language.boolean.java +// ^ punctuation.terminator.java + + assert int foo=0; +// ^^^^^^^ meta.statement.conditional.assertion.java +// ^^^^ meta.declaration.type.java - meta.statement.conditional.assertion +// ^^^ meta.declaration.identifier.java - meta.statement.conditional.assertion +// ^ meta.declaration.java - meta.statement.conditional.assertion +// ^ meta.declaration.value.java - meta.statement.conditional.assertion + + assert if (true) {} +// ^^^^^^^ meta.statement.conditional.assertion.java +// ^^^^^^^^^^^^ meta.statement.conditional.if.java - meta.statement.conditional.assertion + + assert while (true) {} +// ^^^^^^^ meta.statement.conditional.assertion.java +// ^^^^^^^^^^^^^^^ meta.statement.loop.while.java - meta.statement.conditional.assertion + + } +//^ meta.class.java meta.block.java meta.function.java meta.block.java punctuation.section.block.end.java +} + + +/****************************************************************************** + * Switch Statement Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.11 + *****************************************************************************/ + +class SwitchStatementTests { + + void run() { + + switch$ ; +// ^^^^^^^ variable.other.java - keyword + + $switch ; +// ^^^^^^^ variable.other.java - keyword + + switch +// ^^^^^^^ meta.statement.conditional.switch.java +// ^^^^^^ keyword.control.conditional.switch.java + + switch foo +// ^^^^^^^^^^^ meta.statement.conditional.switch.java +// ^^^^^^ keyword.control.conditional.switch.java +// ^^^ variable.other.java + + switch (foo) +// ^^^^^^^^^^^^^ - meta.statement.conditional.switch meta.statement.conditional.switch +// ^^^^^^^ meta.statement.conditional.switch.java +// ^^^^^ meta.statement.conditional.switch.java meta.group.java +// ^ meta.statement.conditional.switch.java +// ^^^^^^ keyword.control.conditional.switch.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ punctuation.section.group.end.java + + switch (foo) {} +// ^^^^^^^^^^^^^^^ - meta.statement.conditional.switch meta.statement.conditional.switch +// ^^^^^^^ meta.statement.conditional.switch.java +// ^^^^^ meta.statement.conditional.switch.java meta.group.java +// ^ meta.statement.conditional.switch.java +// ^^ meta.statement.conditional.switch.java meta.block.java +// ^^^^^^ keyword.control.conditional.switch.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + switch (foo {} +// ^^^^^^^^^^^^^^^ - meta.statement.conditional.switch meta.statement.conditional.switch +// ^^^^^^^ meta.statement.conditional.switch.java +// ^^^^^ meta.statement.conditional.switch.java meta.group.java +// ^^ meta.statement.conditional.switch.java meta.block.java +// ^^^^^^ keyword.control.conditional.switch.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + switch (foo%2) { + + case$ ; +// ^^^^^ variable.other.java - keyword + + $case ; +// ^^^^^ variable.other.java - keyword + + case +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^^^^ keyword.control.conditional.case.java + + case : +// ^^^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^ keyword.control.conditional.case.java +// ^ punctuation.separator.expressions.java + + case 0: +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^ keyword.control.conditional.case.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.expressions.java + + case 1: bar() +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^^^^^^^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^ keyword.control.conditional.case.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.expressions.java +// ^^^ variable.function.java + + case 3: ; +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^^^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^ keyword.control.conditional.case.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.expressions.java +// ^ punctuation.terminator.java + + case 5: {} +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^^^^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^ keyword.control.conditional.case.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.expressions.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + case "string": +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^^^^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^ keyword.control.conditional.case.java +// ^^^^^^^^ string.quoted.double.java +// ^ punctuation.separator.expressions.java + + case 'S': +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^ keyword.control.conditional.case.java +// ^^^ meta.string.java string.quoted.single.java +// ^ punctuation.definition.string.begin.java +// ^ constant.character.literal.java +// ^ punctuation.definition.string.end.java +// ^ punctuation.separator.expressions.java + + case '\n' + foo(): +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^^^^^^^^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^ keyword.control.conditional.case.java +// ^^^ meta.string.java string.quoted.single.java +// ^ punctuation.definition.string.begin.java +// ^^ constant.character.escape.other.java +// ^ punctuation.definition.string.end.java +// ^ keyword.operator.arithmetic.java +// ^^^ variable.function.java +// ^ punctuation.separator.expressions.java + + case constant + 5: +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^^^^^^^^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^ keyword.control.conditional.case.java +// ^^^^^^^^ variable.other.java +// ^ keyword.operator.arithmetic.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.expressions.java + + case (constant << 0x5) : +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java - meta.group +// ^^^^^^^^^^^^^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java meta.group.java +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java - meta.group +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java - meta.group +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^ keyword.control.conditional.case.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^ variable.other.java +// ^^ keyword.operator.bitwise.java +// ^^ meta.number.integer.hexadecimal.java constant.numeric.base.java +// ^ meta.number.integer.hexadecimal.java constant.numeric.value.java +// ^ punctuation.section.group.end.java +// ^ punctuation.separator.expressions.java + + case null: +// ^^^^^^^^^^^^ meta.class.java meta.block.java meta.function.java meta.block.java meta.statement.conditional.switch.java meta.block.java +// ^^^^^ meta.statement.conditional.case.java +// ^^^^ meta.statement.conditional.case.label.java +// ^ meta.statement.conditional.case.java +// ^^^^ keyword.control.conditional.case.java +// ^^^^ constant.language.null.java +// ^ punctuation.separator.expressions.java + + case super: +// ^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function.java meta.block.java meta.statement.conditional.switch.java meta.block.java +// ^^^^^ meta.statement.conditional.case.java +// ^^^^^ meta.statement.conditional.case.label.java +// ^ meta.statement.conditional.case.java +// ^^^^ keyword.control.conditional.case.java +// ^^^^^ variable.language.super.java +// ^ punctuation.separator.expressions.java + + case CONSTANT +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^^^^^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java - meta.path +// ^^^^ keyword.control.conditional.case.java +// ^^^^^^^^ constant.other.java + + case CONSTANT: +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java +// ^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^^^^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java - meta.path +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^ keyword.control.conditional.case.java +// ^^^^^^^^ constant.other.java +// ^ punctuation.separator.expressions.java + + case constant +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^^^^^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java - meta.path +// ^^^^ keyword.control.conditional.case.java +// ^^^^^^^^ constant.other.java + + case constant +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java +// ^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^^^^^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java - meta.path +// ^^^^ keyword.control.conditional.case.java +// ^^^^^^^^ constant.other.java + { } +// ^^^ meta.statement.conditional.switch.java meta.block.java meta.block.java + + case constant +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^^^^^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java - meta.path +// ^^^^ keyword.control.conditional.case.java +// ^^^^^^^^ constant.other.java + ; +// ^ meta.statement.conditional.switch.java meta.block.java punctuation.terminator.java + + case constant: +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^^^^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java - meta.path +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^ keyword.control.conditional.case.java +// ^^^^^^^^ constant.other.java +// ^ punctuation.separator.expressions.java + + case EnumConst +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^^^^^^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java - meta.path +// ^^^^ keyword.control.conditional.case.java +// ^^^^^^^^^ constant.other.java + + case EnumConst: +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java - meta.path +// ^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^^^^^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.label.java - meta.path +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.case.java +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^ keyword.control.conditional.case.java +// ^^^^^^^^^ constant.other.java +// ^ punctuation.separator.expressions.java + + case module.CONSTANT: +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.case.java - meta.path +// ^^^^^^^^^^^^^^^ meta.statement.conditional.case.label.java meta.path.java +// ^ meta.statement.conditional.case.java - meta.path +// ^^^^ keyword.control.conditional.case.java +// ^^^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^ constant.other.java +// ^ punctuation.separator.expressions.java + + case MyClass.CONSTANT: +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.case.java - meta.path +// ^^^^^^^^^^^^^^^^ meta.statement.conditional.case.label.java meta.path.java +// ^ meta.statement.conditional.case.java - meta.path +// ^^^^ keyword.control.conditional.case.java +// ^^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^ constant.other.java +// ^ punctuation.separator.expressions.java + + case mod.sub.MyClass.EnumConst +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.case.java - meta.path +// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.conditional.case.label.java meta.path.java +// ^^^^ keyword.control.conditional.case.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^ constant.other.java + + case mod.sub.MyClass.EnumConst: +// ^^^^^ meta.statement.conditional.case.java - meta.path +// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.conditional.case.label.java meta.path.java +// ^ meta.statement.conditional.case.java - meta.path +// ^^^^ keyword.control.conditional.case.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^ constant.other.java +// ^ punctuation.separator.expressions.java + + case @anno mod . @anno sub . @anno MyClass . @anno EnumConst: +// ^^^^^ meta.statement.conditional.case.java - meta.path +// ^^^^^^ meta.statement.conditional.case.label.java - meta.path +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.conditional.case.label.java meta.path.java +// ^ meta.statement.conditional.case.java - meta.path +// ^^^^ keyword.control.conditional.case.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^^^^^^^ constant.other.java +// ^ punctuation.separator.expressions.java + + case mod.sub.myclass.enumconst +// ^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.case.java - meta.path +// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.conditional.case.label.java meta.path.java +// ^^^^ keyword.control.conditional.case.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^ constant.other.java + break +// ^^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.flow.break.java +// ^^^^^ keyword.control.flow.break.java + + case mod.sub.myclass.enumconst: +// ^ meta.statement.conditional.switch.java meta.block.java meta.statement.flow.break.java - meta.statement.conditional.case +// ^^^^^ meta.statement.conditional.case.java - meta.path +// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.conditional.case.label.java meta.path.java +// ^ meta.statement.conditional.case.java - meta.path +// ^^^^ keyword.control.conditional.case.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^ constant.other.java +// ^ punctuation.separator.expressions.java + + case @anno mod . @anno sub . @anno myclass . @anno enumconst: +// ^^^^^ meta.statement.conditional.case.java - meta.path +// ^^^^^^ meta.statement.conditional.case.label.java - meta.path +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.conditional.case.label.java meta.path.java +// ^ meta.statement.conditional.case.java - meta.path +// ^^^^ keyword.control.conditional.case.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^^^^^^^ constant.other.java +// ^ punctuation.separator.expressions.java + + default : {} +// ^^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.default +// ^^^^^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.conditional.default.java +// ^^^^ meta.statement.conditional.switch.java meta.block.java - meta.statement.conditional.case +// ^^^^^^^ keyword.control.conditional.default.java +// ^ punctuation.separator.expressions.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + default$ ; +// ^^^^^^^^ variable.other.java - keyword + + $default ; +// ^^^^^^^^ variable.other.java - keyword + } +// ^ meta.statement.conditional.switch.java meta.block.java punctuation.section.block.end.java + } +//^ meta.class.java meta.block.java meta.function.java meta.block.java punctuation.section.block.end.java +} +//<- meta.class.java meta.block.java punctuation.section.block.end.java + + +/****************************************************************************** + * Switch Expression Tests + * https://docs.oracle.com/javase/specs/jls/se16/html/jls-15.html#jls-15.28 + *****************************************************************************/ + +class SwitchExpressionsTests { + + void testArrowCaseLabels() { + int numLetters = switch (day) { +// ^^^ storage.type.primitive.java +// ^^^^^^^^^^ variable.other.java +// ^ keyword.operator.assignment.java +// ^^^^^^^^^^^^^^^ meta.statement.conditional.switch.java +// ^^^^^^ keyword.control.conditional.switch.java + case null -> +// ^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function.java meta.block.java meta.statement.conditional.switch.java meta.block.java +// ^^^^^ meta.statement.conditional.case.java +// ^^^^^ meta.statement.conditional.case.label.java +// ^^ meta.statement.conditional.case.java +// ^^^^ keyword.control.conditional.case.java +// ^^^^ constant.language.null.java +// ^^ punctuation.separator.expressions.java + + case super -> +// ^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function.java meta.block.java meta.statement.conditional.switch.java meta.block.java +// ^^^^^ meta.statement.conditional.case.java +// ^^^^^^ meta.statement.conditional.case.label.java +// ^^ meta.statement.conditional.case.java +// ^^^^ keyword.control.conditional.case.java +// ^^^^^ variable.language.super.java +// ^^ punctuation.separator.expressions.java + + case MONDAY, FRIDAY, SUNDAY -> 6; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function.java meta.block.java meta.statement.conditional.switch.java meta.block.java +// ^^^^^ meta.statement.conditional.case.java +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.conditional.case.label.java +// ^^ meta.statement.conditional.case.java +// ^^^^ - meta.statement.conditional.case +// ^^^^ keyword.control.conditional.case.java +// ^^^^^^ constant.other.java +// ^ punctuation.separator.comma.java +// ^^^^^^ constant.other.java +// ^ punctuation.separator.comma.java +// ^^^^^^ constant.other.java +// ^^ punctuation.separator.expressions.java +// ^ constant.numeric.value.java +// ^ punctuation.terminator.java + case TUESDAY -> 7; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.block.java meta.function.java meta.block.java meta.statement.conditional.switch.java meta.block.java +// ^^^^^ meta.statement.conditional.case.java +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.conditional.case.label.java +// ^^ meta.statement.conditional.case.java +// ^^^^ - meta.statement.conditional.case +// ^^^^ keyword.control.conditional.case.java +// ^^^^^^^ constant.other.java +// ^^ punctuation.separator.expressions.java +// ^ constant.numeric.value.java +// ^ punctuation.terminator.java + default -> { +// ^^^^^^^^^^^^^^ meta.statement.conditional.switch.java meta.block.java +// ^^^^^^^^^^ meta.statement.conditional.default.java +// ^^^^ - meta.statement.conditional.case +// ^^^^^^^ keyword.control.conditional.default.java +// ^^ punctuation.separator.expressions.java +// ^ punctuation.section.block.begin.java + String s = day.toString(); + int result = s.length(); + yield result; +// ^^^^^^^^^^^^ meta.statement.flow.yield.java +// ^^^^^ keyword.control.flow.yield.java +// ^^^^^^ variable.other.java + } +// ^ punctuation.section.block.end.java + }; +// ^ meta.statement.conditional.switch.java meta.block.java punctuation.section.block.end.java +// ^ punctuation.terminator.java - meta.statement.conditional.switch + } +// ^ punctuation.section.block.end.java + + void testClassicCaseLabels(boolean startWeek) { + + int numLetters = switch (day) { + case startWeek ? MONDAY : FRIDAY : +// ^^^^^ meta.statement.conditional.case.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.conditional.case.label.java +// ^ meta.statement.conditional.case.java +// ^ - meta.statement.conditional.case +// ^^^^ keyword.control.conditional.case.java +// ^^^^^^^^^ variable.other.java +// ^ keyword.operator.ternary.java +// ^^^^^^ constant.other.java +// ^ keyword.operator.ternary.java +// ^^^^^^ constant.other.java +// ^ punctuation.separator.expressions.java + case SUNDAY: + yield 6; +// ^^^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.flow.yield.java +// ^^^^^ keyword.control.flow.yield.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.terminator.java + case TUESDAY: + yield 7; +// ^^^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.flow.yield.java +// ^^^^^ keyword.control.flow.yield.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.terminator.java + default: + throw new IllegalStateException("Invalid day: " + day); +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.conditional.switch.java meta.block.java meta.statement.flow.throw.java +// ^^^^^ keyword.control.flow.throw.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^^^^^^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^^^^^^^ string.quoted.double.java +// ^ keyword.operator.arithmetic.java +// ^^^ variable.other.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + }; +// ^ meta.statement.conditional.switch.java meta.block.java punctuation.section.block.end.java +// ^ punctuation.terminator.java - meta.statement.conditional.switch + } +// ^ punctuation.section.block.end.java +} + + +/****************************************************************************** + * While Statement Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.12 + *****************************************************************************/ + +class WhileStatementTests { + + void run() { + + while$ ; +// ^^^^^^ variable.other.java - keyword + + $while ; +// ^^^^^^ variable.other.java - keyword + + while +// ^^^^^^ meta.statement.loop.while.java +// ^^^^^ keyword.control.loop.while.java + + while false +// ^^^^^^^^^^^^ meta.statement.loop.while.java +// ^^^^^ keyword.control.loop.while.java +// ^^^^^ constant.language.boolean.java + + while (false) +// ^^^^^^^^^^^^^^ - meta.statement.loop.while meta.statement.loop.while +// ^^^^^^ meta.statement.loop.while.java - meta.group +// ^^^^^^^ meta.statement.loop.while.java meta.group.java +// ^ meta.statement.loop.while.java - meta.group +// ^^^^^ keyword.control.loop.while.java +// ^ punctuation.section.group.begin.java +// ^^^^^ constant.language.boolean.java +// ^ punctuation.section.group.end.java + + while (false) { } +// ^^^^^^^^^^^^^^^^^^ - meta.statement.loop.while meta.statement.loop.while +// ^^^^^^ meta.statement.loop.while.java - meta.group +// ^^^^^^^ meta.statement.loop.while.java meta.group.java +// ^ meta.statement.loop.while.java - meta.statement.loop.while.java meta.group - meta.statement.loop.while.java meta.block +// ^^^^ meta.statement.loop.while.java meta.block.java +// ^^^^^ keyword.control.loop.while.java +// ^ punctuation.section.group.begin.java +// ^^^^^ constant.language.boolean.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + while (false { } +// ^^^^^^^^^^^^^^^^^^ - meta.statement.loop.while meta.statement.loop.while +// ^^^^^^ meta.statement.loop.while.java +// ^^^^^^^ meta.statement.loop.while.java meta.group.java +// ^^^^ meta.statement.loop.while.java meta.block.java +// ^^^^^ keyword.control.loop.while.java +// ^ punctuation.section.group.begin.java +// ^^^^^ constant.language.boolean.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + } +} + + +/****************************************************************************** + * For Statement Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.14 + *****************************************************************************/ + +class ForStatementTests { + + void run() { + + for$ ; +// ^^^^ variable.other.java - keyword + + $for ; +// ^^^^ variable.other.java - keyword + + for +// ^^^^ meta.statement.loop.for.java +// ^^^ keyword.control.loop.for.java +// ^ - keyword + + for () +// ^^^^^^ - meta.statement.loop.for meta.statement.loop.for +// ^^^^ meta.statement.loop.for.java - meta.group +// ^^ meta.statement.loop.for.java meta.group.java +// ^^^ keyword.control.loop.for.java +// ^ - keyword +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java + + for () {} +// ^^^^^^^^^ - meta.statement.loop.for meta.statement.loop.for +// ^^^^ meta.statement.loop.for.java - meta.group +// ^^ meta.statement.loop.for.java meta.group.java +// ^ meta.statement.loop.for.java - meta.block meta.block meta.block +// ^^ meta.statement.loop.for.java meta.block.java +// ^^^ keyword.control.loop.for.java +// ^ - keyword +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + for ( {} +// ^^^^^^^^ - meta.statement.loop.for meta.statement.loop.for +// ^^^^ meta.statement.loop.for.java - meta.group +// ^^ meta.statement.loop.for.java meta.group.java +// ^^ meta.statement.loop.for.java meta.block.java +// ^^^ keyword.control.loop.for.java +// ^ - keyword +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + for (; {} +// ^^^^^^^^^ - meta.statement.loop.for meta.statement.loop.for +// ^^^^ meta.statement.loop.for.java - meta.group +// ^^^ meta.statement.loop.for.java meta.group.java +// ^^ meta.statement.loop.for.java meta.block.java +// ^^^ keyword.control.loop.for.java +// ^ - keyword +// ^ punctuation.section.group.begin.java +// ^ punctuation.terminator.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + for (;; {} +// ^^^^^^^^^^ - meta.statement.loop.for meta.statement.loop.for +// ^^^^ meta.statement.loop.for.java - meta.group +// ^^^^ meta.statement.loop.for.java meta.group.java +// ^^ meta.statement.loop.for.java meta.block.java +// ^^^ keyword.control.loop.for.java +// ^ - keyword +// ^ punctuation.section.group.begin.java +// ^^ punctuation.terminator.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + for (;;;;) {;;;} +// ^^^^^^^^^^ - meta.statement.loop.for meta.statement.loop.for +// ^^^^ meta.statement.loop.for.java - meta.group +// ^^^^^^ meta.statement.loop.for.java meta.group.java +// ^ meta.statement.loop.for.java - meta.block meta.block meta.block +// ^^^^^ meta.statement.loop.for.java meta.block.java +// ^^^ keyword.control.loop.for.java +// ^ - keyword +// ^ punctuation.section.group.begin.java +// ^^ punctuation.terminator.java +// ^^ invalid.illegal.stray.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^^^ punctuation.terminator.java +// ^ punctuation.section.block.end.java + + for (i = 0; i < 10; i += 2) {} +// ^^^^ meta.statement.loop.for.java +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.loop.for.java meta.group.java +// ^ meta.statement.loop.for.java - meta.block meta.block meta.block +// ^^ meta.statement.loop.for.java meta.block.java +// ^^^ keyword.control.loop.for.java +// ^ punctuation.section.group.begin.java +// ^ variable.other.java +// ^ keyword.operator.assignment.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.terminator.java +// ^ variable.other.java +// ^ keyword.operator.comparison.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.terminator.java +// ^ variable.other.java +// ^^ keyword.operator.assignment.augmented.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + for (i = , =, , 0; < 10 &&; += 2) {} +// ^^^^ meta.statement.loop.for.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.loop.for.java meta.group.java +// ^ meta.statement.loop.for.java - meta.block meta.block meta.block +// ^^ meta.statement.loop.for.java meta.block.java +// ^^^ keyword.control.loop.for.java +// ^ punctuation.section.group.begin.java +// ^ variable.other.java +// ^ keyword.operator.assignment.java +// ^ punctuation.separator.comma.java +// ^ keyword.operator.assignment.java +// ^ punctuation.separator.comma.java +// ^ punctuation.separator.comma.java +// ^ constant.numeric.value.java +// ^ punctuation.terminator.java +// ^ keyword.operator.comparison.java +// ^^ constant.numeric.value.java +// ^^ keyword.operator.logical.java +// ^ punctuation.terminator.java +// ^^ keyword.operator.assignment.augmented.java +// ^ constant.numeric.value.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + for (i = 0, j = 0; i < 10 && j < 5; i += 2, ++j) {} +// ^^^^ meta.statement.loop.for.java - meta.statement.loop.for meta.statement.loop.for +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.loop.for.java meta.group.java - meta.statement.loop.for meta.statement.loop.for +// ^ meta.statement.loop.for.java - meta.block meta.block meta.block +// ^^ meta.statement.loop.for.java meta.block.java +// ^^^ keyword.control.loop.for.java +// ^ punctuation.section.group.begin.java +// ^ variable.other.java +// ^ keyword.operator.assignment.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ variable.other.java +// ^ keyword.operator.assignment.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.terminator.java +// ^ variable.other.java +// ^ keyword.operator.comparison.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java +// ^^ keyword.operator.logical.java +// ^ variable.other.java +// ^ keyword.operator.comparison.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.terminator.java +// ^ variable.other.java +// ^^ keyword.operator.assignment.augmented.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java + + for (int i = 0; i < 10; i += 2) {} +// ^^^^ meta.statement.loop.for.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.loop.for.java meta.group.java +// ^ meta.statement.loop.for.java - meta.block meta.block meta.block +// ^^ meta.statement.loop.for.java meta.block.java +// ^^^ keyword.control.loop.for.java +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.primitive.java +// ^ variable.other.java +// ^ keyword.operator.assignment.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.terminator.java +// ^ variable.other.java +// ^ keyword.operator.comparison.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.terminator.java +// ^ variable.other.java +// ^^ keyword.operator.assignment.augmented.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java + + for (int i = , =, , 0; < 10 &&; += 2) {} +// ^^^^ meta.statement.loop.for.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.loop.for.java meta.group.java +// ^ meta.statement.loop.for.java - meta.block meta.block meta.block +// ^^ meta.statement.loop.for.java meta.block.java +// ^^^ keyword.control.loop.for.java +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.primitive.java +// ^ variable.other.java +// ^ keyword.operator.assignment.java +// ^ punctuation.separator.comma.java +// ^ keyword.operator.assignment.java +// ^ punctuation.separator.comma.java +// ^ punctuation.separator.comma.java +// ^ constant.numeric.value.java +// ^ punctuation.terminator.java +// ^ keyword.operator.comparison.java +// ^^ constant.numeric.value.java +// ^^ keyword.operator.logical.java +// ^ punctuation.terminator.java +// ^^ keyword.operator.assignment.augmented.java +// ^ constant.numeric.value.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + for (int i = 0, j = 0; i < 10 && j < 5; i += 2, ++j) {} +// ^^^^ meta.statement.loop.for.java - meta.statement.loop.for meta.statement.loop.for +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.loop.for.java meta.group.java - meta.statement.loop.for meta.statement.loop.for +// ^ meta.statement.loop.for.java - meta.block meta.block meta.block +// ^^ meta.statement.loop.for.java meta.block.java +// ^^^ keyword.control.loop.for.java +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.primitive.java +// ^ variable.other.java +// ^ keyword.operator.assignment.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ variable.other.java +// ^ keyword.operator.assignment.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.terminator.java +// ^ variable.other.java +// ^ keyword.operator.comparison.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java +// ^^ keyword.operator.logical.java +// ^ variable.other.java +// ^ keyword.operator.comparison.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.terminator.java +// ^ variable.other.java +// ^^ keyword.operator.assignment.augmented.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java + + for (final int x = 10;;) {} +// ^^^^ meta.statement.loop.for.java - meta.statement.loop.for meta.statement.loop.for +// ^^^^^^^^^^^^^^^^^^^^ meta.statement.loop.for.java meta.group.java - meta.statement.loop.for meta.statement.loop.for +// ^^^ keyword.control.loop.for.java +// ^^^^^ storage.modifier.java +// ^^^ storage.type.primitive.java +// ^ variable.other.java +// ^ keyword.operator.assignment.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java +// ^^ punctuation.terminator.java +// ^ punctuation.section.group.end.java + + for (native int x = 10;;) {} +// ^^^^ meta.statement.loop.for.java - meta.statement.loop.for meta.statement.loop.for +// ^^^^^^^^^^^^^^^^^^^^^ meta.statement.loop.for.java meta.group.java - meta.statement.loop.for meta.statement.loop.for +// ^^^ keyword.control.loop.for.java +// ^^^^^^ invalid.illegal.unexpected-keyword.java +// ^^^ storage.type.primitive.java +// ^ variable.other.java +// ^ keyword.operator.assignment.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java +// ^^ punctuation.terminator.java +// ^ punctuation.section.group.end.java + + for (var i=0;i : new Bar[]) echo(iter); +// ^^^^ meta.statement.loop.for.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.loop.for.java meta.group.java +// ^^^^^^^^^^ meta.instantiation.java +// ^^ - meta.instantiation +// ^^^^^^^^^ meta.instantiation.java +// ^^^^^^^^^^ meta.statement.loop.for.java +// ^ - meta.statement.loop.for +// ^^^ keyword.control.loop.for.java +// ^ punctuation.section.group.begin.java +// ^^^^^ storage.modifier.java +// ^^^^^ meta.annotation.identifier.java +// ^^^^^ storage.type.class.java +// ^^^^ variable.other.java +// ^ keyword.operator.assignment.java +// ^^^^ variable.other.java +// ^ keyword.operator.ternary.java +// ^^^ keyword.other.storage.new.java +// ^^^ storage.type.class.java +// ^^ punctuation.section.generic.diamond.java +// ^ keyword.operator.ternary.java +// ^^^ keyword.other.storage.new.java +// ^^^ storage.type.class.java +// ^ punctuation.section.brackets.begin.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.section.group.end.java +// ^^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^^^^ variable.other.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + for (private @Anno var iter : cond ? new Foo<> : new Bar[]) echo(iter); +// ^^^^ meta.statement.loop.for.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.loop.for.java meta.group.java +// ^^^^^^^^^^ meta.instantiation.java +// ^^ - meta.instantiation +// ^^^^^^^^^ meta.instantiation.java +// ^^^^^^^^^^ meta.statement.loop.for.java +// ^ - meta.statement.loop.for +// ^^^ keyword.control.loop.for.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^ invalid.illegal.unexpected-keyword.java +// ^^^^^ meta.annotation.identifier.java +// ^^^ storage.type.variant.java +// ^^^^ variable.other.java +// ^ keyword.operator.assignment.java +// ^^^^ variable.other.java +// ^ keyword.operator.ternary.java +// ^^^ keyword.other.storage.new.java +// ^^^ storage.type.class.java +// ^^ punctuation.section.generic.diamond.java +// ^ keyword.operator.ternary.java +// ^^^ keyword.other.storage.new.java +// ^^^ storage.type.class.java +// ^ punctuation.section.brackets.begin.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.section.group.end.java +// ^^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^^^^ variable.other.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + } +//^ meta.class.java meta.block.java meta.function.java meta.block.java punctuation.section.block.end.java +} +//<- meta.class.java meta.block.java punctuation.section.block.end.java + + +/****************************************************************************** + * Break Statement Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.15 + *****************************************************************************/ + +class BreakStatementTests { + + void run() { + + label: +// ^^^^^ entity.name.label.java +// ^ punctuation.separator.colon.java + + break$ ; +// ^^^^^^ variable.other.java - keyword + + $break ; +// ^^^^^^ variable.other.java - keyword + + break +// ^ - meta.statement.flow.break +// ^^^^^^ meta.statement.flow.break.java +// ^^^^^ keyword.control.flow.break.java + + break ; +// ^^^^^^^ meta.statement.flow.break.java +// ^ - meta.statement.flow.break +// ^^^^^ keyword.control.flow.break.java +// ^ punctuation.terminator.java + + break label; +// ^ - meta.statement.flow.break +// ^^^^^^^^^^^ meta.statement.flow.break.java +// ^ - meta.statement.flow.break +// ^^^^^ keyword.control.flow.break.java +// ^^^^^ variable.label.java +// ^ punctuation.terminator.java + + break +// ^ - meta.statement.flow.break +// ^^^^^^ meta.statement.flow.break.java +// ^^^^^ keyword.control.flow.break.java + label +// ^^^^^^^ meta.statement.flow.break.java +// ^^^^^ variable.label.java + ; +// ^ meta.statement.flow.break.java +// ^ - meta.statement.flow.break +// ^ punctuation.terminator.java + + break str + 5; +// ^ - meta.statement.flow.break +// ^^^^^^^^^^^^^ meta.statement.flow.break.java +// ^ - meta.statement.flow.break +// ^^^^^ keyword.control.flow.break.java +// ^^^ variable.label.java +// ^ invalid.illegal.expect-terminator.java +// ^ invalid.illegal.expect-terminator.java +// ^ punctuation.terminator.java + + break 5 + 5; +// ^ - meta.statement.flow.break +// ^^^^^^^^^^^ meta.statement.flow.break.java +// ^ - meta.statement.flow.break +// ^^^^^ keyword.control.flow.break.java +// ^ invalid.illegal.expect-terminator.java +// ^ invalid.illegal.expect-terminator.java +// ^ invalid.illegal.expect-terminator.java +// ^ punctuation.terminator.java + + goto label; +// ^^^^ invalid.illegal +// ^^^^^ variable.other.java + } +} + + +/****************************************************************************** + * Continue Statement Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.16 + *****************************************************************************/ + +class ContinueStatementTests { + + void run() { + + label: +// ^^^^^ entity.name.label.java +// ^ punctuation.separator.colon.java + + continue$ ; +// ^^^^^^^^^ variable.other.java - keyword + + $continue ; +// ^^^^^^^^^ variable.other.java - keyword + + continue +// ^ - meta.statement.flow.continue +// ^^^^^^^^^ meta.statement.flow.continue.java +// ^^^^^^^^ keyword.control.flow.continue.java + + continue ; +// ^^^^^^^^^^ meta.statement.flow.continue.java +// ^ - meta.statement.flow.continue +// ^^^^^^^^ keyword.control.flow.continue.java +// ^ punctuation.terminator.java + + continue label; +// ^ - meta.statement.flow.continue +// ^^^^^^^^^^^^^^ meta.statement.flow.continue.java +// ^ - meta.statement.flow.continue +// ^^^^^^^^ keyword.control.flow.continue.java +// ^^^^^ variable.label.java +// ^ punctuation.terminator.java + + continue +// ^ - meta.statement.flow.continue +// ^^^^^^^^^ meta.statement.flow.continue.java +// ^^^^^^^^ keyword.control.flow.continue.java + label +// ^^^^^^^ meta.statement.flow.continue.java +// ^^^^^ variable.label.java + ; +// ^ meta.statement.flow.continue.java +// ^ - meta.statement.flow.continue +// ^ punctuation.terminator.java + + continue str + 5; +// ^ - meta.statement.flow.continue +// ^^^^^^^^^^^^^^^^ meta.statement.flow.continue.java +// ^ - meta.statement.flow.continue +// ^^^^^^^^ keyword.control.flow.continue.java +// ^^^ variable.label.java +// ^ invalid.illegal.expect-terminator.java +// ^ invalid.illegal.expect-terminator.java +// ^ punctuation.terminator.java + + continue 5 + 5; +// ^ - meta.statement.flow.continue +// ^^^^^^^^^^^^^^ meta.statement.flow.continue.java +// ^ - meta.statement.flow.continue +// ^^^^^^^^ keyword.control.flow.continue.java +// ^ invalid.illegal.expect-terminator.java +// ^ invalid.illegal.expect-terminator.java +// ^ invalid.illegal.expect-terminator.java +// ^ punctuation.terminator.java + } +} + + +/****************************************************************************** + * Return Statement Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.17 + *****************************************************************************/ + +class ReturnStatementTests { + + void run() { + + return$ ; +// ^^^^^^^ variable.other.java - keyword + + $return ; +// ^^^^^^^ variable.other.java - keyword + + return +// ^ - meta.statement.flow.return - keyword +// ^^^^^^^ meta.statement.flow.return.java +// ^^^^^^ keyword.control.flow.return.java + + return; +// ^^^^^^^ meta.statement.flow.return.java +// ^ - meta.statement.flow.return +// ^^^^^^ keyword.control.flow.return.java +// ^ punctuation.terminator.java + + return variable +// ^ - meta.statement.flow.return - keyword +// ^^^^^^^^^^^^^^^^ meta.statement.flow.return.java +// ^^^^^^ keyword.control.flow.return.java +// ^^^^^^^^ variable.other.java + + return variable + func(10); +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.flow.return.java +// ^ - meta.statement.flow.return +// ^^^^^^ keyword.control.flow.return.java +// ^^^^^^^^ variable.other.java +// ^ keyword.operator.arithmetic.java +// ^^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + return +// ^ - meta.statement.flow.return - keyword +// ^^^^^^^ meta.statement.flow.return.java +// ^^^^^^ keyword.control.flow.return.java + variable +// ^^^^^^^^^^ meta.statement.flow.return.java +// ^^^^^^^^ variable.other.java + + +// ^^^ meta.statement.flow.return.java +// ^ keyword.operator.arithmetic.java + func +// ^^^^^^ meta.statement.flow.return.java +// ^^^^ variable.function.java + ( +// ^^^ meta.statement.flow.return.java +// ^ punctuation.section.group.begin.java + 10 +// ^^^^ meta.statement.flow.return.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java + ) +// ^^^ meta.statement.flow.return.java +// ^ punctuation.section.group.end.java + ; +// ^ meta.statement.flow.return.java +// ^ - meta.statement.flow.return +// ^ punctuation.terminator.java + + return new MyClass(); +// ^ - meta.statement.flow.return - keyword +// ^^^^^^^^^^^^^^^^^^^^ meta.statement.flow.return.java +// ^ - meta.statement.flow.return +// ^^^^^^ keyword.control.flow.return.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + return (a, int b) -> a + b; +// ^ - meta.statement.flow.return - keyword +// ^^^^^^^ meta.statement.flow.return.java - meta.function.anonymous - meta.group +// ^^^^^^^^^^ meta.statement.flow.return.java meta.function.anonymous.parameters.java meta.group.java +// ^^^^^^^^^ meta.statement.flow.return.java meta.function.anonymous.java - meta.group +// ^^^^^^ keyword.control.flow.return.java +// ^ punctuation.section.group.begin.java +// ^ variable.parameter.java +// ^ punctuation.separator.comma.java +// ^^^ storage.type.primitive.java +// ^ variable.parameter.java +// ^ punctuation.section.group.end.java +// ^^ keyword.declaration.function.arrow.java +// ^ variable.other.java +// ^ keyword.operator.arithmetic.java +// ^ variable.other.java +// ^ punctuation.terminator.java + } +//^ meta.class.java meta.block.java meta.function.java meta.block.java punctuation.section.block.end.java +} + + +/****************************************************************************** + * Throw Statement Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.18 + *****************************************************************************/ + +class ThrowStatementTests { + + void run() { + + throw$ ; +// ^^^^^^ variable.other.java - keyword + + $throw ; +// ^^^^^^ variable.other.java - keyword + + throw +// ^ - meta.statement.flow.throw - keyword +// ^^^^^^ meta.statement.flow.throw.java +// ^^^^^ keyword.control.flow.throw.java + + throw; +// ^^^^^^ meta.statement.flow.throw.java +// ^ - meta.statement.flow.throw +// ^^^^^ keyword.control.flow.throw.java +// ^ punctuation.terminator.java + + throw variable +// ^ - meta.statement.flow.throw - keyword +// ^^^^^^^^^^^^^^^ meta.statement.flow.throw.java +// ^^^^^ keyword.control.flow.throw.java +// ^^^^^^^^ variable.other.java + + throw variable + func(10); +// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.flow.throw.java +// ^ - meta.statement.flow.throw +// ^^^^^ keyword.control.flow.throw.java +// ^^^^^^^^ variable.other.java +// ^ keyword.operator.arithmetic.java +// ^^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + throw +// ^ - meta.statement.flow.throw - keyword +// ^^^^^^ meta.statement.flow.throw.java +// ^^^^^ keyword.control.flow.throw.java + variable +// ^^^^^^^^^^ meta.statement.flow.throw.java +// ^^^^^^^^ variable.other.java + + +// ^^^ meta.statement.flow.throw.java +// ^ keyword.operator.arithmetic.java + func +// ^^^^^^ meta.statement.flow.throw.java +// ^^^^ variable.function.java + ( +// ^^^ meta.statement.flow.throw.java +// ^ punctuation.section.group.begin.java + 10 +// ^^^^ meta.statement.flow.throw.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java + ) +// ^^^ meta.statement.flow.throw.java +// ^ punctuation.section.group.end.java + ; +// ^ meta.statement.flow.throw.java +// ^ - meta.statement.flow.throw +// ^ punctuation.terminator.java + + throw new MyClass(); +// ^ - meta.statement.flow.throw - keyword +// ^^^^^^^^^^^^^^^^^^^ meta.statement.flow.throw.java +// ^ - meta.statement.flow.throw +// ^^^^^ keyword.control.flow.throw.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + throw (a, int b) -> a + b; +// ^ - meta.statement.flow.throw - keyword +// ^^^^^^ meta.statement.flow.throw.java - meta.function.anonymous - meta.group +// ^^^^^^^^^^ meta.statement.flow.throw.java meta.function.anonymous.parameters.java meta.group.java +// ^^^^^^^^^ meta.statement.flow.throw.java meta.function.anonymous.java - meta.group +// ^^^^^ keyword.control.flow.throw.java +// ^ punctuation.section.group.begin.java +// ^ variable.parameter.java +// ^ punctuation.separator.comma.java +// ^^^ storage.type.primitive.java +// ^ variable.parameter.java +// ^ punctuation.section.group.end.java +// ^^ keyword.declaration.function.arrow.java +// ^ variable.other.java +// ^ keyword.operator.arithmetic.java +// ^ variable.other.java +// ^ punctuation.terminator.java + } +//^ meta.class.java meta.block.java meta.function.java meta.block.java punctuation.section.block.end.java +} + + +/****************************************************************************** + * Synchronized Statement Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.19 + *****************************************************************************/ + +class SynchronizedStatementTests { + + + synchronized$ ; +//^^^^^^^^^^^^^ meta.field.type.java storage.type.class.java - keyword + + $synchronized ; +//^^^^^^^^^^^^^ meta.field.type.java storage.type.class.java - keyword + + synchronized +//^^^^^^^^^^^^^ meta.function.modifier.java +//^^^^^^^^^^^^ storage.modifier.java + + synchronized void synchronizedMethod() { +//^^^^^^^^^^^^^ meta.function.modifier.java +// ^^^^^ meta.function.return-type.java +// ^^^^^^^^^^^^^^^^^^ meta.function.identifier.java +// ^^ meta.function.parameters.java meta.group.java +// ^ meta.function.java +// ^^ meta.function.java meta.block.java +//^^^^^^^^^^^^ storage.modifier.java +// ^^^^ storage.type.void.java +// ^^^^^^^^^^^^^^^^^^ entity.name.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java + + synchronized$ ; +// ^^^^^^^^^^^^^ variable.other.java - keyword + + $synchronized ; +// ^^^^^^^^^^^^^ variable.other.java - keyword + + synchronized +// ^ - meta.statement.flow.synchronized - keyword +// ^^^^^^^^^^^^^ meta.statement.flow.synchronized.java +// ^^^^^^^^^^^^ keyword.control.flow.synchronized.java +// ^ - keyword + + synchronized () ; +//^^^^^^^^^^^^^^^^^^^ meta.statement.flow.synchronized.java +// ^^ meta.group.java +// ^ - meta.statement.flow.synchronized +// ^ - keyword +// ^^^^^^^^^^^^ keyword.control.flow.synchronized.java +// ^ - keyword +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + synchronized () {} +// ^ - meta.statement.flow.synchronized +// ^^^^^^^^^^^^^^^^^^ meta.statement.flow.synchronized.java +// ^^ meta.group.java +// ^^ meta.block.java +// ^ - meta.statement.flow.synchronized +// ^ - keyword +// ^^^^^^^^^^^^ keyword.control.flow.synchronized.java +// ^ - keyword +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + } +} + + +/****************************************************************************** + * Try Statement Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.20 + *****************************************************************************/ + +class TryStatementTests { + + void testTry() { + + try$ ; +// ^^^^ variable.other.java - keyword + + $try ; +// ^^^^ variable.other.java - keyword + + try +// ^^^^ meta.statement.exception.try.java +// ^^^ keyword.control.exception.try.java + } + + void testCatch() { + + catch$ ; +// ^^^^^^ variable.other.java - keyword + + $catch ; +// ^^^^^^ variable.other.java - keyword + + catch +// ^^^^^^ meta.statement.exception.catch.java +// ^^^^^ keyword.control.exception.catch.java + + catch (int e) +// ^^^^^^^^^^^^^^^ meta.statement.exception.catch.java +// ^^^^^ keyword.control.exception.catch.java +// ^ punctuation.section.group.begin.java +// ^^^ invalid.illegal.unexpected-keyword.java +// ^ variable.other.java +// ^ punctuation.section.group.end.java + + catch (int[] e) +// ^^^^^^^^^^^^^^^ meta.statement.exception.catch.java +// ^^^^^ keyword.control.exception.catch.java +// ^ punctuation.section.group.begin.java +// ^^^ invalid.illegal.unexpected-keyword.java +// ^^ invalid.illegal.unexpected-modifier.java +// ^ variable.other.java +// ^ punctuation.section.group.end.java + + catch (foo[] e) +// ^^^^^^^^^^^^^^^ meta.statement.exception.catch.java +// ^^^^^ keyword.control.exception.catch.java +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.class.java +// ^^ invalid.illegal.unexpected-modifier.java +// ^ variable.other.java +// ^ punctuation.section.group.end.java + + catch (foo[] | bar[] | int e[]) +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.exception.catch.java +// ^^^^^ keyword.control.exception.catch.java +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.class.java +// ^^ invalid.illegal.unexpected-modifier.java +// ^ punctuation.separator.pipe.java +// ^^^ storage.type.class.java +// ^^ invalid.illegal.unexpected-modifier.java +// ^ punctuation.separator.pipe.java +// ^^^ invalid.illegal.unexpected-keyword.java +// ^ variable.other.java +// ^^ invalid.illegal.unexpected-modifier.java +// ^ punctuation.section.group.end.java + + catch (5 + 10) +// ^^^^^^^^^^^^^^ meta.statement.exception.catch.java +// ^^^^^ keyword.control.exception.catch.java +// ^ punctuation.section.group.begin.java +// ^ invalid.illegal.unexpected-token.java +// ^ invalid.illegal.unexpected-token.java +// ^^ invalid.illegal.unexpected-token.java +// ^ punctuation.section.group.end.java + } + + void testFinally() { + + finally$ ; +// ^^^^^^^^ variable.other.java - keyword + + $finally ; +// ^^^^^^^^ variable.other.java - keyword + + finally +// ^^^^^^^^ meta.statement.exception.finally.java +// ^^^^^^^ keyword.control.exception.finally.java + } + + void testSimleTryCatchFinally() { + + // ensure not to break highlighting even though braces are missing + try foo() catch (Exception e) bar(e) finally baz() +// ^^^^^^^^^^ meta.statement.exception.try.java - meta.statement.exception.try meta.statement.exception.try - meta.statement.exception.catch - meta.statement.exception.finally +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.statement.exception.catch meta.statement.exception.catch - meta.statement.exception.finally - meta.statement.exception.try +// ^^^^^^ meta.statement.exception.catch.java - meta.group +// ^^^^^^^^^^^^^ meta.statement.exception.catch.java meta.group.java +// ^^^^ meta.statement.exception.catch.java - meta.group +// ^^^ meta.statement.exception.catch.java meta.group.java +// ^ meta.statement.exception.catch.java - meta.group +// ^^^^^^^^^^^^^ meta.statement.exception.finally.java - meta.statement.exception.finally meta.statement.exception.finally - meta.statement.exception.catch - meta.statement.exception.try +// ^^^ keyword.control.exception.try.java +// ^^^ variable.function.java +// ^^^^^ keyword.control.exception.catch.java +// ^^^ variable.function.java +// ^^^^^^^ keyword.control.exception.finally.java +// ^^^ variable.function.java + + try { foo(); } catch (Exception e) { bar(e); } finally { baz(); } +// ^^^^ meta.statement.exception.try.java - meta.statement.exception.try meta.block - meta.statement.exception.try meta.statement.exception.try +// ^^^^^^^^^^ meta.statement.exception.try.java meta.block.java - meta.statement.exception.try meta.statement.exception.try +// ^^^^^^ meta.statement.exception.catch.java - meta.statement.exception.catch meta.statement.exception.catch +// ^^^^^^^^^^^^^ meta.statement.exception.catch.java meta.group.java - meta.statement.exception.catch meta.statement.exception.catch +// ^ meta.statement.exception.catch.java - meta.statement.exception.catch meta.statement.exception.catch +// ^^^^^^^^^^^ meta.statement.exception.catch.java meta.block.java - meta.statement.exception.catch meta.statement.exception.catch +// ^^^^^^^^ meta.statement.exception.finally.java - meta.statement.exception.finally meta.statement.exception.finally +// ^^^^^^^^^^ meta.statement.exception.finally.java meta.block.java - meta.statement.exception.finally meta.statement.exception.finally +// ^^^ keyword.control.exception.try.java +// ^^^ variable.function.java +// ^^^^^ keyword.control.exception.catch.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^ storage.type.class.java +// ^ variable.other.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^^^ variable.function.java +// ^ punctuation.section.block.end.java +// ^^^^^^^ keyword.control.exception.finally.java +// ^ punctuation.section.block.begin.java +// ^^^ variable.function.java +// ^ punctuation.section.block.end.java + + try { +// ^^^^ meta.block.java meta.statement.exception.try.java +// ^ meta.statement.exception.try.java meta.block.java +// ^^^ keyword.control.exception.try.java +// ^ punctuation.section.block.begin.java + foo(); + } catch (Exception e) { +// ^ meta.statement.exception.try.java meta.block.java +// ^ - meta.statement.exception.try - meta.statement.exception.catch - meta.statement.exception.finally +// ^^^^^^ meta.statement.exception.catch.java - meta.statement.exception.catch meta.statement.exception.catch +// ^^^^^^^^^^^^^ meta.statement.exception.catch.java meta.group.java - meta.statement.exception.catch meta.statement.exception.catch +// ^ meta.statement.exception.catch.java - meta.statement.exception.catch meta.statement.exception.catch +// ^^ meta.statement.exception.catch.java meta.block.java - meta.statement.exception.catch meta.statement.exception.catch +// ^ punctuation.section.block.end.java +// ^^^^^ keyword.control.exception.catch.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^ storage.type.class.java +// ^ variable.other.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java + bar(e); + } finally { +// ^ meta.statement.exception.catch.java meta.block.java +// ^ - meta.statement.exception.try - meta.statement.exception.catch - meta.statement.exception.finally +// ^^^^^^^^ meta.statement.exception.finally.java - meta.statement.exception.finally meta.statement.exception.finally +// ^^ meta.statement.exception.finally.java meta.block.java - meta.statement.exception.finally meta.statement.exception.finally +// ^ punctuation.section.block.end.java +// ^^^^^^^ keyword.control.exception.finally.java +// ^ punctuation.section.block.begin.java + baz(); + } +// ^ meta.statement.exception.finally.java meta.block.java punctuation.section.block.end.java +// ^ - meta.statement.exception.try - meta.statement.exception.catch - meta.statement.exception.finally + } + + void testTryCatchFinallyWithResource() { + + try (, , = , = null ; , =) {} catch ( | | ) {} +// ^^^^ meta.statement.exception.try.java - meta.statement.exception.try meta.statement.exception.try +// ^^^^^^^^^^^^^^^^^^^^^^ meta.statement.exception.try.java meta.group.java - meta.statement.exception.try meta.statement.exception.try +// ^ meta.statement.exception.try.java - meta.statement.exception.try meta.statement.exception.try - meta.group +// ^^ meta.statement.exception.try.java meta.block.java +// ^ - meta.statement.exception.try +// ^^^^^^ meta.statement.exception.catch.java - meta.statement.exception.catch meta.group +// ^^^^^^^ meta.statement.exception.catch.java meta.group.java +// ^ meta.statement.exception.catch.java - meta.statement.exception.catch meta.group - meta.statement.exception.catch meta.block +// ^^ meta.statement.exception.catch.java meta.block.java +// ^ - meta.statement.exception.catch +// ^^^ keyword.control.exception.try.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.separator.comma.java +// ^ punctuation.separator.comma.java +// ^ keyword.operator.assignment.java +// ^ punctuation.separator.comma.java +// ^ keyword.operator.assignment.java +// ^^^^ constant.language.null.java +// ^ punctuation.terminator.java +// ^ punctuation.separator.comma.java +// ^ keyword.operator.assignment.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java +// ^^^^^ keyword.control.exception.catch.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.separator.pipe.java +// ^ punctuation.separator.pipe.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + try (foo = Bar.baz(path)) {} +// ^^^^ meta.statement.exception.try.java - meta.statement.exception.try meta.statement.exception.try +// ^^^^^^^^^^^^^^^^^^^^^ meta.statement.exception.try.java meta.group.java - meta.statement.exception.try meta.statement.exception.try +// ^ meta.statement.exception.try.java - meta.statement.exception.try meta.statement.exception.try - meta.group +// ^^ meta.statement.exception.try.java meta.block.java +// ^^^ keyword.control.exception.try.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ keyword.operator.assignment.java +// ^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^^^^ variable.other.java +// ^^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + try (foo[], []) {} +// ^^^^ meta.statement.exception.try.java - meta.statement.exception.try meta.statement.exception.try +// ^^^^^^^^^^^ meta.statement.exception.try.java meta.group.java - meta.statement.exception.try meta.statement.exception.try +// ^ meta.statement.exception.try.java - meta.statement.exception.try meta.statement.exception.try - meta.group +// ^^ meta.statement.exception.try.java meta.block.java +// ^^^ keyword.control.exception.try.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^^ storage.modifier.array.java +// ^ punctuation.separator.comma.java +// ^^ storage.modifier.array.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + try (foo[] bar[], []) {} +// ^^^^ meta.statement.exception.try.java - meta.statement.exception.try meta.statement.exception.try +// ^^^^^^^^^^^^^^^^^ meta.statement.exception.try.java meta.group.java - meta.statement.exception.try meta.statement.exception.try +// ^ meta.statement.exception.try.java - meta.statement.exception.try meta.statement.exception.try - meta.group +// ^^ meta.statement.exception.try.java meta.block.java +// ^^^ keyword.control.exception.try.java +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.class.java +// ^^ storage.modifier.array.java +// ^^^ variable.other.java +// ^^ storage.modifier.array.java +// ^ punctuation.separator.comma.java +// ^^ storage.modifier.array.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + try (Stream lines = Files.lines(path)) { +// ^^^^ meta.statement.exception.try.java - meta.statement.exception.try meta.statement.exception.try +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.exception.try.java meta.group.java - meta.statement.exception.try meta.statement.exception.try +// ^ meta.statement.exception.try.java - meta.statement.exception.try meta.statement.exception.try - meta.group +// ^^ meta.statement.exception.try.java meta.block.java +// ^^^ keyword.control.exception.try.java +// ^ punctuation.section.group.begin.java +// ^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^^^^ variable.other.java +// ^ keyword.operator.assignment.java +// ^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^^^^ variable.other.java +// ^^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java + + } catch (IOException ignore) { +//^^^ meta.statement.exception.try.java meta.block.java +// ^ - meta.statement.exception.try - meta.statement.exception.catch +// ^^^^^^ meta.statement.exception.catch.java - meta.statement.exception.catch meta.statement.exception.catch +// ^^^^^^^^^^^^^^^^^^^^ meta.statement.exception.catch.java meta.group.java - meta.statement.exception.catch meta.statement.exception.catch +// ^ meta.statement.exception.catch.java - meta.statement.exception.catch meta.statement.exception.catch +// ^^ meta.statement.exception.catch.java meta.block.java +// ^ punctuation.section.block.end.java +// ^^^^^ keyword.control.exception.catch.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^^^ storage.type.class.java +// ^^^^^^ variable.other.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java + } catch (final MyException | com.net.org.Foo.Bar | +//^^^ meta.statement.exception.catch.java meta.block.java +// ^ - meta.statement.exception.catch +// ^^^^^^ meta.statement.exception.catch.java - meta.statement.exception.catch meta.statement.exception.catch +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.exception.catch.java meta.group.java - meta.statement.exception.catch meta.statement.exception.catch +// ^^^^^ keyword.control.exception.catch.java +// ^ punctuation.section.group.begin +// ^^^^^ storage.modifier.java +// ^^^^^^^^^^^ storage.type.class +// ^ punctuation.separator.pipe.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^ storage.type.class.java +// ^ punctuation.separator.pipe.java + YourException +// ^^^^^^^^^^^^^^^ meta.statement.exception.catch.java meta.group.java - meta.statement.exception.catch meta.statement.exception.catch +// ^^^^^^^^^^^^^ storage.type.class.java + ignore) {} +// ^^^^^^^ meta.statement.exception.catch.java meta.group.java - meta.statement.exception.catch meta.statement.exception.catch +// ^ meta.statement.exception.catch.java - meta.statement.exception.catch meta.statement.exception.catch +// ^^ meta.statement.exception.catch.java meta.block.java +// ^^^^^^ variable.other.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + + try (final InputStream is = new FileInputStream(args[0]); +// ^^^^ meta.statement.exception.try.java - meta.statement.exception.try meta.statement.exception.try +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.exception.try.java meta.group.java - meta.statement.exception.try meta.statement.exception.try +// ^^^ keyword.control.exception.try.java +// ^ punctuation.section.group.begin.java +// ^^^^^ storage.modifier.java +// ^^^^^^^^^^^ storage.type.class.java +// ^^ variable.other.java +// ^ keyword.operator.assignment.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^^^^ variable.other.java +// ^ punctuation.section.brackets.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + final OutputStream os = new FileOutputStream(args[1])) { +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.exception.try.java meta.group.java - meta.statement.exception.try meta.statement.exception.try +// ^ meta.statement.exception.try.java - meta.statement.exception.try meta.statement.exception.try - meta.group +// ^^ meta.statement.exception.try.java meta.block.java +// ^^^^^ storage.modifier.java +// ^^^^^^^^^^^^ storage.type.class.java +// ^^ variable.other.java +// ^ keyword.operator.assignment.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^^^^ variable.other.java +// ^ punctuation.section.brackets.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.brackets.end.java +// ^^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java + } +// ^ meta.statement.exception.try.java meta.block.java punctuation.section.block.end.java +// ^ - meta.statement.exception.try + + try (var in = new BufferedReader()) { +// ^^^^ meta.statement.exception.try.java - meta.statement.exception.try meta.statement.exception.try +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.exception.try.java meta.group.java - meta.statement.exception.try meta.statement.exception.try +// ^ meta.statement.exception.try.java - meta.statement.exception.try meta.statement.exception.try - meta.group +// ^^ meta.statement.exception.try.java meta.block.java +// ^^^ storage.type.variant.java +// ^^ variable.other.java +// ^ keyword.operator.assignment.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^^^^^^^ storage.type.class.java + var line = in.readLine(); +// ^^^ storage.type.variant.java +// ^^^^ variable.other.java +// ^ keyword.operator.assignment.java + } +// ^ meta.statement.exception.try.java meta.block.java punctuation.section.block.end.java +// ^ - meta.statement.exception.try + } +} + + +/****************************************************************************** + * Method Invocation Expressions Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-15.html#jls-15.2 + *****************************************************************************/ + +class MethodInvocationExpressionsTests { + + void invokeMethods() { + + Foo(); +// ^^^ - variable.function.java + + foo( ; +// ^^^ meta.function-call.identifier.java +// ^^ meta.function-call.arguments.java meta.group.java +// ^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.terminator.java + + foo(); +// ^^^ meta.function-call.identifier.java +// ^^ meta.function-call.arguments.java meta.group.java +// ^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + foo (); +// ^^^^ meta.function-call.identifier.java +// ^^ meta.function-call.arguments.java meta.group.java +// ^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + foo +// ^^^^ meta.function-call.identifier.java +// ^^^ variable.function.java + () ; +//^^^ meta.function-call.identifier.java +// ^^ meta.function-call.arguments.java meta.group.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + object.foo(); +// ^^^^^^ variable.other.java +// ^ punctuation.accessor.dot.java +// ^^^ meta.function-call.identifier.java +// ^^ meta.function-call.arguments.java meta.group.java +// ^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + super.foo(); +// ^^^^^ variable.language.super.java +// ^ punctuation.accessor.dot.java +// ^^^ meta.function-call.identifier.java +// ^^ meta.function-call.arguments.java meta.group.java +// ^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + super.foo(); +// ^^^^^ variable.language.super.java +// ^ punctuation.accessor.dot.java +// ^^^ meta.generic.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^^ meta.function-call.identifier.java +// ^^ meta.function-call.arguments.java meta.group.java +// ^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + this.foo(); +// ^^^^ variable.language.this.java +// ^ punctuation.accessor.dot.java +// ^^^ meta.function-call.identifier.java +// ^^ meta.function-call.arguments.java meta.group.java +// ^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + this.foo(); +// ^^^^ variable.language.this.java +// ^ punctuation.accessor.dot.java +// ^^^ meta.generic.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^^ meta.function-call.identifier.java +// ^^ meta.function-call.arguments.java meta.group.java +// ^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + this. foo(); +// ^^^^ variable.language.this.java +// ^ punctuation.accessor.dot.java +// ^^^ meta.generic.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^^ meta.function-call.identifier.java +// ^^ meta.function-call.arguments.java meta.group.java +// ^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + ( foo ).bar(); +// ^^^^^^^ meta.group.java +// ^^^^ - meta.group +// ^^^ meta.function-call.identifier.java +// ^^ meta.function-call.arguments.java meta.group.java +// ^ - meta.function-call - meta.group +// ^ punctuation.accessor.dot.java +// ^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + ( foo .bar(); +// ^^^^^^^^^^^^ meta.group.java +// ^^^ meta.function-call.identifier.java +// ^^ meta.function-call.arguments.java +// ^ - meta.function-call - meta.group +// ^ punctuation.accessor.dot.java +// ^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + foo.bar(hello(world); +// ^^^^^^ meta.group.java - meta.group meta.group +// ^^^^^^^ meta.group.java meta.group.java +// ^^^ meta.function-call.identifier.java - meta.function-call meta.function-call +// ^ meta.function-call.arguments.java - meta.function-call meta.function-call +// ^^^^^ meta.function-call.arguments.java meta.function-call.identifier.java +// ^^^^^^^ meta.function-call.arguments.java meta.function-call.arguments.java +// ^ - meta.function-call - meta.group +// ^ punctuation.accessor.dot.java +// ^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^^^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^^^^^ variable.other.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + some.other.path. +// ^^^^^^^^^^^^^^^^ meta.path.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java + foo.MyClass.staticMethod(true); +// ^^^^^^^^^^^ meta.path.java +// ^^^^^^^^^^^^ meta.function-call.identifier.java +// ^^^^^^ meta.function-call.arguments.java meta.group.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^^^^ constant.language.boolean.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + some.other.path +// ^^^^^^^^^^^^^^^^ meta.path.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^ variable.namespace.java + .foo.MyClass.staticMethod(true); +// ^^^^^^^^^^^^ meta.path.java +// ^^^^^^^^^^^^ meta.function-call.identifier.java +// ^^^^^^ meta.function-call.arguments.java meta.group.java +// ^ punctuation.accessor.dot.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^^^^ constant.language.boolean.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + } +//^ meta.function.java punctuation.section.block.end.java +} +// <- punctuation.section.block.end.java + + +/****************************************************************************** + * Instance Creation Expressions Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-15.html#jls-15.9 + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-15.html#jls-15.10 + *****************************************************************************/ + +class InstanceCreationExpressionsTests { + + @SyntaxTest + public void instantiateClassesObjects() { + + new$ ; +// ^^^^ variable.other.java - keyword + + $new ; +// ^^^^ variable.other.java - keyword + + new TestClass ; +// ^^^^^^^^^^^^^^ meta.instantiation.java +// ^^ - meta.instantiation +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.terminator.java + + new TestClass( +// ^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^ meta.group.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java + + new TestClass( ; +// ^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^ meta.group.java +// ^^ - meta.instantiation - meta.group +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.terminator.java + + new TestClass(foo ; +// ^^^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^^^ meta.group.java +// ^^ - meta.instantiation - meta.group +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ punctuation.terminator.java + + new TestClass(foo); +// ^^^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^^^ meta.group.java +// ^^ - meta.instantiation +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + new testclass(foo); +// ^^^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^^^ meta.group.java +// ^^ - meta.instantiation +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ punctuation.section.group.end.java + + new @Foo TestClass(foo); +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^^ meta.annotation.identifier.java +// ^^^^^^^^^^^^^^^ - meta.annotation +// ^^^^^ meta.group.java +// ^^ - meta.instantiation +// ^^^ keyword.other.storage.new.java +// ^^^ variable.annotation.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ punctuation.section.group.end.java + + new @foo testclass(foo); +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^^ meta.annotation.identifier.java +// ^^^^^^^^^^^^^^^ - meta.annotation +// ^^^^^ meta.group.java +// ^^ - meta.instantiation +// ^^^ keyword.other.storage.new.java +// ^^^ variable.annotation.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ punctuation.section.group.end.java + + new com.java.TestClass(foo); +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^^^^^^^^^^^^^^^^ meta.path.java +// ^^ - meta.instantiation +// ^^^ keyword.other.storage.new.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^ storage.type.class.java +// ^^^^^ meta.group.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ punctuation.section.group.end.java + + new com.java.testclass(foo); +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^^^^^^^^^^^^^^^^ meta.path.java +// ^^ - meta.instantiation +// ^^^ keyword.other.storage.new.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^ storage.type.class.java +// ^^^^^ meta.group.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ punctuation.section.group.end.java + + new OuterClass.InnerClass(); +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^^ storage.type.class.java + + new @Foo com . @Foo java . @Foo OuterClass . @Foo InnerClass(foo); +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^^ meta.annotation.identifier.java +// ^^^^^^^ - meta.annotation +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.path.java +// ^^^^ meta.annotation.identifier.java +// ^^^^^^^^ - meta.annotation +// ^^^^ meta.annotation.identifier.java +// ^^^^^^^^^^^^^^ - meta.annotation +// ^^^^ meta.annotation.identifier.java +// ^^^^^^^^^^^^^^^^ - meta.annotation +// ^^^ keyword.other.storage.new.java +// ^ punctuation.definition.annotation.java +// ^^^ variable.annotation.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^ variable.annotation.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^ variable.annotation.java +// ^^^^^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^ variable.annotation.java +// ^^^^^^^^^^ storage.type.class.java +// ^^^^^ meta.group.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ punctuation.section.group.end.java + + new @foo com . @foo java . @foo outerclass . @foo innerclass(foo) { }; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java - meta.block meta.block meta.block +// ^^^ meta.instantiation.java meta.class.java meta.block.java +// ^^^^ meta.annotation.identifier.java +// ^^^^^^^ - meta.annotation +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.path.java +// ^^^^ meta.annotation.identifier.java +// ^^^^^^^^ - meta.annotation +// ^^^^ meta.annotation.identifier.java +// ^^^^^^^^^^^^^^ - meta.annotation +// ^^^^ meta.annotation.identifier.java +// ^^^^^^^^^^^^^^^^ - meta.annotation +// ^^^ keyword.other.storage.new.java +// ^ punctuation.definition.annotation.java +// ^^^ variable.annotation.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^ variable.annotation.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^ variable.annotation.java +// ^^^^^^^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.definition.annotation.java +// ^^^ variable.annotation.java +// ^^^^^^^^^^ storage.type.class.java +// ^^^^^ meta.group.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java +// ^ punctuation.terminator.java + + new SubClass(new SubClass[0], true); +// ^^^^^^^^^^^^^ meta.instantiation.java - meta.instantiation meta.instantiation +// ^^^^^^^^^^^^^^^ meta.instantiation.java meta.instantiation.java +// ^^^^^^^ meta.instantiation.java - meta.instantiation meta.instantiation +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^ storage.type.class.java +// ^^^ meta.brackets.java +// ^ punctuation.separator.comma.java +// ^^^^ constant.language.boolean.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + new var(); +// ^^^^^^^^^ meta.instantiation.java +// ^^^ keyword.other.storage.new.java +// ^^^ invalid.illegal.unexpected-keyword.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + new static LocalClass() {}; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^ invalid.illegal.unexpected-keyword.java +// ^^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java +// ^ punctuation.terminator.java + + new class LocalClass() {}; +// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^ keyword.other.storage.new.java +// ^^^^^ invalid.illegal.unexpected-keyword.java +// ^^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java +// ^ punctuation.terminator.java + + new if (foo == true) {}; +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^ keyword.other.storage.new.java +// ^^ invalid.illegal.unexpected-keyword.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^^ keyword.operator.comparison.java +// ^^^^ constant.language.boolean.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java +// ^ punctuation.terminator.java + } + + @SyntaxTest + public void instantiatePrimitiveArrays() { + + new int[]{0, 0, 0}; +// ^ - meta.instantiation +// ^^^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^ - meta.instantiation +// ^^^ keyword.other.storage.new.java +// ^^^ storage.type.primitive.java +// ^ punctuation.section.brackets.begin.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.section.braces.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.braces.end.java + + new byte[size]; +// ^ - meta.instantiation +// ^^^^^^^^^^^^^^ meta.instantiation.java +// ^ - meta.instantiation +// ^^^ keyword.other.storage.new.java +// ^^^^ storage.type.primitive.java + + new int[][][] { +// ^^^^^^^^^^^^^^ meta.instantiation.java - meta.braces +// ^^ meta.instantiation.java meta.braces.java +// ^^^ storage.type.primitive.java +// ^ punctuation.section.brackets.begin.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.section.brackets.begin.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.section.brackets.begin.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.section.braces.begin.java + { { 1, 2 }, { 3, 4 } }, +// ^^ meta.instantiation.java meta.braces.java meta.braces.java - meta.braces meta.braces meta.braces +// ^^^^^^^^ meta.instantiation.java meta.braces.java meta.braces.java meta.braces.java +// ^^ meta.instantiation.java meta.braces.java meta.braces.java - meta.braces meta.braces meta.braces +// ^^^^^^^^ meta.instantiation.java meta.braces.java meta.braces.java meta.braces.java +// ^^ meta.instantiation.java meta.braces.java meta.braces.java - meta.braces meta.braces meta.braces +// ^ meta.instantiation.java meta.braces.java - meta.braces meta.braces +// ^ punctuation.section.braces.begin.java +// ^ punctuation.section.braces.begin.java +// ^ constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ constant.numeric.value.java +// ^ punctuation.section.braces.end.java +// ^ punctuation.separator.comma.java +// ^ punctuation.section.braces.begin.java +// ^ constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ constant.numeric.value.java +// ^ punctuation.section.braces.end.java +// ^ punctuation.section.braces.end.java +// ^ punctuation.separator.comma.java + { { 5, 6 }, { 7, 8 } } +// ^^ meta.instantiation.java meta.braces.java meta.braces.java - meta.braces meta.braces meta.braces +// ^^^^^^^^ meta.instantiation.java meta.braces.java meta.braces.java meta.braces.java +// ^^ meta.instantiation.java meta.braces.java meta.braces.java - meta.braces meta.braces meta.braces +// ^^^^^^^^ meta.instantiation.java meta.braces.java meta.braces.java meta.braces.java +// ^^ meta.instantiation.java meta.braces.java meta.braces.java - meta.braces meta.braces meta.braces +// ^ meta.instantiation.java meta.braces.java - meta.braces meta.braces +// ^ punctuation.section.braces.begin.java +// ^ punctuation.section.braces.begin.java +// ^ constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ constant.numeric.value.java +// ^ punctuation.section.braces.end.java +// ^ punctuation.separator.comma.java +// ^ punctuation.section.braces.begin.java +// ^ constant.numeric.value.java +// ^ punctuation.separator.comma.java +// ^ constant.numeric.value.java +// ^ punctuation.section.braces.end.java +// ^ punctuation.section.braces.end.java + }; +// ^^ meta.instantiation.java meta.braces.java +// ^ - meta.instantiation - meta.braces +// ^ punctuation.section.braces.end.java +// ^ punctuation.terminator.java + + new int[1][3][4]; +// ^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^^^^^^^ meta.brackets.java +// ^ - meta.instantiation - meta.brackets +// ^^^ storage.type.primitive.java +// ^ punctuation.section.brackets.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.section.brackets.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.section.brackets.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.brackets.end.java + } + + + @SyntaxTest + public void instantiateObjectArrays() { + + new String[] {"foo", "bar"}; +// ^^^^^^^^^^^^^ meta.instantiation.java - meta.braces +// ^^^^^^^^^^^^^^ meta.instantiation.java meta.braces.java +// ^ - meta.instantiation - meta.braces +// ^^^ keyword.other.storage.new.java +// ^^^^^^ storage.type.class.java +// ^ punctuation.section.brackets.begin.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.section.braces.begin.java +// ^^^^^ string.quoted.double.java +// ^ punctuation.separator.comma.java +// ^^^^^ string.quoted.double.java +// ^ punctuation.section.braces.end.java +// ^ punctuation.terminator.java + + new String[]() {"foo", "bar"}; +// ^^^^^^^^^^^^ meta.instantiation.java - meta.braces +// ^^^^^^^^^^^^^^^^^ - meta.instantiation +// ^^^ keyword.other.storage.new.java +// ^^^^^^ storage.type.class.java +// ^ punctuation.section.brackets.begin.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.section.block.begin.java +// ^^^^^ string.quoted.double.java +// ^ punctuation.separator.comma.java +// ^^^^^ string.quoted.double.java +// ^ punctuation.section.block.end.java +// ^ punctuation.terminator.java + + new MyObject[1]; +// ^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^ meta.brackets +// ^ - meta.instantiation - meta.brackets +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^ storage.type.class.java +// ^ punctuation.section.brackets.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.terminator.java + + new myobject[1]; +// ^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^ meta.brackets +// ^ - meta.instantiation - meta.brackets +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^ storage.type.class.java +// ^ punctuation.section.brackets.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.terminator.java + + new MyObject[1][]; +// ^^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^^^ meta.brackets +// ^ - meta.instantiation - meta.brackets +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^ storage.type.class.java +// ^ punctuation.section.brackets.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.section.brackets.begin.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.terminator.java + + new @notnull MyObject @bound [size + 10] @anno []; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^^^^^^ meta.annotation.identifier.java +// ^ - meta.annotation +// ^^^^^^ meta.annotation.identifier.java +// ^ - meta.annotation +// ^^^^^^^^^^^ meta.brackets.java +// ^^^^^ meta.annotation.identifier.java +// ^ - meta.annotation +// ^^ meta.brackets.java +// ^ - meta.instantiation - meta.brackets +// ^^^ keyword.other.storage.new.java +// ^ punctuation.definition.annotation.java +// ^^^^^^^ variable.annotation.java +// ^^^^^^^^ storage.type.class.java +// ^ punctuation.definition.annotation.java +// ^^^^^ variable.annotation.java +// ^ punctuation.section.brackets.begin.java +// ^^^^ variable.other.java +// ^ keyword.operator.arithmetic.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^ punctuation.section.brackets.begin.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.terminator.java + + new @notnull myobject @bound [size + 10] @anno []; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^^^^^^ meta.annotation.identifier.java +// ^ - meta.annotation +// ^^^^^^ meta.annotation.identifier.java +// ^ - meta.annotation +// ^^^^^^^^^^^ meta.brackets.java +// ^^^^^ meta.annotation.identifier.java +// ^ - meta.annotation +// ^^ meta.brackets.java +// ^ - meta.instantiation - meta.brackets +// ^^^ keyword.other.storage.new.java +// ^ punctuation.definition.annotation.java +// ^^^^^^^ variable.annotation.java +// ^^^^^^^^ storage.type.class.java +// ^ punctuation.definition.annotation.java +// ^^^^^ variable.annotation.java +// ^ punctuation.section.brackets.begin.java +// ^^^^ variable.other.java +// ^ keyword.operator.arithmetic.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^ punctuation.section.brackets.begin.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.terminator.java + + new some.path.to.MyObject[3]; +// ^^^^ meta.instantiation.java - meta.path +// ^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java meta.path.java +// ^^^ meta.instantiation.java meta.brackets.java - meta.path +// ^ - meta.instantiation +// ^^^ keyword.other.storage.new.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^ storage.type.class.java +// ^ punctuation.section.brackets.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.brackets.end.java + + new some.path.to.myobject[3]; +// ^^^^ meta.instantiation.java - meta.path +// ^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java meta.path.java +// ^^^ meta.instantiation.java meta.brackets.java - meta.path +// ^ - meta.instantiation +// ^^^ keyword.other.storage.new.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^ storage.type.class.java +// ^ punctuation.section.brackets.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.brackets.end.java + } + + @SyntaxTest + public void instantiateGenericClassObjects() { + + new Generic<>; +// ^^^^^^^^^^^^^ meta.instantiation.java +// ^^ meta.generic.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^ storage.type.class.java +// ^^ punctuation.section.generic.diamond.java +// ^ punctuation.terminator.java + + new Generic<>(); +// ^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^ meta.generic.java +// ^^ meta.group.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^ storage.type.class.java +// ^^ punctuation.section.generic.diamond.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + new Generic(); +// ^^^^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^^^^ meta.generic.java +// ^^ meta.group.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + new Generic<@Anno Type>(); +// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^^^^^^^^^^ meta.generic.java +// ^^^^^ meta.annotation.identifier.java +// ^ - meta.annotation +// ^^ meta.group.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + new Generic(); +// ^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^ meta.generic.java +// ^^ meta.group.java +// ^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ variable.language.wildcard.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + new @Anno Generic<@Anno ?>(); +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java +// ^^^^^ meta.annotation.identifier.java +// ^^^^^^^^^ - meta.annotation +// ^^^^^^^^^ meta.generic.java +// ^^^^^ meta.annotation.identifier.java +// ^^^ - meta.annotation +// ^^ meta.group.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^ variable.language.wildcard.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + new Generic(); +// ^^^^^^^^^^^ meta.instantiation.java - meta.generic +// ^^^^^^^^^^^^^^^^ meta.instantiation.java meta.generic.java +// ^^ meta.instantiation.java meta.group.java +// ^ punctuation.section.generic.begin.java +// ^ variable.language.wildcard.java +// ^^^^^^^ storage.modifier.extends.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + new @Anno Generic<@Anno ? extends @Anno Type>(); +// ^^^^^^^^^^^^^^^^^ meta.instantiation.java - meta.generic +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java meta.generic.java +// ^^ meta.instantiation.java meta.group.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^ variable.language.wildcard.java +// ^^^^^^^ storage.modifier.extends.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + new @anno generic<@anno ? extends @anno type>(); +// ^^^^^^^^^^^^^^^^^ meta.instantiation.java - meta.generic +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java meta.generic.java +// ^^ meta.instantiation.java meta.group.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^ variable.language.wildcard.java +// ^^^^^^^ storage.modifier.extends.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + new Generic(); +// ^^^^^^^^^^^ meta.instantiation.java - meta.generic +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java meta.generic.java +// ^^ meta.instantiation.java meta.group.java +// ^ punctuation.section.generic.begin.java +// ^ variable.language.wildcard.java +// ^^^^^^^ storage.modifier.extends.java +// ^^^^ storage.type.class.java +// ^ punctuation.separator.comma.java +// ^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + new Generic(); +// ^^^^^^^^^^^ meta.instantiation.java - meta.generic +// ^^^^^^^^^^^^^^ meta.instantiation.java meta.generic.java +// ^^ meta.instantiation.java meta.group.java +// ^ punctuation.section.generic.begin.java +// ^ variable.language.wildcard.java +// ^^^^^ keyword.declaration.super.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + new Generic(); +// ^^^ invalid.illegal.unexpected-keyword.java + + new Generic(); +// ^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java + + new Generic(); +// ^^^ storage.type.primitive.java +// ^^^^^ meta.annotation.identifier.java +// ^^^^ - meta.annotation +// ^^ storage.modifier.array.java + + new Generic(); +// ^^^ storage.type.primitive.java +// ^^^^^^^^^^^^^^ - meta.annotation meta.annotation +// ^^^^^ meta.annotation.parameters.java meta.annotation.identifier.java +// ^^^^^^ - meta.annotation meta.annotation +// ^^^^^^^^^^^^ meta.annotation.identifier.java - meta.path +// ^^^^^^^^^^^^^ meta.annotation.parameters.java meta.group.java +// ^^ storage.modifier.array.java + + new Generic(); +// ^^^ storage.type.primitive.java +// ^^^^^^^^^^^^^^^^^^^^^ meta.annotation.identifier.java meta.path.java +// ^ meta.annotation.identifier.java - meta.path +// ^^^^^^^^^^^^^ meta.annotation.parameters.java meta.group.java +// ^^ storage.modifier.array.java + + new generic(); +// ^^^ storage.type.primitive.java +// ^^^^^^^^^^^ meta.annotation.identifier.java meta.path.java +// ^ meta.annotation.identifier.java - meta.path +// ^^^^^^^^^^^^^ meta.annotation.parameters.java meta.group.java +// ^^ storage.modifier.array.java + + new Generic(); +// ^^^^^^ storage.type.class.java +// ^^^ invalid.illegal.unexpected-keyword.java + + new Generic(); +// ^^^^^^^^^^^^ meta.generic.java +// ^^^^^^^^^^ meta.path.java +// ^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ variable.namespace.java +// ^ punctuation.accessor.dot.java + + new generic(); +// ^^^^^^^^^^^^ meta.generic.java +// ^^^^^^^^^^ meta.path.java +// ^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ variable.namespace.java +// ^ punctuation.accessor.dot.java + + new generic[] { new generic(1), new generic(2) }; +// ^^^^^^^^^^^^^^^^^ meta.instantiation.java - meta.braces - meta.instantiation meta.instantiation +// ^^ meta.instantiation.java meta.braces.java - meta.instantiation meta.instantiation +// ^^^^^^^^^^^^^^ meta.instantiation.java meta.braces.java meta.instantiation.java +// ^^ meta.instantiation.java meta.braces.java - meta.instantiation meta.instantiation +// ^^^^^^^^^^^^^^^ meta.instantiation.java meta.braces.java meta.instantiation.java +// ^ meta.instantiation.java meta.braces.java - meta.instantiation meta.instantiation +// ^ - meta.instantiation - meta.braces +// ^^^ keyword.other.storage.new.java +// ^^^^^^^ storage.type.class.java +// ^^^ meta.generic.java +// ^ punctuation.section.brackets.begin.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.section.braces.begin +// ^^^ keyword.other.storage.new.java +// ^^^^^^^ storage.type.class.java +// ^ punctuation.separator.comma.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^ storage.type.class.java +// ^ punctuation.section.braces.end + + new ArrayList[] { new ArrayList(), new ArrayList() } +// ^^^^^^^^^^^^^^^^^^^ meta.instantiation.java - meta.braces - meta.instantiation meta.instantiation +// ^^ meta.instantiation.java meta.braces.java - meta.instantiation meta.instantiation +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java meta.braces.java meta.instantiation.java +// ^^ meta.instantiation.java meta.braces.java - meta.instantiation meta.instantiation +// ^^^^^^^^^^^^^^^^^^^^^^ meta.instantiation.java meta.braces.java meta.instantiation.java +// ^ meta.instantiation.java meta.braces.java - meta.instantiation meta.instantiation +// ^ - meta.instantiation - meta.braces +// ^^^ meta.generic.java +// ^^^^^^^^^^^^^^^ meta.generic.java +// ^^^^^^^^^^^^^ meta.path.java +// ^^^^^^ meta.generic.java - meta.path +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ variable.language.wildcard.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.brackets.begin.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.section.braces.begin.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.separator.comma.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.braces.end.java + + new +// ^^^^ meta.instantiation.java - meta.path +// ^^^ keyword.other.storage.new.java + a +// ^ meta.instantiation.java - meta.path +// ^^ meta.instantiation.java meta.path.java - meta.path meta.path +// ^ variable.namespace.java + . +// ^^^ meta.instantiation.java meta.path.java +// ^ punctuation.accessor.dot.java + b.Generic +// ^^^^^^^^^^^ meta.instantiation.java meta.path.java +// ^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^ storage.type.class.java + < +// ^ meta.instantiation.java meta.path.java - meta.generic +// ^^ meta.instantiation.java meta.path.java meta.generic.java +// ^ punctuation.section.generic.begin.java + a +// ^ meta.instantiation.java meta.path.java meta.generic.java - meta.path meta.path - variable +// ^ meta.instantiation.java meta.path.java meta.generic.java meta.path.java variable.namespace.java +// ^ meta.instantiation.java meta.path.java meta.generic.java meta.path.java - variable + . +// ^^^ meta.instantiation.java meta.path.java meta.generic.java meta.path.java +// ^ punctuation.accessor.dot.java + b.Generic +// ^^^^^^^^^^^ meta.instantiation.java meta.path.java meta.generic.java meta.path.java +// ^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^ storage.type.class.java + >(); +//<- meta.instantiation.java meta.path.java meta.generic.java - meta.path meta.path +// ^^ meta.instantiation.java meta.path.java meta.generic.java - meta.path meta.path +// ^^ meta.instantiation.java meta.group.java - meta.path +// ^ - meta.instantiation +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + new Generic(); + + } +} + + +/****************************************************************************** + * Method Reference Expressions Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-15.html#jls-15.13 + *****************************************************************************/ + +class MethodReferenceExpressionsTests { + + void run() { + + System::currentTimeMillis // static method +// ^^^^^^ storage.type.class.java +// ^^ punctuation.accessor.double-colon.java +// ^^^^^^^^^^^^^^^^^ variable.function.reference.java + + List::size // inferred type arguments for generic type +// ^^^^ storage.type.class.java +// ^^ punctuation.accessor.double-colon.java +// ^^^^ variable.function.reference.java + + List::size // explicit type arguments for generic type +// ^^^^ storage.type.class.java +// ^^^^^^^^ meta.generic.java +// ^^ punctuation.accessor.double-colon.java +// ^^^^ variable.function.reference.java + + int[]::clone +// ^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java +// ^^ punctuation.accessor.double-colon.java +// ^^^^^ variable.function.reference.java + + T::tvarMember +// ^ storage.type.class.java +// ^^ punctuation.accessor.double-colon.java +// ^^^^^^^^^^ variable.function.reference.java + + System.out::println +// ^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^ variable.other.java +// ^^ punctuation.accessor.double-colon.java +// ^^^^^^^ variable.function.reference.java + + "abc"::length +// ^^^^^ string.quoted.double.java +// ^^ punctuation.accessor.double-colon.java +// ^^^^^^ variable.function.reference.java + + foo[x]::bar +// ^^^ meta.variable.identifier.java variable.other.java +// ^^^ meta.variable.item-access.java meta.brackets.java +// ^^ punctuation.accessor.double-colon.java +// ^^^ variable.function.reference.java + + (test ? list.replaceAll(String::trim) : list) :: iterator +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group.java +// ^^^^^^^^^^ meta.function-call.identifier.java +// ^^^^^^^^^^^^^^ meta.function-call.arguments.java meta.group.java +// ^ punctuation.section.group.begin.java +// ^^^^ variable.other.java +// ^ keyword.operator.ternary.java +// ^^^^ variable.other.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^^ variable.function.java +// ^^^^^^ storage.type.class.java +// ^^ punctuation.accessor.double-colon.java +// ^^^^ variable.function.reference.java +// ^ keyword.operator.ternary.java +// ^^^^ variable.other.java +// ^ punctuation.section.group.end.java +// ^^ punctuation.accessor.double-colon.java +// ^^^^^^^^ variable.function.reference.java + + super::toString +// ^^^^^ variable.language.super.java +// ^^ punctuation.accessor.double-colon.java +// ^^^^^^^^ variable.function.reference.java + + Arrays::sort // explicit type arguments +// ^^^^^^ storage.type.class.java +// ^^ punctuation.accessor.double-colon.java +// ^^^^^^^^ meta.generic.java +// ^^^^ variable.function.reference.java + + ArrayList::new // constructor for parameterized type +// ^^^^^^^^^ storage.type.class.java +// ^^^^^^^^ meta.generic.java +// ^^ punctuation.accessor.double-colon.java +// ^^^ keyword.other.storage.new.java + + ArrayListnew // explicit type arguments for generic constructor +// ^^^ storage.type.class.java +// ^^ punctuation.accessor.double-colon.java +// ^^^^^^^^^ meta.generic.java +// ^^^ keyword.other.storage.new.java + + Bar::new // generic class, generic constructor +// ^^^ storage.type.class.java +// ^^^^^^^^ meta.generic.java +// ^^ punctuation.accessor.double-colon.java +// ^^^^^^^^^ meta.generic.java +// ^^^ keyword.other.storage.new.java + + Outer.Inner::new // inner class constructor +// ^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^^ storage.type.class.java +// ^^ punctuation.accessor.double-colon.java +// ^^^ keyword.other.storage.new.java + int[]::new // array creation +// ^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java +// ^^ punctuation.accessor.double-colon.java +// ^^^ keyword.other.storage.new.java + } +} + + +/****************************************************************************** + * Cast Expressions Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-15.html#jls-15.16 + *****************************************************************************/ + +class CastExpressionsTests { + + void primitiveTypeCastExpression() { + + () foo; +// ^^ meta.cast.java meta.group.java +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + (int) foo; +// ^^^^^ meta.cast.java meta.group.java +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.primitive.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + (int$) foo; +// ^^^^^^ meta.cast.java meta.group.java +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + (int) foo[10]; +// ^^^^^ meta.cast.java meta.group.java +// ^^^^^^^^ - meta.cast - meta.group +// ^^^ meta.variable.identifier.java +// ^^^^ meta.variable.item-access.java meta.brackets.java +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.primitive.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + (int) foo(); +// ^^^^^ meta.cast.java meta.group.java +// ^ - meta.function-call - meta.cast - meta.group +// ^^^ meta.function-call.identifier.java +// ^^ meta.function-call.arguments.java meta.group.java +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.primitive.java +// ^ punctuation.section.group.end.java +// ^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + (int) foo -> {return 0}; +// ^^^^^ meta.cast.java meta.group.java +// ^ - meta.function.anonymous - meta.cast - meta.group +// ^^^ meta.function.anonymous.parameters.java +// ^^^^^^^^^^^^^^ meta.function.anonymous.java +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.primitive.java +// ^ punctuation.section.group.end.java +// ^^^ variable.parameter.java +// ^^ keyword.declaration.function.arrow.java +// ^ punctuation.section.block.begin.java +// ^^^^^^ keyword.control.flow.return.java +// ^ constant.numeric.value.java +// ^ punctuation.section.block.end.java +// ^ punctuation.terminator.java + + (int) this; +// ^^^^^ meta.cast.java meta.group.java +// ^^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.primitive.java +// ^ punctuation.section.group.end.java +// ^^^^ variable.language.this.java +// ^ punctuation.terminator.java + + (int) super.class; +// ^^^^^ meta.cast.java meta.group.java +// ^^^^^^^^^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.primitive.java +// ^ punctuation.section.group.end.java +// ^^^^^ variable.language.super.java +// ^ punctuation.accessor.dot.java +// ^^^^^ variable.language.class.java +// ^ punctuation.terminator.java + + (int) TestClass; +// ^^^^^ meta.cast.java meta.group.java +// ^^^^^^^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.primitive.java +// ^ punctuation.section.group.end.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.terminator.java + + (int) new TestClass(); +// ^^^^^ meta.cast.java meta.group.java +// ^ - meta.cast - meta.group - meta.instantiation +// ^^^^^^^^^^^^^^^ meta.instantiation.java - meta.cast +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.primitive.java +// ^ punctuation.section.group.end.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + (int) (char) (foo + 10); +// ^^^^^ meta.cast.java meta.group.java +// ^ - meta.cast - meta.group +// ^^^^^^ meta.cast.java meta.group.java +// ^ - meta.cast - meta.group +// ^^^^^^^^^^ meta.group.java - meta.cast +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.primitive.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.group.begin.java +// ^^^^ storage.type.primitive.java +// ^ punctuation.section.group.end.java +// ^ punctuation.section.group.begin.java +// ^^^ variable.other.java +// ^ keyword.operator.arithmetic.java +// ^^ constant.numeric.value.java +// ^ punctuation.section.group.end.java + + (int[]) foo; +// ^^^^^^^ meta.cast.java meta.group.java +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + (int[]) ! foo; +// ^^^^^^^ meta.cast.java meta.group.java +// ^^^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java +// ^ punctuation.section.group.end.java +// ^ keyword.operator.logical.java +// ^^^ variable.other.java + + (int[]) ~ foo; +// ^^^^^^^ meta.cast.java meta.group.java +// ^^^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java +// ^ punctuation.section.group.end.java +// ^ keyword.operator.bitwise.java +// ^^^ variable.other.java + + (var) foo; +// ^^^^^ meta.cast.java meta.group.java +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^ invalid.illegal.unexpected-keyword.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + } + + void classTypeCastExpression() { + + (TestClass) foo; +// ^^^^^^^^^^^ meta.cast.java meta.group.java +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + (TestClass[]) foo; +// ^^^^^^^^^^^^^ meta.cast.java meta.group.java +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^ storage.type.class.java +// ^^ storage.modifier.array.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + (testclass) foo; +// ^^^^^^^^^^^ meta.cast.java meta.group.java +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + (testclass[]) foo; +// ^^^^^^^^^^^^^ meta.cast.java meta.group.java +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^ storage.type.class.java +// ^^ storage.modifier.array.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + (TestClass & OtherClass) foo; +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.cast.java meta.group.java +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^ storage.type.class.java +// ^ keyword.operator.logical.java +// ^^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + (testclass & otherclass) foo; +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.cast.java meta.group.java +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^ storage.type.class.java +// ^ keyword.operator.logical.java +// ^^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + (@anno testclass & @anno otherclass) foo; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.cast.java meta.group.java +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^^^ meta.annotation.identifier.java +// ^^^^^^^^^ storage.type.class.java +// ^ keyword.operator.logical.java +// ^^^^^ meta.annotation.identifier.java +// ^^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + } + + void genericTypeCastExpression() { + + (a < b) foo; +// ^^^^^^^ meta.group.java +// ^ punctuation.section.group.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + (a < b) ~ foo; +// ^^^^^^^ meta.group.java +// ^ punctuation.section.group.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.group.end.java +// ^ keyword.operator.bitwise.java +// ^^^ variable.other.java + + (List) foo; +// ^^^^^ meta.cast.java meta.group.java - meta.generic +// ^^^ meta.cast.java meta.group.java meta.generic.java +// ^ meta.cast.java meta.group.java - meta.generic +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + (List[]) foo; +// ^^^^^ meta.cast.java meta.group.java - meta.generic +// ^^^ meta.cast.java meta.group.java meta.generic.java +// ^^^ meta.cast.java meta.group.java - meta.generic +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^ storage.modifier.array.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + (list) foo; +// ^^^^^ meta.cast.java meta.group.java - meta.generic +// ^^^ meta.cast.java meta.group.java meta.generic.java +// ^ meta.cast.java meta.group.java - meta.generic +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + (list[]) foo; +// ^^^^^ meta.cast.java meta.group.java - meta.generic +// ^^^ meta.cast.java meta.group.java meta.generic.java +// ^^^ meta.cast.java meta.group.java - meta.generic +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^ storage.modifier.array.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + (list[] & OtherList & None) foo; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.cast.java meta.group.java +// ^ punctuation.section.group.begin.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^ storage.modifier.array.java +// ^ keyword.operator.logical.java +// ^^^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ keyword.operator.logical.java +// ^^^^ storage.type.class.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + () foo; +// ^ meta.cast.java meta.group.java - meta.generic +// ^^^ meta.cast.java meta.group.java meta.generic.java +// ^ meta.cast.java meta.group.java - meta.generic +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + ([]) foo; +// ^ meta.cast.java meta.group.java - meta.generic +// ^^^ meta.cast.java meta.group.java meta.generic.java +// ^^^ meta.cast.java meta.group.java - meta.generic +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^ storage.modifier.array.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + () foo; +// ^ meta.cast.java meta.group.java - meta.generic +// ^^^ meta.cast.java meta.group.java meta.generic.java +// ^ meta.cast.java meta.group.java - meta.generic +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + ([]) foo; +// ^ meta.cast.java meta.group.java - meta.generic +// ^^^ meta.cast.java meta.group.java meta.generic.java +// ^^^ meta.cast.java meta.group.java - meta.generic +// ^^^^ - meta.cast - meta.group +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.generic.begin.java +// ^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^^ storage.modifier.array.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + } + + void noCastExpressionsTests() { + + (a + b) foo; +// ^^^^^^^ meta.group.java +// ^ punctuation.section.group.begin.java +// ^ variable.other.java +// ^ keyword.operator.arithmetic.java +// ^ variable.other.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + + (a < b) & foo; +// ^^^^^^^ meta.group.java +// ^ punctuation.section.group.begin.java +// ^ variable.other.java +// ^ keyword.operator.comparison.java +// ^ variable.other.java +// ^ punctuation.section.group.end.java +// ^ keyword.operator.bitwise.java +// ^^^ variable.other.java + + (0) foo; +// ^^^ meta.group.java +// ^ punctuation.section.group.begin.java +// ^ constant.numeric.value.java +// ^ punctuation.section.group.end.java +// ^^^ variable.other.java + } +} + + +/****************************************************************************** + * Instance Type Comparison Expressions Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-15.html#jls-15.20.2 + *****************************************************************************/ + +class TypeComparisonExpressionsTests { + + void instanceofPrimitiveTests { + + instanceof +// ^^^^^^^^^^ keyword.other.storage.instanceof.java + + instanceof boolean +// ^^^^^^^^^^ keyword.other.storage.instanceof.java +// ^^^^^^^ storage.type.primitive.java + + instanceof boolean[] +// ^^^^^^^^^^ keyword.other.storage.instanceof.java +// ^^^^^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java + + instanceof boolean@anno[] +// ^^^^^^^^^^ keyword.other.storage.instanceof.java +// ^^^^^^^ storage.type.primitive.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^ storage.modifier.array.java + + instanceof char +// ^^^^^^^^^^ keyword.other.storage.instanceof.java +// ^^^^ storage.type.primitive.java + + instanceof char[] +// ^^^^^^^^^^ keyword.other.storage.instanceof.java +// ^^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java + + instanceof char@anno[] +// ^^^^^^^^^^ keyword.other.storage.instanceof.java +// ^^^^ storage.type.primitive.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^ storage.modifier.array.java + + instanceof int +// ^^^^^^^^^^ keyword.other.storage.instanceof.java +// ^^^ storage.type.primitive.java + + instanceof int[] +// ^^^^^^^^^^ keyword.other.storage.instanceof.java +// ^^^ storage.type.primitive.java +// ^^ storage.modifier.array.java + + instanceof int@anno[] +// ^^^^^^^^^^ keyword.other.storage.instanceof.java +// ^^^ storage.type.primitive.java +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java +// ^^ storage.modifier.array.java + + instanceof +// ^^^^^^^^^^ keyword.other.storage.instanceof.java + int +// ^^^ storage.type.primitive.java + @anno +// ^ punctuation.definition.annotation.java +// ^^^^ variable.annotation.java + [] +// ^^ storage.modifier.array.java +} + + void instanceofClassTests { + + a instanceof b +// ^^^^^^^^^^ keyword.other.storage.instanceof.java +// ^ storage.type.class.java + + a instanceof b.c +// ^^^^^^^^^^ keyword.other.storage.instanceof.java +// ^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ storage.type.class.java + + a instanceof b.c.d +// ^^^^^^^^^^ keyword.other.storage.instanceof.java +// ^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ storage.type.class.java + + a instanceof Object +// ^^^^^^^^^^ keyword.other.storage.instanceof.java +// ^^^^^^ storage.type.class.java +} + + void instanceofGenericsTests { + + instanceof +// ^^^^^^^^^^ keyword.other.storage.instanceof.java + + instanceof X.Y +// ^^^^^^^^^^ keyword.other.storage.instanceof.java + } + + void instanceofAmbigultyTests { + + a = b instanceof c?1__1:0b11110101; +// ^ variable.other.java +// ^ keyword.operator.assignment.java +// ^ variable.other.java +// ^^^^^^^^^^ keyword.other.storage.instanceof.java +// ^ storage.type.class.java +// ^ keyword.operator.ternary.java +// ^^^^ constant.numeric.value.java +// ^ keyword.operator.ternary.java +// ^^ constant.numeric.base.java +// ^^^^^^^^ constant.numeric.value.java +// ^ punctuation.terminator.java + } + // <- meta.class.java meta.block.java meta.function.java meta.block.java punctuation.section.block.end.java + + void instanceofPatternsTests () { + + obj instanceof String s && s.length() > 5 +// ^^^ variable.other.java +// ^^^^^^^^^^ keyword.other.storage.instanceof.java +// ^^^^^^ storage.type.class.java +// ^ variable.other.java +// ^^ keyword.operator.logical.java +// ^ variable.other.java +// ^ punctuation.accessor.dot.java +// ^^^^^^ variable.function.java +// ^^ meta.group.java +// ^ keyword.operator.comparison.java +// ^ constant.numeric.value.java + } +} +// <- meta.class.java meta.block.java punctuation.section.block.end.java + + +/****************************************************************************** + * Lambda Expressions Tests + * https://docs.oracle.com/javase/specs/jls/se13/html/jls-15.html#jls-15.27 + *****************************************************************************/ + +class LambdasExpressionsTests { + + void anonymousFunctions() { + + Function func = a -> 42; +// ^ variable.parameter.java +// ^^ keyword.declaration.function.arrow.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.terminator.java + foo(a -> 42); +// ^^^ meta.function-call.identifier.java +// ^^^^^^^^^ meta.function-call.arguments.java meta.group.java +// ^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ variable.parameter.java +// ^^ keyword.declaration.function.arrow.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + a -> { return 42; }; +// ^^^^^^^^^^^^^^ meta.function.anonymous.java + + (a, b) -> 42; +// ^ variable.parameter.java +// ^ variable.parameter.java +// ^^ keyword.declaration.function.arrow.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java + + (int a, Foo[] b) -> 42; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.function.anonymous meta.function.anonymous +// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.anonymous.parameters.java meta.group.java +// ^^^^^^ meta.function.anonymous.java - meta.group +// ^^^ storage.type.primitive +// ^ variable.parameter.java +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ variable.parameter.java +// ^^ keyword.declaration.function.arrow.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java + + ( +// ^^ meta.function.anonymous.parameters.java meta.group.java - meta.function.anonymous meta.function.anonymous +// ^ punctuation.section.group.begin.java + int a, +// ^^^^^^^^ meta.function.anonymous.parameters.java meta.group.java - meta.function.anonymous meta.function.anonymous +// ^^^ storage.type.primitive +// ^ variable.parameter.java +// ^ punctuation.separator.comma.java + Foo[] b +// ^^^^^^^^^^^^^^^^^^ meta.function.anonymous.parameters.java meta.group.java - meta.function.anonymous meta.function.anonymous +// ^^^ storage.type.class.java +// ^ punctuation.section.generic.begin.java +// ^^^^^^^ storage.type.class.java +// ^ punctuation.section.generic.end.java +// ^ variable.parameter.java + ) +// ^ meta.function.anonymous.parameters.java meta.group.java punctuation.section.group.end.java - meta.function.anonymous meta.function.anonymous +// ^ meta.function.anonymous.java - meta.function.anonymous meta.function.anonymous + -> +// ^^^ meta.function.anonymous.java - meta.function.anonymous meta.function.anonymous +// ^^ keyword.declaration.function.arrow.java + 42; +// ^^^ meta.function.anonymous.java - meta.function.anonymous meta.function.anonymous +// ^^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.terminator.java + + foo.forEach((k, v) -> { +// ^^^^^^^^^^^^ meta.function-call.arguments.java +// ^^^^^^ meta.function.anonymous.parameters.java meta.group.java +// ^ punctuation.section.group.begin.java +// ^ variable.parameter.java +// ^ punctuation.separator.comma.java +// ^ variable.parameter.java +// ^ punctuation.section.group.end.java +// ^^^^^^ meta.function.anonymous.java +// ^^ keyword.declaration.function.arrow.java +// ^ punctuation.section.block.begin + return; +// ^^^^^^^^^ meta.function-call.arguments.java meta.group.java meta.function.anonymous.java meta.block.java +// ^^^^^^ meta.statement.flow.return.java keyword.control.flow.return.java +// ^ punctuation.terminator.java - meta.statement.flow.return + }); +// ^ punctuation.section.block.end.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + a = (int) a + (a, int b) -> { return c }; +// ^^^^^ meta.cast.java meta.group.java +// ^^^^^ - meta.group +// ^^^^^^^^^^ meta.function.anonymous.parameters.java meta.group.java +// ^^^^ meta.function.anonymous.java - meta.group - meta.function.anonymous meta.block +// ^^^^^^^^^^^^ meta.function.anonymous.java meta.block.java +// ^ - meta.function.anonymous +// ^ punctuation.section.group.begin.java +// ^^^ storage.type.primitive.java +// ^ punctuation.section.group.end.java +// ^ variable.other.java +// ^ keyword.operator.arithmetic.java +// ^ punctuation.section.group.begin.java +// ^ variable.parameter.java +// ^ punctuation.separator.comma.java +// ^^^ storage.type.primitive.java +// ^ variable.parameter.java +// ^ punctuation.section.group.end.java +// ^^ keyword.declaration.function.arrow.java +// ^ punctuation.section.block.begin.java +// ^^^^^^ keyword.control.flow.return.java +// ^ variable.other.java +// ^ punctuation.section.block.end.java +// ^ punctuation.terminator.java + + a = ((int) a + (a, int b) -> { return c }); +// ^ meta.group.java - meta.group meta.group +// ^^^^^ meta.group.java meta.cast.java meta.group.java +// ^^^^^ meta.group.java - meta.group meta.group +// ^^^^^^^^^^ meta.group.java meta.function.anonymous.parameters.java meta.group.java +// ^^^^ meta.group.java meta.function.anonymous.java - meta.group meta.group - meta.function.anonymous meta.block +// ^^^^^^^^^^^^ meta.group.java meta.function.anonymous.java meta.block.java +// ^ - meta.function.anonymous - meta.group meta.group +// ^ - meta.group +// ^^ punctuation.section.group.begin.java +// ^^^ storage.type.primitive.java +// ^ punctuation.section.group.end.java +// ^ variable.other.java +// ^ keyword.operator.arithmetic.java +// ^ punctuation.section.group.begin.java +// ^ variable.parameter.java +// ^ punctuation.separator.comma.java +// ^^^ storage.type.primitive.java +// ^ variable.parameter.java +// ^ punctuation.section.group.end.java +// ^^ keyword.declaration.function.arrow.java +// ^ punctuation.section.block.begin.java +// ^^^^^^ keyword.control.flow.return.java +// ^ variable.other.java +// ^ punctuation.section.block.end.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + } +//^ meta.class.java meta.block.java meta.function.java meta.block.java punctuation.section.block.end.java + + // Lambda parameter tests + Function lambda1 = (final @MyAnnotation String foo) -> foo; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.anonymous.parameters.java +// ^^^^^ storage.modifier.java +// ^^^^^^^^^^^^^ meta.annotation +// ^ punctuation.definition.annotation +// ^^^^^^ storage.type.class.java - meta.annotation +// ^^^ variable.parameter.java +// ^^ keyword.declaration.function.arrow.java - meta.function.anonymous.parameters.java + + Function lambda2 = (@MyAnnotation String foo) -> foo; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.anonymous.parameters.java +// ^^^^^^^^^^^^^ meta.annotation +// ^ punctuation.definition.annotation +// ^^^^^^ storage.type.class.java - meta.annotation +// ^^^ variable.parameter.java +// ^^ keyword.declaration.function.arrow.java - meta.function.anonymous.parameters.java + + Function lambda3 = (@MyAnnotation(foo = Foo.BAR) String foo) -> foo; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.anonymous.parameters.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation +// ^ punctuation.definition.annotation +// ^^^ variable.parameter.java +// ^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^ constant.other.java +// ^^^^^^ storage.type.class.java - meta.annotation +// ^^^ variable.parameter.java +// ^^ keyword.declaration.function.arrow.java - meta.function.anonymous.parameters.java + + Function lambda4 = (String foo) -> foo; +// ^^^^^^^^^^^^ meta.function.anonymous.parameters.java +// ^^^^^^ storage.type.class.java - meta.annotation +// ^^^ variable.parameter.java +// ^^ keyword.declaration.function.arrow.java - meta.function.anonymous.parameters.java + + Function lambda4 = (var foo) -> foo; +// ^^^^^^^^^ meta.function.anonymous.parameters.java +// ^^^ storage.type.variant.java +// ^^^ variable.parameter.java +// ^^ keyword.declaration.function.arrow.java - meta.function.anonymous.parameters.java + + Function lambda5 = (foo) -> foo; +// ^^^^^ meta.function.anonymous.parameters.java +// ^^^ variable.parameter.java +// ^^ keyword.declaration.function.arrow.java - meta.function.anonymous.parameters.java + + Function lambda5 = (foo = 0) -> foo; +// ^^^^^^^^^ meta.function.anonymous.parameters.java +// ^^^ variable.parameter.java +// ^ invalid.illegal.expect-terminator.java +// ^ invalid.illegal.expect-terminator.java +// ^^ keyword.declaration.function.arrow.java - meta.function.anonymous.parameters.java + + Function lambda6 = (foo, foo) -> foo; +// ^^^^^^^^^^ meta.function.anonymous.parameters.java +// ^^^ variable.parameter.java +// ^ punctuation.separator.comma.java +// ^^^ variable.parameter.java +// ^^ keyword.declaration.function.arrow.java - meta.function.anonymous.parameters.java + + Function lambda7 = (Foo, Foo) -> foo; +// ^^^^^^^^^^ meta.function.anonymous.parameters.java +// ^^^ variable.parameter.java +// ^ punctuation.separator.comma.java +// ^^^ variable.parameter.java +// ^^ keyword.declaration.function.arrow.java - meta.function.anonymous.parameters.java + + Function lambda8 = foo -> foo; +// ^^^ meta.function.anonymous.parameters.java +// ^^^ variable.parameter.java +// ^^ keyword.declaration.function.arrow.java - meta.function.anonymous.parameters.java + + Function lambda9 = (String... foo) -> foo[0]; +// ^^^^^^^^^^^^^^^ meta.function.anonymous.parameters.java +// ^^^^^^ storage.type.class.java - meta.annotation +// ^^^ keyword.operator.variadic.java +// ^^^ variable.parameter.java +// ^^ keyword.declaration.function.arrow.java - meta.function.anonymous.parameters.java + + IntFunction intLambda1 = (int foo) -> String.valueOf(foo); +// ^^^^^^^^^ meta.function.anonymous.parameters.java +// ^^^ storage.type.primitive - meta.annotation +// ^^^ variable.parameter.java +// ^^ keyword.declaration.function.arrow.java - meta.function.anonymous.parameters.java + + MyObject objLambda = arg -> new MyObject(arg); +// ^^^ meta.function.anonymous.parameters.java variable.parameter.java +// ^^^^^^^^^^^^^^^^^^^^^ meta.function.anonymous.java +// ^^ keyword.declaration.function.arrow.java +// ^^^ keyword.other.storage.new.java +// ^^^^^^^^ storage.type.class.java +// ^ punctuation.section.group.begin.java +// ^^^^^ meta.group.java +// ^^^ variable.other.java +// ^ punctuation.section.group.end.java +// ^ punctuation.terminator.java + + Function BLOCK_LAMBDA = foo -> { return 1; }; +// ^^^^^^^^^^^^ entity.name.constant.java +// ^ keyword.operator.assignment.java +// ^^^ variable.parameter.java +// ^^ keyword.declaration.function.arrow.java +// ^ meta.block punctuation.section.block.begin +// ^^^^^^ keyword.control.flow.return.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.terminator.java +// ^ punctuation.section.block.end.java +// ^ punctuation.terminator.java + + Supplier supplier = () -> true; +// ^ keyword.operator.assignment.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^^ keyword.declaration.function.arrow.java +// ^^^^ constant.language.boolean.java +// ^ punctuation.terminator.java +} + + +/****************************************************************************** + * Annotation Tests + *****************************************************************************/ + +@ClassName.FixMethodOrder( MethodSorters.NAME_ASCENDING ) +// <- meta.class.java meta.annotation.identifier.java punctuation.definition.annotation.java - meta.annotation meta.annotation +//^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.annotation.identifier.java - meta.annotation meta.annotation +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.annotation.parameters.java meta.group.java - meta.annotation meta.annotation +//^^^^^^^^ variable.annotation.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^^^^^^ variable.annotation.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^^^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^^^^^^ constant.other.java +public class GrafoTest { + @Override +// ^^^^^^^^^ meta.annotation..identifier.java +// ^ punctuation.definition.annotation.java +// ^^^^^^^^ variable.annotation.java + void test1() { +// ^ entity.name.function + } + + @Author(first = "Oompah", last +// ^ meta.annotation.identifier.java +// ^^^^^^ meta.annotation.identifier.java +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation.parameters.java +// ^ punctuation.definition.annotation +// ^^^^^^ variable.annotation.java +// ^ punctuation.section.group.begin +// ^^^^^ variable.parameter.java +// ^ keyword.operator +// ^^^^^^^^ string +// ^ punctuation.separator.comma.java +// ^^^^ variable.parameter.java + = "Loompah") +//^^^^^^^^^^^^^^^^^^ meta.annotation.parameters.java +// ^ keyword.operator.assignment.java +// ^^^^^^^^ string +// ^ punctuation.section.group.end + void test2() { +// ^ entity.name.function + + Grafo grafo = new Grafo( true ); + final Grafo temposMaisCedo = new Grafo( true ); +// ^ storage.modifier +// ^ storage.type.class + } + + + @Partial @Mock(type=Grafo.class) DataLoader inline; +// ^^^^^^^^ meta.annotation +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation +// ^ storage.type.class + + @Override public int inline() { +// ^^^^^^^^^ meta.annotation +// ^ punctuation.definition.annotation +// ^^^^^^^^ variable.annotation + } + + void annotatedArgs(@NonNull final String p1, +// ^^^^^^^^ meta.annotation +// ^ storage.modifier - meta.annotation + @Named(value = "") List p2, @NonNull final String p3) {} +// ^^^^^^^^^^^^^^^^^^ meta.annotation +// ^ storage.type.class +// ^ meta.generic punctuation.section.generic.begin +// ^ variable.parameter +// ^ punctuation.separator +// ^^^^^^^^ meta.annotation +// ^ storage.modifier - meta.annotation +// ^ storage.type.class + +} + +@MultiLineAnnotation( +// <- meta.class.java meta.annotation.identifier.java punctuation.definition.annotation.java +//^^^^^^^^^^^^^^^^^^ meta.class.java meta.annotation.identifier.java variable.annotation.java +// ^ meta.class.java meta.annotation.parameters.java punctuation.section.group.begin.java + foo = BAR, +//^^^ variable.parameter.java +// ^ keyword.operator.assignment.java +// ^ constant.other.java +// ^ punctuation.separator.comma.java + other = "foo" +//^^^^^ variable.parameter.java +// ^ keyword.operator.assignment.java +// ^ string +) +// <- meta.class.java meta.annotation.parameters.java punctuation.section.group.end.java +@fully.qualified.Annotation +// <- meta.class.java meta.annotation.identifier.java punctuation.definition.annotation.java +//^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.annotation.identifier.java meta.path.java +//^^^^ variable.annotation.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^ variable.annotation.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^ variable.annotation.java +@fully.qualified.ParentClass.InnerAnnotation +// <- meta.class.java meta.annotation.identifier.java punctuation.definition.annotation.java +//^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.annotation.identifier.java meta.path.java +//^^^^ variable.annotation.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^ variable.annotation.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^^^ variable.annotation.namespace.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^^^^^^^ variable.annotation.java +@fully.qualified +// <- meta.class.java meta.annotation.identifier.java punctuation.definition.annotation.java +//^^^^^^^^^^^^^^ meta.class.java meta.annotation.identifier.java meta.path.java + .multiline.Annotation +// ^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.annotation.identifier.java meta.path.java + (foo = "bar") +// ^^^^^^^^^^^^^ meta.class.java meta.annotation.parameters.java -meta.annotation.identifier.java +@FancyAnnotation ({ +//^^^^^^^^^^^^^^^^^^ - meta.annotation meta.annotation +// <- meta.class.java meta.annotation.identifier.java punctuation.definition.annotation.java +//^^^^^^^^^^^^^^^ meta.class.java meta.annotation.identifier.java +// ^^ meta.class.java meta.annotation.parameters.java + Foo.class, +//^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^^ variable.language.class.java - storage.type.java +// ^ punctuation.separator.comma.java + Bar.class +//^^^ storage.type.class.java +// ^ punctuation.accessor.dot.java +// ^^^^^ variable.language.class.java - storage.type.java +}) +// <- punctuation.section.braces.end.java + // <- meta.class.java meta.annotation.parameters.java punctuation.section.group.end.java +class Bàr { +// ^^^ entity.name.class.java + Bàr() {} +//^^^^^ meta.function +//^^^ entity.name.function.constructor.java +} + +@AnnotationAsParameterSingle( + @Parameter(name = "foo") +// ^ punctuation.definition.annotation.java +// ^^^^^^^^^ variable.annotation.java +// ^^^^ variable.parameter.java +) + +@AnnotationAsParameterSingleNamed( + value = @Parameter(name = "foo") +//^^^^^ variable.parameter.java +// ^ punctuation.definition.annotation.java +// ^^^^^^^^ variable.annotation.java +// ^^^^ variable.parameter.java +) + +@AnnotationAsParameterMultiple + ({ +// <- meta.annotation.identifier.java - meta.annotation meta.annotation +//^ meta.class.java meta.annotation.identifier.java - meta.annotation meta.annotation +// ^^^ meta.annotation.parameters.java meta.group.java +// ^ punctuation.section.braces.begin.java + @Parameter(name = "foo"), +// ^ punctuation.definition.annotation.java +// ^^^^^^^^^ variable.annotation.java +// ^^^^ variable.parameter.java + + @Parameter(name = "bar") +// ^ punctuation.definition.annotation.java +// ^^^^^^^^^ variable.annotation.java +// ^^^^ variable.parameter.java +}) +// <- punctuation.section.braces.end.java + +@AnnotationAsParameterMultipleNamed( + first = {@Parameter(name = "foo"), @Parameter(name = "bar")}, +//^^^^^ variable.parameter.java +// ^ punctuation.definition.annotation.java +// ^^^^^^^^^ variable.annotation.java +// ^^^^ variable.parameter.java +// ^ punctuation.definition.annotation.java +// ^^^^^^^^^ variable.annotation.java +// ^^^^ variable.parameter.java + second = {@Parameter(name = "foo"), @Parameter(name = "bar")}, +//^^^^^^ variable.parameter.java + third = @Parameter(name = "foo") +//^^^^^ variable.parameter.java +// ^^^^^^^^^ variable.annotation.java +) + +@SomeInterface +// <- meta.class.java meta.annotation.identifier.java punctuation.definition.annotation.java +//^^^^^^^^^^^^ meta.class.java meta.annotation.identifier.java variable.annotation.java +public class Foo { +// <- meta.class.java storage.modifier.java +//^^^^ meta.class.java storage.modifier.java +// ^^^^^ meta.class.java +// ^^^ meta.class.identifier.java entity.name.class.java +// ^ meta.class.java meta.block.java punctuation.section.block.begin.java + + FooBar MY_CONST = new FooBar(); +// ^^^^^^^^ entity.name.constant.java + + @Inject +//^ meta.annotation.identifier.java punctuation.definition.annotation.java +// ^^^^^^ meta.annotation.identifier.java variable.annotation.java + public Foo( +//^ - meta.annotation +// ^ meta.function +// ^ entity.name.function.constructor + // Comment for annotation + @MyAnnotation FooType annotatedParam, +// ^ meta.annotation.identifier.java punctuation.definition.annotation.java +// ^^^^^^^^^^^^ meta.annotation.identifier.java variable.annotation.java +// ^ - meta.annotation.identifier.java - variable +// ^ - meta.annotation.identifier.java +// ^^^^^^^ storage.type.class.java +// ^^^^^^^^^^^^^^ variable.parameter.java + String unannotatedParam) { +// ^ storage.type.class.java +// ^ variable.parameter.java + return; +// ^^^^^^ keyword.control.flow.return.java + } + + public static void main(String[] args, String moreArgs, a.b.c.Foo bar) {} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.java +// ^^^^^^ storage.type.class.java +// ^^ storage.modifier.array.java +// ^^^^ variable.parameter.java +// ^ punctuation.separator.comma.java +// ^^^^^^ meta.generic.java +// ^^^^^^ storage.type.class.java +// ^^^^ storage.type.class.java +// ^^^^^^^^ variable.parameter.java +// ^ variable.namespace.java +// ^ punctuation.accessor.dot.java +// ^ punctuation.accessor.dot.java +// ^^^ storage.type.class.java +// ^^^ variable.parameter.java + + MyClass myClass = new MyClass( + SomeEnum.ENUM_VALUE, + new OtherNewClass(), + new OtherNestedClass( + SomeEnum.ENUM_VALUE, + new SuperNestedClass(param, 2)), + anotherParam); + + Object foo = new TypeLiteral< + StandardReferenceNumberProcessor< + SimpleGenerateReferenceNumberOperation, + SimpleSyncReferenceNumberOperation>>() {}; + + Object bar = SomeStaticClass.newBuilder().doThings(1) +// ^^^^^^^^^^ meta.function-call.identifier.java +// ^^ meta.function-call.arguments.java meta.group.java +// ^^^^^^^^ meta.function-call.identifier.java +// ^^^ meta.function-call.arguments.java meta.group.java +// ^^^^^^^^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ punctuation.section.group.end.java +// ^ punctuation.accessor.dot.java +// ^^^^^^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.group.end.java + .withString("I am a string"); +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^^ meta.function-call.identifier.java +// ^^^^^^^^^^^^^^^^^ meta.function-call.arguments.java meta.group.java +// ^^^^^^^^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^^^^^^^ string.quoted.double.java +// ^ punctuation.section.group.end.java + + Object bah = someStaticMethodCall(4) +// ^^^^^^^^^^^^^^^^^^^^ meta.function-call.identifier.java +// ^^^ meta.function-call.arguments.java meta.group.java +// ^^^^^^^^^^^^^^^^^^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.section.group.end.java + .withString("I am a string"); +// ^ punctuation.accessor.dot.java +// ^^^^^^^^^^ meta.function-call.identifier.java +// ^^^^^^^^^^^^^^^^^ meta.function-call.arguments.java meta.group.java +// ^^^^^^^^^^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^^^^^^^^^^^^^^^ string.quoted.double.java +// ^ punctuation.section.group.end.java + + +/****************************************************************************** + * Operators Tests + *****************************************************************************/ + + int operatorsTests() { + + == != <= >= <> < > +// ^^ keyword.operator.comparison.java +// ^^ keyword.operator.comparison.java +// ^^ keyword.operator.comparison.java +// ^^ keyword.operator.comparison.java +// ^^ keyword.operator.comparison.java +// ^ keyword.operator.comparison.java +// ^ keyword.operator.comparison.java + + ! && || +// ^ keyword.operator.logical.java +// ^^ keyword.operator.logical.java +// ^^ keyword.operator.logical.java + + << >> >>> ~ & | ^ +// ^^ keyword.operator.bitwise.java +// ^^ keyword.operator.bitwise.java +// ^^^ keyword.operator.bitwise.java +// ^ keyword.operator.bitwise.java +// ^ keyword.operator.bitwise.java +// ^ keyword.operator.bitwise.java +// ^ keyword.operator.bitwise.java + + ++ -- + - * / % +// ^^ keyword.operator.arithmetic.java +// ^^ keyword.operator.arithmetic.java +// ^ keyword.operator.arithmetic.java +// ^ keyword.operator.arithmetic.java +// ^ keyword.operator.arithmetic.java +// ^ keyword.operator.arithmetic.java +// ^ keyword.operator.arithmetic.java + + x = (e & 1) << c^2 >> 10; +// ^ keyword.operator.assignment.java +// ^ keyword.operator.bitwise.java +// ^^ keyword.operator.bitwise.java +// ^ keyword.operator.bitwise.java +// ^^ keyword.operator.bitwise.java + + y = ~e >>> (c | 2); +// ^ keyword.operator.assignment.java +// ^ keyword.operator.bitwise.java +// ^^^ keyword.operator.bitwise.java +// ^ keyword.operator.bitwise.java + + z += x; z -= x; z *= x; z /= x; z %= x; +// ^^ keyword.operator.assignment.augmented.java +// ^^ keyword.operator.assignment.augmented.java +// ^^ keyword.operator.assignment.augmented.java +// ^^ keyword.operator.assignment.augmented.java +// ^^ keyword.operator.assignment.augmented.java + + z &= x; z ^= x; z |= x; z <<= x; z >>= x; z >>>= x; +// ^^ keyword.operator.assignment.augmented.java +// ^^ keyword.operator.assignment.augmented.java +// ^^ keyword.operator.assignment.augmented.java +// ^^^ keyword.operator.assignment.augmented.java +// ^^^ keyword.operator.assignment.augmented.java +// ^^^^ keyword.operator.assignment.augmented.java + + b=e.a(b b?b:b; +// ^ meta.function-call.identifier.java +// ^^^^^ meta.function-call.arguments.java meta.group.java +// ^ variable.other.java +// ^ keyword.operator.assignment.java +// ^ variable.other.java +// ^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ variable.other.java +// ^ keyword.operator.comparison.java +// ^ variable.other.java +// ^ punctuation.section.group.end.java +// ^ keyword.operator.comparison.java +// ^ variable.other.java +// ^ keyword.operator.ternary.java +// ^ variable.other.java +// ^ keyword.operator.ternary.java +// ^ variable.other.java + + b=e.a(bb?b:b; +// ^ meta.function-call.identifier.java +// ^^^^^ meta.function-call.arguments.java meta.group.java +// ^ variable.other.java +// ^ keyword.operator.assignment.java +// ^ variable.other.java +// ^ variable.function.java +// ^ punctuation.section.group.begin.java +// ^ variable.other.java +// ^ keyword.operator.comparison.java +// ^ variable.other.java +// ^ punctuation.section.group.end.java +// ^ keyword.operator.comparison.java +// ^ variable.other.java +// ^ keyword.operator.ternary.java +// ^ variable.other.java +// ^ keyword.operator.ternary.java +// ^ variable.other.java + + a[0] = true; +// ^^^^ - meta.variable meta.variable +// ^ meta.variable.identifier.java +// ^^^ meta.variable.item-access.java meta.brackets.java +// ^ variable.other.java +// ^ punctuation.section.brackets.begin.java +// ^ constant.numeric.value.java +// ^ punctuation.section.brackets.end.java +// ^ keyword.operator.assignment.java +// ^^^^ constant.language.boolean.java +// ^ punctuation.terminator.java + + a[0][0] = true; +// ^^^^^^^ - meta.variable meta.variable +// ^ meta.variable.identifier.java +// ^^^^^^ meta.variable.item-access.java meta.brackets.java +// ^ variable.other.java +// ^ punctuation.section.brackets.begin.java +// ^ constant.numeric.value.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.section.brackets.begin.java +// ^ constant.numeric.value.java +// ^ punctuation.section.brackets.end.java +// ^ keyword.operator.assignment.java +// ^^^^ constant.language.boolean.java +// ^ punctuation.terminator.java + + a [ 0 ] [ 0 ] = true; +// ^^^^^^^^^^^^^ - meta.variable meta.variable +// ^^ meta.variable.identifier.java +// ^^^^^ meta.variable.item-access.java meta.brackets.java +// ^ meta.variable.item-access.java - meta.brackets +// ^^^^^ meta.variable.item-access.java meta.brackets.java +// ^^^^^^^^^ - meta.variable +// ^ variable.other.java +// ^ punctuation.section.brackets.begin.java +// ^ constant.numeric.value.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.section.brackets.begin.java +// ^ constant.numeric.value.java +// ^ punctuation.section.brackets.end.java +// ^ keyword.operator.assignment.java +// ^^^^ constant.language.boolean.java +// ^ punctuation.terminator.java + + a /**/ [ /**/ 0 /**/ ] /**/ [ /**/ 0 /**/ ] /**/ = /**/ true; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.variable meta.variable +// ^^^^^^^ meta.variable.identifier.java +// ^^^^^^^^^^^^^^^ meta.variable.item-access.java meta.brackets.java +// ^^^^^^ meta.variable.item-access.java - meta.brackets +// ^^^^^^^^^^^^^^^ meta.variable.item-access.java meta.brackets.java +// ^^^^^ meta.variable.item-access.java - meta.brackets +// ^^^^^^^^^^^^^ - meta.variable +// ^ variable.other.java +// ^ punctuation.section.brackets.begin.java +// ^ constant.numeric.value.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.section.brackets.begin.java +// ^ constant.numeric.value.java +// ^ punctuation.section.brackets.end.java +// ^ keyword.operator.assignment.java +// ^^^^ constant.language.boolean.java +// ^ punctuation.terminator.java + + a +// ^^ meta.variable.identifier.java +// ^ variable.other.java + [ +//^^ meta.variable.identifier.java +// ^^ meta.variable.item-access.java meta.brackets.java +// ^ punctuation.section.brackets.begin.java + 0 +// ^^^ meta.variable.item-access.java meta.brackets.java +// ^ constant.numeric.value.java + ] +// ^^ meta.variable.item-access.java meta.brackets.java +// ^ punctuation.section.brackets.end.java + = +// ^ keyword.operator.assignment.java + true; +// ^^^^ constant.language.boolean.java +// ^ punctuation.terminator.java + + a.c = true; +// ^ - meta.variable +// ^ meta.variable.identifier.java +// ^ - meta.variable +// ^ meta.variable.identifier.java +// ^ - meta.variable +// ^ variable.other.java +// ^ punctuation.accessor.dot.java +// ^ variable.other.java +// ^ keyword.operator.assignment.java +// ^^^^ constant.language.boolean.java +// ^ punctuation.terminator.java + + a[0].c[1] = true; +// ^ - meta.variable +// ^ meta.variable.identifier.java +// ^^^ meta.variable.item-access.java meta.brackets.java +// ^ - meta.variable +// ^ meta.variable.identifier.java +// ^^^ meta.variable.item-access.java meta.brackets.java +// ^ - meta.variable +// ^ variable.other.java +// ^ punctuation.section.brackets.begin.java +// ^ constant.numeric.value.java +// ^ punctuation.section.brackets.end.java +// ^ punctuation.accessor.dot.java +// ^ variable.other.java +// ^ punctuation.section.brackets.begin.java +// ^ constant.numeric.value.java +// ^ punctuation.section.brackets.end.java +// ^ keyword.operator.assignment.java +// ^^^^ constant.language.boolean.java +// ^ punctuation.terminator.java + + int foo = true ? 1 : 2; +// ^^^^ constant.language.boolean.java +// ^ keyword.operator.ternary.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ keyword.operator.ternary.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.terminator.java + + if (a == false) {} +// ^^ keyword.operator.comparison.java + + if (this.scale<0) { +// ^^ keyword.control.conditional.if.java +// ^^^^^^^^^^^^^^ meta.group.java +// ^ punctuation.section.group.begin +// ^ punctuation.accessor.dot.java +// ^ keyword.operator.comparison.java +// ^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ - meta.group.java + return foo<<32; +// ^^^^^^ keyword.control.flow.return.java +// ^^ keyword.operator.bitwise.java +// ^^ meta.number.integer.decimal.java constant.numeric.value.java +// ^ punctuation.terminator.java + } +// ^ meta.block.java punctuation.section.block.end.java + + return foo + + + +// ^^^^^^^^^^^^^^^ meta.tag + + +// ^^^^^^^^ meta.tag.style.end.html + + +// ^^^^^^^^^ meta.tag.script.end.html + + + + <%-- This is a comment --%> +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.jsp + + + + + <%@ include file="foo.bar" %> +// ^ - meta +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.embedded.directive.jsp +// ^ - meta +// ^^^ punctuation.section.embedded.begin.jsp +// ^^^^^^^ keyword.control.directive.jsp +// ^^^^ entity.other.attribute-name.jsp +// ^ punctuation.separator.key-value.jsp +// ^^^^^^^^^ string.quoted.double.jsp +// ^^ punctuation.section.embedded.end.jsp + + + + + <%! int i = 0; %> +// ^ - meta +// ^^^ meta.embedded.declaration.jsp - source.java.embedded.jsp +// ^^^^^^^^^^^^ meta.embedded.declaration.jsp source.java.embedded.jsp - source.java source.java +// ^^ meta.embedded.declaration.jsp - source.java.embedded.jsp +// ^ - meta +// ^^^ punctuation.section.embedded.begin.jsp +// ^^^ storage.type.primitive.java +// ^^ punctuation.section.embedded.end.jsp + + + + + The map file has <%= map.size() %> entries. +// ^^^^^^^^^^^^^^^^^ - meta +// ^^^^^^ meta.tag.inline.any.html - meta.attribute-with-value.html +// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.inline.any.html meta.attribute-with-value.html +// ^ meta.string.html - meta.interpolation +// ^^^^^^^^^^^^^^^^^ meta.string.html meta.interpolation.jsp +// ^ meta.string.html - meta.interpolation +// ^^^ meta.embedded.expression.jsp punctuation.section.embedded.begin.jsp - source.java +// ^^^^^^^^^^^^ meta.embedded.expression.jsp source.java.embedded.jsp - source.java source.java +// ^^ meta.embedded.expression.jsp punctuation.section.embedded.end.jsp - source.java +// ^ meta.tag.inline.any.html - meta.attribute-with-value.html +// ^^^ meta.embedded.expression.jsp punctuation.section.embedded.begin.jsp - source.java +// ^^^^^^^^^^^^ meta.embedded.expression.jsp source.java.embedded.jsp +// ^^ meta.embedded.expression.jsp punctuation.section.embedded.end.jsp - source.java +// ^^^^^^^ meta.tag.inline.any.html +// ^^^^^^^^^ - meta + + + + + <% +// ^^ punctuation.section.embedded.begin.jsp - source.java.embedded.jsp +// ^ source.java.embedded.jsp - source.java source.java + if (!foo && !bar) { +// ^^ keyword.control.conditional.if.java +// ^ keyword.operator.logical.java +// ^^ keyword.operator.logical.java + %>
    <% +// ^^ punctuation.section.embedded.end.jsp - source.java.embedded.jsp +// ^^^^^ meta.tag.block.any.html - meta.attribute-with-value +// ^^^^^^^ meta.tag.block.any.html meta.attribute-with-value.style.html - source.css +// ^^^^^^^ meta.tag.block.any.html meta.attribute-with-value.style.html source.css - meta.expression +// ^^^^^^^^^ meta.tag.block.any.html meta.attribute-with-value.style.html source.css meta.embedded.expression.jsp +// ^ meta.tag.block.any.html meta.attribute-with-value.style.html - source.css +// ^^^^^^^ meta.tag.block.any.html - meta.attribute-with-value.style.html - source.css +// ^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.block.any.html +// ^^^^^ entity.other.attribute-name.style.html +// ^ punctuation.separator.key-value.html +// ^ string.quoted.double punctuation.definition.string.begin.html +// ^^^^^ meta.property-name.css support.type.property-name.css +// ^ punctuation.separator.key-value.css +// ^^^ punctuation.section.embedded.begin.jsp - source.java.embedded +// ^^^^ source.java.embedded.jsp +// ^^ punctuation.section.embedded.end.jsp - source.java.embedded +// ^ string.quoted.double punctuation.definition.string.end.html +// ^ punctuation.definition.tag.end.html +// ^^ punctuation.section.embedded.begin.jsp - source.java.embedded.jsp + if (foot.shouldBe()) { +// ^^ keyword.control.conditional.if.java + boolean test = false; +// ^^^^^^^ storage.type +// ^^^^^ constant + %> +// ^^ punctuation.section.embedded.end.jsp - source.java.embedded.jsp +// ^ text.html.jsp - source.java.embedded.jsp + + <%-- This is a comment --%> +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.jsp + <% int aNumber = 0; // this scriptlet should close %> +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash.java +// ^^ punctuation.section.embedded.end.jsp + +
    +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag + <% +// ^^ punctuation.section.embedded.begin.jsp - source.java.embedded.jsp + } +// ^ - invalid.illegal.stray-brace-end + } +// ^ - invalid.illegal.stray-brace-end + %> +// ^^ punctuation.section.embedded.end.jsp - source.java.embedded.jsp +// ^ text.html.jsp - source.java.embedded.jsp + + + + + + +// ^^^^^^^^^^^^^^^^ meta.tag.jsp.directive.end.html - meta.tag.jsp meta.tag.jsp +// ^^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html + + +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.jsp.directive.begin.html - meta.tag.jsp meta.tag.jsp +// ^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ entity.name.tag.html punctuation.separator.namespace.html +// ^^^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.accessor.dot.jsp +// ^^^^^^^ keyword.control.directive.jsp +// ^^^^ meta.attribute-with-value.href.html entity.other.attribute-name.href.html +// ^ meta.attribute-with-value.href.html punctuation.separator.key-value.html +// ^^^^^^^^^ meta.attribute-with-value.href.html string.quoted.double.html +// ^^ punctuation.definition.tag.end.html + + +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag.jsp meta.tag.jsp +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.jsp.directive.begin.html +// ^^^^^^^^^^^^^^^^ meta.tag.jsp.directive.end.html +// ^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ entity.name.tag.html punctuation.separator.namespace.html +// ^^^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.accessor.dot.jsp +// ^^^^^^^ keyword.control.directive.jsp +// ^^^^ meta.attribute-with-value.href.html entity.other.attribute-name.href.html +// ^ meta.attribute-with-value.href.html punctuation.separator.key-value.html +// ^^^^^^^^^ meta.attribute-with-value.href.html string.quoted.double.html +// ^ punctuation.definition.tag.end.html +// ^^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ entity.name.tag.html punctuation.separator.namespace.html +// ^^^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html + + + + + + +// ^^^^^^^^^^^^^^^^^^ meta.tag.jsp.declaration.end.html - meta.tag.jsp meta.tag.jsp +// ^^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html + + + int i = 0; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag.jsp meta.tag.jsp +// ^^^^^^^^^^^^^^^^^^ meta.tag.jsp.declaration.begin.html +// ^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ entity.name.tag.html punctuation.separator.namespace.html +// ^^^^^^^^^^^ entity.name.tag.localname.html +// ^^ punctuation.definition.tag.end.html +// ^^^^^^^^^^ - source.java.embedded +// ^^^^^^^^^^^^^^^^^^ meta.tag.jsp.declaration.end.html +// ^^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ entity.name.tag.html punctuation.separator.namespace.html +// ^^^^^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html + + int i = 0; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag.jsp meta.tag.jsp +// ^^^^^^^^^^^^^^^^^ meta.tag.jsp.declaration.begin.html +// ^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ entity.name.tag.html punctuation.separator.namespace.html +// ^^^^^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html +// ^^^^^^^^^^ source.java.embedded.jsp - source.java source.java +// ^^^ storage.type.primitive.java +// ^^^^^^^^^^^^^^^^^^ meta.tag.jsp.declaration.end.html +// ^^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ entity.name.tag.html punctuation.separator.namespace.html +// ^^^^^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html + + + + + variable +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag.jsp meta.tag.jsp +// ^^^^^^^^^^^^^^^^ meta.tag.jsp.expression.begin.html +// ^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ entity.name.tag.html punctuation.separator.namespace.html +// ^^^^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html +// ^^^^^^^^ source.java.embedded.jsp variable.other.java - source.java source.java +// ^^^^^^^^^^^^^^^^^ meta.tag.jsp.expression.end.html +// ^^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ entity.name.tag.html punctuation.separator.namespace.html +// ^^^^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html + + Good guess, but nope. Trynumguess.getHint(). +// ^^^^^^^^^^^^^^^^^^^^^^^^^ - meta +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag.jsp meta.tag.jsp +// ^^^ meta.tag.inline.any.html +// ^^^^^^^^^^^^^^^^ meta.tag.jsp.expression.begin.html +// ^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ entity.name.tag.html punctuation.separator.namespace.html +// ^^^^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html +// ^^^^^^^^^^^^^^^^^^ source.java.embedded.jsp - source.java source.java +// ^^^^^^^^^^^^^^^^^ meta.tag.jsp.expression.end.html +// ^^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ entity.name.tag.html punctuation.separator.namespace.html +// ^^^^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html +// ^^^^ meta.tag.inline.any.html + + Good guess, but nope. Trynumguess.getHint(). +// ^^^^^^^^^^^^^^^^^^^^^^^^^ - meta +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag.jsp meta.tag.jsp +// ^^^ meta.tag.inline.any.html +// ^^^^^^^^^^^^^^^^ meta.tag.jsp.expression.begin.html +// ^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ entity.name.tag.html punctuation.separator.namespace.html +// ^^^^^^^^^^ entity.name.tag.localname.html +// ^^ punctuation.definition.tag.end.html +// ^^^^^^^^^^^^^^^^^^ - source.java.embedded +// ^^^^^^^^^^^^^^^^^ meta.tag.jsp.expression.end.html +// ^^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ entity.name.tag.html punctuation.separator.namespace.html +// ^^^^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html +// ^^^^ meta.tag.inline.any.html + + + + + + +// ^^^^^^^^^^^^^^^^ meta.tag.jsp.scriptlet.end.html +// ^^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html + + + int i; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag.jsp meta.tag.jsp +// ^^^^^^^^^^^^^^^^ meta.tag.jsp.scriptlet.begin.html +// ^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^^^^^^ entity.name.tag.localname.html +// ^^ punctuation.definition.tag.end.html +// ^^^^^^ - source +// ^^^^^^^^^^^^^^^^ meta.tag.jsp.scriptlet.end.html +// ^^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html + + + int i = (1 >< 5); +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag.jsp meta.tag.jsp +// ^^^^^^^^^^^^^^^ meta.tag.jsp.scriptlet.begin.html +// ^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html +// ^^^^^^^^^^^^^^^^^^^^ source.java.embedded.jsp +// ^^^^ constant.character.entity.named.html +// ^^^^^^^^^^^^^^^^ meta.tag.jsp.scriptlet.end.html +// ^^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html + + + +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag.jsp meta.tag.jsp +// ^^^^^^^^^^^^^^^ meta.tag.jsp.scriptlet.begin.html +// ^^^^^^^^^ meta.tag.sgml.cdata.html +// ^^^ meta.tag.sgml.cdata.html +// ^^^^^^^^^^^^^^^^ meta.tag.jsp.scriptlet.end.html +// ^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html +// ^^^ punctuation.definition.tag.begin.html +// ^^^^^ keyword.declaration.cdata.html +// ^ punctuation.definition.tag.begin.html +// ^^^^^^^^^^^^^^^^^^^^ source.java.embedded.jsp +// ^^^^ constant.character.entity.named.html +// ^^^ punctuation.definition.tag.end.html +// ^^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html + + + +//^^^ meta.tag.jsp.scriptlet.begin.html +// ^ punctuation.definition.tag.end.html +// ^ source.java.embedded.jsp - meta.tag + out.println("Starting"); +// ^^^^^^^^^^^^^^^^^^^^^^^^ source.java.embedded.jsp + // Note we need to declare CDATA because we don't escape the less than symbol + +// ^^^ source.java.embedded.jsp meta.tag.sgml.cdata.html punctuation.definition.tag.end.html + out.println("Done!"); +// ^^^^^^^^^^^^^^^^^^^^^ source.java.embedded.jsp + +//^^^ meta.tag.jsp.scriptlet.end.html +// ^ - meta.tag +// ^ punctuation.definition.tag.end.html + + + + + +// ^ meta.tag.jsp.other.begin.html punctuation.definition.tag.end.html + + +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.jsp.other.begin.html - meta.tag.jsp meta.tag.jsp +// ^ meta.attribute-with-value.href.html meta.string.html - meta.path +// ^^^^^^^^^^^^^^ meta.attribute-with-value.href.html meta.path.url.html meta.string.html +// ^ meta.attribute-with-value.href.html meta.string.html - meta.path +// ^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^^^^ entity.name.tag.localname.html +// ^^^^ meta.attribute-with-value.href.html entity.other.attribute-name.href.html +// ^ meta.attribute-with-value.href.html punctuation.separator.key-value.html +// ^^^^^^^^^^^^^^^^ string.quoted.double.html +// ^ punctuation.definition.string.begin.html +// ^ punctuation.separator.path.html +// ^ punctuation.separator.path.html +// ^ punctuation.definition.string.end.html +// ^^ punctuation.definition.tag.end.html + + +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.jsp.other.begin.html - meta.tag.jsp meta.tag.jsp +// ^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html + + +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.jsp.other.begin.html - meta.tag.jsp meta.tag.jsp +// ^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^^ entity.name.tag.localname.html +// ^^ punctuation.definition.tag.end.html + + +// ^^^^^^^^^^^^^^ meta.tag.jsp.other.end.html - meta.tag.jsp meta.tag.jsp +// ^^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html + + +// ^^^^^^^^^^^ meta.tag.jsp.other.end.html - meta.tag.jsp meta.tag.jsp +// ^^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html + + + + Plain text +// ^^^^^^^^^^ text.html.jsp - meta + + Plaintext +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag.jsp meta.tag.jsp +// ^^^^^^^^^^^ meta.tag.jsp.other.begin.html +// ^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^ entity.name.tag.localname.html +// ^^ punctuation.definition.tag.end.html +// ^^^ meta.tag.inline.any.html +// ^^^^ meta.tag.inline.any.html +// ^^^^^^^^^^^ meta.tag.jsp.other.end.html +// ^^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html + + Plaintext +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag.jsp meta.tag.jsp +// ^^^^^^^^^^ meta.tag.jsp.other.begin.html +// ^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html +// ^^^ meta.tag.inline.any.html +// ^^^^ meta.tag.inline.any.html +// ^^^^^^^^^^^ meta.tag.jsp.other.end.html +// ^^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html + + Plain<b>text
    +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag.jsp meta.tag.jsp +// ^^^^^^^^^^ meta.tag.jsp.other.begin.html +// ^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html +// ^^^^ constant.character.entity.named.html +// ^^^^ constant.character.entity.named.html +// ^^^^ meta.tag.inline.any.html +// ^^^^^^^^^^^^ meta.tag.jsp.other.end.html +// ^^ punctuation.definition.tag.begin.html +// ^^^ entity.name.tag.namespace.html +// ^ punctuation.separator.namespace.html +// ^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html +// ^^^ meta.tag.inline.any.html + + +// ^ meta.tag.other.begin.html meta.attribute-with-value.html meta.string.html - meta.interpolation +// ^^^^^^^^^^^^ meta.tag.other.begin.html meta.attribute-with-value.html meta.string.html meta.interpolation.jsp +// ^ meta.tag.other.begin.html meta.attribute-with-value.html meta.string.html - meta.interpolation +// ^ meta.tag.other.begin.html - meta.string - meta.interpolation +// ^ string.quoted.double.html punctuation.definition.string.begin.html +// ^^ punctuation.section.interpolation.begin.jsp +// ^^^^^^^^^ source.java.embedded.jsp meta.variable.identifier.java variable.other.java +// ^ punctuation.section.interpolation.end.jsp +// ^ string.quoted.double.html punctuation.definition.string.end.html + + +// ^^^^^^^^^^^^ meta.tag.other.end.html +// ^^ punctuation.definition.tag.begin.html +// ^ entity.name.tag.namespace.html +// ^ entity.name.tag.html punctuation.separator.namespace.html +// ^^^^^^^ entity.name.tag.localname.html +// ^ punctuation.definition.tag.end.html + + + diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex index 3870a3f1dc..77910bc6c7 100644 --- a/LaTeX/syntax_test_latex.tex +++ b/LaTeX/syntax_test_latex.tex @@ -415,7 +415,7 @@ \subsubsection{name} % <- meta.environment.verbatim.lstlisting.latex % <- meta.environment.embedded.java.latex % <- source.java.embedded -% ^ storage.type.java +% ^ keyword.declaration.class.java } \end{lstlisting}
  • Description that starts with tag -// ^^^ text.html.javadoc meta.tag - */ - - /** One-liner with tags */ -// ^^^ text.html.javadoc meta.tag -// ^^^ text.html.javadoc meta.tag - - /** @param onFirstLine @param -// ^^^^^^ keyword.other.documentation.param.javadoc -// ^^^^^^ -keyword.other.documentation.param.javadoc - * @param normal @param -// ^^^^^^ -keyword.other.documentation.param.javadoc -// ^^^^^^ keyword.other.documentation.param.javadoc - * - @param withoutAsterisk @param -// ^^^^^^ -keyword.other.documentation.param.javadoc -// ^^^^^^ keyword.other.documentation.param.javadoc - */ - - /** - * Parameters - * - * @param paramName Some description -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-tag.javadoc -// ^^^^^^^^^ variable.parameter.javadoc - * that spans several lines. -// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-tag.javadoc -// ^^^ meta.tag -// ^^^^ meta.tag -// ^ punctuation.definition.comment.javadoc - * - * @param - * paramName1 -// ^^^^^^^^^^ variable.parameter.javadoc - * Parameter description -// ^^^^^^^^^^^^^^^^^^^^^ meta.block-tag.javadoc - * - * @param - * paramName2 -// ^^^^^^^^^^ variable.parameter.javadoc - * - * @param - * @param - * paramName3 -// ^^^^^^^^^^ variable.parameter.javadoc - */ -// ^^ punctuation.definition.comment.end.javadoc - - /** Not a @param tag */ -// ^^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation.javadoc -// ^^^^^^ -keyword.other.documentation.param.javadoc - - /** - * Code blocks - * - * {@code} {@literal} -// ^^^^^ keyword.other.documentation.code-or-literal.javadoc -// ^ punctuation.definition.keyword.javadoc -// ^^^^^^^^ keyword.other.documentation.code-or-literal.javadoc -// ^ punctuation.definition.keyword.javadoc - - * {@code List lst = new ArrayList<>()} -// ^ punctuation.section.inline-tag.begin.javadoc -// ^^^^^ keyword.other.documentation.code-or-literal.javadoc -// ^ -markup.raw.javadoc -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.raw.javadoc -meta.tag -// ^ punctuation.section.inline-tag.end.javadoc - - * Multiline, line break in content: {@code x + y -// ^^^^^ markup.raw.javadoc -// ^ -markup.raw.javadoc - * = z} -//^^^ -markup.raw.javadoc -// ^^^ markup.raw.javadoc - - * Multiline, line break before content: {@literal -// ^ -markup.raw.javadoc - * x + y = z} -//^^^ -markup.raw.javadoc -// ^^^^^^^^^ markup.raw.javadoc - - * Bracket balancing: {@code int[][] a = {{1, 2, 3}, {4, 5}}} -// ^ punctuation.section.inline-tag.begin.javadoc -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.raw.javadoc -// ^ punctuation.section.inline-tag.end.javadoc - - * Bracket balancing with line break: {@code int[][] a = { -// ^ punctuation.section.inline-tag.begin.javadoc -// ^^^^^^^^^^^^^ markup.raw.javadoc -// ^ -markup.raw.javadoc - * {1, 2, 3}, {4, 5}}} -//^^^ -markup.raw.javadoc -// ^^^^^^^^^^^^^^^^^^ markup.raw.javadoc -// ^ punctuation.section.inline-tag.end.javadoc - */ - - /** - * Inline tags with references - - * {@link} {@linkplain} -// ^^^^^ keyword.other.documentation.link.javadoc -// ^^^^^^^^^^ keyword.other.documentation.link.javadoc - - * {@link Class} {@linkplain org.package.Class} {@link org.package.Class.NestedClass} -// ^^^^^ keyword.other.documentation.link.javadoc -// ^^^^^ markup.underline.link.javadoc -// ^^^^^^^^^ keyword.other.documentation.link.javadoc -// ^^^^^^^^^^^^^^^^^ markup.underline.link.javadoc -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.javadoc - - * Method separator: - * {@link package.Class#method} {@linkplain #method} -// ^^^^^^^^^^^^^^^^^^^^ markup.underline.link.javadoc -// ^^^^^^^ markup.underline.link.javadoc - - * Brackets: - * {@link Class#method(Type, Type)} {@link #method(Type, Type) label} -// ^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.javadoc -// ^^^^^^^^^^^^^^^^^^^ markup.underline.link.javadoc -// ^^^^^ meta.label.javadoc -markup.underline.link.javadoc - - * Line breaks: - * {@link Class#method(Type, - * Type, Type) label} -// ^^^^^^^^^^^ markup.underline.link.javadoc -// ^^^^^ meta.label.javadoc -//^^^ -markup.underline.link.javadoc - * {@link - * Class#method(Type, Type, Type) label} -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.javadoc -// ^^^^^ meta.label.javadoc - * {@link Class#method(Type, Type, Type) - * label} -// ^^^^^ meta.label.javadoc - * - * Tags in label: - * {@link Class#method(Type, Type, Type) label} -// ^^^^^^^^^^^^ meta.label.javadoc -// ^^^ meta.tag -// ^^^^ meta.tag - * - * {@value} {@value #SOME_CONSTANT} {@value package.Class#SOME_CONSTANT} -// ^^^^^^ keyword.other.documentation.value.javadoc -// ^^^^^^^^^^^ markup.underline.link.javadoc -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.javadoc - */ - - /** - * Block tags with reference - * - * @see Class#method(Type, Type) -// ^^^^ keyword.other.documentation.see.javadoc -// ^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.javadoc - * - * @see java.util.stream -// ^^^^ keyword.other.documentation.see.javadoc -// ^^^^^^^^^^^^^^^^^^^^^^^ -markup.underline.link.javadoc -// ^^^ meta.tag -// ^^^ meta.tag - * - * @see 'java.util.stream' -// ^^^^ keyword.other.documentation.see.javadoc -// ^^^^^^^^^^^^^^^^^^ -markup.underline.link.javadoc - * - * @throws IOException -// ^^^^^^^ keyword.other.documentation.throws.javadoc -// ^^^^^^^^^^^ markup.underline.link.javadoc - - * @throws IOException because IOException -// ^^^^^^^ keyword.other.documentation.throws.javadoc -// ^^^^^^^^^^^ markup.underline.link.javadoc -// ^^^^^^^^^^^^^^^^^^^ - markup.underline.link.javadoc - */ - - /** - * Leading asterisk with space -// ^ punctuation.definition.comment.javadoc - *Without space -// ^ punctuation.definition.comment.javadoc - *