Re: Semantic-parse-region returning non-string Tag name

Eric Ludlam <[email protected]> Sun, 13 Mar 2016 11:47:50 -0400
Newsgroups gmane.emacs.semantic
Message-ID <[email protected]>
On 03/08/2016 04:04 PM, Thomas Karolski wrote:
> Hi Guys,
>
> I'm currently trying to speedup semantic, by moving parsing jobs for
> files to a different emacs instance. However, when invoking
> semantic-parse-region on a buffer, I sometimes get tags where the first
> element (the name) is a list, instead of a string.
>
> On the remote emacs instance, I parse files using this code:

Hi,

The tags returned from the parser go through two phases.  In one phase, 
the parser returns raw 'uncooked' tags, where the name could be a list 
(as for C/C++) but could also have any other random structure the parser 
authore chooses.  The tags then get cooked and prepared to be linked 
into the buffer.  Those single tags then get split up into multiple tags 
(for C) which then conforms to the in buffer tag standards.

You may have better luck looking at 'cedet/semantic/db-mk.el' which was 
designed to allow a makefile to update your semanticdb cache files. 
You'll not it is a lot simpler because it depends on getting the 
database files update.  I didn't look at your code in detail, but I know 
you shouldn't need to replicate buffer state checking and all that other 
stuff.

If you don't want the database files updated what you can do is init 
your emacs to use only in-memory database files.  You can do that with a 
code snippet like this:

(setq-default semanticdb-new-database-class 'semanticdb-project-database)

You can see this in cedet-utest-batch in tests/cedet-utest.el directory. 
  That has a few other tricks for making an emacs instance a little less 
noisy from a CEDET point of view.

I note your function returns the cache and parse table.  If you use 
semanticdb, it will wrap everything up for you so you don't need to 
track that stuff.  Enable semanticdb mode as in that utest example, and 
use (semanticdb-current-database) to get it.  If you return the database 
table for your buffer you can use lots of other convenience features 
such as:

semanticdb-full-filename
semanticdb-set-buffer - to re-visit the buffer later
semanticdb-get-tags - to get the tag list
(oref db unmatched-syntax) - to get any unmatched syntax

It also tracks changes made to the lexical table (any #defines) and a 
few other useful things.  It also knows how to refresh itself.

Note the files I listed are part of the CEDET repository on sourceforge 
in case you are working with the code that is part of Emacs.

I know I didn't really answer you question, but I hope I can save you 
some time with these simpler solutions.

Eric

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140