Commit Graph

30 Commits (master)

Author SHA1 Message Date
Mirco Schoenfeld 82e09b5d9b added a bibtex parser that extracts identifiers of entries in bib-files and makes them accessible on the sidebar 2019-07-09 16:33:53 +02:00
Colomban Wendling ec6e2320dd Add new upstream candidate Flex parser
See: https://github.com/universal-ctags/ctags/pull/2084

This import has 3 difference with upstream, not to use newer API than
current Geany has, and to workaround current limitations of Geany ctags
calls: imports are enabled by default and don't have a specific role.
2019-04-27 14:59:30 +02:00
Jiří Techet a1cf475fcf Sync ctags with upstream so that most parsers can be copied from uctags (#2018)
* Use latest version of htable

* Use latest version of mio

* Use latest version of objpool

* Use latest version of ptrarray

* Use latest version of vstring

This also requires adding trashbox.c/h which is now used by vstring and
inline macros from inline.h.

* Rename fieldSpec to fieldDefinition

See b56bd065123d69087acd6f202499d71a86a7ea7a upstream.

* Rename kindOption to kindDefinition

See e112e8ab6e0933b5bd7922e0dfb969b1f28c60fa upstream

* Rename kinds field in parserDefinition to kindTable

See 09ae690face8b5cde940e2d7cf40f8860381067b upstream.

* Rename structure fields about field in parserDefinition

See a739fa5fb790bc349a66b2bee0bf42cf289994e8 upstream.

* Use kindIndex instead of kindDefinition

This patch replaces kindDefinition related entries from sTagEntryInfo
with kindIndex so kinds are referenced indirectly using the index. For
more info please refer to commits:

16a2541c0698bd8ee03c1be8172ef3191f6e695a
f92e6bf2aeb21fd6b04756487f98d0eefa16d9ce

Some other changes had to be made to make the sources compile (without
bringing all the diffs from upstream). At some places, which aren't used
by Geany, only stub implementations have been created.

In particular, the regex parser has been disabled (for now?) because its
current implementation doesn't allow accessing kindDefinitions using
index and allowing this would require big changes in its implementation.
The affected parsers are Cobol, ActionScript and HTML. For HTML we can
use the token-based parser from upstream, and we should consider
whether Cobol and ActionScript are worth the effort to maintain a separate
regex implementation using GRegex (IMO these languages are dead enough
not to justify the extra effort).

The patch also disables tests for languages using regex parsers.

* Rename roleDesc to roleDefinition

See 1345725842c196cc0523ff60231192bcd588961b upstream. Since we don't care
about roles in Geany, we don't have to do the additional stuff the upstream
patch does.

* Add XTAG_ANONYMOUS used by jscript

See 0e4c5d4a0461bc8d9616fe3b97d75b91d014246e upstream.

* Include stdint.h in entry.h

* Don't use hash value as an Anonymous field identifier

Instead of something like "Anonymous0ab283cd9402" use sequential integer
values like "Anonymous1".

* Call anonReset in main part

See 3c91b1ea509df238feb86c9cbd552b621e462653 upstream.

* Use upstream javascript parser

* Use upstream css parser

* Create correctly sized MIO for 0 size

See https://github.com/universal-ctags/ctags/pull/1951

* Always enable promise API and subparsers for Geany

* Support subparsers in Geany and add HTML parser demonstrating this feature

This feature requires several changes:

1. Propagating language of the tag from ctags to Geany so we know whether
the tag comes from a master parser or a subparser.

2. We need to address the problem that tag types from a subparsers can
clash with tag types from master parsers or other subparsers used by the
master parser. For instance, HTML and both its css and javascript
subparsers use tm_tag_class_t but HTML uses it for <h2> headings, and
css and javascript for classes. Representing all of them using
tm_tag_class_t would lead to complete mess where all of these types would
for instance be listed in the same branch of the tree in the sidebar.

To avoid this problem, this patch adds another mapping for subparsers where
each tag type can be mapped to another tag type (which isn't used neither
by master parser or other subparsers). To avoid unwanted clashes with other
parsers, only tags explicitly mentioned in such mappings are added to tag
manager; other subparser tags are discarded.

For HTML this patch introduces mapping only for tm_tag_function_t (which
in this case maps to the same type) to mimick the previous HTML parser
behavior but other javascript and css tag types can be added this way
in the future too.

3. Since in most of the code Geany and tag manager assume that tags from
one file use the same language, subparser's tags are modified to have the
same language like the master parser.

4. HTML parser itself was copied from upstream without any modifications.
Tests were fixed as the parser now correctly ignores comments.

* Rename truncateLine field of tagEntryInfo

See 0e70b22791877322598f03ecbe3eb26a6b661001 upstream. Needed for Fortran
parser.

* Add dummy mbcs.h and trace.h

Included by javascript parser.

* Introduce an accessor to `locate' field of `Option'

See fb5ef68859f71ff2949f1d9a7cab7515f523532f upstream. Needed for Fortran.

* Add numarray.c/h

Needed by various parsers.

* Add getLanguageForFilename() and getLanguageForCommand()

See

416c5e6b8807feaec318d7f8addbb4107370c187
334e072f9d6d9954ebd3eb89bbceb252c20ae9dd

upstream. Needed for Sh parser.

* txt2tags: Fix scope separator definition and re-enable tests

* Rename rest.c to rst.c to match upstream filename

* Use upstream asciidoc and rst parsers

* Add asciidoc and rst unit tests

* Rename conf.c to iniconf.c to match upstream filename

* Add tests of conf, diff, md parsers from universal ctags

* Add more ctags unit tests

This patch adds unit tests for: nsis, docbook, haskell, haxe, abaqus, vala,
abc.

The only missing unit tests are for GLSL and Ferite parsers which
however share the implementation with the C parser and should be
reasonably well covered by other C-like language tests.

The tests were put together from various tutorials and help of the
languages in order to cover the tags these parsers generate. No guarantee
they'd compile with real parsers.

* Rename latex.c to tex.c to match upstream filename

* Rename entry points of parsers to match upstream names

* Initialize trashbox

* Add newline to the end of file
2019-04-06 12:14:30 +10:00
Jiří Techet 0a6acff818 Remove mbcs.c/h
Currently unused by Geany.
2016-10-24 14:52:11 +02:00
Jiří Techet 40ed52cf64 Remove output writer implementations
Not needed by Geany, just keep dummy implementation so we don't have to
change the rest of the files.
2016-10-24 12:47:50 +02:00
Jiří Techet e1b4d14097 Add the remaining missing files from uctags 2016-10-15 16:43:14 +02:00
Jiří Techet 3390e2acc8 Move ctags "API" from Geany to ctags
This commit basically just moves stuff from tm_ctags_wrappers.c/h to
ctags. The "api.h" file has been renamed to "ctags-api.h" to make it
clearer it belongs to ctags when included.

The code also tries to completely isolate ctags from the caller;
previously we were using tagEntryInfo to pass information to Geany. This
however required including entry.h which added lots of other stuff we
don't want in the API. Instead create an auxiliary struct that holds
all the needed information from tagEntryInfo (currently only the stuff
used by Geany) and copy all the info from tagEntryInfo before invoking
the callback.
2016-10-15 15:16:45 +02:00
Jiří Techet 32dfa2878a Some initial work on ctags as a library
Protect library-specific stuff by CTAGS_LIB macro which also makes it
better visible what changes had to be made to convert ctags into library.
Changes which need further Geany sync and aren't library-related aren't
protected by the macro.

Move things from geany.c/h to the locations where they belong and rename
geany.c/h to api.c/h into which API-like functions will be moved in the
next commits (mostly things from tm_ctags_wrappers.c/h).

Add complete main.c from uctags and just remove main() using the CTAGS_LIB
macro.
2016-10-15 00:14:37 +02:00
Jiří Techet 829ea7d38b Grab uctags version of parse.c/h and nestlevel.c/h plus additional fallout
At this point the only remaining files with big changes are parser.c/h
and nestlevel.c/h. However, the amount of changes is big and these
changes cannot be easily separated into individual small patches. Fortunately
by looking at parse.c there doesn't seem to be anything really valuable
in Geany's version and we can just simply take over the ctags one and
only apply the necessary changes on top of that. nestlevel.c/h has to
be synced at the same time as the changes are related to cork introduction
which was done in both of them.

A few points:

createTagsWithFallback1() and createTagsWithFallback() have been modified
so they don't do anything with the output tags file which we don't use.
Because they contain all the reparsing logic we originally had in
tm_ctags_parse(), this function got simplified and just calls
createTagsWithFallback().

In Options EX_PATTERN has been changed to EX_LINENUM (there's some strange
thing with EX_PATTERN in uctags as it always checks the previous line
in the output tags file - and we don't have output tags file so it
crashes).

Lots of previously commented-out lines (because we didn't have all the
functions from uctags at that point) could be uncommented.

lxpath.c has been added.

Parsers had to be adjusted to work with the updated nestlevel and cork.
Changes in asciidoc and rest were based on the "rst.c" parser from uctags.
txt2tags has been modified manually. The ruby changes wer taken directly
from the uctags ruby parser and the python ones were based on the last
commit before the introduction of the token-based parser.

The parser now respects if kinds are enabled/disabled so prototypes
and externvars had to be enabled in the c.c parser to get the same output.

The parse2() function now returns rescanReason union instead of simple
bool to indicate reparsing should happen - c.c and fortran have been
changed accordingly.

tm_ctags_init() has been changed to call all the initialization that
happens in uctags except of output tag file initialization which we don't
use. In addition it calls

initializeParser (LANG_AUTO)

This forces all parsers to get initialized. Without it parsers get
initialized lazily as they are used but the problem is code like

isInputLanguage (Lang_java)

in c.c which just does ((lang) == getInputLanguage ()) works incorrectly
because getInputLanguage () returns 0 for C and when uninitialized,
Lang_java is also 0 and we have a problem. This problem isn't present in
uctags because there the 0th parser is always CTagsSelfTestParser
so this cannot happen.
2016-10-14 18:07:31 +02:00
Jiří Techet 051b780745 parse: some simple syncs and include syncs
Addition of dependency.c/h and promise.c/h. Also moved tagEntryFunction
definitions to geany.c/h.
2016-10-11 23:04:13 +02:00
Jiří Techet 8e804b3145 entry: Add the remaining code from uctags
Also enable compilation of forgotten kind.c
2016-10-09 19:58:24 +02:00
Jiří Techet 2a9f473d78 Sync options.c/h (and introduce a lot of new garbage)
This commit started innocently as an attempt to grab options.c/h from
uctags. However it started referencing other files (which started
referencing other files) so the result is lots of new files are added.

When trying to make it compile, I run into many differences of existing
code which would have to be resolved. As all the added code is more or
less garbage for Geany, I just simply commented-out various function
bodies so it compiles without additional modifications. Should get fixed
once more files get synced with uctags.
2016-10-08 15:48:42 +02:00
Jiří Techet 0a0ed51792 Create geany.c/h and put isIgnoreToken()
This is a (hopefully) temporary file where we put geany-specific code
that for some reason has to be still in ctags. Put isIgnoreToken()
in this file.
2016-10-08 14:13:41 +02:00
Jiří Techet 88cbe3871c Grab ctags version of general.h and make related changes
Added e_msoft.h, changed configure.ac to make more checks for header files
so we have corresponding macros defined, drop HAVE_REGEX macro check which
isn't defined any more, drop debugging function from lua parser (complains
about missing definition of errout).

