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

use modeline as a hint for choosing a parser #41

Merged
merged 14 commits into from
Jul 7, 2014

Conversation

masatake
Copy link
Member

Choosing parser by file extension can conflict. For example ".m" is
used by ObjectiveC and Matlab. shbang and modline is more specific
hint for choosing a parser than file extension.

modeline formats used in vim and emacs are supported in this patch set.

TODO: Documents must be updated.

@masatake masatake mentioned this pull request Jun 23, 2014
@masatake
Copy link
Member Author

I found Vim modeline detector is broken. I withdraw this again.

@masatake masatake closed this Jun 25, 2014
@masatake masatake deleted the modeline branch June 25, 2014 05:47
@masatake masatake reopened this Jun 25, 2014
@masatake
Copy link
Member Author

Revised. Please, review them.

artnez and others added 14 commits July 4, 2014 17:26
…-option

"Honor --ruby-kinds option in ruby.c" is merged.
A unit test case is added for checking.
If a parser for a given file cannot be determined by file extension,
a editor mode line can be used as a good hint for the choice.

emacs detects following two formats at the first line of a file as a
mode specification:

     -*- MODE -*-[1]

     -*- mode: MODE; ... -*-[2]

[1] https://www.gnu.org/software/emacs/manual/html_node/emacs/Choosing-Modes.html#Choosing-Modes
[2] https://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html
This patch makes ctags determines a parser by this mode specification.

TODO: getPatternLanguage is not considered yet.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
… -*-" editor mode line

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
…r mode line

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
emacs detects following format at the end of file as a mode specification[1]:

     Local Variables:
     mode: MODE
     ...
     End:

This patch makes ctags determines a parser by this mode specification.

[1] https://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
…ditor mode line

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
…executable

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Generally -*- MODE -*- style emacs modeline must be appeared on
the first line of the file. However, if the first line is #! shbang,
the modeline can be appeared on the second line. This patch handles
this case.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
…er #!

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
vim detects following format at the end of file as a mode specification[1][2]:

     /* vim: set filetype=FILETYPE */

This patch makes ctags determines a parser by this mode specification.

[1] http://vimdoc.sourceforge.net/htmldoc/options.html#modeline
[2] http://vimdoc.sourceforge.net/htmldoc/filetype.html#filetype

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
…choosing a parser

Choosing parser by file extension can conflict.  For example ".m" is
used by ObjectiveC and Matlab.  shbang and modline is more specific
hint for choosing a parser than file extension.

TODO: Documents must be updated.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@masatake masatake closed this Jul 7, 2014
@masatake masatake reopened this Jul 7, 2014
masatake added a commit that referenced this pull request Jul 7, 2014
use modeline as a hint for choosing a parser
@masatake masatake merged commit 05938d9 into universal-ctags:deploy Jul 7, 2014
masatake pushed a commit to masatake/ctags that referenced this pull request Mar 12, 2020
masatake pushed a commit to masatake/ctags that referenced this pull request Mar 12, 2020
masatake added a commit to masatake/ctags that referenced this pull request Sep 15, 2021
69d052914 Merge pull request universal-ctags#42 from wataash/pcc-debug
f325a479a Conform style of PCC_DEBUG
00e41d611 Fix -Wformat (2)
a60906336 Merge pull request universal-ctags#41 from wataash/wformat
547709ae7 Fix -Wformat
1dcc4a8bb Merge pull request universal-ctags#40 from wataash/has-attribute
99454223b Fix gcc build: error: attributes should be specified before the declarator in a function definition
222388cfa `#ifndef __has_attribute` instead of invalid `#ifndef __attribute__`
9569c380a Merge pull request universal-ctags#39 from wataash/fix-w-format
ffd9f12ad Fix -Wformat
291934145 Use parentheses within macros around parameter names
563d6be05 Fix syntax
73dde20bd Correct captured text positions $0s and $0e
eb6efd959 Enable execution of actions embedded in predicates

git-subtree-dir: misc/packcc
git-subtree-split: 69d052914c97191e7b1dfb4997ae740c735a7a63
masatake added a commit to masatake/ctags that referenced this pull request Dec 2, 2022
e9aec0d0b Version 0.2.0 (universal-ctags#41)
33b51a75f Merge pull request universal-ctags#44 from masatake/fopen-m
c0f010773 Use mmap(2) when opening a tags file if fopen() supports "m" mode flag.
fbb9011a4 GitHub Actions: show error logs when failed

git-subtree-dir: libreadtags
git-subtree-split: e9aec0d0ba4fa8c1223d774e1c4b2dce328b9a97
masatake added a commit to masatake/ctags that referenced this pull request Dec 2, 2022
53b7e27ab Version 0.2.1
5fbf0c7c8 use "m" mode flag of fopen only when compiling with glibc 2.3 or higher
e9aec0d0b Version 0.2.0 (universal-ctags#41)
33b51a75f Merge pull request universal-ctags#44 from masatake/fopen-m
c0f010773 Use mmap(2) when opening a tags file if fopen() supports "m" mode flag.
fbb9011a4 GitHub Actions: show error logs when failed

git-subtree-dir: libreadtags
git-subtree-split: 53b7e27abc24162e5650985877a2fd2c637600a8
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.

2 participants