Commit Graph

189 Commits (master)

Author SHA1 Message Date
Mirco Schoenfeld 1d94ba2c32 moved bibtex definition to the end of filetypes and parser definitions 2019-09-21 05:02:51 +02:00
Mirco Schoenfeld 67456e0cc3 Copied BibTeX-parser from https://github.com/universal-ctags/ctags/pull/2137 2019-09-18 13:27:35 +02:00
Mirco Schoenfeld e652dd909d added filetypes.bibtex to relevant Makefile plus made lookup of bibtex keywords case insensitive 2019-07-11 09:58:17 +02:00
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 349b8c40e2 Merge pull request #2134 from b4n/ctags/new-flex-parser
Add new upstream candidate Flex parser
2019-04-28 11:14:33 +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
Colomban Wendling 585b16b0da COBOL: Import new upstream candidate parser
This fixes support for COBOL symbols after the recent breakage of regex
parsers, as well as introducing additional features and bug fixes.

Also import some of the tests.

https://github.com/universal-ctags/ctags/pull/2076

Part of #2119.
2019-04-20 11:36:03 +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
Colomban Wendling 4452b365bf Merge pull request #1263 from techee/ctags_sync_main
First part of syncing with Universal-CTags.
2018-12-17 21:37:43 +01:00
Jiří Techet 457658dcfb Avoid warnings about unused variables in rest and asciidoc parsers
We don't use the return value of getNestingLevel(), only its
nestingLevelsPop() semantics. Get rid of the return value and rename the
function to avoid confusion.
2018-12-17 21:19:52 +01:00
Colomban Wendling 66a08f6570 Remove an unused variable and fix a related comment 2018-12-09 09:45:55 +01:00
Colomban Wendling 89a934edee Guard some more code for non-library builds only 2018-12-09 09:45:49 +01:00
Colomban Wendling e792d4fdf9 Don't export some local functions
They are already fixed upstream, so it doesn't add to the diff.
2018-12-09 09:45:48 +01:00
Colomban Wendling f61bd540b7 Remove two unused variables 2018-12-09 09:45:48 +01:00
Colomban Wendling f93aa14788 Remove an unused function that was removed upstream 2018-12-09 09:45:43 +01:00
Masatake YAMATO 749ab56058 main: remove duplicated declarations
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2018-12-09 09:42:09 +01:00
Masatake YAMATO 33a102ee91 Add dummy definitions to Assert* macros for suppressing compiler warnings
main/field.c:968:23: warning: \
     suggest braces around empty body in an ‘else’ statement [-Wempty-body]

     AssertNotReached();

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2018-12-09 09:42:09 +01:00
Jiří Techet 99e0f208b2 Merge branch 'master' into ctags_sync_main
# Conflicts:
#	ctags/main/lcpp.c
#	ctags/main/parse.c
2018-10-13 14:25:12 +02:00
Jiří Techet 248c970aa0 Add missing void 2018-10-13 13:38:08 +02:00
Jiří Techet 25e8ebc444 Fix indent 2018-10-13 13:36:38 +02:00
Jiří Techet 9b44e9fa42 Fix parsing with sub-parsers
The previous code would skip parsing with sub-parsers so these would not
work. Running full createTagsWithFallback1() in this case would cause
two problems:

1. We would have to propagate the extra callback arguments to
runParserInNarrowedInputStream()

2. And the callbacks after each pass should not actually be called in this
case because the caller expects these are called for the master parser,
not the sub-parsers.

So instead just do simple parsing without re-tries which are used only in
the C and Fortran parsers which lack sub-parser capability anyway.
2018-10-13 13:33:23 +02:00
Colomban Wendling 46ee2a826f Report subroutine declarations as such
They were reported as subroutines because kind was assigned after being
used, which was likely a bug.
2018-06-15 22:17:12 +02:00
Matthew Brush 43122ea7d9 Add more 'fall through' comments for switch cases
TODO: make sure these are actually meant to fall-through.
2017-12-20 17:22:51 -08:00
Matthew Brush bf28794635 Adjust 'fall through' comments to be recognized by GCC
As per the documentation[0], GCC will silence these warnings when
the comments are formatted correctly.

[0]: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
2017-12-20 17:22:51 -08:00
Matthew Brush 243d55fa58 Fix missing initializer for field warnings in parsers 2017-12-20 17:22:50 -08:00
Matthew Brush 81144dc401 Fix missing initializer for field warnings
This is basically a false-positive by GCC since static variables are
unambiguously zeroed-out per the language standard, but the workaround
is simple enough.
2017-12-20 17:22:50 -08:00
Matthew Brush dbd0573dd6 Fix comparison between signed and unsigned integers 2017-12-20 17:22:50 -08:00
Matthew Brush 63850b3eb7 Fix pointer and character constant comparison 2017-12-20 17:22:50 -08:00
Colomban Wendling 6f692112e3 C: Fix line continuation handling (#1370)
Escaped newlines were properly handled inside preprocessor directives,
but not otherwise.

Seeing `continue` here suggests the code used to work a long time ago
but some loop refactoring broke it, as now it would not stay in the
loop unless in a preprocessor directive.  Or maybe it only ever worked
for preprocessor directives, and the `continue` was superfluous?

Fixes #1370.
2017-04-20 16:57:02 +10:00
Jiří Techet bf4eb8f093 lcpp: use eStrdup() instead of strdup() 2017-02-15 12:03:41 +01:00
Jiří Techet df0ae9b77a python: minor cleanups 2017-02-15 12:00:17 +01:00
Jiří Techet e5b5326cc0 python: Rename corkPair struct to corkInfo 2017-02-15 11:58:02 +01:00
Jiří Techet 3e8365c7f2 asciidoc, rest: Remove unnecessary scope assignments
Should be handled by cork.
2017-02-15 11:50:22 +01:00
Jiří Techet cf6653a4ce Don't check if kind is enabled for library
Library users probably want all found tags and decide themselves whether
the tag is interesting for them or not. Revert "enabled" values in c.c
to their previous values to match uctags as these are ignored now.
2017-02-15 01:13:57 +01:00
Jiří Techet 634719aff6 c.c: Eliminate useless kind_for_define variable 2017-02-15 00:35:56 +01:00
Jiří Techet d5823ced94 c.c: Reinitialize rescan variable in case longjmp() happens 2017-02-15 00:34:34 +01:00
Jiří Techet 8455f8e70d lcpp, c: Fix signature collection
First, make sure that when calling cppGetc() and cppUngetc() the signature
is properly updated.

Second, make sure that signature is cleared when preparing for new token
read.
2017-02-15 00:31:10 +01:00
Jiří Techet 0a6acff818 Remove mbcs.c/h
Currently unused by Geany.
2016-10-24 14:52:11 +02:00
Jiří Techet efc40f4007 #if 0 most of options.c
We don't need command-line options parsing so we can remove most of the
file. Add dummy implementations of functions called from elsewhere.
2016-10-24 13:11:43 +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 b8df6e02ad Eliminate use of fnmatch() which isn't present on MINGW
We could add the fnmatch implementation from uctags (see the fnmatch
directory) but since we don't use fileNameMatched(), we can just drop it.
2016-10-15 19:40:17 +02:00
Jiří Techet 0dd9f3a362 Eliminate use of regex from read.c
readLineFromBypassSlow() isn't used in Geany so we can drop it for now.
Preferably in the future part of this code should be moved to lregex.c.
2016-10-15 19:24:20 +02:00
Jiří Techet 09e13d50cf Don't compile bigger part of main for CTAGS_LIB
Without this clock_t definition is missing (haven't investigated why)
but we don't need the stuff from main anyway.
2016-10-15 18:17:57 +02:00
Jiří Techet 38403d1ca0 Annotate geany-specific diffs
This makes it clearer to see which diffs are related to Geany. Only for
files which are synced, not e.g. for lcpp where changes are everywhere.
2016-10-15 16:55:52 +02:00
Jiří Techet e1b4d14097 Add the remaining missing files from uctags 2016-10-15 16:43:14 +02:00
Jiří Techet 06f1a19c4b Make LanguageTable variable private in parse.c
This requires having some accessor to LanguageTable for the API functions
which is done by getParserDefinition().
2016-10-15 16:29:40 +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 29d801aa7b tmp 2016-10-14 23:28:30 +02:00
Jiří Techet f82218ab07 Sync error.c completely and create a custom error printer
Make sure the custom error printer never ends with fatal errors terminating
the application.
2016-10-14 23:26:59 +02:00