[Github-comments] [geany/geany] Add Ocaml ctags parser (PR #3163)

Jiří Techet notifications at github.com
Sat Apr 16 10:41:46 UTC 2022


> What part(s) does the no apply to?

(2) is correct ;-) (i.e. it is still possible to get tag file for multiple source file even with `-P`). To make things clearer, for

```
geany -g file1.h file2.h file3.h
```

Geany creates `tmp.h` containing
```
#include "file1.h"
#include "file2.h"
#include "file3.h"
```
and makes the preprocessor perform the includes and Geany then parses the resulting file (this is valid only for C/C++, for other languages Geany always behaves as if `-P` were used). The generated header file is syntactically valid, C/C++ doesn't care about file name so there's no problem with this method.

With
```
geany -P -g file1.h file2.h file3.h
```
Geany used to concatenate the files and parse the resulting file. After this patch, Geany parses each of the files separately, combines the resulting tags, sorts them and removes duplicates. The should be the same except for the minor difference for anonymous tags described in the previous post which isn't important for global tags.

I really don't see any reason for performing the concatenation - first, there's a need for the temporary file which may be a problem for languages like Ocaml, but second, it may even lead to a syntactically invalid file for some languages. For instance Go programs start with package specification followed by imports and these are not allowed to appear later in the source. So when you concatenate two files like
```
package main

import "fmt"

func main() {
	fmt.Println("Hello, 世界")
}
```
the result is invalid. It then depends on how the ctags parser is constructed and if it is tolerant enough to allow that - it may, it may not but we are risking problems.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/3163#issuecomment-1100634786
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/pull/3163/c1100634786 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20220416/dc2f842e/attachment.htm>


More information about the Github-comments mailing list