[Geany-Devel] Interested making a patch to add QML support
Colomban Wendling
lists.ban at xxxxx
Sat Sep 21 00:03:30 UTC 2013
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
More information about the Devel
mailing list