Discussion:
[Geany-Devel] Interested making a patch to add QML support
Tory Gaurnier
2013-09-17 15:02:32 UTC
Permalink
I'm interested in making a patch to add QML support to Geany, but first
I had a few questions. First of all, is anyone else already working on
this? And if not, if I manage to get it working well would my patch be
worked into the main Geany code so others could get it also? I've been
learning programming for a while, but I've never patched or edited
anyone else’s code, so I'm not making promises how fast I'd be able to
get this done, of course from looking at the hacking page it doesn't
look to complicated to add support for another language, I just wanted
to ask these questions before I even attempted this.

Honestly it'll probably take me longer to figure out how to create and
submit the patch then it will to actually change the code in the source
itself.
Matthew Brush
2013-09-17 21:02:22 UTC
Permalink
Post by Tory Gaurnier
I'm interested in making a patch to add QML support to Geany, but first
I had a few questions. First of all, is anyone else already working on
this? And if not, if I manage to get it working well would my patch be
worked into the main Geany code so others could get it also? I've been
learning programming for a while, but I've never patched or edited
anyone else’s code, so I'm not making promises how fast I'd be able to
get this done, of course from looking at the hacking page it doesn't
look to complicated to add support for another language, I just wanted
to ask these questions before I even attempted this.
To answer your questions first; no, no one is working on it AFAIK, and
if you follow the guidelines and write decent code, yes, I'm sure we
would include it Geany. I'd rather like to use QML in Geany myself as I
find QtCreator to be way too big and slow for something so simple (even
if it's quite nice overall).

You found probably the most important info already (notes in HACKING
file), so that's a good start :)

We use Scintilla[1] for the editing component as you probably know, and
it seems like no one is working on this, though someone talked on the
their mailing list[2] about starting to work on one last year. In order
to get syntax highlighting support for QML, you'll need to code up a
lexer in C++ (actually very C-like C++) and get it included into
Scintilla project. With that, we can pull it downstream and integrate
into Geany.

We use a fork of CTags[3] inside Geany for tag/symbol parsing, so in
order to have that supported for QML you'll need to code up a parser in
C and ideally get it included into CTags, but more likely we could just
pull it into Geany directly first.

With those two things done, which aren't exactly trivial, but for a
language like QML, probably aren't super difficult, then you can do the
stuff in the HACKING file to integrate everything into Geany, which is
the easiest part.
Post by Tory Gaurnier
Honestly it'll probably take me longer to figure out how to create and
submit the patch then it will to actually change the code in the source
itself.
Naw, writing the Scintilla lexer and Ctags parser will probably be the
hardest part as writing lexers and parsers isn't the easiest thing in
the world (especially in C and C++). The rest is just learning how to
use the version control system and common knowledge you can find online
about best practices for making commits and using the tools (in our case
Git, and Mercurial for Scintilla - which is quite similar). If you work
in features branches, and make small incremental commits, you can go
back after and re-jigger everything into nice clean patches for Geany
and Scintilla.

All that being said, if you aren't a strong C programmer and have no
interest in becoming one, all of this is probably way too much trouble
for what it's worth :) Unfortunately adding new proper language support
to Geany is quite difficult compared to most editors. Alternatively, you
might be able to get reasonable results by re-using existing filetypes
in Geany, maybe basing it on JavaScript or something more similar to
QML. Check Geany's manual for "custom filetypes"[4] for more info on
this much easier approach, there's a few existing examples of these kind
in Geany's source tree[5].

Cheers,
Matthew Brush

[1] http://www.scintilla.org/
[2]
https://groups.google.com/d/msg/scintilla-interest/jxch35Fue2k/ExZcjlrHdRkJ
[3] http://ctags.sourceforge.net/
[4] http://www.geany.org/manual/current/index.html#custom-filetypes
[5] https://github.com/geany/geany/blob/master/data/filetypes.Cython.conf
Tory Gaurnier
2013-09-17 22:59:17 UTC
Permalink
I actually prefer C, and since I've been playing with C++ I like it a lot so far. The app I'm working on is actually a C app with a C++ wrapper connecting it to a QML gui.

And I already added QML by copying the javascript configuration file and adding certain keywords, such as the QML basic types for highlighting.

I didn't realize I'd have to create the lexer myself. Is it possible to use the C lexer that's already in Geany and then work it into the QML file type? The only thing I really want to get working is the symbol list (which would be the ctags thing you refered to if I'm not mistaken, right?).

I'm already writing my QML in Geany, but it would be awesome to be able to see the symbols.
Post by Tory Gaurnier
Post by Tory Gaurnier
I'm interested in making a patch to add QML support to Geany, but
first
Post by Tory Gaurnier
I had a few questions. First of all, is anyone else already working
on
Post by Tory Gaurnier
this? And if not, if I manage to get it working well would my patch
be
Post by Tory Gaurnier
worked into the main Geany code so others could get it also? I've
been
Post by Tory Gaurnier
learning programming for a while, but I've never patched or edited
anyone else’s code, so I'm not making promises how fast I'd be able
to
Post by Tory Gaurnier
get this done, of course from looking at the hacking page it doesn't
look to complicated to add support for another language, I just
wanted
Post by Tory Gaurnier
to ask these questions before I even attempted this.
To answer your questions first; no, no one is working on it AFAIK, and
if you follow the guidelines and write decent code, yes, I'm sure we
would include it Geany. I'd rather like to use QML in Geany myself as I
find QtCreator to be way too big and slow for something so simple (even
if it's quite nice overall).
You found probably the most important info already (notes in HACKING
file), so that's a good start :)
We use Scintilla[1] for the editing component as you probably know, and
it seems like no one is working on this, though someone talked on the
their mailing list[2] about starting to work on one last year. In order
to get syntax highlighting support for QML, you'll need to code up a
lexer in C++ (actually very C-like C++) and get it included into
Scintilla project. With that, we can pull it downstream and integrate
into Geany.
We use a fork of CTags[3] inside Geany for tag/symbol parsing, so in
order to have that supported for QML you'll need to code up a parser in
C and ideally get it included into CTags, but more likely we could just
pull it into Geany directly first.
With those two things done, which aren't exactly trivial, but for a
language like QML, probably aren't super difficult, then you can do the
stuff in the HACKING file to integrate everything into Geany, which is
the easiest part.
Post by Tory Gaurnier
Honestly it'll probably take me longer to figure out how to create
and
Post by Tory Gaurnier
submit the patch then it will to actually change the code in the
source
Post by Tory Gaurnier
itself.
Naw, writing the Scintilla lexer and Ctags parser will probably be the
hardest part as writing lexers and parsers isn't the easiest thing in
the world (especially in C and C++). The rest is just learning how to
use the version control system and common knowledge you can find online
about best practices for making commits and using the tools (in our case
Git, and Mercurial for Scintilla - which is quite similar). If you work
in features branches, and make small incremental commits, you can go
back after and re-jigger everything into nice clean patches for Geany
and Scintilla.
All that being said, if you aren't a strong C programmer and have no
interest in becoming one, all of this is probably way too much trouble
for what it's worth :) Unfortunately adding new proper language support
to Geany is quite difficult compared to most editors. Alternatively, you
might be able to get reasonable results by re-using existing filetypes
in Geany, maybe basing it on JavaScript or something more similar to
QML. Check Geany's manual for "custom filetypes"[4] for more info on
this much easier approach, there's a few existing examples of these kind
in Geany's source tree[5].
Cheers,
Matthew Brush
[1] http://www.scintilla.org/
[2]
https://groups.google.com/d/msg/scintilla-interest/jxch35Fue2k/ExZcjlrHdRkJ
[3] http://ctags.sourceforge.net/
[4] http://www.geany.org/manual/current/index.html#custom-filetypes
[5]
https://github.com/geany/geany/blob/master/data/filetypes.Cython.conf
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
Matthew Brush
2013-09-18 01:45:15 UTC
Permalink
Post by Tory Gaurnier
[...]
I didn't realize I'd have to create the lexer myself. Is it possible to use the C lexer that's already in Geany and then work it into the QML file type? The only thing I really want to get working is the symbol list (which would be the ctags thing you refered to if I'm not mistaken, right?).
You could look at the CTags tutorial about extending[1], it has an
example for writing a "regex-based" parser which will probably be quite
a bit easier for a language like QML, if maybe less powerful than a
character-based parser.

Cheers,
Matthew Brush

[1] http://ctags.sourceforge.net/EXTENDING.html
Tory Gaurnier
2013-09-18 17:48:55 UTC
Permalink
Post by Matthew Brush
Post by Tory Gaurnier
[...]
I didn't realize I'd have to create the lexer myself. Is it possible
to use the C lexer that's already in Geany and then work it into the
QML file type? The only thing I really want to get working is the
symbol list (which would be the ctags thing you refered to if I'm not
mistaken, right?).
You could look at the CTags tutorial about extending[1], it has an
example for writing a "regex-based" parser which will probably be
quite a bit easier for a language like QML, if maybe less powerful
than a character-based parser.
Cheers,
Matthew Brush
[1] http://ctags.sourceforge.net/EXTENDING.html
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Ok, well, I'm going to go ahead and attempt this, I'll be putting my
current app on hold for a little while and I'm jumping straight into
CTags for now, I'm not making an promises, but I'm going to see if I can
get it done, I'll update you if I get something working.
Tory Gaurnier
2013-09-18 18:47:44 UTC
Permalink
Post by Matthew Brush
Post by Tory Gaurnier
[...]
I didn't realize I'd have to create the lexer myself. Is it possible
to use the C lexer that's already in Geany and then work it into the
QML file type? The only thing I really want to get working is the
symbol list (which would be the ctags thing you refered to if I'm not
mistaken, right?).
You could look at the CTags tutorial about extending[1], it has an
example for writing a "regex-based" parser which will probably be
quite a bit easier for a language like QML, if maybe less powerful
than a character-based parser.
Cheers,
Matthew Brush
[1] http://ctags.sourceforge.net/EXTENDING.html
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Ok, so I've been looking at the CTags tutorial you posted, and it really
looks pretty easy, especially using regex, but there is one thing I
can't find. Would you happen to know if when using regex it's possible
to have mulitple regexes? For example, the tutorial has this:

