Hi, is there any chance to add Lexer for [AutoIt3 scripting language](https://www.autoitscript.com/site/autoit/) to Geany? I am ready to help with a _filetypes.au3_ and _au3.tags_.
Regards,
P.S. _LexAU3.cxx_ in the source of Scintilla is old (Jul 26, 2007), but it works (as well as au3.properties). [There is a new version](https://bitbucket.org/scite-ru/scite-ru.bitbucket.org/src/53d62fc5aeb28f9af6...) (Sep 05, 2013). I tried to compile SciTE 3.6.4 with new version: it's works on Windows XP SP3 (MinGW), but there are some weird problems with ends commentblock on Xubuntu 14.04. I seem to find the problem and wrote the author.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/967
I am not programmer and I don't know when the decision is will made: but I was curious and I read [Hacking Geany >> Adding a filetype](http://geany.org/manual/dev/hacking.html#adding-a-filetype) and tried to :) (certainly without tags). I compiled eventually without errors, but it doesn't work: [diff](http://pastebin.com/A7EnmWwa) (many strings by one comment and I reduced section _keywords_). Where is I am wrong? :)
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/967#issuecomment-199070791
How much doesn't it work? Does the new filetype show up in the Menu->Document->Set Filetype?
Does it highlight if you set the filetype manually?
Does it recognise the filetype from the extension?
On 21 March 2016 at 10:41, Skif-off notifications@github.com wrote:
I am not programmer and I don't know when the decision is will made: but I was curious and I read Hacking Geany >> Adding a filetype http://geany.org/manual/dev/hacking.html#adding-a-filetype and tried to :) (certainly without tags). I compiled eventually without errors, but it doesn't work: diff http://pastebin.com/A7EnmWwa (many strings by one comment and I reduced section *keywords*). Where is I am wrong? :)
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/geany/geany/issues/967#issuecomment-199070791
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/967#issuecomment-199079839
- _recognise the filetype from the extension_ is works; - _set the filetype manually_ is works; - Edit->Insert Comments insert right multiline comment ```#cs...#ce```
but the syntax highlighting did not work in anyway.
P.S. I'm not a programmer: I would definitely could not write /tagmanager/ctags/autoit.c for examle :)
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/967#issuecomment-199264434
I compared the Geany files with the Scintilla files again and found (strange that I missed this): ```diff --- /geany-master/scintilla/src/Catalogue.cxx Tue Mar 22 00:44:10 2016 +++ /geany-master/scintilla/src/Catalogue.cxx Wed Mar 23 06:20:05 2016 @@ -123,6 +123,7 @@ LINK_LEXER(lmVHDL); LINK_LEXER(lmXML); LINK_LEXER(lmYAML); + LINK_LEXER(lmAU3);
//--Autogenerated -- end of automatically generated section ``` Now it works :)
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/967#issuecomment-200143557
Report: I nearly completed (without AutoIt tags parser and _filetypes.autoit_ without udfs (because >3000)), remains only to disassemble filetypes.* parameters and pick up the colors (if there was one theme, it would be easier :)).
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/967#issuecomment-201757122
[geany-master-autoit.zip](http://www118.zippyshare.com/v/8aYKBxFO/file.html) (new/modif. files): ``` geany-master/data/filedefs/filetypes.autoit geany-master/data/filetype_extensions.conf geany-master/data/Makefile.am geany-master/scintilla/lexers/LexAU3.cxx geany-master/scintilla/Makefile.am geany-master/scintilla/scintilla_changes.patch geany-master/scintilla/src/Catalogue.cxx geany-master/src/filetypes.c geany-master/src/filetypes.h geany-master/src/highlighting.c geany-master/src/highlightingmappings.h ``` I added a file _au3.tags_ for http://download.geany.org/contrib/tags/
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/967#issuecomment-203010311
Please make a pull request.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/967#issuecomment-203126759
I never did it, but I'll try.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/967#issuecomment-203279015
I'm confused and rewrite pull request.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/967#issuecomment-215814862
Is it interesting to anyone? :)
@Skif-off did you mean to ping the PR #1017? :)
@elextr yes, a lot of time and no answer :) If this is not interesting, then probably I will remove my fork as useless.
P.S. I rechecked [Hacking](https://www.geany.org/Support/Hacking) again and compile: I think it works fine.
@Skif-off simply a lack of available time for the volunteer team that develops Geany.
@elextr I meant no offense, everything is ready and I wanted to know the prospects. I'll wait :)
No offence taken, it doesn't hurt to ping stuff, things do get forgotten, and it reminds people when they are deciding what to spend their time on.
1. About [PR #1017 ](https://github.com/geany/geany/pull/1017): 1.32 is likely to be without AutoIt support?
2. How can I use tags-file? I added ```~/.config/geany/tags/autoit.au3.tags``` and try ``` # format=pipe Abs||(expression)| ACos||(expression)| Asc||("char")| AscW||("char")| ASin||(expression)| Assign||("varname", "data" [, flag = 0])| ATan||(expression)| ``` but it doesn't work. I clean second and third fields: ``` # format=pipe Abs||| ACos||| AdlibRegister||| AdlibUnRegister||| Asc||| AscW||| ASin||| Assign||| ATan||| ``` but it doesn't work too. I was looking in manual and HACKING, but I didn't find solution.
@Skif-off if you're using #1017, the file would have to be named `whatever.AutoIt.tags` I believe.
if you're using #1017, the file would have to be named whatever.AutoIt.tags I believe.
The [manual](https://www.geany.org/manual/current/index.html#global-tags-files) says its whatever.lang_ext.tags so @Skif-off should work. But does the filetype need a parser for tags to work?
The manual says its whatever.lang_ext.tags so...
Right, I was thinking of custom filetype filenames.
But does the filetype need a parser for tags to work?
If it does, doesn't that defeat the purpose of the pipe format tags?
But does the filetype need a parser for tags to work?
If it does, doesn't that defeat the purpose of the pipe format tags?
Well, yes and yes, [see](https://github.com/geany/geany/blob/fca450e10b8631641731e8cb01ad89f23873f211...)
@elextr
But does the filetype need a parser for tags to work?
Thanks! I was scared that I must write parser for CTags :)) I read about filetype configuration again, remembered that [AutoIt v3 is a freeware **BASIC-like** scripting language](https://en.wikipedia.org/wiki/AutoIt) and tried ``` ... [settings] ... tag_parser=FreeBasic ... ``` Now autocompletion works, but some keywords not works (like ```#letters``` and macroses ```@letters``` ). I tried changing parametres ```whitespace_chars``` and ```wordchars``` - without effect. I found theme [Geany tag files](https://freebasic.net/forum/viewtopic.php?t=19311) on freebasic.net: author excluded words such as ```#letters```. I think it's normal :) I want fix ```filetypes.autoit```, but I have doubt (little-little): is ```tag_parser=FreeBasic``` a good solution?
What about first question? Is likely no?
What about first question? Is likely no?
Is definite yes, see link in my previous post.
but some keywords not works (like `#letters` and macroses `@letters` )
The symbol management assumes all languages are C (or if they are not they should be), ie no non-ASCII non-alphanumeric characters like `#` or `@` and as for those _Unicode_ characters!!!! ;-P
parametres whitespace_chars and wordchars
Those don't affect the parsers, they are more to do with selecting words and similar stuff.
@elextr ok :)
About tags/autocompletion: ```tag_parser=FreeBasic``` is bad idea: autocompletion works, but Symbols tab - with errors (i.e. garbage)...
I'm confused, what I should do for 1. autocompletion; 2. normal work tab "Symbols"?
For both items I must write parser ```autoit.c``` for CTags and put it in ```ctags/parsers/```?
autocompletion works, but Symbols tab - with errors (i.e. garbage)...
What does autocompletion work for? The tags in your hand made tags file? And for symbols in the current open file?
The tags file doesn't use the parser, it just needs a language defined to connect the tags structures in memory to.
The symbols and autocomplete of things in the current file use the parser, so I would be surprised if autocomplete worked and symbols were "garbage".
What do you mean by "garbage", maybe post a picture, and the source that caused it.
Its possible that autoit is just too different from freebasic, after all Scintilla needed a separate lexer.
First check if a parser exists in [Universal ctags](https://github.com/universal-ctags/ctags) and if not then any that you write should be submitted there, thats where the Geany ones come from (mostly, a few of ours are forks, but thats for historical reasons).
What does autocompletion work for? The tags in your hand made tags file? And for symbols in the current open file?
With ```tag_parser=FreeBasic``` - yes and yes, without ```tag_parser``` - no and yes.
What do you mean by "garbage", maybe post a picture, and the source that caused it.
With ```tag_parser=FreeBasic``` - single comments (at the beginning of the line) and some FreeBasic keywords. ![0](https://user-images.githubusercontent.com/6333198/32144525-7fa4563e-bcd3-11e...) (Символы == Symbols)
The tags file doesn't use the parser, it just needs a language defined to connect the tags structures in memory to.
I don't understand. Without CTags parser? How can I do this? Does Geany do it automatically?
First check if a parser exists in Universal ctags
I didn't find :( (I checked Issues, Pull requests, Exuberant ctags too.)
Well, there's ya problem, freebasic comments don't start with `;` ([see](https://www.freebasic.net/wiki/wikka.php?wakka=ProPgComments)) so the parser is justifiably confused by all those lines. So the freebasic parser is not going to work for autoit.
I don't understand. Without CTags parser? How can I do this? Does Geany do it automatically?
To be more clear _loading_ an existing tags file doesn't need the language parser, after all its reading the tags file not a source file. But it does need a tag parser language to be specified on the filetype since the tags must be associated with a parser language, thats how autocomplete finds them in the mass of tags for multiple languages, the same as it finds symbols the parser gets from open files, which is why you need to specify `tag_parser` for the tags to load.
I didn't find :( (I checked Issues, Pull requests, Exuberant ctags too.)
Well, I guess you could try modifying the freebasic parser to make an autoit one.
@elextr Thanks, now I understand you :)
Well, I guess you could try modifying the freebasic parser to make an autoit one.
Well, I'm not a programmer, but I wanted AutoIt syntax highlighting and I got it :)) I will try and I found [How to Add Support for a New Language to Exuberant Ctags](http://ctags.sourceforge.net/EXTENDING.html), but not Universal Ctags. Now I read [awk.c](https://github.com/universal-ctags/ctags/blob/master/parsers/awk.c): one element only, "function", and I think everything is not as difficult as it seems at first glance.
Note that exuberant ctags is unmaintained and universal ctags is a maintained fork so its where Geany gets most of its parsers from, so you need to submit stuff to universal ctags, not exuberant.
Yes, I know :) I wanted to say that Exuberant Ctags have "How to Add", but I could not find it for Universal Ctags.
There are bits of it buried in various parts of the docs, but also many TBW sections (To Be Written presumably). I don't think ctags has changed that much, so maybe the olde description will still work.
I added ```ctags/parsers/autoit.c``` ```c /* * Copyright (c) 2000-2006, Darren Hiebert, Elias Pschernig * * This source code is released for free distribution under the terms of the * GNU General Public License version 2 or (at your option) any later version. * * This module contains functions for generating tags for AutoIt functions. */
/* * INCLUDE FILES */ #include "general.h" /* must always come first */
#include <string.h>
#include "parse.h" #include "read.h" #include "routines.h" #include "vstring.h"
/* * DATA DEFINITIONS */ typedef enum { K_FUNCTION } AutoItKind;
static kindOption AutoItKinds[] = { { true, 'f', "func", "functions" } };
/* * FUNCTION DEFINITIONS */ static void findAutoItTags (void) { vString *name = vStringNew (); const unsigned char *line;
while ((line = readLineFromInputFile ()) != NULL) { const unsigned char* cp = line; if ((line[0] == 'F' || line[0] == 'f') && (line[1] == 'U' || line[1] == 'u') && (line[2] == 'N' || line[2] == 'n') && (line[3] == 'C' || line[3] == 'c') && isspace ((int) line[4])) { cp += 4; while (isspace ((int) *cp)) ++cp; while (isalnum ((int) *cp) || *cp == '_') { vStringPut (name, (int) *cp); ++cp; } while (isspace ((int) *cp)) ++cp; if (*cp == '(') makeSimpleTag (name, AutoItKinds, K_FUNCTION); vStringClear (name); } } vStringDelete (name); }
parserDefinition *AutoItParser (void) { static char const *extensions[] = { "au3", "AU3", "Au3", "aU3", NULL }; parserDefinition* def = parserNew ("AutoIt"); def->kinds = AutoItKinds; def->kindCount = ARRAY_SIZE (AutoItKinds); def->extensions = extensions; def->parser = findAutoItTags; return def; } ``` and change ```ctags/Makefile.am``` ```diff @@ -14,6 +14,7 @@ parsers/actionscript.c \ parsers/asciidoc.c \ parsers/asm.c \ + parsers/autoit.c \ parsers/basic.c \ parsers/c.c \ parsers/cobol.c \ ``` Sad outcome: autocompletion doesn't work, on Symbols tab I see "No symbols found". What did I miss?
What did I miss?
RTFM! :))
Well, now works fine and I need to see how to add all this to Universal Ctags. Is Geany uses the latest (current) version of Universal Ctags?
P.S. I think maybe try to add special tag ```#Region - #EndRegion```? Lexer supports it. It's convenient for navigation and work with big (large?) files: ![1](https://user-images.githubusercontent.com/6333198/32360867-59b87056-c073-11e...)
P.P.S. So I'll writing on С soon as big boy :))
Is Geany uses the latest (current) version of Universal Ctags?
Unfortunately no, not yet. But "conservative" parsers (e.g. not using too recent features from UCTags) work the same.
P.S. I think maybe try to add special tag `#Region - #EndRegion`?
if it's useful info, I guess, sure. U-CTags has support for custom fields like where a symbol end, so this should be used instead of emitting 2 tags (but Geany doesn't support it yet).
Unfortunately no, not yet.
There is a PR to update to a fairly recent version, but its structured as a single PR with many parsers in it, so its difficult to review and test. (actually the PR is old enough that its probably not that recent any more)
@b4n
U-CTags has support for custom fields like where a symbol end, so this should be used instead of emitting 2 tags (but Geany doesn't support it yet).
I was meant only to the initial, opening, tag ```#Region```, I think that's enough (and lexer support folding). I have not decided yet definitely: it's harder because custom field. And I don't know yet how to name the item: lexer and man uses "Special", maybe "Region" will be more understandable.
I added [PR](https://github.com/universal-ctags/ctags/pull/1598) for current Ctags version, but Geany uses some previous version and I must use slightly different code for current Geany version: ```diff -static kindDefinition AutoItKinds[] = { +static kindOption AutoItKinds[] = {
- makeSimpleTag (name, K_FUNCTION); + makeSimpleTag (name, AutoItKinds, K_FUNCTION);
- def->kindTable = AutoItKinds; + def->kinds = AutoItKinds; ``` Can I add parser in my PR for Geany [Add AutoIt syntax highlighting #1017](https://github.com/geany/geany/pull/1017)?
AutoIt parser was added to Сtags, PR [#1017](https://github.com/geany/geany/pull/1017) was updated.
Closed #967.
Closing as this is continued in #1017
github-comments@lists.geany.org