Commit Graph

110 Commits

Author SHA1 Message Date
Arfon Smith
c8094d3775 Merge branch 'master' into 3227-local 2016-09-21 20:26:51 -07:00
Alhadis
697380336c Revise pattern for Emacs modeline detection
This is a rewrite of the regex that handles Emacs modeline matching. The
current one is a little flaky, causing some files to be misclassified as
"E", among other things.

It's worth noting malformed modelines can still change a file's language
in Emacs. Provided the -*- delimiters are intact, and the mode's name is
decipherable, Emacs will set the appropriate language mode *and* display
a warning about a malformed modeline:

    -*- foo-bar mode: ruby -*-   # Malformed, but understandable
            -*- mode: ruby--*-   # Completely invalid

The new pattern accommodates this leniency, making no effort to validate
a modeline's syntax beyond readable mode-names. In other words, if Emacs
accepts certain errors, we should too.
2016-09-17 19:45:43 +10:00
Alhadis
abf7bee464 Include tests for version-specific Vim modelines 2016-09-12 20:00:05 +10:00
Alhadis
e73a4ecd0e Allow " ex:" to match at beginning of file
Although unlikely to be valid syntax in most programming languages, such
a modeline is valid syntax in Vim, and will trigger any filetype modes.
2016-09-12 19:59:08 +10:00
Alhadis
22d4865c52 Revise patterns for Vim modeline detection
The current expressions fail to match certain permutations of options:

    vim: noexpandtab: ft=javascript:
    vim: titlestring=foo\ ft=notperl ft=javascript:

Version-specific modelines are also unaccounted for:

    vim600: set foldmethod=marker ft=javascript:   # >= Vim 6.0
    vim<600: set ft=javascript:                    # <  Vim 6.0

See http://vimdoc.sourceforge.net/htmldoc/options.html#modeline
2016-09-11 00:51:03 +10:00
James Ko
c7868a95bc Merge pull request #2902 from jamesqo/patch-2
Add App.config + NuGet.config to the XML file list
2016-03-23 20:11:36 -06:00
Farbod Salamat-Zadeh
9bfbd0550c Move cars.csv from test/fixtures/Data to samples/CSV 2016-02-27 14:32:50 +00:00
chrisarcand
d87fad649c Improved vim modeline detection
TLDR: This greatly increases the flexibility of vim modeline detection
to manually set the language of a file.

In vim there are two forms of modelines:

[text]{white}{vi:|vim:|ex:}[white]{options}
examples: 'vim: syntax=perl', 'ex: filetype=ruby'

-and-

[text]{white}{vi:|vim:|Vim:|ex:}[white]se[t] {options}:[text]
examples: 'vim set syntax=perl:', 'Vim: se ft=ruby:'

As you can see, there are many combinations. These changes should allow
most combinations to be used. The two most important additions are the
use of the keyword 'syntax', as well as the addition of the first form
(you now no longer need to use the keyword 'set' with a colon at the end).
The use of first form with 'syntax' is very, very common across GitHub:

