Re: [Vala] lexical analysis using libvala



Sure I'm looked at the Valadoc (which uses libvala already) and there is AST
parser inside vala, which is libvala :)
AST doesn't include comments, they are removed as useless for compilation i
guess.
Also I'm looked into the sources of Scanner class itself and found no way to
get all comments without hacks.
Sadly i can't derive from Scanner and implement that functionality, there is
no overridable virtual methods.

On Sat, Jun 18, 2011 at 5:09 PM, Serge Hulne <serge hulne gmail com> wrote:

I am new to Vala, so my remarks might be naive, but:

1) Is there not some kind of source code parser already included in
Valadoc that you could reuse (as opposed to writing something from
scratch).

2) Is there not and AST parser somewhere in Vala anyway ?

3) Why not parse the vapi files ?

4) Why not derive your analyser from the way the vapi files generator
parses the Vala code ?

If my remarks are obvious or naive, please ignore them.

Serge.




On Sat, Jun 18, 2011 at 2:44 PM, Maga Abdurakhmanov <maqdev gmail com>
wrote:
Hi!

I'm working on vala plugin for netbeans, and have some questions
regarding
libvala and parsing (scanning) using libvala. My existing version of
plugin
is implemented using antlr and it's not easy to maintain and support all
the
features of vala.

So I've come up with the idea to use libvala to parse files and integrate
it
somehow with java part of plugin.

Now i'm trying to parse vala files using libvala, and i've made some
progress but got problems with parsing of code comments.

Here is my tryout to parse vala files:

https://github.com/carbonfx/netbeans-valaproject/blob/libvala/plugin/libvalaproxy/src/valaparser/vala-parser.vala
I've made some hacks to get comments from source, and it doesn't looks
right
for me. For example I'm calling scanner.parse_file_comments(); before
each
call of read_token method.

Is there any way to get comments and correct line and column number for
comments using Scanner class?

--
Sincerely,
Magomed

_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list






-- 
Sincerely,
Magomed


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]