Re[1]: [cedet-semantic] Not all comments ignored when parsing C
Brought to you by:
zappo
From: Eric M. L. <er...@si...> - 2004-12-15 04:07:44
|
Hi, You have found a curious side-effect of the lexical short-cut I used to handle complex expressions. Basically, the lexical stage skips everything inside { } or ( ), and they are identified as full syntactic expressions. If the parser must know what is inside, it asks (argument lists, for example). In the case of expressions, I wasn't ready to write a full expression parser, so I just captured the plain-text of that expression into the value. It is probably possible to strip out comments here. It is near line 1030 in c.by. Eric >>> Marcus Harnisch <mar...@gm...> seems to think that: >Hi Eric, David, > >I just noticed that a comment in a struct initializer won't be skipped >by the parser. I can see why that happens, but does it make sense? >Hmm, in a different context you said that the value is basically just >the raw string [that would have to be postprocessed anyway]. I guess >that applies here, too, doesn't it. > > >struct _FOOBAR { > char foo; > char bar; >} FOOBAR = { 0, /* This comment will end up in the value of FOOBAR */ > 0 } ; > > >;; Object cedet-bug/ >;; SEMANTICDB Tags save file >(semanticdb-project-database-file "cedet-bug/" > :tables (list > (semanticdb-table "struct.c" > :major-mode 'c-mode > :tags '(("FOOBAR" variable (:default-value "{ 0, /* This comment will end up in the value of FOOBAR */ > 0 }" :type ("_FOOBAR" type (:members (("foo" variable (:type "char") (reparse-symbol classsubparts) [24 33]) ("bar" variable (:type "char") (reparse-symbol classsubparts) [40 49])) :type "struct") nil nil)) nil [1 134])) > :file "struct.c" > :pointmax 135 > ) > ) > :file "semantic.cache" > :semantic-tag-version "2.0beta3" > :semanticdb-version "2.0beta3" > ) [ ... ] |