Menu

#19 Non-symbols can be mistaken for symbols

current_cvs
open
3
2009-04-22
2001-10-09
Malcolm Box
No

When marking up source code, each possible string is
checked to see if it is a symbol, by calling
issymbol(). The implementations in Mysql.pm and
Postgres.pm only use the string to lookup whether this
is a symbol.

Unfortunately it is possible that in one release a
string is a symbol, while in another it is not. Since
the release of the file being looked at is not taken
into account, the current algorithm will highlight
symbols that, when clicked on, will return "Not used".

The solution is to change issymbol to do:

select s.symid from symbols s, releases r, indexes i
where s.symname = 'name' and i.symid = s.symid and
i.fileid = r.fileid and r.release = 'release';

This is not much slower, and the results could be cached.

Note that is problem shows up only rarely, since it is
unusual to have a string that both resembles an
identifier (not a reserved word, not a string/include
token) but matches a symbol name in another release.
The easiest way to show it up is to look at the source
of a release that has not be indexed yet.

Discussion

  • Malcolm Box

    Malcolm Box - 2009-04-22
    • assigned_to: mbox --> adrianissott
     
  • AdrianIssott

    AdrianIssott - 2009-04-22

    Malcolm, I'm happy to take this on as it was implicitly what I was going to do anyway :)

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.