JavaFXPluginHighlightingSpecification

Revision as of 12:48, 5 November 2009 by Admin (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)

JavaFX Plugin - Highlighting Specification

Document Status Initial Draft Top-level document JavaFXPlugin
{{{1}}}

Contents


Introduction

The JavaFX Plugin uses and extends the standard Netbeans editor infrastructure to provide highlighting both the JavaFX source code in the Editor window and the related elements in other GUI components of the IDE.

The JavaFX Plugin provides a set of the highlighting layers that are specified by this document.

Related Documents

From Wikipedia, the free encyclopedia:

Highlighting Layers

Syntax Highlighting

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

{{{1}}}

More specifically, the Syntax Highlighting is based on knowledge about tokens that is provided by a lexer. See the Lexical analysis article on the wikipedia site for more info about the process.

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.

Categories of Tokens

An IDE lexer should provide more detailed info about tokens and lexems than it is usually required for both compiler and interpreter of a language. In difference to the original compiler lexer, the IDE lexer has more detailed classification of the JavaFX tokens. Note, such detailed classification is required not only for the Syntax Highlighting, other IDE services will also rely on this classification.

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



Keywords

{{{1}}}
Keyword Directive Comments
keyword tokens that can start a statement/definition
abstract
assert X
attribute
bind
bound
{{{1}}}
lazy
{{{1}}}
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


Not in list:

format distinct easeboth easein easeout fps linear nodebug order reverse by do dur

Literals

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.

Keyword Literals

Literal Comments
true Boolean literal
false Boolean literal
null JavaFXObject reference literal


Numerical Literals

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.

String Literals

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.

Operators

Q: Whether the tween token is the operator or the keyword?
TODO provide the section

Separators

TODO provide the section

Semantic Highlighting

TODO

Built-in data types

{{{1}}}

Dynamic Highlighting

See the following articles for more info about Dynamic Highlighting:

Application Highlighting

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.
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo