Re: [Geany-Devel] Interested making a patch to add QML support

2013-10-16 Thread Matthew Brush

On 13-10-16 12:53 PM, Tory Gaurnier wrote:

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


___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-10-11 Thread 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.

___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-10-11 Thread Lex Trotman
On 12 October 2013 06:14, Tory Gaurnier tory.gaurn...@linuxmail.org wrote:

 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



 __**_
 Devel mailing list
 Devel@lists.geany.org
 https://lists.geany.org/cgi-**bin/mailman/listinfo/develhttps://lists.geany.org/cgi-bin/mailman/listinfo/devel

___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-10-08 Thread Tory Gaurnier

On 10/07/2013 12:23 PM, Colomban Wendling wrote:

Le 07/10/2013 21:01, Tory Gaurnier a écrit :

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
Devel@lists.geany.org
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.

___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-10-08 Thread Tory Gaurnier

On 10/05/2013 05:12 PM, Lex Trotman wrote:




On 6 October 2013 01:25, Tory Gaurnier tory.gaurn...@linuxmail.org 
mailto:tory.gaurn...@linuxmail.org wrote:


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
Devel@lists.geany.org mailto:Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel




___
Devel mailing list
Devel@lists.geany.org
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?
___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-10-08 Thread Lex Trotman
On 8 October 2013 20:08, Lex Trotman ele...@gmail.com wrote:


 [...]

  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
 Devel@lists.geany.org
 https://lists.geany.org/cgi-bin/mailman/listinfo/devel



___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-10-08 Thread Tory Gaurnier

On 10/08/2013 02:11 AM, Lex Trotman wrote:




On 8 October 2013 20:08, Lex Trotman ele...@gmail.com 
mailto:ele...@gmail.com wrote:



[...]

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
Devel@lists.geany.org mailto:Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel





___
Devel mailing list
Devel@lists.geany.org
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?
___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-10-08 Thread Tory Gaurnier

On 10/08/2013 12:39 PM, Colomban Wendling wrote:

Le 08/10/2013 20:53, Tory Gaurnier a écrit :

On 10/08/2013 02:11 AM, Lex Trotman wrote:

[...]

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
___
Devel mailing list
Devel@lists.geany.org
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?
___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-10-07 Thread Matthew Brush

On 13-10-07 12:01 PM, Tory Gaurnier wrote:

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

___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-10-05 Thread 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.

___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-10-05 Thread Lex Trotman
On 6 October 2013 01:25, Tory Gaurnier tory.gaurn...@linuxmail.org wrote:

 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
 Devel@lists.geany.org
 https://lists.geany.org/cgi-**bin/mailman/listinfo/develhttps://lists.geany.org/cgi-bin/mailman/listinfo/devel

___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-09-30 Thread Tory Gaurnier
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.

___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-09-23 Thread Tory Gaurnier

On 09/23/2013 11:37 AM, Tory Gaurnier wrote:
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.
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_QMLSCLEX_CPP
#define highlighting_styles_QMLhighlighting_styles_C
static const HLKeyword highlighting_keywords_QML[] =
{
{ 0, primary,FALSE },
{ 1, secondary,FALSE }
};
#define highlighting_properties_QMLhighlighting_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.

___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-09-22 Thread Matthew Brush

On 13-09-22 01:09 AM, Tory Gaurnier wrote:

[...]
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
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-09-22 Thread Tory Gaurnier

On 09/22/2013 02:06 AM, Matthew Brush wrote:

On 13-09-22 01:09 AM, Tory Gaurnier wrote:

[...]
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
Devel@lists.geany.org
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 
;] ).

___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-09-20 Thread Tory Gaurnier

On 09/19/2013 05:38 PM, Colomban Wendling wrote:

Le 20/09/2013 02:05, Tory Gaurnier a écrit :

On 09/19/2013 03:21 PM, Colomban Wendling wrote:

Le 20/09/2013 00:07, Tory Gaurnier a écrit :

[...]

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)


, 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

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:
[...]

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.


Then the rest appears normal.

Good :)


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.


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().


#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.


 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.


 def-regex = FALSE;

you don't need to set this, it's the default -- though, it's harmless to
set it again.


 return def;
}
CODE ENDS HERE

___
Devel mailing list
Devel@lists.geany.org
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.

___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-09-20 Thread Colomban Wendling
Le 20/09/2013 21:00, Tory Gaurnier a écrit :
 [...],
 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
___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-09-19 Thread Tory Gaurnier

On 09/19/2013 12:03 AM, Matthew Brush wrote:

On 13-09-18 06:27 PM, Lex Trotman wrote:

On 19 September 2013 09:35, Lex Trotman ele...@gmail.com wrote:



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
Devel@lists.geany.org
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???

___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-09-19 Thread Tory Gaurnier

On 09/19/2013 03:21 PM, Colomban Wendling wrote:

Le 20/09/2013 00:07, Tory Gaurnier a écrit :

[...]

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)


, 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
___
Devel mailing list
Devel@lists.geany.org
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
___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-09-19 Thread Colomban Wendling
Le 20/09/2013 02:05, Tory Gaurnier a écrit :
 On 09/19/2013 03:21 PM, Colomban Wendling wrote:
 Le 20/09/2013 00:07, Tory Gaurnier a écrit :
 [...]

 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)

 , 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

 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:
 [...]

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.

 Then the rest appears normal.

Good :)

 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.

 
 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().

 
 #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.

 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.

 def-regex = FALSE;

you don't need to set this, it's the default -- though, it's harmless to
set it again.

 
 return def;
 }
 CODE ENDS HERE
___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-09-18 Thread Tory Gaurnier

On 09/17/2013 06:45 PM, Matthew Brush wrote:

On 13-09-17 03:59 PM, Tory Gaurnier wrote:

[...]
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
Devel@lists.geany.org
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.
___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-09-18 Thread 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.

Cheers
Lex


On 19 September 2013 06:52, Matthew Brush mbr...@codebrainz.ca wrote:

 On 13-09-18 11:47 AM, Tory Gaurnier wrote:

 On 09/17/2013 06:45 PM, Matthew Brush wrote:

 On 13-09-17 03:59 PM, Tory Gaurnier wrote:

 [...]
 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.htmlhttp://ctags.sourceforge.net/EXTENDING.html

 __**_
 Devel mailing list
 Devel@lists.geany.org
 https://lists.geany.org/cgi-**bin/mailman/listinfo/develhttps://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?


 Yeah, I think you can call it multiple times, see COBOL parser, for
 example:
 https://sourceforge.net/p/**ctags/code/HEAD/tree/trunk/**cobol.chttps://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
 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
 Devel@lists.geany.org
 https://lists.geany.org/cgi-**bin/mailman/listinfo/develhttps://lists.geany.org/cgi-bin/mailman/listinfo/devel

___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


Re: [Geany-Devel] Interested making a patch to add QML support

2013-09-18 Thread Lex Trotman
On 19 September 2013 09:35, Lex Trotman ele...@gmail.com wrote:


 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




 Cheers
 Lex



___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel


[Geany-Devel] Interested making a patch to add QML support

2013-09-17 Thread 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.


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.

___
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel