Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parsers and built-in filetypes for Lisp dialects #1922

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

quipa
Copy link

@quipa quipa commented Aug 9, 2018

Rationale:
Currently geany functionality for Lisp dialects is limited to syntax highlighting and only covers [Common] Lisp and Clojure (currently not full built-in file type). The following change not only expands functionality to existing Lisps dialects but adds support for two major Lisp dialects, Scheme and Racket.

Changes:

  • Add and integrate universal-ctags parsers for Lisp, Clojure, Scheme and Racket (based on Scheme parser)
  • Add built-in filetypes for Clojure, Scheme and Racket (following HACKING instructions)
  • Modify calltip functionality to work with current document file type defined wordchars

Existing problems:

  • Parser capability to identify symbols is limited to functions (Lisp, Clojure, Scheme, Racket), variables (Scheme, Racket) and namespaces (Clojure)
  • Calltip only works by typing a open paren after function name which is not suitable for Lisp dialects
  • Racket filetype keywords are not being consistently highlighted
  • Racket parser is minimal adaptation of Scheme parser
  • ctags tests missing

quipa and others added 7 commits August 1, 2018 01:30
# Description
Add parsers to allow for the use of global tag files and enable basic
autocompletion for these Lisp dialects. Add Scheme
filetype.

Commit follows instructions described in HACKING for parsers and filetypes.

## Parsers

In ctags/
* Add clojure.c and modify for integration with geany
* Add lisp.c and modify for integration with geany
* Add scheme.c and modify for integration with geany
NOTE: These parsers are originally from the universal-ctags/ctags
repository.

In ctags/Makefile.am
* Add clojure.c to parsers
* Add lisp.c to parsers
* Add scheme.c to parsers

In ctags/main/parsers.h
* Add ClojureParser
* Add LispParser
* Add SchemeParser

In src/tagmanager/tm_parser.h.
* Add TM_PARSER_CLOJURE
* Add TM_PARSER_LISP
* Add TM_PARSER_SCHEME

In src/tagmanager/tm_parser.c:
* Add a map_CLOJURE TMParserMapEntry mapping to ClojureKinds with
appropriate TMTagType and add corresponding MAP_ENTRY(CLOJURE) to
parser_map
* Add a map_LISP TMParserMapEntry mapping to LispKinds with appropriate
TMTagType and add corresponding MAP_ENTRY(LISP) to parser_map
* Add a map_SCHEME TMParserMapEntry mapping to SchemeKinds with appropriate
TMTagType and add corresponding MAP_ENTRY(SCHEME) to parser_map

In src/tagmanager/tm_parser.c:
Add Clojure, Lisp and Scheme to tm_parser_has_full_context().

In symbols.c:
Update add_top_level_items() with Clojure and Lisp and Scheme.

## Filetypes

In filetypes.c, init_builtin_filetypes():
* Set 2nd argument to Lisp in FT_INIT() macro for Lisp filetype
* Add full entry for Clojure in FT_INIT() macro for Clojure filetype
* Add full entry for Scheme in FT_INIT() macro for Clojure filetype

In filetypes.h
* Add GEANY_FILETYPES_CLOJURE
* Add GEANY_FILETYPES_LISP
* Add GEANY_FILETYPES_SCHEME

In data/filetype_extensions.conf
* Add Scheme

In data/filedefs/
* Add filetypes.Scheme.conf

In data/Makefile.am
* Add filetype.Scheme.conf to filetypes

## Notes
* In tm_parser.c tm_parser_has_full_context() new entries probably need
verifying in language relevant documentation.
* Need to add tests for parsers in this commit.
# Description
Add parser to allow for the use of global tag files and enable basic
autocompletion for these Racket. Add Clojure, Scheme and Racket
as built-in filetypes. Clojure, Scheme and Racket use Lisp Lexer.

Commit follows instructions described in HACKING for parsers and filetypes.

## Racket Parser

In ctags/
* Add ``racket.c``. This parser is based on the Scheme parser from the universal-ctags/ctags
repository and was adapted for integration with geany.

In ctags/Makefile.am
* Add ``scheme.c`` to ``parsers``

In ctags/main/parsers.h
* Add ``RacketParser``

In src/tagmanager/tm_parser.h.
* Add ``TM_PARSER_RACKET``

In src/tagmanager/tm_parser.c:
* Add a ``ap_SCHEME TMParserMapEntry`` mapping to ``SchemeKinds`` with appropriate
``TMTagType`` and add corresponding ``MAP_ENTRY(SCHEME)`` to ``parser_map``

In src/tagmanager/tm_parser.c:
Add Racket to ``tm_parser_has_full_context()``.

In symbols.c:
Update ``add_top_level_items()`` with Racket.

## Built-in filetypes

In filetypes.c, ``init_builtin_filetypes()``:
* Add full entry for Scheme in ``FT_INIT()`` macro for Racket filetype

In filetypes.h
* Add GEANY_FILETYPES_RACKET

In data/filetype_extensions.conf
* Add ``Racket`` to ``[Extensions]``
* Add ``Racket`` to ``Script`` in ``[Groups]``

In data/filedefs/
* Add ``filetypes.racket``
* Modify ``filetype.Clojure.conf`` to ``filetypes.clj``
* Modify ``filetype.Scheme.conf`` to ``filetypes.scheme``

In data/fildefs/filetype.clj
In data/fildefs/filetype.scheme
In data/fildefs/filetype.lisp
In data/fildefs/filetype.rkt
* (except lisp) Add ``[styling]`` section with contents equal
to those in filetype.lisp
* Add ``wordchars``
* Add ``whitespaces_chars``
NOTE: This enables selecting  on double click functions and variables
with these characters

In data/Makefile.am
* Add filetype.racket to filetypes
* Modify ``filetype.Clojure.conf`` to ``filetypes.clj``
* Modify ``filetype.Scheme.conf`` to ``filetypes.scheme``

In src/highlightingsmappings.h
* Add ``highlighting_lexer_CLOJURE``
* Add ``highlighting_lexer_SCHEME``
* Add ``highlighting_lexer_RACKET``
* Add ``highlighting_styles_CLOJURE``
* Add ``highlighting_styles_SCHEME``
* Add ``highlighting_styles_RACKET``
* Add ``highlighting_keywords_CLOJURE``
* Add ``highlighting_keywords_SCHEME``
* Add ``highlighting_keywords_RACKET``
* Add ``highlighting_properties_CLOJURE``
* Add ``highlighting_properties_SCHEME``
* Add ``highlighting_properties_RACKET``

In src/highlighting.c
* Add ``init_styleset_case(CLOJURE);`` in ``highlighting_init_styles()``
* Add ``init_styleset_case(SCHEME);`` in ``highlighting_init_styles()``
* Add ``init_styleset_case(RACKET);`` in ``highlighting_init_styles()``

## Notes
* Need to add tests for Racket parser in this commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant