GREAT !
Indeed, I did not receive your post before (but my subscription to the
list may specify weekly update ???)
So first congrats again for your achievement
Second, about the error:
The difficulty of "parsing" any source code is not really in the parsing
itself (grammar, building AST, etc.) , but in resolving the identifiers
(when one sees an identifier used somewhere, one must guess what it is
and where it is defined, for example several methods with the same name
may exist, and one has to find the right one that is called at this moment)
For this, verveineC uses CDT, eclipse's plugin for C/C++
But this is difficult for CDT to always guess what entity a name refers to
To improve things a bit, VerveineC makes 2 passes, first pass to define
all entities, 2nd pass to record the references to all entities (access
to variables, method calls, uses of classes, ...)
This is what
"!MESSAGE recording variables declared type and methods/functions
return type"
means, it is in the 2nd pass, try to record uses of types, either as the
type of a declared variable, or as the return type of a method/function.
But even with that, it is still a tough task. Sometimes VerveineC finds
a name that it does not know what it is, so it must guess. In your case,
at some earlier time it guessed that a given name was a function, but
now it sees that it is used to declare a variable or a function/method
and deduces it is a type.
So it tries to cast the entity to a type but it was declared earlier as
a function and the cast fails.
The 1st solution is to look more precisely at the code you were trying
to parse to understand what happened exactly:
* a some point it though it was a function and that was a mistake
* or there is a function and a type with the same name and it is
mixing the two
A second more generic solution would be to avoid crashing and do
something more intelligent, may be like ignoring the use of this type at
this point ? And warn the user that it could not resolve that name ?
nicolas
On 24/06/2018 18:37, smallglt wrote:
I just got the extractor to run! (Though it logged an
error.)
I don't know what was different, except that I updated my Eclipse
installation before building and installing VerveineC this time around.
As sample code I chose the source for gawk v4.1.2, partly because I know my
way around it somewhat.
When I ran the extractor script the output looked okay up until I got an
error message like this:
-------
!ENTRY verveine.extractor.Cpp 1 0 2018-06-24 12:14:41.206
!MESSAGE recording variables declared type and methods/functions return type
!ENTRY org.eclipse.osgi 4 0 2018-06-24 12:14:41.268
!MESSAGE Application error
!STACK 1
java.lang.ClassCastException: eu.synectique.verveine.core.gen.famix.Function
cannot be cast to eu.synectique.verveine.core.gen.famix.Type
at
eu.synectique.verveine.extractor.visitors.ref.AbstractRefVisitor.referedType(AbstractRefVisitor.java:190)
at
eu.synectique.verveine.extractor.visitors.ref.AbstractRefVisitor.visit(AbstractRefVisitor.java:98)
.
.
.
---
The vertical ellipsis indicates that I left out the rest of the long
traceback.
I've uploaded the entire log so you can have a look at it:
log.zip <http://forum.world.st/file/t371881/log.zip>
--
Sent from:
http://forum.world.st/Moose-f1310756.html
_______________________________________________
Moose-dev mailing list
Moose-dev(a)list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev
--
Nicolas Anquetil
RMod team -- Inria Lille