My favorites | Sign in
Project Logo
Project hosting will be READ-ONLY Wednesday at 8am PST due to brief network maintenance.
                
New issue | Search
for
| Advanced search | Search tips
Issue 68: Add support for basic identifier parsing
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Feb 2008
Type-Enhancement
Priority-High
Milestone-Release2.0


Sign in to add a comment
 
Reported by broofa, Feb 01, 2008
See
http://groups.google.com/group/jgrousedoc/browse_thread/thread/f66c56511d5b544a

I've attached a updated version of jgdlint, written in Java. I believe the
"parseIdentifier" method is the code you'll be most interested in - it's
what actually does the line-by-line scan through the code looking for an
identifier.

I've had a couple more thoughts on how this might be implemented, but
they're probably more appropriate for the group discussion, so I'll append
them there.
jgdlint.java
5.7 KB   Download
Comment 1 by broofa, Feb 01, 2008
(No comment was entered for this change.)
Labels: -Type-Defect -Priority-Medium Type-Enhancement Priority-High
Comment 2 by denis.riabtchik, Feb 02, 2008
I have incorporated your algorithm into jGrouseDoc (see it in svn) with minor
modifications.

So far I have found one problem though - it does not handle properly valid JS
identifiers like $break or _continue and the like since the first pass removes all JS
reserved words.
Also it would try to parse strings, so construct like
/**
* var bla
*/
"SOME STRING".indexOf(...) 

would result in parsed id SOME (not that one should expect this kind of code
somewhere, but nevertheless...)

Can you take a look how this could be addressed (since you started that :-))?
Comment 3 by denis.riabtchik, Feb 02, 2008
BTW, after adding the check to jGrouseDoc I have cleared ~20 doc errors in my
framework :-)
Comment 4 by broofa, Feb 02, 2008
okay, I tweaked the reserved word regex to handle things like $break and _continue (I
hope).  I haven't actually tested it, but I'm pretty sure it'll work.

Re the string literals ... hmm... that's the sort of thing I think we can punt on for
the time being.  I think the current parseIdentifier() behavior will deal with 90+%
of the most common cases, which is a huge time savings.  I'd rather wait until we
have concrete examples of other (common) code patterns that need to be addressed
before trying to tune it's behavior.
Comment 5 by broofa, Feb 07, 2008
(No comment was entered for this change.)
Status: Fixed
Labels: Milestone-Release2.0
Sign in to add a comment

Hosted by Google Code