-
Enhancement
-
Resolution: Won't Fix
-
P4
-
None
-
9
A DESCRIPTION OF THE REQUEST :
Script comments currently get swallowed by the parser and only the relevant code is visible in the tree.
Same for keywords in structures like
do {
stmt;
} while (true);
The AST nodes only show the position of the entire do-while-loop, the stmt and the condition, not the "do" or the "while" keywords. (Ok, "do" is always at the start, but "while" is a problem when there is whitespace.)
JUSTIFICATION :
In order to do proper syntax highlighting on JavaScript, you need to know the location of comments (line and block) and keywords in a script.
Mozilla Rhino has special flags to activate comment output in ASTs.
env.setRecordingComments(true);
env.setRecordingLocalJsDocComments(true);
And it had methods like
DoLoop.getWhilePosition()
I can't replace the old Rhino code until this information is present.
Script comments currently get swallowed by the parser and only the relevant code is visible in the tree.
Same for keywords in structures like
do {
stmt;
} while (true);
The AST nodes only show the position of the entire do-while-loop, the stmt and the condition, not the "do" or the "while" keywords. (Ok, "do" is always at the start, but "while" is a problem when there is whitespace.)
JUSTIFICATION :
In order to do proper syntax highlighting on JavaScript, you need to know the location of comments (line and block) and keywords in a script.
Mozilla Rhino has special flags to activate comment output in ASTs.
env.setRecordingComments(true);
env.setRecordingLocalJsDocComments(true);
And it had methods like
DoLoop.getWhilePosition()
I can't replace the old Rhino code until this information is present.
- duplicates
-
JDK-8155242 Nashorn comment nodes should be available in the syntax tree
-
- Closed
-