https://github.com/search?l=ruby&q=vim%3A+syntax%3D&ref=searchresults&type=Code&utf8=%E2%9C%93
2016-01-16 08:57:20 -05:00
Ammar Askar
4650368bc2 Make regex for vim modeline more lenient
This change allows the filetype/language to be retrieved from more complex vim modelines. The current regex strictly allows a set line which contains only the filetype/ft parameter and nothing else
2015-08-10 00:42:14 -05:00
Arfon Smith
21e97cc65c Merge pull request #2170 from pchaigno/mod-extension
.mod extension
2015-07-04 20:57:40 +01:00
Paul Chaignon
8c54f68040 Fix conflicts from merging master into 'mod-extension' 2015-07-04 18:01:56 +02:00
Arfon Smith
117735ffb9 Merge pull request #2179 from pchaigno/symlinks
Ignore symbolic links
2015-07-04 16:57:43 +01:00
Arfon Smith
2fac182a90 Improving Vim modeline regex 2015-05-12 16:49:14 -05:00
Paul Chaignon
e073e91d62 Detect GFortran module files as generated 2015-04-19 16:56:38 +02:00
Paul Chaignon
da9bda0e27 Detect KiCAD module files as generated 2015-04-19 16:19:52 +02:00
michael tesch
a5b0b333b0 Merge branch 'master' into tesch1-emacs-patch-1 2015-03-24 09:44:08 +01:00
なつき
67e4212f64 Test detecting generated source maps 2015-03-19 19:50:40 -07:00
michael tesch
fda0f2a042 detect emacs modeline for fundamental as Text 2015-03-14 23:53:17 +01:00
michael tesch
6af4ab6db1 harder test 2015-03-14 23:26:08 +01:00
michael tesch
a364e4a2dc tests for emacs modeline regex 2015-03-14 23:13:59 +01:00
Michael Tesch
1bb639617c Create seeplusplusEmacs1
one type of emacs modeline
2015-03-14 22:44:02 +01:00
Paul Chaignon
730be65514 Ignore symlinks in repository statistics 2015-02-28 16:08:16 +01:00
Arfon Smith
88e79cd3a8 Adding fixtures to test shebang strategy ordering 2015-02-07 10:24:03 -06:00
Arfon Smith
0db1d1c8ca Modifying some modeline fixtures to test case InSeNsItivitY 2015-02-06 08:48:59 -06:00
Lars Brinkhoff
2077fa3837 'Text' doesn't qualify as a valid modeline language. 2015-02-04 08:20:19 +01:00
Arfon Smith
119a8fff1e Emacs modeline fixtures 2015-01-26 15:38:19 -06:00
Arfon Smith
429c791377 Testing Vim modeline support 2015-01-26 14:39:07 -06:00
Paul Chaignon
f93272f0bd Move text files from fixtures to samples when possible 2014-12-10 20:09:14 -05:00
Paul Chaignon
93186947c2 Move binaries and text files from samples folder to fixtures 2014-12-04 23:48:05 -05:00
Paul Chaignon
77444284e3 Data folder in fixtures for files with no language 2014-12-04 19:14:44 -05:00
Arfon Smith
e70cd33323 Moving to fixtures 2014-09-17 08:37:00 -05:00
Joshua Peek
5521dd08a0 Move test fixtures to samples/ 2012-06-22 10:09:24 -05:00
Joshua Peek
540f2a0941 More matlab samples 2012-06-21 10:44:31 -05:00
Joshua Peek
4b9b8a5058 Remove matlab file with bogus keywords 2012-06-21 10:25:30 -05:00
Joshua Peek
a10e52a3c2 Revert removing some fixtures 2012-06-20 11:18:16 -05:00
Joshua Peek
6113e6d548 Remove ambiguous obj-c header example 2012-06-19 16:28:34 -05:00
Joshua Peek
4ea1e8aece Remove ambiguous c header example 2012-06-19 16:26:39 -05:00
Joshua Peek
fcd8c089dc Add some more c header examplesgst 2012-06-19 16:25:09 -05:00
Joshua Peek
79a473cf58 Add some more apex and openedge fixtures 2012-06-19 15:01:58 -05:00
Michael Ficarra
11166911dc Recognise that PEG.js-generated parsers are in fact generated 2012-06-19 11:18:51 -05:00
Joshua Peek
8a9d8a15af Building an army 2012-06-08 15:46:39 -05:00
Joshua Peek
4df3199818 Reorg test fixtures 2012-06-07 12:17:24 -05:00
Rob Sanheim
1c7b8ebe71 Make colorize safer:
- don't try to colorize blobs that have a high ratio of
    long lines -- these are most likely minified files or something else
    strange that will blow up Pygments.rb
  - re github/github#3938
2012-05-21 11:33:01 -05:00
Joshua Peek
285c9b4c60 Fix xslt mime type 2012-05-09 10:59:00 -05:00
Joshua Peek
35fe44549e Fix empty .m file 2012-05-09 09:52:14 -05:00
Andrew D. Horchler
354e1fc85e More robust heuristics for .m files and 3 new Matlab tests. Support for Obj-C detection fully intact; all tests pass. Detection of Obj-C keywords @implementation, @property, @interface, and @synthesize removed to avoid possible conflicts with user-created Matlab function handles. Only @end is needed, which is not valid in Matlab. Matlab class files supported. Comments preceded by whitespace detected for Obj-C and Matlab.
Signed-off-by: Andrew D. Horchler <adh9@case.edu>
2012-05-08 18:31:18 -04:00
Daniel Micay
be42a8411b add detection for Arch Linux PKGBUILDs 2012-05-08 07:39:48 -04:00
Ilya Grigorik
cb715e2092 add fixture file for Dart 2012-04-09 14:41:01 -07:00
Patrick O'Leary
4f0b457287 Updated Julia language with lexer and added tests 2012-04-04 21:28:29 -05:00
Martin d'Allens
dc145ff715 Set lexer for VHDL language.
Conflicts:

	test/test_blob.rb
2012-03-28 11:37:25 -05:00