| Document Status | Initial Draft | Top-level document | JavaFXPlugin |
|---|
The JavaFX Plugin provides a set of the highlighting layers that are specified by this document.
From Wikipedia, the free encyclopedia:
The Syntax Highlighting for the JavaFX language is based on the JavaFX language grammar. Current JavaFX version defines (specifies) own grammar via ANTLR. The ANTLR grammar source is located here: https://openjfx-compiler.dev.java.net/source/browse/openjfx-compiler/trunk/src/share/classes/com/sun/tools/javafx/antlr/v3.g
A main goal of the Syntax Highlighting is to highlight a role of each token in the JavaFX program. For this purpose, all JavaFX tokens are divided into the lexical categories or simply categories.
The functional classification is used as the main approach for classification of the JavaFX tokens.
| Primary Category | Comments |
|---|---|
| comment | |
| error | |
| format | especially for the FORMAT_STRING_LITERAL token |
| i18n-artifact | especially for the TRANSLATION_KEY token |
| identifier | |
| keyword | all keywords, excepting the keywords which belong to the following categories: keyword-directive, keyword-literal |
| keyword-directive | keywords that can change control flow in the program |
| keyword-literal | keywords that have the same function as a literal (e.g. true, null) |
| literal | |
| number | |
| operator | |
| separator | |
| string | |
| time | |
| whitespace |
| Keyword | Directive | Comments |
|---|---|---|
| keyword tokens that can start a statement/definition | ||
| abstract | ||
| assert | X | |
| attribute | ||
| bind | ||
| bound | added rev 2184 | |
| lazy | deleted rev 2184 | |
| break | X | |
| class | ||
| continue | X | |
| delete | ||
| for | X | |
| function | ||
| if | X | |
| import | ||
| init | ||
| insert | ||
| let | ||
| new | ||
| not | ||
| override | ||
| package | ||
| postinit | ||
| private | ||
| protected | ||
| public | ||
| readonly | ||
| return | X | |
| super | ||
| sizeof | ||
| static | ||
| this | ||
| throw | X | |
| try | X | |
| var | ||
| while | ||
| keyword tokens that cannot start a statement/definition | ||
| after | ||
| and | ||
| as | ||
| before | ||
| catch | X | |
| else | X | |
| exclusive | ||
| extends | ||
| finally | ||
| first | ||
| from | ||
| in | ||
| indexof | ||
| instanceof | ||
| into | ||
| inverse | ||
| last | ||
| lazy | ||
| on | ||
| or | ||
| replace | ||
| reverse | ||
| step | ||
| then | Should we treat it as a separator? It seems this keyword is redundant, because according to the grammar the parentheses around a conditional expression after the if keyword are required in all cases and they are used as separator. | |
| typeof | ||
| with | ||
| where |
The JavaFX language establishes the following literals that can be recognized on the syntax analysis phase:
The details for each class of literals are specified in the sections below.
| Literal | Comments |
|---|---|
| true | Boolean literal |
| false | Boolean literal |
| null | JavaFXObject reference literal |
| Literal | Comments |
|---|---|
| DECIMAL_LITERAL | |
| OCTAL_LITERAL | |
| HEX_LITERAL | |
| FLOATING_POINT_LITERAL | |
| TIME_LITERAL |
Requirement: The numerical literals, including HEX_LITERAL, FLOATING_POINT_LITERAL, and TIME_LITERAL, have various attributes that let a user to distinguish these literals in the source text, e.g. the leading pair "0x" for HEX_LITERAL, the terminating letter(s) "h", "m", "s", and "ms" for TIME_LITERAL, the decimal point and/or an exponent letter ("e" or "E") for FLOATING_POINT_LITERAL. In contrast, both DECIMAL_LITERAL and OCTAL_LITERAL haven't such "highlighted" attributes. Therefore, IDE must provide highlighting of both DECIMAL_LITERAL and OCTAL_LITERAL so that it can be easy distinguished in the JavaFX source.
| Literal | Comments |
|---|---|
| STRING_LITERAL (double quote) | |
| STRING_LITERAL (single quote) | |
| QUOTE_LBRACE_STRING_LITERAL | |
| RBRACE_QUOTE_STRING_LITERAL | |
| RBRACE_LBRACE_STRING_LITERAL |
Requirement: All String Escape Sequences inside a string literal should be highlighted.
The Application Highlighting layer is intended to highlight important elements the of the program and underline their roles in the application. Unlike other layers this layer relies on the knowledge about application rather than the language grammar.
E.g. declarations of the GUI components, action listeners and other parts of the GUI specific code might be highlighted in the source of the GUI application.
The Application Highlighting layer isn't specified and it isn't supported for the present.