I am working in building halstead Metrics
in java and I am using javaparser
library and I am confusing about how I can find all java reserved words in the java imported file which will be parsing to find the operator (n1) ?
Asked
Active
Viewed 255 times
1

Mp0int
- 18,172
- 15
- 83
- 114

JavaTrainner
- 37
- 1
- 5
-
Do you understand what the AST actually contains? If so, why are you concerned about "finding reserved words"? (Hmm, this question seems rather stale. Is OP still interested in a response?) – Ira Baxter Apr 26 '15 at 18:28
1 Answers
-1
You might be better to use ANTLR to do this - I provided details in response to another question here - building halstead metrics in java?
-
And what exactly is the justification that "ANTLR might be better"? Apparantly the javaparser library parses Java 1.5, produces trees and provides visitor support. That should be plenty to support a metrics tool. ANTLR might be OK, but which parser isn't apparantly part of OP's problem. – Ira Baxter Apr 26 '15 at 18:27
-
I just answered this question because I was answering the other question and Stackoverflow asked me to 'be nice' and answer another question. Personally I think ANTLR is 'better' than javaparser if you are building a parser - mainly because it gives you more freedom in relation to designing the grammar based on the latest version - I thought, like you, that javaparser only supported 1.5 but I see it now supports 1.8. – Ken Hall Apr 27 '15 at 20:40