diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d0884dab..658931b3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,7 @@ This can usually be solved either by adding a new filename or file name extensio ### Syntax highlighting looks wrong -Assuming your code is being detected as the right language (see above), in most cases this is due to a bug in the language grammar rather than a bug in Linguist. [`grammars.yml`][grammars] lists all the grammars we use for syntax highlighting on github.com. Find the one corresponding to your code's programming language and submit a bug report upstream. +Assuming your code is being detected as the right language (see above), in most cases this is due to a bug in the language grammar rather than a bug in Linguist. [`grammars.yml`][grammars] lists all the grammars we use for syntax highlighting on github.com. Find the one corresponding to your code's programming language and submit a bug report upstream. If you can, try to reproduce the highlighting problem in the text editor that the grammar is designed for (TextMate, Sublime Text, or Atom) and include that information in your bug report. You can also try to fix the bug yourself and submit a Pull Request. [This piece from TextMate's documentation](http://manual.macromates.com/en/language_grammars) offers a good introduction on how to work with TextMate-compatible grammars. You can test grammars using [Lightshow](https://lightshow.githubapp.com). diff --git a/grammars.yml b/grammars.yml index ae0245e4..c921d505 100644 --- a/grammars.yml +++ b/grammars.yml @@ -9,8 +9,6 @@ http://svn.textmate.org/trunk/Review/Bundles/Forth.tmbundle: - source.forth http://svn.textmate.org/trunk/Review/Bundles/Parrot.tmbundle: - source.parrot.pir -http://svn.textmate.org/trunk/Review/Bundles/Ruby%20Sass.tmbundle: -- source.sass http://svn.textmate.org/trunk/Review/Bundles/SecondLife%20LSL.tmbundle: - source.lsl http://svn.textmate.org/trunk/Review/Bundles/VHDL.tmbundle: @@ -85,6 +83,8 @@ https://github.com/atom/language-csharp: - source.cs - source.csx - source.nant-build +https://github.com/atom/language-gfm: +- text.html.markdown https://github.com/atom/language-javascript: - source.js - source.js.regexp @@ -92,6 +92,9 @@ https://github.com/atom/language-python: - source.python - source.regexp.python - text.python.traceback +https://github.com/atom/language-sass: +- source.css.scss +- source.sass https://github.com/atom/language-shellscript: - source.shell - text.shell-session @@ -170,6 +173,7 @@ https://github.com/lavrton/sublime-better-typescript: https://github.com/leafo/moonscript-tmbundle: - source.moonscript https://github.com/lsf37/Isabelle.tmbundle: +- source.isabelle.root - source.isabelle.theory https://github.com/lunixbochs/x86-assembly-textmate-bundle: - source.asm.x86 @@ -323,8 +327,6 @@ https://github.com/textmate/lua.tmbundle: - source.lua https://github.com/textmate/make.tmbundle: - source.makefile -https://github.com/textmate/markdown.tmbundle: -- text.html.markdown https://github.com/textmate/matlab.tmbundle: - source.matlab - source.octave @@ -421,4 +423,6 @@ https://github.com/wmertens/sublime-nix: https://raw.githubusercontent.com/eregon/oz-tmbundle/master/Syntaxes/Oz.tmLanguage: - source.oz https://raw.githubusercontent.com/tenbits/sublime-mask/release/Syntaxes/mask.tmLanguage: -- source.mask \ No newline at end of file +- source.mask +https://raw.githubusercontent.com/andik/IDL-Syntax/master/IDL.tmLanguage: +- source.webidl diff --git a/lib/linguist/heuristics.rb b/lib/linguist/heuristics.rb index 8d45ccd6..c96a93f0 100644 --- a/lib/linguist/heuristics.rb +++ b/lib/linguist/heuristics.rb @@ -61,6 +61,14 @@ module Linguist @heuristic.call(data) end + disambiguate "BitBake", "BlitzBasic" do |data| + if /^\s*; /.match(data) || data.include?("End Function") + Language["BlitzBasic"] + elsif /^\s*(# |include|require)\b/.match(data) + Language["BitBake"] + end + end + disambiguate "Objective-C", "C++", "C" do |data| if (/@(interface|class|protocol|property|end|synchronised|selector|implementation)\b/.match(data)) Language["Objective-C"] @@ -156,6 +164,14 @@ module Linguist end end + disambiguate "TypeScript", "XML" do |data| + if data.include?(" "python2" - script.sub! $1, '' if script =~ /(\.\d+)$/ + script.sub! /(\.\d+)$/, '' # Check for multiline shebang hacks that call `exec` if script == 'sh' && - lines.first(5).any? { |l| l.match(/exec (\w+).+\$0.+\$@/) } + data.lines.first(5).any? { |l| l.match(/exec (\w+).+\$0.+\$@/) } script = $1 end diff --git a/samples/BitBake/gstreamer-libav.bb b/samples/BitBake/gstreamer-libav.bb new file mode 100644 index 00000000..803bcf2f --- /dev/null +++ b/samples/BitBake/gstreamer-libav.bb @@ -0,0 +1,25 @@ +include gstreamer1.0-libav.inc + +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://COPYING.LIB;md5=6762ed442b3822387a51c92d928ead0d \ + file://ext/libav/gstav.h;beginline=1;endline=18;md5=a752c35267d8276fd9ca3db6994fca9c \ + file://gst-libs/ext/libav/LICENSE;md5=23a54f59b82572c203a559346e89ed57 \ + file://gst-libs/ext/libav/COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://gst-libs/ext/libav/COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ + file://gst-libs/ext/libav/COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ + file://gst-libs/ext/libav/COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" + +SRC_URI = " \ + http://gstreamer.freedesktop.org/src/gst-libav/gst-libav-${PV}.tar.xz \ + file://0001-Disable-yasm-for-libav-when-disable-yasm.patch \ + " +SRC_URI[md5sum] = "86540dee14d31daf976eb2713f2294f3" +SRC_URI[sha256sum] = "585eb7971006100ad771a852e07bd2f3e23bcc6eb0b1253a40b5a0e40e4e7418" + +LIBAV_EXTRA_CONFIGURE_COMMON_ARG = "--target-os=linux \ + --cc='${CC}' --as='${CC}' --ld='${CC}' --nm='${NM}' --ar='${AR}' \ + --ranlib='${RANLIB}' \ + ${GSTREAMER_1_0_DEBUG}" + +S = "${WORKDIR}/gst-libav-${PV}" + diff --git a/samples/BitBake/qtbase-native.bb b/samples/BitBake/qtbase-native.bb new file mode 100644 index 00000000..5d24f48a --- /dev/null +++ b/samples/BitBake/qtbase-native.bb @@ -0,0 +1,13 @@ +require qt5-git.inc +require ${PN}.inc + +do_install_append() { + # for modules which are still using syncqt and call qtPrepareTool(QMAKE_SYNCQT, syncqt) + # e.g. qt3d, qtwayland + ln -sf syncqt.pl ${D}${OE_QMAKE_PATH_QT_BINS}/syncqt +} + +QT_MODULE_BRANCH = "release" +# v5.2.1 + 168 commits +SRCREV = "08cbbde61778276ccdda73d89fd64d02c623779f" + diff --git a/samples/WebIDL/AnimationEvent.webidl b/samples/WebIDL/AnimationEvent.webidl new file mode 100644 index 00000000..e48ed571 --- /dev/null +++ b/samples/WebIDL/AnimationEvent.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/css3-animations/#animation-events- + * http://dev.w3.org/csswg/css3-animations/#animation-events- + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Constructor(DOMString type, optional AnimationEventInit eventInitDict)] +interface AnimationEvent : Event { + readonly attribute DOMString animationName; + readonly attribute float elapsedTime; + readonly attribute DOMString pseudoElement; +}; + +dictionary AnimationEventInit : EventInit { + DOMString animationName = ""; + float elapsedTime = 0; + DOMString pseudoElement = ""; +}; diff --git a/samples/WebIDL/Fetch.webidl b/samples/WebIDL/Fetch.webidl new file mode 100644 index 00000000..fb022126 --- /dev/null +++ b/samples/WebIDL/Fetch.webidl @@ -0,0 +1,35 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://fetch.spec.whatwg.org/ + */ + +typedef object JSON; +// FIXME(nsm): Bug 739173: FormData is not available in workers. +// typedef (ArrayBuffer or ArrayBufferView or Blob or FormData or USVString or URLSearchParams) BodyInit; +typedef (ArrayBuffer or ArrayBufferView or Blob or USVString or URLSearchParams) BodyInit; + +[NoInterfaceObject, Exposed=(Window,Worker)] +interface Body { + readonly attribute boolean bodyUsed; + [Throws] + Promise arrayBuffer(); + [Throws] + Promise blob(); + // FIXME(nsm): Bug 739173 FormData is not supported in workers. + // Promise formData(); + [Throws] + Promise json(); + [Throws] + Promise text(); +}; + +[NoInterfaceObject, Exposed=(Window,Worker)] +interface GlobalFetch { + [Throws, Func="mozilla::dom::Headers::PrefEnabled"] + Promise fetch(RequestInfo input, optional RequestInit init); +}; + diff --git a/test/test_heuristics.rb b/test/test_heuristics.rb index 2417c77e..aaae4956 100644 --- a/test/test_heuristics.rb +++ b/test/test_heuristics.rb @@ -126,6 +126,13 @@ class TestHeuristcs < Test::Unit::TestCase }) end + def test_bb_by_heuristics + assert_heuristics({ + "BitBake" => all_fixtures("BitBake"), + "BlitzBasic" => all_fixtures("BlitzBasic") + }) + end + def assert_heuristics(hash) candidates = hash.keys.map { |l| Language[l] } diff --git a/test/test_language.rb b/test/test_language.rb index 10b714c8..fb6e102b 100644 --- a/test/test_language.rb +++ b/test/test_language.rb @@ -375,4 +375,13 @@ class TestLanguage < Test::Unit::TestCase message << missing.map { |language| sprintf("%-#{width}s %s", language.name, language.ace_mode) }.sort.join("\n") assert missing.empty?, message end + + def test_all_popular_languages_exist + popular = YAML.load(File.read(File.expand_path("../../lib/linguist/popular.yml", __FILE__))) + + missing = popular - Language.all.map(&:name) + message = "The following languages are listed in lib/linguist/popular.yml but not in lib/linguist/languages.yml.\n" + message << missing.sort.join("\n") + assert missing.empty?, message + end end diff --git a/test/test_shebang.rb b/test/test_shebang.rb index 4b6b39a6..5ead299d 100644 --- a/test/test_shebang.rb +++ b/test/test_shebang.rb @@ -17,6 +17,8 @@ class TestShebang < Test::Unit::TestCase assert_interpreter nil, " #!/usr/sbin/ruby" assert_interpreter nil, "\n#!/usr/sbin/ruby" assert_interpreter nil, "#!" + assert_interpreter nil, "#! " + assert_interpreter nil, "#!/usr/bin/env" assert_interpreter "ruby", "#!/usr/sbin/ruby\n# bar" assert_interpreter "ruby", "#!/usr/bin/ruby\n# foo" @@ -34,6 +36,8 @@ class TestShebang < Test::Unit::TestCase assert_interpreter "python3", "#!/usr/bin/python3\n\n\n\n" assert_interpreter "sbcl", "#!/usr/bin/sbcl --script\n\n" assert_interpreter "perl", "#! perl" + + assert_interpreter "ruby", "#!/bin/sh\n\n\nexec ruby $0 $@" end end