Tested only on Linux (TODO: Windows, OS X)
2016-10-08 14:13:41 +02:00
Jiří Techet ded5ea3eea Move debug related code to debug.c/h 2016-10-08 14:13:41 +02:00
Jiří Techet 7ebcfb77dc Define gcc attributes inside gcc-attr.h 2016-10-08 14:13:36 +02:00
Jiří Techet c6294e37c9 Grab uctags ctags.h and add repoinfo.c/h 2016-10-08 14:12:45 +02:00
Jiří Techet ed01b7edb4 Grab uctags keyword.c/h and add types.h with type declarations
keyword.c/h contains only changes made by me. To make the sync complete,
add type.h with type declarations (and remove the added declarations from
their original locations).
2016-10-08 14:12:44 +02:00
Jiří Techet 560107804c Drop some more unused functions from routines.c/h
Also get the error() implementation from error.c/h (modified slightly to
make sure exit() isn't called and which doesn't call errorPrinter() as
this one should be set somewhere else in the code and it doesn't happen
now).
2016-10-08 14:12:35 +02:00
Jiří Techet 992306aec3 Add generic pointer array 2016-10-06 15:41:19 +02:00
Jiří Techet ea72ecc00f Remove ctags.c and move its content to routines.c, main.c and options.c
This is mostly just moving code with just some minor modifications:
- removal of code of unsupported platforms (VAX, OS2, etc.)
- syncing includes/headers of affected files with uctags
- removal of some functions we don't need in Geany and whose movement
  would require additional changes (those will get added back when
  doing final sync with uctags)