|addTagRegex (language, "^def[ \t]*([a-zA-Z0-9_]+)", "\\1", "d,definition", NULL);|

Which is using the regex to create tags labelled 'definition' (unless
I'm missing something). But since QML supports javascript I at the very
least want to have it recognize Items/Components, and functions. And I'd
eventually like to have it label the Items/Components by ID if it's present.

Now I know there's also the callback method, but for now, do you know if
it will work to have addTagRegex appear multiple times?

Also, I can't seem to find anything on how I'll even test this, do you
know if ctags can maybe be run from terminal or something???

Anyways, I know I'm asking a lot of questions, so thanks for all the help.
Matthew Brush
2013-09-18 20:52:41 UTC
Permalink
Post by Tory Gaurnier
Post by Matthew Brush
Post by Tory Gaurnier
[...]
I didn't realize I'd have to create the lexer myself. Is it possible
to use the C lexer that's already in Geany and then work it into the
QML file type? The only thing I really want to get working is the
symbol list (which would be the ctags thing you refered to if I'm not
mistaken, right?).
You could look at the CTags tutorial about extending[1], it has an
example for writing a "regex-based" parser which will probably be
quite a bit easier for a language like QML, if maybe less powerful
than a character-based parser.
Cheers,
Matthew Brush
[1] http://ctags.sourceforge.net/EXTENDING.html
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Ok, so I've been looking at the CTags tutorial you posted, and it really
looks pretty easy, especially using regex, but there is one thing I
can't find. Would you happen to know if when using regex it's possible
|addTagRegex (language, "^def[ \t]*([a-zA-Z0-9_]+)", "\\1",
"d,definition", NULL);|
Which is using the regex to create tags labelled 'definition' (unless
I'm missing something). But since QML supports javascript I at the very
least want to have it recognize Items/Components, and functions. And I'd
eventually like to have it label the Items/Components by ID if it's present.
Now I know there's also the callback method, but for now, do you know if
it will work to have addTagRegex appear multiple times?
Yeah, I think you can call it multiple times, see COBOL parser, for example:
https://sourceforge.net/p/ctags/code/HEAD/tree/trunk/cobol.c
Post by Tory Gaurnier
Also, I can't seem to find anything on how I'll even test this, do you
know if ctags can maybe be run from terminal or something???
ctags is actually a command-line (only) program, the fork we have in
Geany was an attempt by the/an Anjuta developer to make it into a
library for use by IDEs and such. So yeah, your best bet is to check out
CTags SVN code, add your parser to it, so you can test it standalone,
and also it has the advantage that it will be fully compatible with
upstream CTags so you can contribute it to that project first and all of
its users will be able to use CTags for QML code. Once you have it all
working, it should be quite trivial to move it into Geany.

Cheers,
Matthew Brush
Lex Trotman
2013-09-18 23:35:25 UTC
Permalink
Have you tried to see if the javascript lexer and parser work well enough
for QML? its supposed to be based on js.

Cheers
Lex
Post by Tory Gaurnier
Post by Matthew Brush
Post by Tory Gaurnier
[...]
I didn't realize I'd have to create the lexer myself. Is it possible
to use the C lexer that's already in Geany and then work it into the
QML file type? The only thing I really want to get working is the
symbol list (which would be the ctags thing you refered to if I'm not
mistaken, right?).
You could look at the CTags tutorial about extending[1], it has an
example for writing a "regex-based" parser which will probably be
quite a bit easier for a language like QML, if maybe less powerful
than a character-based parser.
Cheers,
Matthew Brush
[1] http://ctags.sourceforge.net/**EXTENDING.html<http://ctags.sourceforge.net/EXTENDING.html>
______________________________**_________________
Devel mailing list
https://lists.geany.org/cgi-**bin/mailman/listinfo/devel<https://lists.geany.org/cgi-bin/mailman/listinfo/devel>
Ok, so I've been looking at the CTags tutorial you posted, and it really
looks pretty easy, especially using regex, but there is one thing I
can't find. Would you happen to know if when using regex it's possible
|addTagRegex (language, "^def[ \t]*([a-zA-Z0-9_]+)", "\\1",
"d,definition", NULL);|
Which is using the regex to create tags labelled 'definition' (unless
I'm missing something). But since QML supports javascript I at the very
least want to have it recognize Items/Components, and functions. And I'd
eventually like to have it label the Items/Components by ID if it's present.
Now I know there's also the callback method, but for now, do you know if
it will work to have addTagRegex appear multiple times?
https://sourceforge.net/p/**ctags/code/HEAD/tree/trunk/**cobol.c<https://sourceforge.net/p/ctags/code/HEAD/tree/trunk/cobol.c>
Also, I can't seem to find anything on how I'll even test this, do you
Post by Tory Gaurnier
know if ctags can maybe be run from terminal or something???
ctags is actually a command-line (only) program, the fork we have in Geany
was an attempt by the/an Anjuta developer to make it into a library for use
by IDEs and such. So yeah, your best bet is to check out CTags SVN code,
add your parser to it, so you can test it standalone, and also it has the
advantage that it will be fully compatible with upstream CTags so you can
contribute it to that project first and all of its users will be able to
use CTags for QML code. Once you have it all working, it should be quite
trivial to move it into Geany.
Cheers,
Matthew Brush
______________________________**_________________
Devel mailing list
https://lists.geany.org/cgi-**bin/mailman/listinfo/devel<https://lists.geany.org/cgi-bin/mailman/listinfo/devel>
Lex Trotman
2013-09-19 01:27:01 UTC
Permalink
Post by Lex Trotman
Have you tried to see if the javascript lexer and parser work well enough
for QML? its supposed to be based on js.
Looks like the js lexer works ok, but the parser simply treats QML
constructs as data and skips them, oh well.

Not sure how easy a regex parser will be, IIUC QML symbols are specified as
the id: property inside the object, meaning you need to handle nested
context.

Cheers
Lex
Post by Lex Trotman
Cheers
Lex
Matthew Brush
2013-09-19 07:03:45 UTC
Permalink
Post by Lex Trotman
Post by Lex Trotman
Have you tried to see if the javascript lexer and parser work well enough
for QML? its supposed to be based on js.
Looks like the js lexer works ok, but the parser simply treats QML
constructs as data and skips them, oh well.
Not sure how easy a regex parser will be, IIUC QML symbols are specified as
the id: property inside the object, meaning you need to handle nested
context.
I guess you'd have to recognize first an "anonymous" declaration and
then if you see "id:" pattern then set the (likely global variable)
name, otherwise leave as anonymous. I don't think there's requirement to
give declarations a name in QML, IIRC.

That being said, my recollection of QML is coming back and I think it
can actually embed many valid JavaScript expressions inline, so it might
not be as easy as I initially figured: Caveat scriptor.

Cheers,
Matthew Brush
Tory Gaurnier
2013-09-19 22:07:20 UTC
Permalink
Post by Matthew Brush
Post by Lex Trotman
Post by Lex Trotman
Have you tried to see if the javascript lexer and parser work well enough
for QML? its supposed to be based on js.
Looks like the js lexer works ok, but the parser simply treats QML
constructs as data and skips them, oh well.
Not sure how easy a regex parser will be, IIUC QML symbols are specified as
the id: property inside the object, meaning you need to handle nested
context.
I guess you'd have to recognize first an "anonymous" declaration and
then if you see "id:" pattern then set the (likely global variable)
name, otherwise leave as anonymous. I don't think there's requirement
to give declarations a name in QML, IIRC.
That being said, my recollection of QML is coming back and I think it
can actually embed many valid JavaScript expressions inline, so it
might not be as easy as I initially figured: Caveat scriptor.
Cheers,
Matthew Brush
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Ok, so far creating the source is pretty easy, I decided to just go with
character parsing instead of regex (I've created a function that should
theoretically create tags for the javascript functions in the QML file),
but I'm at a point where I need to test it (once I have the javascript
functions down I'll add a function for QML objects).

So, the issue now is I can't really figure out how to build CTags, from
what I could figure out it seems I need to run the configure script to
add values to the Makefile.in, then run make -f Makefile.in, but that
doesn't seem to work, and there are no instructions that I can find on
building, I've checked the Readme, and the FAQ. Have any of you guys
built CTags before and can point me in the right direction???
Colomban Wendling
2013-09-19 22:21:42 UTC
Permalink
Post by Tory Gaurnier
[...]
So, the issue now is I can't really figure out how to build CTags, from
what I could figure out it seems I need to run the configure script to
add values to the Makefile.in, then run make -f Makefile.in, but that
doesn't seem to work, and there are no instructions that I can find on
building, I've checked the Readme
It's in INSTALL, though a little too detailed (I guess this INSTALL file
is just Autotool's one with slight modifications)
Post by Tory Gaurnier
, and the FAQ. Have any of you guys
built CTags before and can point me in the right direction???
You need to first generate the configure script using `autoreconf`, then
run that configure script (`./configure [OPTIONS]`, which will generate
Makefiles), and then run make:

autoreconf -v && ./configure && make

Regards,
Colomban
Tory Gaurnier
2013-09-20 00:05:12 UTC
Permalink
Post by Colomban Wendling
Post by Tory Gaurnier
[...]
So, the issue now is I can't really figure out how to build CTags, from
what I could figure out it seems I need to run the configure script to
add values to the Makefile.in, then run make -f Makefile.in, but that
doesn't seem to work, and there are no instructions that I can find on
building, I've checked the Readme
It's in INSTALL, though a little too detailed (I guess this INSTALL file
is just Autotool's one with slight modifications)
Post by Tory Gaurnier
, and the FAQ. Have any of you guys
built CTags before and can point me in the right direction???
You need to first generate the configure script using `autoreconf`, then
run that configure script (`./configure [OPTIONS]`, which will generate
autoreconf -v && ./configure && make
Regards,
Colomban
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Ok, so now when I build it, I'm getting some warning, I'm not sure if
these are normal or if something needs to be configured, I'm getting
these warnings on build:
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal
configure.ac:489: warning: underquoted definition of CHECK_PROTO
configure.ac:489: run info '(automake)Extending aclocal'
configure.ac:489: or see
http://www.gnu.org/software/automake/manual/automake.html#Extending-aclocal
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf
autoreconf: running: /usr/bin/autoheader
autoreconf: configure.ac: not using Automake
autoreconf: Leaving directory `.'
Exuberant Ctags, version 5.8
Linux 3.8.0-30-generic #44-Ubuntu SMP Thu Aug 22 20:52:24 UTC 2013 x86_64

Then the rest appears normal.

Then when I run, the program segfaults on freeParserResources () at
parse.c:364
Which is this line of code: eFree (lang->name);
Which is being called from main.c:572

Now my findQMLTags function in my qml.c file is very closely following
the awk.c function findAwkTags, so I don't see how it could be caused by
this, but I may be wrong.




Here is what I have so far:

----CODE STARTS HERE----
#include "general.h" /* always include first */

#include <string.h> /* to declare strxxx() functions */

#include "parse.h" /* always include */
#include "read.h" /* to define file fileReadLine() */

typedef enum {
QML_OBJECT,
JS_FUNCTION
} QMLKind;

static kindOption QMLKinds [] = {
{ TRUE, 'o', "object", "objects" },
{ TRUE, 'f', "function", "functions" }
};

static void findQMLTags(void) {
vString *name = vStringNew();
const unsigned char *line;

// If line is a function
while((line = fileReadLine()) != NULL) {
if(strncmp((const char*)line, "function", (size_t)8) == 0 &&
isspace((int)line[8])) {
const unsigned char *cp = line + 8;

while(isspace((int)*cp)) ++cp;
while(isalnum((int)*cp) || *cp == '_') {
vStringPut (name, (int)*cp);
++cp;
}

vStringTerminate(name);

while(isspace((int)*cp)) ++cp;
if(*cp == '(') makeSimpleTag(name, QMLKinds, JS_FUNCTION);
vStringClear(name);
if(*cp != '\0') ++cp;
}
}

vStringDelete (name);
}

extern parserDefinition *QMLParser(void) {
parserDefinition* def = parserNew("QML");
static const char *const extensions [] = { "QML", NULL };

def->name = "QML";
def->kinds = QMLKinds;
def->kindCount = KIND_COUNT(QMLKinds);
def->extensions = extensions;
def->parser = findQMLTags;
//def->parser2; // Not sure I will need this
def->regex = FALSE;

return def;
}
----CODE ENDS HERE----
Colomban Wendling
2013-09-20 00:38:04 UTC
Permalink
Post by Tory Gaurnier
Post by Colomban Wendling
Post by Tory Gaurnier
[...]
So, the issue now is I can't really figure out how to build CTags, from
what I could figure out it seems I need to run the configure script to
add values to the Makefile.in, then run make -f Makefile.in, but that
doesn't seem to work, and there are no instructions that I can find on
building, I've checked the Readme
It's in INSTALL, though a little too detailed (I guess this INSTALL file
is just Autotool's one with slight modifications)
Post by Tory Gaurnier
, and the FAQ. Have any of you guys
built CTags before and can point me in the right direction???
You need to first generate the configure script using `autoreconf`, then
run that configure script (`./configure [OPTIONS]`, which will generate
autoreconf -v && ./configure && make
Regards,
Colomban
Ok, so now when I build it, I'm getting some warning, I'm not sure if
these are normal or if something needs to be configured, I'm getting
[...]
Those are "normal" and harmless. Actually this means the CTags guys
should fix a little thing in their configure.ac but that's no biggie and
not your problem.
Post by Tory Gaurnier
Then the rest appears normal.
Good :)
Post by Tory Gaurnier
Then when I run, the program segfaults on freeParserResources () at
parse.c:364
Which is this line of code: eFree (lang->name);
Which is being called from main.c:572
Now my findQMLTags function in my qml.c file is very closely following
the awk.c function findAwkTags, so I don't see how it could be caused by
this, but I may be wrong.
You should not manually set def->name, this is set by parserNew() as the
name you give it. And the reason it segfaults is because it should be
an allocated string -- but again, you should just not touch it.
Post by Tory Gaurnier
----CODE STARTS HERE----
#include "general.h" /* always include first */
#include <string.h> /* to declare strxxx() functions */
you should include <ctype.h> for isspace() and isalnum().
Post by Tory Gaurnier
#include "parse.h" /* always include */
#include "read.h" /* to define file fileReadLine() */
[...]
extern parserDefinition *QMLParser(void) {
parserDefinition* def = parserNew("QML");
static const char *const extensions [] = { "QML", NULL };
def->name = "QML";
here, remove this line.
Post by Tory Gaurnier
def->kinds = QMLKinds;
def->kindCount = KIND_COUNT(QMLKinds);
def->extensions = extensions;
def->parser = findQMLTags;
//def->parser2; // Not sure I will need this
parser2 is for "retry parsers", e.g. if your parser should use an
alternative algorithm or something if it encountered something in the
middle of the file. This is rarely needed. Fortran parser uses it to
switch to free form if struct form failed, and C one uses it to try a
different branch conditional method.
Post by Tory Gaurnier
def->regex = FALSE;
you don't need to set this, it's the default -- though, it's harmless to
set it again.
Post by Tory Gaurnier
return def;
}
----CODE ENDS HERE----
Tory Gaurnier
2013-09-20 17:46:46 UTC
Permalink
Post by Colomban Wendling
Post by Tory Gaurnier
Post by Colomban Wendling
Post by Tory Gaurnier
[...]
So, the issue now is I can't really figure out how to build CTags, from
what I could figure out it seems I need to run the configure script to
add values to the Makefile.in, then run make -f Makefile.in, but that
doesn't seem to work, and there are no instructions that I can find on
building, I've checked the Readme
It's in INSTALL, though a little too detailed (I guess this INSTALL file
is just Autotool's one with slight modifications)
Post by Tory Gaurnier
, and the FAQ. Have any of you guys
built CTags before and can point me in the right direction???
You need to first generate the configure script using `autoreconf`, then
run that configure script (`./configure [OPTIONS]`, which will generate
autoreconf -v && ./configure && make
Regards,
Colomban
Ok, so now when I build it, I'm getting some warning, I'm not sure if
these are normal or if something needs to be configured, I'm getting
[...]
Those are "normal" and harmless. Actually this means the CTags guys
should fix a little thing in their configure.ac but that's no biggie and
not your problem.
Post by Tory Gaurnier
Then the rest appears normal.
Good :)
Post by Tory Gaurnier
Then when I run, the program segfaults on freeParserResources () at
parse.c:364
Which is this line of code: eFree (lang->name);
Which is being called from main.c:572
Now my findQMLTags function in my qml.c file is very closely following
the awk.c function findAwkTags, so I don't see how it could be caused by
this, but I may be wrong.
You should not manually set def->name, this is set by parserNew() as the
name you give it. And the reason it segfaults is because it should be
an allocated string -- but again, you should just not touch it.
Post by Tory Gaurnier
----CODE STARTS HERE----
#include "general.h" /* always include first */
#include <string.h> /* to declare strxxx() functions */
you should include <ctype.h> for isspace() and isalnum().
Post by Tory Gaurnier
#include "parse.h" /* always include */
#include "read.h" /* to define file fileReadLine() */
[...]
extern parserDefinition *QMLParser(void) {
parserDefinition* def = parserNew("QML");
static const char *const extensions [] = { "QML", NULL };
def->name = "QML";
here, remove this line.
Post by Tory Gaurnier
def->kinds = QMLKinds;
def->kindCount = KIND_COUNT(QMLKinds);
def->extensions = extensions;
def->parser = findQMLTags;
//def->parser2; // Not sure I will need this
parser2 is for "retry parsers", e.g. if your parser should use an
alternative algorithm or something if it encountered something in the
middle of the file. This is rarely needed. Fortran parser uses it to
switch to free form if struct form failed, and C one uses it to try a
different branch conditional method.
Post by Tory Gaurnier
def->regex = FALSE;
you don't need to set this, it's the default -- though, it's harmless to
set it again.
Post by Tory Gaurnier
return def;
}
----CODE ENDS HERE----
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Just thought I would give you guys an update, it's coming along quite
nicely now, it can successfully find all the Javascript functions and
QML Objects, now I'm just working on getting the IDs of the QML Objects
if they exist, and I've pretty much figured out how that part's going to
work.
Tory Gaurnier
2013-09-20 19:00:55 UTC
Permalink
Post by Colomban Wendling
Post by Tory Gaurnier
Post by Colomban Wendling
Post by Tory Gaurnier
[...]
So, the issue now is I can't really figure out how to build CTags, from
what I could figure out it seems I need to run the configure script to
add values to the Makefile.in, then run make -f Makefile.in, but that
doesn't seem to work, and there are no instructions that I can find on
building, I've checked the Readme
It's in INSTALL, though a little too detailed (I guess this INSTALL file
is just Autotool's one with slight modifications)
Post by Tory Gaurnier
, and the FAQ. Have any of you guys
built CTags before and can point me in the right direction???
You need to first generate the configure script using `autoreconf`, then
run that configure script (`./configure [OPTIONS]`, which will generate
autoreconf -v && ./configure && make
Regards,
Colomban
Ok, so now when I build it, I'm getting some warning, I'm not sure if
these are normal or if something needs to be configured, I'm getting
[...]
Those are "normal" and harmless. Actually this means the CTags guys
should fix a little thing in their configure.ac but that's no biggie and
not your problem.
Post by Tory Gaurnier
Then the rest appears normal.
Good :)
Post by Tory Gaurnier
Then when I run, the program segfaults on freeParserResources () at
parse.c:364
Which is this line of code: eFree (lang->name);
Which is being called from main.c:572
Now my findQMLTags function in my qml.c file is very closely following
the awk.c function findAwkTags, so I don't see how it could be caused by
this, but I may be wrong.
You should not manually set def->name, this is set by parserNew() as the
name you give it. And the reason it segfaults is because it should be
an allocated string -- but again, you should just not touch it.
Post by Tory Gaurnier
----CODE STARTS HERE----
#include "general.h" /* always include first */
#include <string.h> /* to declare strxxx() functions */
you should include <ctype.h> for isspace() and isalnum().
Post by Tory Gaurnier
#include "parse.h" /* always include */
#include "read.h" /* to define file fileReadLine() */
[...]
extern parserDefinition *QMLParser(void) {
parserDefinition* def = parserNew("QML");
static const char *const extensions [] = { "QML", NULL };
def->name = "QML";
here, remove this line.
Post by Tory Gaurnier
def->kinds = QMLKinds;
def->kindCount = KIND_COUNT(QMLKinds);
def->extensions = extensions;
def->parser = findQMLTags;
//def->parser2; // Not sure I will need this
parser2 is for "retry parsers", e.g. if your parser should use an
alternative algorithm or something if it encountered something in the
middle of the file. This is rarely needed. Fortran parser uses it to
switch to free form if struct form failed, and C one uses it to try a
different branch conditional method.
Post by Tory Gaurnier
def->regex = FALSE;
you don't need to set this, it's the default -- though, it's harmless to
set it again.
Post by Tory Gaurnier
return def;
}
----CODE ENDS HERE----
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Well, it's actually proving more difficult then I thought to get the ID,
what I was planning on doing is when my function finds a valid Object,
it would store the name and continue to loop through the lines until it
either finds an ID or '}' (unless of course another '{' was found, for
instance if for some reason someone put a function before an ID
declaration in an Item/Component, I was prepared for this stuff ;] ),
and in the mean time while it was scanning it would still be on the
lookout for Javascript functions and add them when it sees them, then
when it was ready (found ID or end of Object), it would create the tag,
however, I reallized that it's probably getting the line # to point at
from the current line number in File when you actually create the tag,
so I traced down the functions, and it appears to be the case, so with
that method it would most definitely not be pointing at the correct line
for the tag.

So here is my question, does anyone know if another filetype is already
doing something similar to this (scanning ahead to find aditional info
before adding the tag) so I can study it? Or is there maybe a way I can
copy File.fp so I can scan ahead on that one without affecting File? Or
is there a way to rewind File to a specific point (this would probably
be the easiest method)? If I rewind File.fp will it update all the other
info (File.lineNumber, File.filePosition, etc.) with it? I'm just weary
about editing File itself because it's kinda hard to trace down how it's
managed.
Matthew Brush
2013-09-20 20:18:18 UTC
Permalink
Post by Tory Gaurnier
[...]
Well, it's actually proving more difficult then I thought to get the ID,
what I was planning on doing is when my function finds a valid Object,
it would store the name and continue to loop through the lines until it
either finds an ID or '}' (unless of course another '{' was found, for
instance if for some reason someone put a function before an ID
declaration in an Item/Component, I was prepared for this stuff ;] ),
and in the mean time while it was scanning it would still be on the
lookout for Javascript functions and add them when it sees them, then
when it was ready (found ID or end of Object), it would create the tag,
however, I reallized that it's probably getting the line # to point at
from the current line number in File when you actually create the tag,
so I traced down the functions, and it appears to be the case, so with
that method it would most definitely not be pointing at the correct line
for the tag.
I've never written a CTags parser, but writing other parsers, a common
technique is to use a stack data structure and each time you encounter a
`{`, you push a new "scope" onto the stack and each time you encounter a
`}`, you pop the top "scope" off of the stack. This way when you
encounter an `id:` token, you go (in pseudo-code):

if (iHaveFoundAnId)
theScopeStack->peekTop()->setId(theId);

And you'll always be putting the id on the right thing. It also works
good for scoping sub-objects or whatever else too:

if (iHaveFoundASubObjectDecl) {
// Add theObject to the current scope
theScopeStack->peekTop()->addChild(theObject);
}

I'm not sure this is at all relevant in the context of a CTags parser,
but maybe it'll give some ideas.

Cheers,
Matthew Brush
Colomban Wendling
2013-09-21 00:03:30 UTC
Permalink
[...],
however, I reallized that it's probably getting the line # to point at
from the current line number in File when you actually create the tag,
so I traced down the functions, and it appears to be the case, so with
that method it would most definitely not be pointing at the correct line
for the tag.
So here is my question, does anyone know if another filetype is already
doing something similar to this (scanning ahead to find aditional info
before adding the tag) so I can study it? Or is there maybe a way I can
copy File.fp so I can scan ahead on that one without affecting File? Or
is there a way to rewind File to a specific point (this would probably
be the easiest method)? If I rewind File.fp will it update all the other
info (File.lineNumber, File.filePosition, etc.) with it? I'm just weary
about editing File itself because it's kinda hard to trace down how it's
managed.
To do that, normally you store the File.lineNumber/File.filePosition at
the location you want to generate the tag, and use initTagEntry() and
makeTagEntry() instead of simpler but dumber makeSimpleTag():

createMyTag(qmlKind kind, const char *name, ...) {
tagEntryInfo entry;

initTagEntry (&entry, name);
entry.lineNumber = savedLineNumber;
entry.filePosition = savedFilePosition;
entry.kindName = QMLKinds[kind].name;
entry.kind = (char) QMLKinds[kind].letter;

makeTagEntry (&entry);
}

See e.g. Geany's PHP parser functions makeNamespacePhpTag() or
makeSimplePhpTag().


Regards,
Colomban
Tory Gaurnier
2013-09-22 08:09:19 UTC
Permalink
Post by Colomban Wendling
[...],
however, I reallized that it's probably getting the line # to point at
from the current line number in File when you actually create the tag,
so I traced down the functions, and it appears to be the case, so with
that method it would most definitely not be pointing at the correct line
for the tag.
So here is my question, does anyone know if another filetype is already
doing something similar to this (scanning ahead to find aditional info
before adding the tag) so I can study it? Or is there maybe a way I can
copy File.fp so I can scan ahead on that one without affecting File? Or
is there a way to rewind File to a specific point (this would probably
be the easiest method)? If I rewind File.fp will it update all the other
info (File.lineNumber, File.filePosition, etc.) with it? I'm just weary
about editing File itself because it's kinda hard to trace down how it's
managed.
To do that, normally you store the File.lineNumber/File.filePosition at
the location you want to generate the tag, and use initTagEntry() and
createMyTag(qmlKind kind, const char *name, ...) {
tagEntryInfo entry;
initTagEntry (&entry, name);
entry.lineNumber = savedLineNumber;
entry.filePosition = savedFilePosition;
entry.kindName = QMLKinds[kind].name;
entry.kind = (char) QMLKinds[kind].letter;
makeTagEntry (&entry);
}
See e.g. Geany's PHP parser functions makeNamespacePhpTag() or
makeSimplePhpTag().
Regards,
Colomban
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Sorry for the late reply, been super busy at work. But this is exactly
what I needed, thanks! I could tell makeSimpleTag() was a convenience
function but for some reason I was having trouble finding where and how
makeTagEntry was being used. I seem to have it working, when I run ctags
with a QML file now it prints js functions and QML Objects, and if it
finds their id it prints that as well.
Here's a sample of what it prints:
Item main.qml /^Item {$/;" o
Timer createLibraryTimer main.qml /^ Timer {$/;" o
Timer firstRunTimer main.qml /^ Timer {$/;" o
Timer loadLibraryTimer main.qml /^ Timer {$/;" o
Timer scanFoldersTimer main.qml /^ Timer {$/;" o
testFunc1 main.qml /^ function testFunc1(variable) {$/;" f
testFunc2 main.qml /^ function testFunc2() {$/;" f


Does that look about right?
One thing I notice is I don't see line numbers on output, is there an
option I have to run ctags with to show the line numbers maybe?
Matthew Brush
2013-09-22 09:06:54 UTC
Permalink
Post by Tory Gaurnier
[...]
One thing I notice is I don't see line numbers on output, is there an
option I have to run ctags with to show the line numbers maybe?
--excmd=number

Cheers,
Matthew Brush
Tory Gaurnier
2013-09-22 18:10:24 UTC
Permalink
Post by Matthew Brush
Post by Tory Gaurnier
[...]
One thing I notice is I don't see line numbers on output, is there an
option I have to run ctags with to show the line numbers maybe?
--excmd=number
Cheers,
Matthew Brush
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Haha, it's a good thing I made sure to test the line numbers, I
accidentally had File.currentLine being assigned to lineNumber :P Here I
should have noticed, because I casted it to a unsigned long do to
warnings about converting a pointer to an integer.

Anyways the ctags portion seems to be finished, it works as expected, so
I'm going to find out how to submit it to the ctags team to be included
in the code, and I'm going to look at how to add it to Geany.

Thanks for all the help guys :D
Tory Gaurnier
2013-09-22 18:50:21 UTC
Permalink
Post by Matthew Brush
Post by Tory Gaurnier
[...]
One thing I notice is I don't see line numbers on output, is there an
option I have to run ctags with to show the line numbers maybe?
--excmd=number
Cheers,
Matthew Brush
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
So now I'm waiting on a reply from the ctags team, so I can find out how
to submit my code to their project, and in the mean time I want to learn
how I'll be adding to Geany, from what I can find it looks like I'd be
submitting the patch via git, but I've never used git before, and I
can't really find any detailed directions on the Geany hacking page, so
could you guys, once again, point me in the right direction? Also, git
actually downloads the source right? I ask because I want to do this
right, not sure if I'm supposed to manually download the source to start
working on it or use git to download it.

And thanks for all the help, I know I'm a total noob with this stuff,
I've honestly never even edited/contributed to someone elses code until
now (well, with the exception of helping a fellow student with homework
;] ).
Tory Gaurnier
2013-09-23 18:36:47 UTC
Permalink
So far what I can tell by looking at the Geany source, I added my qml.c
file to the ctags folder, in qml.c I only changed one variable type,
filePosition (from fpos_t to MIOPos). I edited parsers.h adding my qml
parser to the end of the list, I edited the Makefile to add qml.c, then
in filetypes.h I added the qml filetype id to the enum list, then in
filetypes.c I added it as such:
#define QML
ft = filetypes[GEANY_FILETYPES_QML];
ft->lang = 45; // 45th in the ctags list, I was supposed to do
this, right?
ft->name = g_strdup("QML");
filetype_make_title(ft, TITLE_SOURCE_FILE);
ft->mime_type = g_strdup("text/x-qml");
ft->group = GEANY_FILETYPE_GROUP_MISC;

It compiles fine, and runs, but it's not showing up under filetypes.

There must be something I'm missing but I just can't seem to find it.
Tory Gaurnier
2013-09-23 18:37:22 UTC
Permalink
So far what I can tell by looking at the Geany source, I added my qml.c
file to the ctags folder, in qml.c I only changed one variable type,
filePosition (from fpos_t to MIOPos). I edited parsers.h adding my qml
parser to the end of the list, I edited the Makefile to add qml.c, then
in filetypes.h I added the qml filetype id to the enum list, then in
filetypes.c I added it as such:
#define QML
ft = filetypes[GEANY_FILETYPES_QML];
ft->lang = 45; // 45th in the ctags list, I was supposed to do
this, right?
ft->name = g_strdup("QML");
filetype_make_title(ft, TITLE_SOURCE_FILE);
ft->mime_type = g_strdup("text/x-qml");
ft->group = GEANY_FILETYPE_GROUP_MISC;

It compiles fine, and runs, but it's not showing up under filetypes.

There must be something I'm missing but I just can't seem to find it.
Tory Gaurnier
2013-09-23 18:56:10 UTC
Permalink
Post by Tory Gaurnier
So far what I can tell by looking at the Geany source, I added my
qml.c file to the ctags folder, in qml.c I only changed one variable
type, filePosition (from fpos_t to MIOPos). I edited parsers.h adding
my qml parser to the end of the list, I edited the Makefile to add
qml.c, then in filetypes.h I added the qml filetype id to the enum
#define QML
ft = filetypes[GEANY_FILETYPES_QML];
ft->lang = 45; // 45th in the ctags list, I was supposed to do
this, right?
ft->name = g_strdup("QML");
filetype_make_title(ft, TITLE_SOURCE_FILE);
ft->mime_type = g_strdup("text/x-qml");
ft->group = GEANY_FILETYPE_GROUP_MISC;
It compiles fine, and runs, but it's not showing up under filetypes.
There must be something I'm missing but I just can't seem to find it.
Ok, well, I forgot about the lexer part, so I added it in in the same
way Javascript is, in highlightingmappings.h I added this:
/* QML */
#define highlighting_lexer_QML SCLEX_CPP
#define highlighting_styles_QML highlighting_styles_C
static const HLKeyword highlighting_keywords_QML[] =
{
{ 0, "primary", FALSE },
{ 1, "secondary", FALSE }
};
#define highlighting_properties_QML highlighting_properties_C

Which is exactly how JS works in this, it's just using the C lexer. In
fact I did a global search for 'JS' in all the source files to see where
it was being added, the only other things I saw were in HTML sections
(for when it's embedded in HTML). So now, I can really say I can't find
anything else, I know I'm still missing something, but I just can't find it.
Tory Gaurnier
2013-09-23 19:02:03 UTC
Permalink
Ok, I'm stepping on my own feet here, ignore my other messages, I just
found all the conf files -_-

I feel really dumb now, I think I'll be able to figure the rest of this
out, but unfortunately I got to go to work now, and I don't get back
till like 10PM, so I'll get started again as soon as I can.

And sorry for all the dumb questions :P
Tory Gaurnier
2013-09-24 20:10:59 UTC
Permalink
Well, I've pretty much got it working, the highlighting is working, and
the Javascript functions show up in the symbol list, it's just not
showing the QML Objects, so once I get that fixed it'll be finished, at
least the first version, I'm sure I'll want to improve it in the future.
Tory Gaurnier
2013-09-24 23:18:14 UTC
Permalink
Post by Tory Gaurnier
Well, I've pretty much got it working, the highlighting is working,
and the Javascript functions show up in the symbol list, it's just not
showing the QML Objects, so once I get that fixed it'll be finished,
at least the first version, I'm sure I'll want to improve it in the
future.
Ok, so now I really am at a loss, my qml.c file works fine in Ctags, but
in Geany it only adds the Javascript functions to the symbol list, I
really can't figure it out. I've looked over everything, I've compared
the differences from Ctags in Geany to the original Ctags, the only real
change that makes a difference that I can see is the fact that the type
for filePosition was changed to MIOPos. I'm pretty sure I've edited the
different config files correctly, everythings working except for the QML
Objects. Now when I'm running Geany I'm running in terminal and there
are 0 errors being printed.

Here's my qml.c file:

#include "general.h" /* always include first */
#include "entry.h"
#include "parse.h" /* always include */
#include "read.h" /* to define file fileReadLine() */

#include <string.h> /* to declare strxxx() functions */

typedef struct {
vString *id;
vString *kind;
vString *name;
unsigned long line_num;
MIOPos file_pos; // THIS IS THE ONLY THING I'VE CHANGED FROM THE
CTAGS VERSION
char *kind_name;
char kind_letter;
} QMLObject;

typedef enum {
QML_OBJECT,
JS_FUNCTION,
KIND_COUNT
} QMLKind;

static kindOption QMLKinds[KIND_COUNT] = {
{ TRUE, 'o', "object", "objects" },
{ TRUE, 'f', "function", "functions" }
};

const unsigned char* skipMultilineComment(const unsigned char *line) {
boolean found = FALSE;

while(*line != '\0') {
if(strncmp(line, "*/", 2) == 0) {
line += 2;
found = TRUE;
break;
}

line++;
}

if(found) line = NULL;

return line;
}

void createQMLObjectTag(QMLObject *qml_obj, boolean *is_qml_object) {
tagEntryInfo entry;

// Added this line here to test, and it's printing fine, all values
are there
printf("%s - %d - %s - %c\n", qml_obj->name->buffer,
(int)qml_obj->line_num, qml_obj->kind_name, qml_obj->kind_letter);

initTagEntry(&entry, qml_obj->name->buffer);
entry.lineNumber = qml_obj->line_num;
entry.filePosition = qml_obj->file_pos;
entry.kindName = qml_obj->kind_name;
entry.kind = qml_obj->kind_letter;
makeTagEntry(&entry); // WHY YOU NO MAKE TAG IN SYMBOL LIST!!!! >_<

vStringClear(qml_obj->name);
vStringDelete(qml_obj->name);

*is_qml_object = FALSE;
}

vString* getName(const unsigned char **str_ptr) {
vString *name = vStringNew();
const unsigned char *str = *str_ptr;

while(isalnum(*str) || *str == '_') {
vStringPut(name, *str);
str++;
}

*str_ptr = str;
vStringTerminate(name);
return name;
}

vString *getId(const unsigned char *str, vString *name) {
vString *id = vStringNew();

while(strstr(str, "id:") != NULL) {
if(strncmp(str, "id:", 3) == 0) {
str += 3;
while(isspace(*str)) str++;
id = getName(&str);
vStringCatS(name, " ");
vStringCat(name, id);
}

else str++;
}

vStringClear(id);
vStringDelete(id);
return name;
}

static void findQMLTags(void) {
vString *js_name;
QMLObject *qml_obj = malloc(sizeof(QMLObject));
const unsigned char *line;
boolean is_multiline_comment = FALSE;
boolean is_qml_object = FALSE;

while((line = fileReadLine()) != NULL) {
// If in middle of multiline comment, skip through till end
if(is_multiline_comment) {
if((line = skipMultilineComment(line)) == NULL) continue;
else is_multiline_comment = FALSE;
}

// Skip whitespace and comments
while(isspace(*line)) line++;
if(strncmp(line, "//", 2) == 0) continue;
if(strncmp(line, "/*", 2) == 0) {
is_multiline_comment = TRUE;
if((line = skipMultilineComment(line)) == NULL) continue;
else is_multiline_comment = FALSE;
}

// If in middle of QML Object { } check for ID and '}'
if(is_qml_object && (strstr(line, "id:") != NULL ||
strchr(line, '}') != NULL)) {
if(strstr(line, "id:") != NULL)
qml_obj->name = getId(line, qml_obj->name);

else createQMLObjectTag(qml_obj, &is_qml_object);
}

// If '{' in line, but '(' not in line, then there might be a
QML Object
if(strchr(line, '{') != NULL && strchr(line, '(') == NULL) {
int i = 0;
while(isspace(*line)) line++; // Increment ptr past any
whitespace before 'Object {'
// Search past whole word of 'Object'
while(!isspace(line[i])) {
if(line[i] == '{' || line[i] == ':') break;
i++;
}

while(isspace(line[i])) i++; // Search past any space
between 'Object' and '{'

// If '{' is after potential Object name and any
whitespace, prepare tag to be added
if(line[i] == '{') {
qml_obj->name = getName(&line);
qml_obj->line_num = File.lineNumber;
qml_obj->file_pos = File.filePosition;
qml_obj->kind_name = (char*)QMLKinds[QML_OBJECT].name;
qml_obj->kind_letter = QMLKinds[QML_OBJECT].letter;
qml_obj->kind = QML_OBJECT;
is_qml_object = TRUE;

// If ID is on same line
if(strstr(line, "id:") != NULL) {
while(strncmp(line, "id:", 3) != 0) line++;
qml_obj->name = getId(line, qml_obj->name);
}

// If single line Object
if(strchr(line, '}') != NULL)
createQMLObjectTag(qml_obj, &is_qml_object);
}
}

// If line contains a function
// Using while to prepare for unlikely event that "function"
appears more than once in line
while(strstr(line, "function") != NULL) {
while(strncmp(line, "function", 8) != 0) line++;

// If whitespace is after "function"
if(isspace(line[8])) {
line += 8; // Skip past "function"

while(isspace(*line)) line++;

vString *name = getName(&line);

while(isspace(*line)) line++;

// If '(' is after "function" and whitespace, then add
tag as JS_FUNCTION
if(*line == '(') makeSimpleTag(name, QMLKinds,
JS_FUNCTION);
vStringClear(name);
vStringDelete(name);

break;
}

else line++;
}
}
}

extern parserDefinition *QMLParser(void) {
parserDefinition* def = parserNew("QML");
static const char *const extensions [] = { "qml", NULL };

def->kinds = QMLKinds;
def->kindCount = KIND_COUNT(QMLKinds);
def->extensions = extensions;
def->parser = findQMLTags;
def->regex = FALSE;

return def;
}
Tory Gaurnier
2013-09-25 18:55:40 UTC
Permalink
Post by Tory Gaurnier
Post by Tory Gaurnier
Well, I've pretty much got it working, the highlighting is working,
and the Javascript functions show up in the symbol list, it's just
not showing the QML Objects, so once I get that fixed it'll be
finished, at least the first version, I'm sure I'll want to improve
it in the future.
Ok, so now I really am at a loss, my qml.c file works fine in Ctags,
but in Geany it only adds the Javascript functions to the symbol list,
I really can't figure it out. I've looked over everything, I've
compared the differences from Ctags in Geany to the original Ctags,
the only real change that makes a difference that I can see is the
fact that the type for filePosition was changed to MIOPos. I'm pretty
sure I've edited the different config files correctly, everythings
working except for the QML Objects. Now when I'm running Geany I'm
running in terminal and there are 0 errors being printed.
#include "general.h" /* always include first */
#include "entry.h"
#include "parse.h" /* always include */
#include "read.h" /* to define file fileReadLine() */
#include <string.h> /* to declare strxxx() functions */
typedef struct {
vString *id;
vString *kind;
vString *name;
unsigned long line_num;
MIOPos file_pos; // THIS IS THE ONLY THING I'VE CHANGED FROM THE
CTAGS VERSION
char *kind_name;
char kind_letter;
} QMLObject;
typedef enum {
QML_OBJECT,
JS_FUNCTION,
KIND_COUNT
} QMLKind;
static kindOption QMLKinds[KIND_COUNT] = {
{ TRUE, 'o', "object", "objects" },
{ TRUE, 'f', "function", "functions" }
};
const unsigned char* skipMultilineComment(const unsigned char *line) {
boolean found = FALSE;
while(*line != '\0') {
if(strncmp(line, "*/", 2) == 0) {
line += 2;
found = TRUE;
break;
}
line++;
}
if(found) line = NULL;
return line;
}
void createQMLObjectTag(QMLObject *qml_obj, boolean *is_qml_object) {
tagEntryInfo entry;
// Added this line here to test, and it's printing fine, all
values are there
printf("%s - %d - %s - %c\n", qml_obj->name->buffer,
(int)qml_obj->line_num, qml_obj->kind_name, qml_obj->kind_letter);
initTagEntry(&entry, qml_obj->name->buffer);
entry.lineNumber = qml_obj->line_num;
entry.filePosition = qml_obj->file_pos;
entry.kindName = qml_obj->kind_name;
entry.kind = qml_obj->kind_letter;
makeTagEntry(&entry); // WHY YOU NO MAKE TAG IN SYMBOL LIST!!!! >_<
vStringClear(qml_obj->name);
vStringDelete(qml_obj->name);
*is_qml_object = FALSE;
}
vString* getName(const unsigned char **str_ptr) {
vString *name = vStringNew();
const unsigned char *str = *str_ptr;
while(isalnum(*str) || *str == '_') {
vStringPut(name, *str);
str++;
}
*str_ptr = str;
vStringTerminate(name);
return name;
}
vString *getId(const unsigned char *str, vString *name) {
vString *id = vStringNew();
while(strstr(str, "id:") != NULL) {
if(strncmp(str, "id:", 3) == 0) {
str += 3;
while(isspace(*str)) str++;
id = getName(&str);
vStringCatS(name, " ");
vStringCat(name, id);
}
else str++;
}
vStringClear(id);
vStringDelete(id);
return name;
}
static void findQMLTags(void) {
vString *js_name;
QMLObject *qml_obj = malloc(sizeof(QMLObject));
const unsigned char *line;
boolean is_multiline_comment = FALSE;
boolean is_qml_object = FALSE;
while((line = fileReadLine()) != NULL) {
// If in middle of multiline comment, skip through till end
if(is_multiline_comment) {
if((line = skipMultilineComment(line)) == NULL) continue;
else is_multiline_comment = FALSE;
}
// Skip whitespace and comments
while(isspace(*line)) line++;
if(strncmp(line, "//", 2) == 0) continue;
if(strncmp(line, "/*", 2) == 0) {
is_multiline_comment = TRUE;
if((line = skipMultilineComment(line)) == NULL) continue;
else is_multiline_comment = FALSE;
}
// If in middle of QML Object { } check for ID and '}'
if(is_qml_object && (strstr(line, "id:") != NULL ||
strchr(line, '}') != NULL)) {
if(strstr(line, "id:") != NULL)
qml_obj->name = getId(line, qml_obj->name);
else createQMLObjectTag(qml_obj, &is_qml_object);
}
// If '{' in line, but '(' not in line, then there might be a
QML Object
if(strchr(line, '{') != NULL && strchr(line, '(') == NULL) {
int i = 0;
while(isspace(*line)) line++; // Increment ptr past any
whitespace before 'Object {'
// Search past whole word of 'Object'
while(!isspace(line[i])) {
if(line[i] == '{' || line[i] == ':') break;
i++;
}
while(isspace(line[i])) i++; // Search past any space
between 'Object' and '{'
// If '{' is after potential Object name and any
whitespace, prepare tag to be added
if(line[i] == '{') {
qml_obj->name = getName(&line);
qml_obj->line_num = File.lineNumber;
qml_obj->file_pos = File.filePosition;
qml_obj->kind_name = (char*)QMLKinds[QML_OBJECT].name;
qml_obj->kind_letter = QMLKinds[QML_OBJECT].letter;
qml_obj->kind = QML_OBJECT;
is_qml_object = TRUE;
// If ID is on same line
if(strstr(line, "id:") != NULL) {
while(strncmp(line, "id:", 3) != 0) line++;
qml_obj->name = getId(line, qml_obj->name);
}
// If single line Object
if(strchr(line, '}') != NULL)
createQMLObjectTag(qml_obj, &is_qml_object);
}
}
// If line contains a function
// Using while to prepare for unlikely event that "function"
appears more than once in line
while(strstr(line, "function") != NULL) {
while(strncmp(line, "function", 8) != 0) line++;
// If whitespace is after "function"
if(isspace(line[8])) {
line += 8; // Skip past "function"
while(isspace(*line)) line++;
vString *name = getName(&line);
while(isspace(*line)) line++;
// If '(' is after "function" and whitespace, then add
tag as JS_FUNCTION
if(*line == '(') makeSimpleTag(name, QMLKinds,
JS_FUNCTION);
vStringClear(name);
vStringDelete(name);
break;
}
else line++;
}
}
}
extern parserDefinition *QMLParser(void) {
parserDefinition* def = parserNew("QML");
static const char *const extensions [] = { "qml", NULL };
def->kinds = QMLKinds;
def->kindCount = KIND_COUNT(QMLKinds);
def->extensions = extensions;
def->parser = findQMLTags;
def->regex = FALSE;
return def;
}
Still can't figure it out, to test I even put printf("MAKING TAG: %s -
%d - %s - %c\n", tag->name, (int)tag->lineNumber, tag->kindName,
tag->kind); in entry.c's makeTagEntry function, and it prints just as
you'd expect, it prints the info for QML objects and JS functions, but
only the JS functions show in the symbol list, I've tried tracing it
back further but can't even figure it out. But, I mean, if makeTagEntry
is getting all the data, it should be adding to symbol list right???

This is getting very frustrating, I've looked over my code a million
times and I can't find anything that would be keeping this from working,
it works fine in CTags, but not in Geany, makeSimpleTag works fine, but
when I try to manually use makeTagEntry, nothing happens, even though
makeSimpleTag is doing the exact same thing...
Colomban Wendling
2013-09-25 19:51:37 UTC
Permalink
Post by Tory Gaurnier
[...]
Still can't figure it out, to test I even put printf("MAKING TAG: %s -
%d - %s - %c\n", tag->name, (int)tag->lineNumber, tag->kindName,
tag->kind); in entry.c's makeTagEntry function, and it prints just as
you'd expect, it prints the info for QML objects and JS functions, but
only the JS functions show in the symbol list, I've tried tracing it
back further but can't even figure it out. But, I mean, if makeTagEntry
is getting all the data, it should be adding to symbol list right???
This is getting very frustrating, I've looked over my code a million
times and I can't find anything that would be keeping this from working,
it works fine in CTags, but not in Geany, makeSimpleTag works fine, but
when I try to manually use makeTagEntry, nothing happens, even though
makeSimpleTag is doing the exact same thing...
Geany requires the tag type long name to be one of the known ones as
seen in tagmanager/src/tm_tag.c:s_tag_type_names[] array. This is to
translate them to a numeric ID we use internally. And no, unknown name
don't become tm_tag_other_t but tm_tag_undef_t.

Also, not all types may be displayed,
src/symbols.c:tag_list_add_groups() decides which type are displayed as
what -- if your language don't follow the common
function/class/interface/structure/variables/… scheme you may want to
add your language-specific case to give the proper title to the groups.

Regards,
Colomban
Tory Gaurnier
2013-09-26 07:30:48 UTC
Permalink
Post by Colomban Wendling
Post by Tory Gaurnier
[...]
Still can't figure it out, to test I even put printf("MAKING TAG: %s -
%d - %s - %c\n", tag->name, (int)tag->lineNumber, tag->kindName,
tag->kind); in entry.c's makeTagEntry function, and it prints just as
you'd expect, it prints the info for QML objects and JS functions, but
only the JS functions show in the symbol list, I've tried tracing it
back further but can't even figure it out. But, I mean, if makeTagEntry
is getting all the data, it should be adding to symbol list right???
This is getting very frustrating, I've looked over my code a million
times and I can't find anything that would be keeping this from working,
it works fine in CTags, but not in Geany, makeSimpleTag works fine, but
when I try to manually use makeTagEntry, nothing happens, even though
makeSimpleTag is doing the exact same thing...
Geany requires the tag type long name to be one of the known ones as
seen in tagmanager/src/tm_tag.c:s_tag_type_names[] array. This is to
translate them to a numeric ID we use internally. And no, unknown name
don't become tm_tag_other_t but tm_tag_undef_t.
Also, not all types may be displayed,
src/symbols.c:tag_list_add_groups() decides which type are displayed as
what -- if your language don't follow the common
function/class/interface/structure/variables/… scheme you may want to
add your language-specific case to give the proper title to the groups.
Regards,
Colomban
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Thanks, that's just what I needed, for now I'm just going to make it the
"other" tag type (since it doesn't really fit into any of the other
categories), and if the Geany team would be willing to accept it I will
try to eventually add an "object" tag type. I'm not sure how much would
have to go into trying to get that to work.

Otherwise it's working perfectly, JS functions are detected and shown
under Functions in the symbol list, and Objects are shown under Other,
if you have Item {} it will just show as 'Item', but if you have
something like Item {id: myItem} it will show 'Item: myItem' in the
symbol list. But the line numbers point directly at the 'Item {' itself.
Tory Gaurnier
2013-09-26 10:09:42 UTC
Permalink
Ok, so I've been looking at git, and I kinda got it figured out, I
cloned the master branch from GitHub to my computer, branched it, then I
copied over my updated files, and commited the changes, so now I have a
few questions. First of all using 'git add' after you configure and make
the source it ignores all the extra files right? And how do I go about
submitting it to be reviewed? Do I just 'git push'? Or do I have to make
a branch on GitHub and push it there?
Lex Trotman
2013-09-26 10:33:57 UTC
Permalink
Ok, so I've been looking at git, and I kinda got it figured out, I cloned
the master branch from GitHub to my computer, branched it, then I copied
over my updated files, and commited the changes, so now I have a few
questions. First of all using 'git add' after you configure and make the
source it ignores all the extra files right? And how do I go about
submitting it to be reviewed? Do I just 'git push'? Or do I have to make a
branch on GitHub and push it there?
The process is:

1. Make a fork on github, that is your personal copy you can change as much
as you like
2. clone it to your computer and change it and push the changes back to
your github fork, make your changes on a branch other than master, eg
add_qml
3. when it reaches a suitable quality level (there is a warning there :)
create a pull request asking for the changes to be incorporated into master

See the github documentation on those steps, IMHO Github doco isn't
terrible well organised, but google is your friend

Cheers
Lex
______________________________**_________________
Devel mailing list
https://lists.geany.org/cgi-**bin/mailman/listinfo/devel<https://lists.geany.org/cgi-bin/mailman/listinfo/devel>
Tory Gaurnier
2013-09-30 18:56:58 UTC
Permalink
So far so good, I've completely re-vamped the qml.c file, so it
correctly recurses into tags, and I've added support for all possible
QML Objects and Javascript functions (including signal frunctions, like
Component.onCompleted, it won't point to a declaration of a signal like
signal my_signal(), but it'll point to onMy_signal: {}).

But now I have a question, I've been looking at c.c to see how it makes
the tree stucture in the symbol list, from what I can tell it's
extensionFields.scope that's behind it, is that correct? Is there
anything else that needs to be set to accomplish this? And what do you
set the values of extensionFields.scope to? It looks to me like this:
extensionFields.scope[0] = parentKindName;
extensionFields.scope[1] = parentName;

Is this correct? I did notice that in the c.c file it appears to
reverse-recurse (whatever you'd call that :P) all the way up to the root
parent of the tag, making the extensionFields.scope[1] something like this:
parent1Name::parent2Name::parent3Name::rootParentName, but the '::' may
be a '.' depending on the language in question. Am I reading it correctly?

Anyways, I'm just trying to figure out how to set the scope of each tag,
for "sub-tags", or a tree structure in the symbol list, right now
everthing just appears in a simple list under "Functions" and "Other".

Also, (sorry for so many questions), it appears that you can only
recurse once in the symbol list, is this correct? Only two scopes so to
speak, parent and child, no grandchild, so, for example, you can have this:
Other
TagParent
TagChild

But not this:
Other
TagParent
TagChild
TagGrandChild

Is this correct?

I hope my questions make sense, I'll continue to research this on my own
(when I'm not working that is ;] ), but I'd appreciate any help if
possible. Thanks.
Tory Gaurnier
2013-09-26 20:40:51 UTC
Permalink
Well I've got git pretty well figured out, but I'm going to further test
my code and search for bugs before I do a push request (or pull request,
whatever it's called :P).

Also, I reallized I'm going to want to make use of scope, for the QML
objects I need to be able to recurse into other QML objects, so instead
of just showing a huge list of qml objects they'll be in a tree format
in the symbol list, and I'm probably going to have Functions inside of
the QML objects, only the Functions at root level will show under
Functions in the symbol list.

For anyone familiar with QML, does that sound like a good way to go
about this?
Matthew Brush
2013-09-27 02:14:43 UTC
Permalink
Post by Tory Gaurnier
Well I've got git pretty well figured out, but I'm going to further test
my code and search for bugs before I do a push request (or pull request,
whatever it's called :P).
Also, I reallized I'm going to want to make use of scope, for the QML
objects I need to be able to recurse into other QML objects, so instead
of just showing a huge list of qml objects they'll be in a tree format
in the symbol list, and I'm probably going to have Functions inside of
the QML objects, only the Functions at root level will show under
Functions in the symbol list.
For anyone familiar with QML, does that sound like a good way to go
about this?
I would model it after existing languages. In C++, Vala and Python when
you scope a class inside another class it's hierarchical in the symbols
tree.

Cheers,
Matthew Brush
Tory Gaurnier
2013-10-05 15:25:55 UTC
Permalink
Just thought I'd give everyone an update, it's still coming along, I
have the tree view in the symbol list working as expected (it was easier
than I thought, I was overcomplicating it at first), right now I'm
working on cleaning up my code, and optimizing certain things.

I would be done by now if I wasn't working so much, but I should have
QML support finished within the next few days (if I have the time I'll
get it finished tonight). Then I'll be ready to submit my work to ctags,
and Geany.
Lex Trotman
2013-10-06 00:12:25 UTC
Permalink
Just thought I'd give everyone an update, it's still coming along, I have
the tree view in the symbol list working as expected (it was easier than I
thought, I was overcomplicating it at first), right now I'm working on
cleaning up my code, and optimizing certain things.
I would be done by now if I wasn't working so much, but I should have QML
support finished within the next few days (if I have the time I'll get it
finished tonight). Then I'll be ready to submit my work to ctags, and Geany.
One thing you could do to assist is to make a test suite for the tag
parser, see the preliminary ones Colomban has been adding. Another thing
is to see if you can get others to use and comment on the filetype. There
is some reluctance to commit new filetypes for languages that the Geany
devs don't know, because of the effort required to learn the language to
tell if the colouring and symbology make sense. Having more than one user
of the filetype makes it more likely that it will be "just accepted".

Cheers
Lex
______________________________**_________________
Devel mailing list
https://lists.geany.org/cgi-**bin/mailman/listinfo/devel<https://lists.geany.org/cgi-bin/mailman/listinfo/devel>
Tory Gaurnier
2013-10-07 19:01:24 UTC
Permalink
Well I've run into quite a strange bug, and I'm wondering if anyone has
had a similar issue. It's working as expected when you first open a QML
file, it finds all the tags and places them in a hierarchy/tree
structure in the symbol list, however, when you do something that causes
it to refresh (like deleting a bracket or something else), then it
suddenly removes a whole bunch of the tags from the symbol list and it
doesn't add them back no matter what. Doesn't it rerun your whole
filetype.c file every time it refreshes the symbol list?

At first I thought it could be a memory corruption because I didn't yet
have all my malloced values being freed, but I've fixed that, every bit
of memory I allocate is freed now, so it's not that.

What scenarios could possibly cause something like this?
Matthew Brush
2013-10-07 19:13:40 UTC
Permalink
Post by Tory Gaurnier
Well I've run into quite a strange bug, and I'm wondering if anyone has
had a similar issue. It's working as expected when you first open a QML
file, it finds all the tags and places them in a hierarchy/tree
structure in the symbol list, however, when you do something that causes
it to refresh (like deleting a bracket or something else), then it
suddenly removes a whole bunch of the tags from the symbol list and it
doesn't add them back no matter what. Doesn't it rerun your whole
filetype.c file every time it refreshes the symbol list?
At first I thought it could be a memory corruption because I didn't yet
have all my malloced values being freed, but I've fixed that, every bit
of memory I allocate is freed now, so it's not that.
What scenarios could possibly cause something like this?
I've no clue specifically, but if you suspect memory corruption, you
might find some interesting stuff by running Valgrind and checking for
any "invalid read" or "invalid write" messages.

Cheers,
Matthew Brush
Colomban Wendling
2013-10-07 19:23:12 UTC
Permalink
Post by Tory Gaurnier
Well I've run into quite a strange bug, and I'm wondering if anyone has
had a similar issue. It's working as expected when you first open a QML
file, it finds all the tags and places them in a hierarchy/tree
structure in the symbol list, however, when you do something that causes
it to refresh (like deleting a bracket or something else), then it
suddenly removes a whole bunch of the tags from the symbol list and it
doesn't add them back no matter what. Doesn't it rerun your whole
filetype.c file every time it refreshes the symbol list?
At first I thought it could be a memory corruption because I didn't yet
have all my malloced values being freed, but I've fixed that, every bit
of memory I allocate is freed now, so it's not that.
What scenarios could possibly cause something like this?
Do you have global variables you don't re-initialize each time?
Tory Gaurnier
2013-10-08 08:13:10 UTC
Permalink
Post by Colomban Wendling
Post by Tory Gaurnier
Well I've run into quite a strange bug, and I'm wondering if anyone has
had a similar issue. It's working as expected when you first open a QML
file, it finds all the tags and places them in a hierarchy/tree
structure in the symbol list, however, when you do something that causes
it to refresh (like deleting a bracket or something else), then it
suddenly removes a whole bunch of the tags from the symbol list and it
doesn't add them back no matter what. Doesn't it rerun your whole
filetype.c file every time it refreshes the symbol list?
At first I thought it could be a memory corruption because I didn't yet
have all my malloced values being freed, but I've fixed that, every bit
of memory I allocate is freed now, so it's not that.
What scenarios could possibly cause something like this?
Do you have global variables you don't re-initialize each time?
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
I don't know how I didn't realize this, but I was using a static
variable in a while loop only thinking of it in scope of the while loop.
You got me thinking about it when you suggested the global variables not
being re-initialized. I hate that I didn't notice it earlier but I'm
glad it wasn't a complicated issue.
Tory Gaurnier
2013-10-08 08:55:31 UTC
Permalink
Post by Tory Gaurnier
Just thought I'd give everyone an update, it's still coming along,
I have the tree view in the symbol list working as expected (it
was easier than I thought, I was overcomplicating it at first),
right now I'm working on cleaning up my code, and optimizing
certain things.
I would be done by now if I wasn't working so much, but I should
have QML support finished within the next few days (if I have the
time I'll get it finished tonight). Then I'll be ready to submit
my work to ctags, and Geany.
One thing you could do to assist is to make a test suite for the tag
parser, see the preliminary ones Colomban has been adding. Another
thing is to see if you can get others to use and comment on the
filetype. There is some reluctance to commit new filetypes for
languages that the Geany devs don't know, because of the effort
required to learn the language to tell if the colouring and symbology
make sense. Having more than one user of the filetype makes it more
likely that it will be "just accepted".
Cheers
Lex
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Not sure what you mean by test suite, I've uploaded it to github (
https://github.com/tgaurnier/geany/), and would love for people to test
it, it seems to be fairly bug free now, there's things I still want to
fix, but when using correct QML syntax it seems to be pretty flawless
now (at least from the testing I've done).

Could you maybe shoot me a link of one of the test suites from Colomban
you're refering to?
Lex Trotman
2013-10-08 09:08:52 UTC
Permalink
[...]
Post by Tory Gaurnier
Not sure what you mean by test suite, I've uploaded it to github (
https://github.com/tgaurnier/geany/), and would love for people to test
it, it seems to be fairly bug free now, there's things I still want to fix,
but when using correct QML syntax it seems to be pretty flawless now (at
least from the testing I've done).
Could you maybe shoot me a link of one of the test suites from Colomban
you're refering to?
https://github.com/geany/geany/tree/master/tests/ctags is the tests for
other parsers. As the commit messages say most come from upstream, more
are always welcome, especially for new parsers.

Cheers
Lex
Post by Tory Gaurnier
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Lex Trotman
2013-10-08 09:11:30 UTC
Permalink
Post by Lex Trotman
[...]
Post by Tory Gaurnier
Not sure what you mean by test suite, I've uploaded it to github (
https://github.com/tgaurnier/geany/), and would love for people to test
it, it seems to be fairly bug free now, there's things I still want to fix,
but when using correct QML syntax it seems to be pretty flawless now (at
least from the testing I've done).
Also could you put your changes in a branch, not master, so they are easier
to identify.

Cheers
Lex
Post by Lex Trotman
Post by Tory Gaurnier
Could you maybe shoot me a link of one of the test suites from Colomban
you're refering to?
https://github.com/geany/geany/tree/master/tests/ctags is the tests for
other parsers. As the commit messages say most come from upstream, more
are always welcome, especially for new parsers.
Cheers
Lex
Post by Tory Gaurnier
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Tory Gaurnier
2013-10-08 18:53:54 UTC
Permalink
Post by Tory Gaurnier
[...]
Not sure what you mean by test suite, I've uploaded it to
github ( https://github.com/tgaurnier/geany/), and would love
for people to test it, it seems to be fairly bug free now,
there's things I still want to fix, but when using correct QML
syntax it seems to be pretty flawless now (at least from the
testing I've done).
Also could you put your changes in a branch, not master, so they are
easier to identify.
Cheers
Lex
Could you maybe shoot me a link of one of the test suites from
Colomban you're refering to?
https://github.com/geany/geany/tree/master/tests/ctags is the
tests for other parsers. As the commit messages say most come
from upstream, more are always welcome, especially for new parsers.
Cheers
Lex
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
That's what I was originally doing, but I forgot to switch back to it,
and accidentally commited everything to master :P As you can tell I'm
totally new to git.

So, should I just upload the secondary branch, or is there a way I can
restore the master branch to it's original form?
Colomban Wendling
2013-10-08 19:39:50 UTC
Permalink
Post by Tory Gaurnier
Post by Lex Trotman
[...]
Also could you put your changes in a branch, not master, so they are
easier to identify.
[...]
That's what I was originally doing, but I forgot to switch back to it,
and accidentally commited everything to master :P As you can tell I'm
totally new to git.
So, should I just upload the secondary branch, or is there a way I can
restore the master branch to it's original form?
If you want to branch master and restore it as it's original form, you
can do:

Go on master:
$ git checkout master
Create a new branch reflecting the current one's state:
$ git checkout -b your-new-branch
Go back to master as the previous command went to the new branch:
$ git checkout master
Reset the current branch (master) to the state of origin/master:
$ git reset --hard origin/master

*WARNING:* make sure you properly branched before or backed up your
commits in some way before executing the last command, because it will
*drop* the new commits from the branch you're on (master) -- hence if
they aren't in any other branch they are orphaned and you probably won't
know how to get them back.

Regards,
Colomban
Tory Gaurnier
2013-10-08 23:30:53 UTC
Permalink
Post by Colomban Wendling
Post by Tory Gaurnier
Post by Lex Trotman
[...]
Also could you put your changes in a branch, not master, so they are
easier to identify.
[...]
That's what I was originally doing, but I forgot to switch back to it,
and accidentally commited everything to master :P As you can tell I'm
totally new to git.
So, should I just upload the secondary branch, or is there a way I can
restore the master branch to it's original form?
If you want to branch master and restore it as it's original form, you
$ git checkout master
$ git checkout -b your-new-branch
$ git checkout master
$ git reset --hard origin/master
*WARNING:* make sure you properly branched before or backed up your
commits in some way before executing the last command, because it will
*drop* the new commits from the branch you're on (master) -- hence if
they aren't in any other branch they are orphaned and you probably won't
know how to get them back.
Regards,
Colomban
_______________________________________________
Devel mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Ok, I think I got it, just to be on the safe side is archived my work
and put it in a different directory, but I created a new branch
qml-support (I had a qml_support branch before, but I deleted it to keep
to the naming conventions of the other branches ['-' instead of '_']). I
set the qml-support branch as my default remote branch, then I deleted
the master branch, and reuploaded it without my commits.

Does it look like I did it right?
Tory Gaurnier
2013-10-11 19:14:37 UTC
Permalink
Ok, I've been testing with several of my QML files, and I think I've
worked out most of the bugs, I am going to start working on my other
project to test out the QML support, because as of my latest commit I
can't find anymore bugs. I'm also open to anyone who wants to test it
out to try to find bugs.

Also, I joined the CTags dev mailing list, but it doesn't really seem to
be active, is that project really even alive anymore? It looks like
there hasn't been an update for quite a few years now, so I'm not sure
I'll even be able to submit my code to them.
Lex Trotman
2013-10-11 21:53:53 UTC
Permalink
Post by Tory Gaurnier
Ok, I've been testing with several of my QML files, and I think I've
worked out most of the bugs, I am going to start working on my other
project to test out the QML support, because as of my latest commit I can't
find anymore bugs. I'm also open to anyone who wants to test it out to try
to find bugs.
Also, I joined the CTags dev mailing list, but it doesn't really seem to
be active, is that project really even alive anymore? It looks like there
hasn't been an update for quite a few years now, so I'm not sure I'll even
be able to submit my code to them.
Colomban can confirm, but I don't think his last attempt to push stuff
upstream has been accepted.

Cheers
Lex
Post by Tory Gaurnier
______________________________**_________________
Devel mailing list
https://lists.geany.org/cgi-**bin/mailman/listinfo/devel<https://lists.geany.org/cgi-bin/mailman/listinfo/devel>
Tory Gaurnier
2013-10-16 19:53:56 UTC
Permalink
Just found a bug where when you have a JS function like 'function
myFunct()' it was only displaying 'function' in the symbol list, that's
fixed now, so it'll show 'myFunct' as it should. Not sure if anyone is
even trying out my QML support yet, but figured I'd update anyone who
cares ;)

If anyone does try it out I'd like some feedback, thanks.
Matthew Brush
2013-10-17 00:30:53 UTC
Permalink
Post by Tory Gaurnier
Just found a bug where when you have a JS function like 'function
myFunct()' it was only displaying 'function' in the symbol list, that's
fixed now, so it'll show 'myFunct' as it should. Not sure if anyone is
even trying out my QML support yet, but figured I'd update anyone who
cares ;)
If anyone does try it out I'd like some feedback, thanks.
You might want to poke the users list to see if any other people are
interested in testing too.

Cheers,
Matthew Brush

Loading...