Friday 15 June 2012

c - Extracting enum values from ctags file -


Is it possible to use CTA with veem, to remove all value values ​​for one single enum?

For example, if I have the following enum type:

  typed FM fruit {apple, orange, peer,} fruit_t;   

that generates the following lines in my tag file (using the default - c-types ):

  APPLE MY X C / ^ APPLE, $ /; "AEAM: Fruit File: Orange M.C./ ^ Orange, $ /;" E-Nem: Fruit File: Peer Mines / ^ Pair, $ /; "E NAM: Fatal File: Food Minds. C / ^ Tippedem FF $ /; G File: Fruit_T minex.c / ^} FULT_T; $ /;" TTIFFIFF: AM: FORFF file:   There is no way to specify 

fruit or get the function_type and get value ['APPLE', 'ORANGE', 'PEAR'] ?

In Vim I expected that :

Of course I can repeat the tag file and the result can be processed myself, but it will be expensive for a very large file , And I hope there is an inherent way of getting such basic information.

Yes, you can, the tag list () function Filtering the results, which gives you a convenient programmatic access to tag databases.

 : map echo (filter (tag. ('. *'), 'Is_key (v: wall, "enum") and amp; ve: well.nim == # "fruit" ), 'V: Well.Name') ['apple', 'orange' peer ']   

What does this do:

  1. .htm) Code>) All tags with a enum attribute, and whose names are exactly ( == # ) fruit .
  2. From the resulting objects, ( map) ) only the name attribute.

No comments:

Post a Comment