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

Tory Gaurnier torygaurnier at xxxxx
Fri Sep 20 19:00:55 UTC 2013


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


More information about the Devel mailing list