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

Colomban Wendling notifications at xxxxx
Mon Aug 6 13:24:58 UTC 2018


b4n commented on this pull request.



> +	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'))

Hum, I just tested whether I'm wasn't crazy, and I ain't:
```autoit
#regiontest
#endregion
```
results in showing a region named `test` in the symbols tree.

It might be considered OK as this is probably invalid syntax, I'm just mentioning this so you can make an informed decision whether it's a problem or an acceptable behavior given invalid input not worth handling.

---
Additionally with your examples, the leading `;` is included in the displayed region name, is that intentional? If not, you probably could simply use
```c
while (isspace ((int) *p) || *p == ';')
```
below.  It would allow for `#region;;;;foo`, but that might be valid or OK to get wrong (as suggested above, it can be considered OK to emit improper tags in invalid input)

-- 
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#discussion_r207889671
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20180806/8d206b8a/attachment-0001.html>


More information about the Github-comments mailing list