[Github-comments] [geany/geany] Add AutoIt syntax highlighting and Ctags parser for AutoIt (#1752)

Colomban Wendling notifications at xxxxx
Sat Aug 4 11:43:44 UTC 2018


b4n requested changes on this pull request.

Otherwise it looks good.
I didn't review the Scintilla lexer properly, but it matches upstream's so I'm gonna be happy about it.

> @@ -0,0 +1,72 @@
+# For complete documentation of this file, please see Geany's main documentation
+# AutoIt 3.3.14.2
+[styling]
+# Edit these in the colorscheme .conf file instead
+default=default
+comment=comment
+commentblock=comment
+number=number
+function=function
+keyword=type

shouldn't this be `keyword=keyword`?

> @@ -0,0 +1,72 @@
+# For complete documentation of this file, please see Geany's main documentation
+# AutoIt 3.3.14.2
+[styling]
+# Edit these in the colorscheme .conf file instead
+default=default
+comment=comment

this should likely be `comment=comment_line`, shouldn't it?

> @@ -0,0 +1,72 @@
+# For complete documentation of this file, please see Geany's main documentation
+# AutoIt 3.3.14.2
+[styling]
+# Edit these in the colorscheme .conf file instead
+default=default
+comment=comment
+commentblock=comment
+number=number
+function=function
+keyword=type
+macro=preprocessor
+string=string
+operator=operator
+variable=keyword_2

This is also questionable, but there's not a so obvious expected value, I would guess `variable=identifier`

> +function=function
+keyword=type
+macro=preprocessor
+string=string
+operator=operator
+variable=keyword_2
+sent=other
+preprocessor=preprocessor
+special=type
+expand=default
+comobj=keyword_1
+udf=class
+
+[keywords]
+keywords=and byref case const continuecase continueloop default dim do else elseif endfunc endif endselect endswitch endwith enum exit exitloop false for func global if in local next not null or redim return select static step switch then to true until volatile wend while with
+functions=abs acos adlibregister adlibunregister asc ascw asin assign atan autoitsetoption autoitwingettitle autoitwinsettitle beep binary binarylen binarymid binarytostring bitand bitnot bitor bitrotate bitshift bitxor blockinput break call cdtray ceiling chr chrw clipget clipput consoleread consolewrite consolewriteerror controlclick controlcommand controldisable controlenable controlfocus controlgetfocus controlgethandle controlgetpos controlgettext controlhide controllistview controlmove controlsend controlsettext controlshow controltreeview cos dec dircopy dircreate dirgetsize dirmove dirremove dllcall dllcalladdress dllcallbackfree dllcallbackgetptr dllcallbackregister dllclose dllopen dllstructcreate dllstructgetdata dllstructgetptr dllstructgetsize dllstructsetdata drivegetdrive drivegetfilesystem drivegetlabel drivegetserial drivegettype drivemapadd drivemapdel drivemapget drivesetlabel drivespacefree drivespacetotal drivestatus envget envset envupdate eval execute exp filechangedir fileclose filecopy filecreatentfslink filecreateshortcut filedelete fileexists filefindfirstfile filefindnextfile fileflush filegetattrib filegetencoding filegetlongname filegetpos filegetshortcut filegetshortname filegetsize filegettime filegetversion fileinstall filemove fileopen fileopendialog fileread filereadline filereadtoarray filerecycle filerecycleempty filesavedialog fileselectfolder filesetattrib filesetend filesetpos filesettime filewrite filewriteline floor ftpsetproxy funcname guicreate guictrlcreateavi guictrlcreatebutton guictrlcreatecheckbox guictrlcreatecombo guictrlcreatecontextmenu guictrlcreatedate guictrlcreatedummy guictrlcreateedit guictrlcreategraphic guictrlcreategroup guictrlcreateicon guictrlcreateinput guictrlcreatelabel guictrlcreatelist guictrlcreatelistview guictrlcreatelistviewitem guictrlcreatemenu guictrlcreatemenuitem guictrlcreatemonthcal guictrlcreateobj guictrlcreatepic guictrlcreateprogress guictrlcreateradio guictrlcreateslider guictrlcreatetab guictrlcreatetabitem guictrlcreatetreeview guictrlcreatetreeviewitem guictrlcreateupdown guictrldelete guictrlgethandle guictrlgetstate guictrlread guictrlrecvmsg guictrlregisterlistviewsort guictrlsendmsg guictrlsendtodummy guictrlsetbkcolor guictrlsetcolor guictrlsetcursor guictrlsetdata guictrlsetdefbkcolor guictrlsetdefcolor guictrlsetfont guictrlsetgraphic guictrlsetimage guictrlsetlimit guictrlsetonevent guictrlsetpos guictrlsetresizing guictrlsetstate guictrlsetstyle guictrlsettip guidelete guigetcursorinfo guigetmsg guigetstyle guiregistermsg guisetaccelerators guisetbkcolor guisetcoord guisetcursor guisetfont guisethelp guiseticon guisetonevent guisetstate guisetstyle guistartgroup guiswitch hex hotkeyset httpsetproxy httpsetuseragent hwnd inetclose inetget inetgetinfo inetgetsize inetread inidelete iniread inireadsection inireadsectionnames inirenamesection iniwrite iniwritesection inputbox int isadmin isarray isbinary isbool isdeclared isdllstruct isfloat isfunc ishwnd isint iskeyword isnumber isobj isptr isstring log memgetstats mod mouseclick mouseclickdrag mousedown mousegetcursor mousegetpos mousemove mouseup mousewheel msgbox number objcreate objcreateinterface objevent objevent objget objname onautoitexitregister onautoitexitunregister opt ping pixelchecksum pixelgetcolor pixelsearch processclose processexists processgetstats processlist processsetpriority processwait processwaitclose progressoff progresson progressset ptr random regdelete regenumkey regenumval regread regwrite round run runas runaswait runwait send sendkeepactive seterror setextended shellexecute shellexecutewait shutdown sin sleep soundplay soundsetwavevolume splashimageon splashoff splashtexton sqrt srandom statusbargettext stderrread stdinwrite stdioclose stdoutread string stringaddcr stringcompare stringformat stringfromasciiarray stringinstr stringisalnum stringisalpha stringisascii stringisdigit stringisfloat stringisint stringislower stringisspace stringisupper stringisxdigit stringleft stringlen stringlower stringmid stringregexp stringregexpreplace stringreplace stringreverse stringright stringsplit stringstripcr stringstripws stringtoasciiarray stringtobinary stringtrimleft stringtrimright stringupper tan tcpaccept tcpclosesocket tcpconnect tcplisten tcpnametoip tcprecv tcpsend tcpshutdown tcpstartup timerdiff timerinit tooltip traycreateitem traycreatemenu traygetmsg trayitemdelete trayitemgethandle trayitemgetstate trayitemgettext trayitemsetonevent trayitemsetstate trayitemsettext traysetclick trayseticon traysetonevent traysetpauseicon traysetstate traysettooltip traytip ubound udpbind udpclosesocket udpopen udprecv udpsend udpshutdown udpstartup vargettype winactivate winactive winclose winexists winflash wingetcaretpos wingetclasslist wingetclientsize wingethandle wingetpos wingetprocess wingetstate wingettext wingettitle winkill winlist winmenuselectitem winminimizeall winminimizeallundo winmove winsetontop winsetstate winsettitle winsettrans winwait winwaitactive winwaitclose winwaitnotactive

do we need this?  I don't think any other language has that, and better fit for a tag file, doesn't it?
If we want different highlighting for known function names, we probably should rather play with Scintilla's rainbow identifiers or simply set this dynamically from a tags file (which is indeed not currently possible and has performance questions, but well).

Not a blocker, but it looks a bit odd.

> +
+[keywords]
+keywords=and byref case const continuecase continueloop default dim do else elseif endfunc endif endselect endswitch endwith enum exit exitloop false for func global if in local next not null or redim return select static step switch then to true until volatile wend while with
+functions=abs acos adlibregister adlibunregister asc ascw asin assign atan autoitsetoption autoitwingettitle autoitwinsettitle beep binary binarylen binarymid binarytostring bitand bitnot bitor bitrotate bitshift bitxor blockinput break call cdtray ceiling chr chrw clipget clipput consoleread consolewrite consolewriteerror controlclick controlcommand controldisable controlenable controlfocus controlgetfocus controlgethandle controlgetpos controlgettext controlhide controllistview controlmove controlsend controlsettext controlshow controltreeview cos dec dircopy dircreate dirgetsize dirmove dirremove dllcall dllcalladdress dllcallbackfree dllcallbackgetptr dllcallbackregister dllclose dllopen dllstructcreate dllstructgetdata dllstructgetptr dllstructgetsize dllstructsetdata drivegetdrive drivegetfilesystem drivegetlabel drivegetserial drivegettype drivemapadd drivemapdel drivemapget drivesetlabel drivespacefree drivespacetotal drivestatus envget envset envupdate eval execute exp filechangedir fileclose filecopy filecreatentfslink filecreateshortcut filedelete fileexists filefindfirstfile filefindnextfile fileflush filegetattrib filegetencoding filegetlongname filegetpos filegetshortcut filegetshortname filegetsize filegettime filegetversion fileinstall filemove fileopen fileopendialog fileread filereadline filereadtoarray filerecycle filerecycleempty filesavedialog fileselectfolder filesetattrib filesetend filesetpos filesettime filewrite filewriteline floor ftpsetproxy funcname guicreate guictrlcreateavi guictrlcreatebutton guictrlcreatecheckbox guictrlcreatecombo guictrlcreatecontextmenu guictrlcreatedate guictrlcreatedummy guictrlcreateedit guictrlcreategraphic guictrlcreategroup guictrlcreateicon guictrlcreateinput guictrlcreatelabel guictrlcreatelist guictrlcreatelistview guictrlcreatelistviewitem guictrlcreatemenu guictrlcreatemenuitem guictrlcreatemonthcal guictrlcreateobj guictrlcreatepic guictrlcreateprogress guictrlcreateradio guictrlcreateslider guictrlcreatetab guictrlcreatetabitem guictrlcreatetreeview guictrlcreatetreeviewitem guictrlcreateupdown guictrldelete guictrlgethandle guictrlgetstate guictrlread guictrlrecvmsg guictrlregisterlistviewsort guictrlsendmsg guictrlsendtodummy guictrlsetbkcolor guictrlsetcolor guictrlsetcursor guictrlsetdata guictrlsetdefbkcolor guictrlsetdefcolor guictrlsetfont guictrlsetgraphic guictrlsetimage guictrlsetlimit guictrlsetonevent guictrlsetpos guictrlsetresizing guictrlsetstate guictrlsetstyle guictrlsettip guidelete guigetcursorinfo guigetmsg guigetstyle guiregistermsg guisetaccelerators guisetbkcolor guisetcoord guisetcursor guisetfont guisethelp guiseticon guisetonevent guisetstate guisetstyle guistartgroup guiswitch hex hotkeyset httpsetproxy httpsetuseragent hwnd inetclose inetget inetgetinfo inetgetsize inetread inidelete iniread inireadsection inireadsectionnames inirenamesection iniwrite iniwritesection inputbox int isadmin isarray isbinary isbool isdeclared isdllstruct isfloat isfunc ishwnd isint iskeyword isnumber isobj isptr isstring log memgetstats mod mouseclick mouseclickdrag mousedown mousegetcursor mousegetpos mousemove mouseup mousewheel msgbox number objcreate objcreateinterface objevent objevent objget objname onautoitexitregister onautoitexitunregister opt ping pixelchecksum pixelgetcolor pixelsearch processclose processexists processgetstats processlist processsetpriority processwait processwaitclose progressoff progresson progressset ptr random regdelete regenumkey regenumval regread regwrite round run runas runaswait runwait send sendkeepactive seterror setextended shellexecute shellexecutewait shutdown sin sleep soundplay soundsetwavevolume splashimageon splashoff splashtexton sqrt srandom statusbargettext stderrread stdinwrite stdioclose stdoutread string stringaddcr stringcompare stringformat stringfromasciiarray stringinstr stringisalnum stringisalpha stringisascii stringisdigit stringisfloat stringisint stringislower stringisspace stringisupper stringisxdigit stringleft stringlen stringlower stringmid stringregexp stringregexpreplace stringreplace stringreverse stringright stringsplit stringstripcr stringstripws stringtoasciiarray stringtobinary stringtrimleft stringtrimright stringupper tan tcpaccept tcpclosesocket tcpconnect tcplisten tcpnametoip tcprecv tcpsend tcpshutdown tcpstartup timerdiff timerinit tooltip traycreateitem traycreatemenu traygetmsg trayitemdelete trayitemgethandle trayitemgetstate trayitemgettext trayitemsetonevent trayitemsetstate trayitemsettext traysetclick trayseticon traysetonevent traysetpauseicon traysetstate traysettooltip traytip ubound udpbind udpclosesocket udpopen udprecv udpsend udpshutdown udpstartup vargettype winactivate winactive winclose winexists winflash wingetcaretpos wingetclasslist wingetclientsize wingethandle wingetpos wingetprocess wingetstate wingettext wingettitle winkill winlist winmenuselectitem winminimizeall winminimizeallundo winmove winsetontop winsetstate winsettitle winsettrans winwait winwaitactive winwaitclose winwaitnotactive
+macros=@appdatacommondir @appdatadir @autoitexe @autoitpid @autoitversion @autoitx64 @com_eventobj @commonfilesdir @compiled @computername @comspec @cpuarch @cr @crlf @desktopcommondir @desktopdepth @desktopdir @desktopheight @desktoprefresh @desktopwidth @documentscommondir @error @exitcode @exitmethod @extended @favoritescommondir @favoritesdir @gui_ctrlhandle @gui_ctrlid @gui_dragfile @gui_dragid @gui_dropid @gui_winhandle @homedrive @homepath @homeshare @hotkeypressed @hour @ipaddress1 @ipaddress2 @ipaddress3 @ipaddress4 @kblayout @lf @localappdatadir @logondnsdomain @logondomain @logonserver @mday @min @mon @msec @muilang @mydocumentsdir @numparams @osarch @osbuild @oslang @osservicepack @ostype @osversion @programfilesdir @programscommondir @programsdir @scriptdir @scriptfullpath @scriptlinenumber @scriptname @sec @startmenucommondir @startmenudir @startupcommondir @startupdir @sw_disable @sw_enable @sw_hide @sw_lock @sw_maximize @sw_minimize @sw_restore @sw_show @sw_showdefault @sw_showmaximized @sw_showminimized @sw_showminnoactive @sw_showna @sw_shownoactivate @sw_shownormal @sw_unlock @systemdir @tab @tempdir @tray_id @trayiconflashing @trayiconvisible @username @userprofiledir @wday @windowsdir @workingdir @yday @year
+sent={!} {#} {^} {{} {}} {+} {alt} {altdown} {altup} {appskey} {asc} {backspace} {break} {browser_back} {browser_favorites} {browser_forward} {browser_home} {browser_refresh} {browser_search} {browser_stop} {bs} {capslock} {ctrldown} {ctrlup} {del} {delete} {down} {end} {enter} {esc} {escape} {f1} {f10} {f11} {f12} {f2} {f3} {f4} {f5} {f6} {f7} {f8} {f9} {home} {ins} {insert} {lalt} {launch_app1} {launch_app2} {launch_mail} {launch_media} {lctrl} {left} {lshift} {lwin} {lwindown} {lwinup} {media_next} {media_play_pause} {media_prev} {media_stop} {numlock} {numpad0} {numpad1} {numpad2} {numpad3} {numpad4} {numpad5} {numpad6} {numpad7} {numpad8} {numpad9} {numpadadd} {numpaddiv} {numpaddot} {numpadenter} {numpadmult} {numpadsub} {oem_102} {pause} {pgdn} {pgup} {printscreen} {ralt} {rctrl} {right} {rshift} {rwin} {rwindown} {rwinup} {scrolllock} {shiftdown} {shiftup} {sleep} {space} {tab} {up} {volume_down} {volume_mute} {volume_up}
+preprocessor=#ce #comments-end #comments-start #cs #include #include-once #notrayicon #onautoitstartregister #requireadmin
+special=#endregion #forcedef #forceref #ignorefunc #pragma #region
+expand=
+udf=
+
+[lexer_properties]
+#settings for folding comment blocks and preprocessor lines
+fold.comment=1
+fold.compact=0
+fold.preprocessor=1

You shouldn't be setting those here, they are not lexer-specific and we set them unconditionally (to the same values, even).
If there is *really* a compelling reason to set them for this filetype, comment them out for them to be easy to find, but don't set them in case we wanna change Geany's default one day.

> @@ -0,0 +1,121 @@
+/*

All comments on this file are optional, as it's UCTags' upstream. I just take this opportunity to make comment on this, but anything here should be changed upstream first -- or at the same time.

> +/*
+*   FUNCTION DEFINITIONS
+*/
+static void findAutoItTags (void)
+{
+	vString *name = vStringNew ();
+	const unsigned char *line;
+
+	while ((line = readLineFromInputFile ()) != NULL)
+	{
+		const unsigned char* p = line;
+		if (p [0] == '#')
+		{
+			/* min. string "#region" > 7 */
+			if ((p [1] == 'R' || p [1] == 'r') &&
+				strlen ((const char *) p) > 8 &&

Why `strlen()` here?  It'll highly likely be slower than manually checking the characters, and as a C string always ends with a `NUL` byte, it's safe to drop it, the character checks would catch a premature end.

> +	vString *name = vStringNew ();
+	const unsigned char *line;
+
+	while ((line = readLineFromInputFile ()) != NULL)
+	{
+		const unsigned char* p = line;
+		if (p [0] == '#')
+		{
+			/* min. string "#region" > 7 */
+			if ((p [1] == 'R' || p [1] == 'r') &&
+				strlen ((const char *) p) > 8 &&
+				(p [2] == 'E' || p [2] == 'e') &&
+				(p [3] == 'G' || p [3] == 'g') &&
+				(p [4] == 'I' || p [4] == 'i') &&
+				(p [5] == 'O' || p [5] == 'o') &&
+				(p [6] == 'N' || p [6] == 'n'))

Doesn't the syntax require a whitespace after the `#region`? This would catch `#regionfoobar something` as a region named `foobar something`

> +	vString *name = vStringNew ();
+	const unsigned char *line;
+
+	while ((line = readLineFromInputFile ()) != NULL)
+	{
+		const unsigned char* p = line;
+		if (p [0] == '#')
+		{
+			/* min. string "#region" > 7 */
+			if ((p [1] == 'R' || p [1] == 'r') &&
+				strlen ((const char *) p) > 8 &&
+				(p [2] == 'E' || p [2] == 'e') &&
+				(p [3] == 'G' || p [3] == 'g') &&
+				(p [4] == 'I' || p [4] == 'i') &&
+				(p [5] == 'O' || p [5] == 'o') &&
+				(p [6] == 'N' || p [6] == 'n'))

Depending on the syntax limitation, you could also want to restrict the set of characters allowed for the region's name, but that might be less of a problem.

> +
+				if (vStringLength(name) > 0)
+				{
+					makeSimpleTag (name, AutoItKinds, K_REGION);
+					vStringClear (name);
+				}
+			}
+		}
+		else
+		{
+			/* skip white space */
+			while (isspace ((int) *p))
+				++p;
+			/* min. string "func a()" == 8 */
+			if ((p [0] == 'F' || p [0] == 'f') &&
+				strlen ((const char *) p) >= 8 &&

again, the `strlen()` check doesn't seem very useful.

> @@ -74,7 +74,7 @@ index ed47aa8..e58f1ab 100644
  	LINK_LEXER(lmAsm);
 -	LINK_LEXER(lmAsn1);
 -	LINK_LEXER(lmASY);
--	LINK_LEXER(lmAU3);
+ 	LINK_LEXER(lmAU3);

You also need to change the diff section header to match (`-77,123 +77,51`) as you're changing the final line count.

-- 
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/pull/1752#pullrequestreview-143377776
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20180804/27a0ea7f/attachment-0001.html>


More information about the Github-comments mailing list