- minor whitespace syncs
2016-08-03 00:27:22 +02:00
Jiří Techet 1b32ac5481 Add full xtag implementation and use it to check XTAG_QUALIFIED_TAGS 2016-08-01 18:58:27 +02:00
Jiří Techet 359c60b81b Rename get.c/h to lcpp.c/h 2016-07-31 21:00:58 +02:00
Jiří Techet 0ed5c16b46 Rename tagEntryInfo.extensionFields.scope
This requires moving kindOption into a separate file because of circular
include dependency. Also eliminate now redundant tagLetter() function
in c.c.
2016-07-30 16:04:06 +02:00
Jiří Techet 7b9d0dd83c Make parser includes closer to uctags and sync parser license header
Adds (currently empty) debug.h, routines.h and xtag.h and uses them at the
same places like uctags.
2016-07-28 23:55:56 +02:00
Jiří Techet f95656cbe8 Remove makefile.win32 based build system
No more needed using MSYS2.
2016-07-21 13:21:32 +02:00
Jiří Techet 3b4d9fadf8 Rename js.c to jscript.c to match universal-ctags 2016-07-21 13:14:21 +02:00
Jiří Techet eb2865a819 Separate ctags into parsers and main sources 2016-07-21 13:08:42 +02:00
Jiří Techet 18b7527fcc Use the single-file implementation of MIO from universal-ctags
The version of MIO corresponds to commit 509a47dbc in universal-ctags
which contains just minimal changes mostly related to changing MIO from
a library into a single ctags source file:

- replaced the glib types with ordinary C types
- removed the "virtual" calls and replaced them with simple if/else
- made the implementation in a single file
- reformatted the library to more or less match universal-ctags style
- removed the MIO_FORCE_ANSI ifdef as it included some glib file and
  we don't really need it
- added mio_flush() - of course makes sense just for the file backend
  (calls fflush())
- made mio_free() return error code from fclose()
- changed mio_new_fp() to return NULL when the passed FILE is NULL
  (simplifies logic at one place in ctags and makes sense IMO)
2016-07-21 13:08:42 +02:00
Jiří Techet 3d2e7d4fca Move TM into src
Move the tag manager implementation to src as it really is part of Geany
sources and start making the ctags directory structure similar to
the universal-ctags one.

In principle, the patch does

mv tagmanager/src src/tagmanager
mv tagmanager/ctags tagmanager/main
mv tagmanager ctags

plus corresponding Makefile.am and configure.ac updates.
2016-07-21 13:08:42 +02:00