Each strategy takes as candidates the language outputted by the
previous strategy if any. This was already the case for the
Classifier and Heuristic strategies as these couldn't generate new
candidate languages (as opposed to the Modeline, Filename, Shebang,
and Extension strategies).
In practice, this signifies that if, for example, the Shebang
strategy finds two possible languages for a given file (as is
currently possible with the perl interpreter), the next strategy, the
Extension strategy, will use this information and further reduce the
set of possible language.
Currently, without this commit, the Extension strategy would discard
the results from the previous strategy and start anew, possibly
returning a different language from those returned by the Shebang
strategy.
* Licensed needs a full path now
* Add docker installed/running guard
* Docker is required for adding/replacing grammars
* Use more elegant method
Hat-tip to @Alhadis 🎩
* Mainly fixing problems with Perl heuristics
And also adding a little bit of text to the README file to help with local use and test.
* Adds new sample
* Adds a couple of samples more, not represented before
* Moves installation intructions to CONTRIBUTING.md
Refs #2309 and also changes github.com to an uniform capitalization.
* Correcting error. Great job, CI
* Moving another file
* Adds samples and new checks for perl/perl6
* Stupid mistake
* Changing regex for perl5 vs perl6
Initial suggestion by @pchaigno, slightly changed to eliminate false positives such as "classes" or "modules" at the beginning of a line in the =pod
BTW, it would be interesting to just eliminate these areas for language detection.
* Eliminates Rexfile from Perl6
And adds .pod6
* Followup to #2709
I just found I had this sitting here, so I might as well follow
instructions to fix it.
* Adds example for pod6
* Eliminates .pod because it's its own language
* Removes bad directory
* Reverting changes that were already there
* Restored CONTRIBUTING.md from head
I see installation of cmake is advised in README.md
* Eliminates `.pod6`
To leave way for #3366 or succeeding PRs.
* Removed by request, since we're no longer adding this extension
* Sorting by alphabetical order filenames
* Moved from sample to test fixtures
* Detect Maven wrapper "mvnw"
* Fix build, filenames must be sorted in the "filenames" section of languages.yml, filenames cannot be grouped by topic
* Remove `mvnw` file from languages/Shell/filenames according to @Alhadis recommendation as we are sure that `mvnw` always starts with the shebang `#!/bin/sh`.
* Remove space chars added by mistake
* Register `cperl` as an alias of Perl 5
Emacs ships with an enhanced major-mode for editing Perl with embedded C
sections (called `cperl-mode`). This commit enables Linguist to identify
Perl files containing cperl modelines.
* Add `cperl` to list of Perl 5 interpreters
* Update licensee version
This pulls in Licensed 0.10.0 too.
* Use a full path to the grammars
Licensed now enforces this as it's easier then guessing.
* Ensure full path
* Use new path for FSProject
* Starting to adjust tests
* require licensee again
* Fix grammar tests
* verify -> status
* whitelist -> allowed
* explicitly set cache_path in configuration
default for licensed v1.0 changed from `vendor/licenses` to `.licenses`
* load configuration from file location
default configuration file location changed from `vendor/licenses/config.yml` to `.licensed.yml`
* update gemspec for licensed 1.0.0
* Remove unused license hash
* enable syntax highlighting for .jinja2 ext
This is a commonly used jinja (2!) extension
* add sample jinja2 file
* move jinja to django samples dir
* added a link to the jinja docs in the sample file
* change sample jinja2 file to a one that exists on GH
* * add CoNLL-U format
- add to languages.yml
- add textmate grammar
- add to vendor/README
- add to grammars.yml
- add samples
* rm other extensions as I couldn't find properly licensed examples of them in the wild
* substitutesamples for something with appropriate license
* update grammar submodule so it finds the LICENSE
* add license to grammar
* * conllu
- readd other extensions
- abridge samples and a new one
- update grammar submodule: correct extension of grammar file
* rm .conllx extension
The submodule was pointing to a repo which no longer has a tmLanguage
definition. We've now reinstated such a repo, with a tmLanguage file
existing in the master branch.
Since we reinstated this repo with the same name (as the old name
redirected to a new repo), the commit used is the only change.
* Update all submodules
* Ensure always using lastest docker image
* Allow passing in GEM_VERSION from env
This is useful to building test gems in a cache friendly way using:
`GEM_VERSION=$(git describe --tags 2>/dev/null | sed 's/-/./g' | sed
's/v//') bundle exec rake build_gem`
* Update submodules one last time
* Set version 6.0.0
* Add detectable key to languages
This key allows to override the language being included in the
language stats of a repository.
* Make detectable override-able using .gitattributes
* Mention `linguist-detectable` in README
* Remove detectable key from languages
Reverts changes in 0f7c0df5.
* Update commit hash to the one that was merged
PR #3806 changed the commit hash. The original commit was not
actually merged into the test/attributes branch.
* Fix check to ensure detectable is defined
* Add include in language stats tests when detectable set
* Ignore detectable when vendored, documentation or overridden
* Add documentation on detectable override in README
* Improve documentation on detectable override in README
* Add issue and pull request templates
* Implement feedback
* Request new and old grammar refs
* Add note about vendor, documentation, and generated lists
* Implement @Alhadis's suggestions
* add solidity language
* add solidity color
* move samples to test fixtures
they're not used by the bayesian classifier
* Update languages.yml
* Rename RefundVault.sol to RefundVault.solidity
* Rename pygments-example.sol to pygments-example.solidity
* Change color from #383838 to #AA6746
`Color #383838 is too close to ["3F3F3F", "383838"]`
* Fix test
* Remove test/fixtures and add samples
* Remove extension
* Remove sample file
* Revert "Remove Arduino as a language (#3933)"
This reverts commit 8e628ecc36.
* Revert "Check generated Jest snap file (#3874)"
This reverts commit ca714340e8.
* Added Monkey2 (extension .monkey2) example
This compiles with the most up to date Monkey2 release (V1.1.06).
* Sorting example in Monkey2
* Add files via upload
* Gui example using the MojoX module
* Added nextflow language
* Added main.nf to list of filenames
* Fixed duplicate groovy scope
* Removed hello-world example
* Update grammar submodule
* Removed main.nf from filenames
* Added nextflow.config example
Many repository rely on `perl6` as a Markdown key for code snippet
highlighting. The new Perl 6 name breaks this behavior as it requires
`perl-6` as the Markdown key.
* Add more troubleshooting info
* Add more updates
* A lot more words and reformatting
* Few more tweaks
* Add how it works on GitHub.com
* More clarifications
* Feedback tweaks
* Add missing run
* Learn grammar
* Don't attempt to get pwd for error message
* Print error instead of raising exception
This is more user-friendly too.
* Switch back to raise, but rescue it too
* Refactor
* grammars: Update several grammars with compat issues
* [WIP] Add new grammar conversion tools
* Wrap in a Docker script
* Proper Dockerfile support
* Add Javadoc grammar
* Remove NPM package.json
* Remove superfluous test
This is now always checked by the grammars compiler
* Update JSyntax grammar to new submodule
* Approve Javadoc license
* grammars: Remove checked-in dependencies
* grammars: Add regex checks to the compiler
* grammars: Point Oz to its actual submodule
* grammars: Refactor compiler to group errors by repo
* grammars: Cleanups to error reporting
* Add Cocoapods to generated list so it doesn't show in PR diffs
* Removed Cocoapods from vendor.yml
* Enhance regex to match only Cocoapod's Pods folder
* Adds additional test cases for generated Pods folder
* Add the language for the Common Workflow Language standards
* add CWL grammer
* add MIT licensed CWL sample
* script/set-language-ids --update for CWL
* Lex everything except SGML, multiline, SHEBANG
* Prepend SHEBANG#! to tokens
* Support SGML tag/attribute extraction
* Multiline comments
* WIP cont'd; productionifying
* Compile before test
* Add extension to gemspec
* Add flex task to build lexer
* Reentrant extra data storage
* regenerate lexer
* use prefix
* rebuild lexer on linux
* Optimise a number of operations:
* Don't read and split the entire file if we only ever use the first/last n
lines
* Only consider the first 50KiB when using heuristics/classifying. This can
save a *lot* of time; running a large number of regexes over 1MiB of text
takes a while.
* Memoize File.size/read/stat; re-reading in a 500KiB file every time `data` is
called adds up a lot.
* Use single regex for C++
* act like #lines
* [1][-2..-1] => nil, ffs
* k may not be set
* Add test to demonstrate Perl syntax detection bug
A Perl 5 .pm file containing the word `module` or `class`, even with
an explicit `use 5.*` statement, is recognized as Perl 6 code.
* Improve Perl 5 and Perl 6 disambiguation
The heuristics for Perl 5 and 6 `.pm` files disambiguation was done
searching for keywords which can appear in both languages (`class` and
`module`) in addition to the `use` statement check.
Due to Perl 6 being tested first, code containing those words would
always be interpreted as Perl 6.
Test order was thus reversed, testing for Perl 5 first. Since Perl 6
code would never contain a `use 5.*` statement, this does no harm to
Perl 6 detection while fixing the problem to Perl 5.
Fixes: #3637
.clang-tidy is the filename used for clang-tidy's configuration file.
clang-tidy is a clang-based C++ "linter" tool. For more info, see:
https://clang.llvm.org/extra/clang-tidy/
* Updated color for Ceylon language
* Adjusting Ceylon color due to its proximity to Clarion color
* Made Ceylon color darker to avoid collision
* Used more accurate color
* Specified tm_scope for Ceylon
* Change KiCad Board language to KiCad Legacy Layout
KiCad .brd files and .kicad_pcb files have the same purpose, they are both source files for PCB layouts. Having one of the file types named "KiCad Board" and the other one "KiCad Layout" can cause confusion since it implies they are not the same thing.
The [.brd files use the old, legacy layout format](http://kicad-pcb.org/help/file-formats/#_native_file_formats) that is [not actively used anymore](https://github.com/search?utf8=%E2%9C%93&q=language%3A%22KiCad+Board%22&type=Repositories&ref=advsearch&l=KiCad+Board&l=). Having it come before the KiCad Layout language in the Language Selection list and not having it flagged as legacy can cause people to select it when searching for KiCad layout files.
* Change KiCad sample according to changes in 4b306f34
* Update vendor/README.md using script/list-grammars
* Reclassify Protocol Buffer as a data-type language
References: #3740
* Fix classification of bogus "markup" languages
* Fix category of the ironically-named "Pure Data"
Ironically and *appropriately* named, might I add.
* Add failing test for finding with non-String input
Show the failing behaviour of find_by_alias, find_by_name, and []
when non-String input is provided.
* Return nil rather than erroring on non-String input
* Support for C++ files generated by protobuf/grpc
This changeset includes a sample generated file.
[grpc](http://grpc.io) is a high performance, open-source universal
RPC framework.
* Account for older gRPC protobuf plugin message
test_classify_ambiguous_languages was not running any test, since
it was looking only for languages that are ambiguous on
filename for known filenames (rather than ambiguous for filename
or extension).
Note that test time and assertions.
Before:
Finished in 0.149294s, 40.1892 runs/s, 46.8874 assertions/s.
After:
Finished in 3.043109s, 1.9717 runs/s, 224.7702 assertions/s.
* .xpm and .pm extensions associated with XPM.
* .pm is disambiguated by searching the /* XPM */ string.
This is how `file` performs detection and should work with
every XPM3 file (most XPM generated by software later than 1991).
Added XPM samples:
* stick-unfocus.xpm: extracted from Fluxbox (MIT License)
0c13ddc0c8/data/styles/Emerge/pixmaps/stick-unfocus.xpm
* cc-public_domain_mark_white.pm: public domain image from
https://commons.wikimedia.org/wiki/File:Cc-public_domain_mark_white.svg
converted to XPM with ImageMagick (convert input.svg output.xpm).
* ash: only interpreter, extension is more commonly used for
Kingdom of Loathing scripting, e.g. github.com/twistedmage/assorted-kol-scripts
* dash: only interpreter, extension is more commonly used for
dashboarding-related stuff
* ksh: extension was already present
* mksh
* pdksh
A few MAXScript files were misclassified as Unix Assembly.
Some of them can be found at github.com/davestewart/maxscript
* This commit changes the heuristic which looked for labels
such as ".LG7E0:" to actually match the full label including
the colon. This reduced the number of MAXScript files
misclassified as Unix Assembly, without any new Unix Assembly
misclassified so far.
* add MAXScript sample rolloutCreator.ms, extrated from MIT repo:
https://github.com/davestewart/maxscript/blob/master/3D/3ds2ae/02_resources/max%20scripts/3ds%20ax%20scripts/rolloutCreator.ms
The hpcugent/easybuild-framework is a python framework for the installation
of application in an HPC context. The actual package build description are
written in python but having .eb as extension.
Signed-off-by: Justin Lecher <jlec@gentoo.org>
* Added mgiannini/sublime-factor as a submodule
Provided better color for Fantom
Added license for sublime-fantom
Specified tm_scope for Fantom
* Redirected submodule for Fantom to fork with updated grammar
* Triggering build
* Updating sublime-fantom submodule
* Updated submodule sublime-fantom
* Adding Fantom samples
* Update md5 sums for Ruby 2.4
Ruby 2.4 deprecated Fixnum & Bignum into Integer. This means the MD5 digests for the integers in our tests have a class of Integer instead of Fixnum which means we need to update the digests specifically for 2.4.
* Use Gem::Version for safer version comparison
* Add comp, tesc, and tese as GLSL file extensions
* Add GLSL compute shader sample
* Add GLSL tessellation control shader sample
* Add GLSL tessellation evaluation shader sample
* Remove .comp from GLSL extensions
We have to be sure that most of the .comp files on GitHub are indeed GLSL compute shaders.
* Remove GLSL compute shader sample
Pep/8 is a toy assembly language used in some universities for teaching
the basics of assembly and low-level programming.
Signed-off-by: Lucas Bajolet <lucas.bajolet@gmail.com>
* Revert "Switch the PHP grammar to the upstream repo (#3575)"
Manually reverting this as it breaks PHP syntax highlighting on
github.com.
* Update submodule ref
* Update all grammars
* Update atom-language-clean grammar to match
* Don't update reason grammer
There seems to be a problem with the 1.3.5 release in that the conversion isn't producing a reason entry so doesn't match whats in grammar.yml
* Bump version to 5.0.9
* Update grammars
* Don't update javascript grammar
The current grammar has a known issue and is pending the fix in https://github.com/atom/language-javascript/pull/497
* fix Roff detection in heuristics
This affects extensions .l, .ms, .n and .rno.
Groff was renamed to Roff in 673aeb32b9851cc58429c4b598c876292aaf70c7,
but heuristic was not updated.
* replace FORTRAN with Fortran
It was already renamed in most places since 4fd8fce08574809aa58e9771e2a9da5d135127be
heuristics.rb was missing though.
* fix caseness of GCC Machine Description
* Add additional PL/SQL file extensions
* Add PL/SQL samples for .ddl and .prc
* Fix sort order of PL/SQL extensions
* Restore vendor/grammars/assembly.
* Restore `pls` as primary PL/SQL extension
* Add tpb to go with tps
* Clarify description of implicit alias.
I was trying to look up the alias to use for DNS Zone. From the docs
the alias I should use would be dns zone, but in reality it is dns-zone.
This change updates the comments to describe how to derive the
implicit name of a given alias.
* Further clarify description of implicit alias.
@pchaigno requested replacing the Ruby with English.
* Add ShaderLab language
* Update HLSL and ShaderLab grammars to latest version
* Add .shader extension back to GLSL language
* Add sample GLSL .shader files
Note that these are copies of existing GLSL samples, renamed to have
the .shader extension.
* fix benchmark
- require json for Hash.to_json
* better heuristic distinction of .d files
- properly recongnize dtrace probes
- recongnize \ in Makefile paths
- recongnize single line `file.ext : dep.ext` make targets
- recognize D module, import, function, and unittest declarations
- add more representative D samples
D changed from 31.2% to 28.1%
DTrace changed from 33.5% to 32.5%
Makefile changed from 35.3% to 39.4%
See
https://gist.github.com/MartinNowak/fda24fdef64f2dbb05c5a5ceabf22bd3
for the scraper used to get a test corpus.
I added a check for case-sensitivity to the regex's. In my repositories, I have both a Docs and Demos folder and those wouldn't have been matched before. Now, they would.
* Remove a few hashes for grammars with BSD licenses
There was an error in Licensee v8.8.2, which caused it to not
recognize some BSD licenses. v8.8.3 fixes it.
* Update submodules
Remove 2 grammars from the whitelist because their licenses were
added to a LICENSE file which a proper format (one that Licensee
detects).
MagicPython now supports all scopes that were previously supported
by language-python.
* Update Licensee hashes for grammar licenses
Licensee v8.8 changed the way licenses are normalized, thus changing hashes for
some grammars
* Update Licensee
Prevent automatic updates to major releases
* Add Terraform grammar, and change .tf and .hcl files from using Ruby to Terraform sublime syntax
* Expand Terraform sample to demonstrate more language features
* Revert terraform sample change
* Add terraform sample - Dokku AWS deploy
* Updated to latest Terraform
* Update terraform string interpolation
* Update terraform to latest
Release v5.0.5
* Update submodules
* Update grammars
* Bump version to 5.0.5
* Relax dependency on rugged
It's probably not wise to depend on a beta version just yet.
* revert php.tmbundle grammar update
One of the changes in 3ed4837b43...010cc1c22c leads to breakage in snippet highlighting on github.com
* Return early if no languages supplied
There's no need to tokenise the data when attempting to classify without a limited language scope as no action will be performed when it comes to scoring anyway.
* Add test for empty languages array
fix the little flaws found on http protocol that is used,
one of the web using the http protocol which is already supporting more secure protocol,
which is https
* Add Genie programming language
Genie was introduced in 2008 as part of the GNOME project:
https://wiki.gnome.org/Projects/Genie
It is a programming language that uses the Vala compiler to
produce native binaries. It has good bindings to C libraries
especially those that are part of the GObject world such as
Gtk+3 and GStreamer
* Change color for Genie so tests pass
* Skip removed grammar submodule
* Clean up old grammar from grammars and grammars.yml
* Clean up unused grammar license
Run `script/licensed`.
This was missing change in 12f9295 of #3350.
* Clean up license files when we replace grammar
Update license files by running `script/licensed`.
Since we replace grammar, the old grammar license must be removed
and new grammar license must be added.
* Add XCompose language and highlighter
* XCompose fix some errors in the Travis build
* Remove xmodmap files for XCompose
Most xmodmap files aren't XCompose, and there's not enough xmodmap files
which are XCompose to be worth adding to heuristics
* Remove some extensions/filenames from XCompose
* Rename and move sample to correct folder and filename
That we have added in languages.yml
* Use generated language id
* Separate find_by_extension and find_by_filename
find_by_extension now takes a path as argument and not only the file extension.
Currently only find_by_extension is used as a strategy.
* Add find_by_filename as first strategy
* Remove deprecated find_by_shebang
* Remove deprecated ace_modes function
* Remove deprecated primary_extension function
Gists don't have a language dropdown anymore
* Remove deprecated Linguist::Language.detect function
* Remove deprecated search_term field
* Add samples and definition for GN build files
* Add grammar to provide GN syntax highlighting
* Fix failing tests
* Add Python extensions for GYP includes and .gclient configs
* Remove trailing spaces
* Setup Bundler in some scripts
* Update grammar index
* Make prune-grammars script to be callable in a script directory
* Prune unused xquery grammar repo
source.xq by language-jsoniq is actual tm_scope for XQuery.
* Remove xquery submodule
git submodule deinit vendor/grammars/xquery/
git rm vendor/grammars/xquery/
* Fix invocation of script/list-grammars
This fixes#3339.
* Make add-grammars script to be callable in a script directory
* Generate samples.json before running list-grammars
list-grammars requires linguist.
* Added Dangerfile for ruby
* rm ant.tmbundle from wlist because has license
Travis output says ant.tmbundle has license, so Im removing it from the whitelist (projects without license)
* Added sample
* New line at EOF
* Fix
* Remove bad file
* Generate language_id from language names
The language_id is generated from the SHA256 hash of the language's name
* Test the validity of language ids
All languages should have a positive 32bit integer as an id
* Update languages.yml header in set-language-ids
These files are modified variants of the ones included in Coq's standard
distribution. The original materials feature the GPL 2.1 license in each
file's header, which was suspiciously removed from Linguist's samples.
https://github.com/coq/coq/tree/trunk/theories
Basics.v is a different file to that found in Coq's distro, but is vague
in origin and being removed to err on the side of caution. The remaining
samples are from a MIT-licensed online course by Software Foundations:
https://www.cis.upenn.edu/~bcpierce/sf/current/
References: github/linguist#3313
This stops the ASN.1 submodule from being flagged as modified due to its
.DS_Store file being wiped locally by an automated process.
References: ajLangley12/language-asn1#1
This is classified on GitHub as "data", so the colour it's assigned only
wastes valuable "real estate" when checking colour proximity.
References: github/linguist#3113
Remove our own license classification code
Add hashes for any project which does not have a standard license body
Add projects for which a license was not found to the whitelist
Requires Licensee v8.6.0 to correctly recognize TextMate bundles' .mdown README
Since v6.1.0, Licensee exposes the hash of the license
We can use it to uniquely identify unrecognized licenses,
Thus, tests will fail if the content of an unrecognized license changes
Projects for which no license was found are kept in the whitelist
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.
Elm grammar repository contains several YAML files with a source.elm scope
We need to restrict the path to the Syntaxes directory
to make sure we select the appropriate YAML file
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
Use the opening TS tag instead of the closing tag since
the closing tag might be at the end of the file,
after the max number of lines we read with a LazyBlob
Linguist actually uses licensed, which in turn uses licensee
Licensee recognizes the zlib license starting with v8.3.0
zlib license added to choosealicense.com: github/choosealicense.com#438
Sublime Text YAML syntax definitions use the .sublime-syntax file extension
Most syntax files declare a YAML 1.2 syntax although they are YAML 1.1 compatible
Thus, the YAML version header is stripped off before parsing
Displays a warning if parsing fails
In .sublime-syntax files, the scope is under the 'scope' key -- as opposed to the usual 'scopeName' key
This file is generated by the `npm shrinkwrap` command. It's large,
generated, and has a noisey diff. One similar file, php composer lock
files, is already ignored.
Closes https://github.com/github/linguist/issues/3045
* Add ECR entry from language-crystal
* Add HTML+ECR to Languages.
* Create greeting.erb sample
From the ECR documentation: http://crystal-lang.org/api/ECR.html
* Rename greeting.erb to greeting.ecr
* Rename samples/HTML-ERB/greeting.ecr to samples/HTML-ECR/greeting.ecr
* Update Crystal submodule.
This contains the ECR highlighting.
* Proper named HTML+ECR folder.
The GitHub website just wouldn't do the folder right.
* Add .ecr file extension to ECR
* Added Django environment folder in exclusion
Django projects have env/ folder in which dependencies of the project like Django, Pillow, and other libraries are installed from the requirements.txt file. It would be best if this folder of dependencies is ignored from the language statistics.
* Corrected Errors
Corrected the misplaced code and put removed the start character as the environment folder may not always be in the root.
* Adding test for env folder
* Add the TLA+ language
This patch adds support for the TLA+ specification language.
https://github.com/search?utf8=%E2%9C%93&q=MODULE+extension%3Atla&type=Code&ref=searchresults
* Update TLA grammar license
Attribution is given in the license since the grammar is based off of the TLA+ language developed by Microsoft and HP.
* Sort languages.yml alphabetically
* Removing duplicate entry
* Add language rule and heuristic for WoW Addon data
* Add test fixtures for the .toc extension
* Add grammar for syntax highlighting
* Define colour of WoW .toc files
* Refine heuristic to include a commonly-used keyword
* Check whitespace in WoW-token heuristic
* Include additional TeX keywords in .toc heuristic
* Update grammar submodules
* Cache license for WoW-toc grammar
* Reverting sourcepawn update
We are still solidifying patterns around how licenses should be managed, but given the Gemfile.lock file is ignored, I don't think it makes sense for linguist to track licenses for Ruby dependencies. A consumer of this gem could end up with a different version of a dependency that has a different license.
In general, I think libraries should only track licenses for code that they vendor. Since linguist vendors the grammars, it makes sense for it to track the licenses for them.
* Add Forge Mod Loader Mod Info file as JSON
* Add Forge Mod Loader Mod Info File
* Rename samples/JSON/mcmod.info to samples/JSON/filenames/mcmod.info
When I submitted the HLSL-language, I accidentally missed that the
first extension was the primary one (as is documented in the source
code, which I unfortunately missed), and instead alphabetized the
whole list.
The primary extension should be .hlsl, so let's remedy this.
BUCK is the filename for the build files of the Facebook Buck build
system. BUCK files are valid Python files.
Eg.:
https://github.com/GerritCodeReview/gerrit/blob/master/BUCK
Also add a missing sample for Pants / Bazel BUILD files. They are also
valid Python files.
Add support for DirectX HLSL / FX files. The FX files are
just HLSL files with some additional syntax to set
render-states and define multiple shader stages in one file.
Samples are either written by me, or taken from Chromium.
* master: (168 commits)
ruby for example
Bumping version
Updating grammars
Grammar for Less from Atom package
Remove Less grammar
Updating to latest perl6 grammar
Adding Perl6-specific grammar.
Grammar for YANG from Atom package
Support for YANG language
Add detection of GrammarKit-generated files
Add .xproj to list of XML extensions
Test submodules are using HTTPS links
Improved vim modeline detection
Heuristic for Pod vs. Perl
Bumping to v4.7.4
Grammar update
Support .rs.in as a file extension for Rust files.
HTTPS links for submodules
Add the LFE lexer as an example of erlang .xrl
Add the Elixir parser as an example of erlang .yrl
...
These samples were taken from the paper "Flux: A Language for
Programming High-Performance Servers", by Burns et al and Flux V0.02
which can be found here:
https://plasma.cs.umass.edu/emery/flux.1.html
GrammarKit is a plugin by JetBrains for creating custom language plugins
for JetBrains IDEs (such as IntelliJ, RubyMine, CLion and more). It
defines a BNF parser language which can be used to generate a parser in
Java, and it also integrates JFLex for generating a lexer in Java.
Both of these generated Java files can be recognised by a comment on the
first line of the file, and so classifying them as generated is trivial.
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
When using syntax extensions in stable or beta Rust channels using the syntex package, it is common to use the file extension .rs.in for the source file, and .rs for the generated file.
Updated grammar to support triple-quoted strings properly:
0c53f8162e
atom-language-purescript repo has been moved to purescript-contrib org,
update the URL.
There's no need for `clear_cache` to fail if the cache doesn't exist,
either because we call `clear_cache` twice or because no cache was
previously written on this particular repo.
Since Octave is a clone of Matlab, the syntax is exactly the same
and hence it is desirable for highlighting to be exactly the same
as well.
Adding octave as an alias for Matlab will trivially provide support
for highlighting Octave code, and will ensure the two languages
always use the same syntax highlighting rules.
Linguist currently uses the presence of "move" commands to differentiate
a GAS file from Groff. This is problematic with MAXScript, with includes
a built-in function of that name. Furthermore, because of the language's
exhaustive vocabulary, case insensitive nature and flexible syntax, it's
difficult to impose rigid criteria on classifying it.
This commit modifies the heuristic to assume the following flow:
1. If a line contains ".include" or ".global"/".globl" which doesn't
follow a non-whitespace character, assume GAS.
2. Otherwise, if the line starts with a command like ".LG7E0" with a
possible string of whitespace before it, assume it's also GAS.
UNLESS either of the following conditions are true:
2a. The token is enclosed by a string or /* multiline comment */
2b. The previous line ends with a backslash to denote a statement
broken between lines, with possible whitespace and/or comment
sequences between the backslash and the actual newline.
3. If neither of the above are met, assume the file is MAXScript.
This approach may appear overly-inclusive, but given real-world usage of
MAXScript includes writing brief files with few distinguishing keywords,
it's reasonable to permit this leniency.
Rake's tests are failing because #0AA is too similar to the colour being
used by another language (Dart: #00B4AB). This commit increases contrast
enough to satisfy the build (with 00A6A6 being the closest shade allowed
by the current colour threshold).
See also: github/linguist@3c96f9e
This is a test. I don't understand the details of how the `bundle config
build.charlock_holmes` bit works/fails, so the intent here is to get a PR posted
for purposes of getting feedback via the full Travis machinery.
plus a few minor language support updates including:
- recognize `sclang` and `scsynth` interpreters
- set `tm_scope: source.supercollider`
- reorder extensions so that `.sc` is primary
This adds the .cake file extension to the C# language.
Here is a search in the wild: https://github.com/search?q=extension%3Acake+NOT+coffee&type=Code
Cake (C# Make) is a cross platform build automation system with a C# DSL to do things like compiling code, copy files/folders, running unit tests, compress files and build NuGet packages.
You can find out out more about cake here: http://cakebuild.net/
The original yellow color doesn't fit D very well, and it looks an awful lot like the color for JavaScript. This changes it to the color used on the website's sidebar, and nice dark maroon: http://www.colorpicker.com/2e2324
This changeset includes a sample racc file from [this auto-generated
file](44e9bf0440/lib/rjson/parser.rb)
(MIT-licensed).
[Racc](https://github.com/tenderlove/racc) Racc is an LALR(1) parser
generator. It is written in Ruby itself, and generates ruby programs.
Taken from tokenrove/parsur so I don't have to worry about license
hassles. (You may relicense these samples as necessary.)
It would be nice to have an example of the embedded SQL syntax in a
sample.
I have used syntactic color values with respect to the table below:
A | B C | D | E | F G | H | I | J K | L M | N O | P Q | R S | T U | V W | X | Y Z
0 1 2 3 4 5 6 7 8 9 A B C D E F
For example for Gradle the color should be 4B0283, for Cuda the color should be 1C201C(for six-letter CudaCu) and for reStructuredText the color should be B3BCBC(for six-letter reStru).
* 'master' of https://github.com/github/linguist:
Switch to Apache License.
also add help for unapproved licenses
Update X10 grammar license.
add some help text to license test
Fix typo in Obj-C heuristic keyword
Add the X10 language (http://x10-lang.org/).
Sublime Text workspace files as vendored
Make Slick regexp more general
Tests for new vendored files
Test for new CodeMirror regexp
New JS vendored files
Fix CodeMirror regex for vendored files
added *.lslp to samples/LSL folder
added *.lslp as LSL(Linden Scripting Language)
Conflicts:
.gitmodules
RAML was originally merged as a data language, but this seems like an incorrect definition. I changed it to be markup instead, which will also result in RAML appearing in repo statistics.
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
Prior to this commit, some Puppet files were being incorrectly
identified as Pascal when they contained only the following content:
hiera_include('classes')
This commit adds a hiera_include() sample to for the Puppet language to
correct this behavior.
Prior to this commit, the Puppet language was colored to #332A77. The
Puppet Labs style guide (https://puppetlabs.com/styleguide/brand)
specifies Puppet Dark Purple to be #302B6D. Alternately, Puppet Purple,
a lighter variant, may be used: #7C6AAB.
Keeping with the dark purple theme, this commit modifies the Puppet
language to use Puppet Dark Purple, hex #302B6D.
Makes it possible to detect the language of a snippet of code
without having an actual file on disk
Will allow github-markup to use Linguist without restricting its API
The previous definition used at fsharpbinding is no longer maintained.
That repository has been split into separate parts for each editor. Atom
now has the most complete compatible grammar.
XPages design element extensions and NSF-based design elements (Form, View) extensions added (all readable when marked up using XML settings for ACE); .jss (Domino SSJS) already aliased under JavaScript
zend_ini_scanner.l by Zend Technologies; New BSD license.
common.l by Toshihiro MATSUI, Electrotechnical Laboratory; New BSD license.
create_view.l by PostgreSQL Global Development Group; MIT license.
the emacs modeline is actually a per-file variable setting mechanism, which means it can have other flags in it.
this regex extracts the part that corresponds to the file's language ("mode:" - ie emacs major mode)
http://ergoemacs.org/emacs_manual/emacs/Specifying-File-Variables.html
The assumption that `.conf` files are Apache is causing many projects to
be detected incorrectly as being primarily "ApacheConf".
The `.conf` extension is widely used by software; Apache accounts for
only a very tiny proportion of its overall use. The addition of `.conf`
for ApacheConf has resulted in projects which contain none (or almost
no) Apache config being marked as primarily containing it.
The problem was introduced by 18a3ef9e5e
Gettext catalogues are used for translations and are thus essentially prose, but were classified as "programming" in 507d191d7d.
In large projects like e.g. wesnoth/wesnoth, gettext can dominate the language statistics with about 95% although the actual code is C++.
Sample file mpq.d by Georg Lukas; license GPL 2.
Sample file counts.d by Kate Turner; public domain.
Sample file javascript-race.d by unknown; license MPL 1.1/GPL 2.0/LGPL 2.1.
Sample file probes.d by momjian; license TBD.
While XML is technically a markup language, in the majority of cases it
is just a serialization format for a tool (e.g., project files for IDEs)
rather than hand-authored markup. As such it isn't really useful to
include it in repository language statistics. A C# project doesn't
really care whether Visual Studio uses XML, JSON, or some other format
to serialize its project files, for example.
* vendor/grammars/Modelica f2b1242...e1fd853 (1):
> Some string improvements
* vendor/grammars/NimLime 58a1e0c...fac6b18 (2):
> Added support for ST3
> Merge pull request #15 from fenekku/master
* vendor/grammars/SublimePapyrus 152c7b7...2731300 (1):
> Updated INI path setting behavior
* vendor/grammars/actionscript3-tmbundle d69fcc8...d24ad7d (1):
> all contexts
* vendor/grammars/dart-sublime-bundle c1afc62...d55b1d4 (4):
> Merge pull request #458 from guillermooo-forks/prep-release
> Merge pull request #457 from guillermooo-forks/refactor
> Merge pull request #455 from guillermooo-forks/fix-stagehand-unavailable
> Merge pull request #452 from guillermooo-forks/improve-syntax-def
* vendor/grammars/grace-tmbundle c342d35...acbf9a2 (9):
> Add simple block parameter highlighting
> Track open braces for better interpolation
> Add highlighting for full import syntax
> Check for extra word characters after var keyword
> Remove built-ins and change storage to support
> Highlight untyped block parameters
> Highlight interpolation braces as keywords
> Highlight only capitalised words with generic args
> Include comment highlighting in every construct
* vendor/grammars/language-javascript ac37d2a...d58edec (2):
> Prepare 0.57.0 release
> Merge pull request #101 from postcasio/iojs-shebang
* vendor/grammars/latex.tmbundle 0441781...669040b (1):
> Fix doctest for `run_biber` in `texmate`
* vendor/grammars/mako-tmbundle e039636...da79638 (1):
> Merge pull request #7 from seedofjoy/patch-1
* vendor/grammars/sublime-text-ox bdd03e0...10ca883 (5):
> Update README.md
> Update README.md
> Moved license to separate md-file.
> Ctrl+B executes on a single core instaed of two.
> Added patterns for 'foreach' and 'delete'.
* vendor/grammars/GDScript-sublime 99a0d51...44ac5c4 (3):
> Merge pull request #7 from erbridge/null-keyword
> Merge pull request #6 from erbridge/assert-keyword
> Merge pull request #5 from erbridge/update-yaml
* vendor/grammars/Modelica d7e50e3...f2b1242 (8):
> Update README.md
> Update README.md
> Update README.md
> Update README.md
> Update README.md
> Update README.md
> Delete .gitattributes
> Create .gitattributes
* vendor/grammars/NimLime 7581153...58a1e0c (5):
> Merge pull request #13 from fenekku/master
> Refactored a bit nimsuggest service hosting a bit more robust
> Print error if nimsuggest does not respond
> Close test sock Turn off autoreload
> Merge pull request #14 from Varriount/update-to-sockets
* vendor/grammars/Sublime-SQF-Language 708c78a...0313fbe (1):
> Merge pull request #12 from DenVdmj/master
* vendor/grammars/SublimePapyrus 5a7b3e7...152c7b7 (1):
> Added setting
* vendor/grammars/ats.sublime d954ef6...2565468 (2):
> fix record/tuple/then/else with {
> fix bugs for single quote char
* vendor/grammars/c.tmbundle f825425...f6048af (1):
> Add syntax highlight for CoreGraphics types
* vendor/grammars/dart-sublime-bundle fecdbc5...c1afc62 (4):
> Merge pull request #450 from guillermooo-forks/prep-release
> Merge pull request #449 from guillermooo-forks/fix-analysis-server-init
> Merge pull request #448 from guillermooo-forks/prep-release
> Merge pull request #446 from guillermooo-forks/new-analysis-server-integration-linting
* vendor/grammars/elixir-tmbundle dcf1fc1...9c63ff0 (1):
> Merge pull request #34 from bharendt/master
* vendor/grammars/factor 4ada328...ec896cd (17):
> images.tiff: Fix partial refactor rollback and offeset typo.
> images.tiff: Fix infinite loop bug exposed by AFL test suite. IDFs are found at certain offsets, then the next offset is after the IDF. If a next-offset is its own previous offset, then it would loop. Now we record the offset and stop if it would loop.
> alien.libraries: Cannot include alien.libraries.finder here for docs.
> Explicitly reference find-library in alien docs
> Fix typo in hash-set documentation
> opencl: remove <size_t> (use size_t <ref> instead).
> forestdb.ffi: Update ffi.
> forestdb: Embrace the forestdb handle vs kvs handle idiom. Update tests.
> stack-checker.state: Fix error in docs. Tweak doc grammar.
> bootstrap.image.upload: Use pscp on Windows for uploading boot images since c:\ paths are treated as hostnames and the command fails.
> stack-checker: minor help-lint fixes.
> compiler.tree.*: more compiler tree docs
> stack-checker.*: misc doc additions
> stack-checker.known-words: docs and tests
> stack-checker.values: docs and tests
> stack-checker.state: docs and tests
> stack-checker.backend: docs and tests
* vendor/grammars/fsharpbinding 92d969b...0cd6439 (2):
> revert typo, typo is actually upstream in monodevelop
> bump version number
* vendor/grammars/java.tmbundle a74cb83...ccdebdf (1):
> Highlight volatile like synchronized
* vendor/grammars/javadoc.tmbundle 484d468...5276d7a (1):
> Grammar: Be strict on what can start an HTML tag
* vendor/grammars/language-clojure bae6eee...cfc8a5c (6):
> Prepare 0.12.0 release
> Merge pull request #14 from joelash/master
> Prepare 0.11.0 release
> Merge pull request #13 from hanjos/proposed
> Add initial spec
> Add initial Travis CI config
* vendor/grammars/language-csharp fba368a...d07ba8f (4):
> Prepare 0.5.0 release
> Merge pull request #19 from atom/ks-remove-deprecations
> Prepare 0.4.0 release
> Merge pull request #16 from damieng/master
* vendor/grammars/language-gfm 18400b2...5f5df30 (3):
> Prepare 0.64.0 release
> Add heading spec with no space
> Merge pull request #77 from jonathandelgado/master
* vendor/grammars/language-python 0141d44...8daa100 (4):
> Prepare 0.32.0 release
> Merge pull request #54 from nicktimko/binary-literals
> Prepare 0.31.0 release
> Merge pull request #53 from nicktimko/python-3-octals
* vendor/grammars/latex.tmbundle 16154ce...0441781 (16):
> Remove unnecessary code from tests
> Try to read tex file using different encodings
> Recognize errors in files containing spaces
> Prepend `lib` to path in Python scripts
> Fix minor style issues reported by `flake8`
> Tell `flake8` to ignore “relative” imports
> Use `format` instead of `sprintf`
> Use encoding `latin_1` to open log files
> Add “LaTeX Tidy” to the bundle again
> Add `YAML::Tiny` library to the bundle
> Use `texdoc` to show documentation for single word
> Determine `TEXMFMAIN` only once in `texdoc`
> Autoupdate cache for “Documentation for Package”
> Update “Documentation for Package”
> Use direct imports in `texdoc`
> Add folding markers for sections
* vendor/grammars/objective-c.tmbundle 8387be8...1bade8a (1):
> Add syntax highlight for the typedefs in NSObjCRuntime.h
* vendor/grammars/php.tmbundle 1ae104d...7178a10 (4):
> Doc Snippet: Allow for static keyword in declarations
> Further work on escapes in single-quoted regular expressions
> Grammar: Correct improper '\' escaping
> Improve/simplify escaping rules for single-quoted regexps
* vendor/grammars/sublime-nix 412f7e1...217ffe5 (1):
> Fix comma-first
Documentation is an important part of a software project but is not
generally thought of as part of the code for that project. Repository
language statistics are used to quantify the project's code, so it makes
sense to exclude documentation from those computations.
Documentation files are recognized similarly to vendored files.
lib/linguist/documentation.yml contains regular expressions to match
common names for documentation files. A new linguist-documentation Git
attribute can be used to override those conventions.
Originally, only "programming" languages were included in repository
language statistics. In 33ebee0f6a we
started detecting a few selected "markup" languages as well. We didn't
include all "markup" languages because at the time formats like Markdown
and AsciiDoc were labeled as "markup" languages, and we thought that
including those prose (i.e., non-code) languages in repository
statistics on github.com was misleading for repositories that are
largely about code but also contain a lot of documentation (e.g.,
rails/rails).
This hand-picked set of whitelisted "markup" languages can cause strange
categorization for some repositories. For example, it includes CSS (and
some variants) but not HTML. This results in repositories that contain
the source code for a static website being classified as either a
JavaScript (programming) or CSS (markup) repository, with no mention of
HTML anywhere.
Fast-forward to today, and prose languages are no longer "markup"
languages; they're now "prose" languages. So now we can include all
"markup" languages in repository language statistics without worrying
about undesirable effects for documentation-heavy repositories.
* origin/master: (97 commits)
Modifying some modeline fixtures to test case InSeNsItivitY
Making modelines case-insensitive
Missing whitespace
Vim and Emacs modelines
Update README.md
Update URL for AutoHotkey grammar
Remove grammar for AutoHotkey
Bumping version to v4.3.1
Grammar update
'Text' doesn't qualify as a valid modeline language.
Add .4TH Forth extension.
Grammar for eC from TextMate bundle
Sample for eC
Grammar for Ox from Sublime Text package
Grammar for Grace from TextMate bundle
Grammar for G-Code from Sublime Text package
Grammar for TXL from Sublime Text package
Grammar for J from Sublime Text package
Sample for J
Grammar for Golo from Sublime Text package
...
Conflicts:
README.md
`cpplint.py` is Google's Python script used for linting C++ files.
I have a small C++ project with `cpplint.py` included mistakenly making
Python the main language of my project.
* origin/master: (104 commits)
Added shebang sample for Pike.
Added interpreter "pike" for Pike.
Add support for FXML files.
Add support for Turtle and SPARQL
Fixed issues for web ontology to pass tests
Added Web Ontology Language Support
Simplify blob tests
Use the original FileBlob path for filesystem access
Sample sagews file, as requested
Update languages.yml with *.sagews
New grammar for Racket
Remove grammar for Racket
Modifying BlobHelper and FileBlob to use path
Sample file for .cmake.in
Restore the .cmake.in extension.
More CMake samples.
Updating file regex to support unlicense.txt
Updating ref to include license
Remove pry
Start using path with LazyBlob
...
Conflicts:
CONTRIBUTING.md
README.md
Now that FileBlobs with relative paths can still access their files on
disk, we can use relative paths for all FileBlobs in the test. This more
closely matches the behavior in github.com's codebase, where all blobs
use relative paths.
FileBlob now remembers the full path that was passed to its constructor,
and uses that for performing filesystem access. FileBlob#path continues
to return a relative path as before. This ensures that you can call
methods like #size and #mode on FileBlobs with relative paths,
regardless of the current working directory.
Now that all our grammars are licensed (or grandfathered in), we can
distribute them as part of the standard github-linguist gem. This makes
it easier for projects to get up and running with Linguist.
* The `thread`-gem is required for the script, because otherwise Ruby throws an error that `Queue` in line 259 is an uninitialized constant
* The variable `p` was previously in the same method with the status message saying `OK ‹path› ‹converted scopes›`. But `p` is now defined in load_grammars() and thus not visible when showing the OK-message in install_grammars(). This was solved by adding a path-parameter to install_grammars().
We require all grammars to have a license that permits redistribution. A
few existing grammars have been grandfathered in without a license (and
we're working to remedy that), but no new grammars should be added
without a license.
convert-grammars now supports a few flags that we can use to make it
dump out the YAML just for the local grammar submodules. We can then
compare this to the YAML that's actually in grammars.yml to check that
they're the same. If they aren't, grammars.yml needs to be updated.
This will help catch mistakes like using the wrong scope name.
This was performed via `git submodule update --remote`.
* vendor/grammars/Agda.tmbundle 784f435...68a218c (1):
> Merge pull request #1 from aroben/patch-1
* vendor/grammars/IDL-Syntax 9473b7f...3baeaea (1):
> Merge pull request #3 from aroben/patch-1
* vendor/grammars/NimLime 7a2fb4e...9cef4b6 (4):
> Updated command names
> Updated generated documentation
> renamed more from nimrod to nim
> Renamed several files
* vendor/grammars/SCSS.tmbundle d6188e5...4147502 (1):
> Merge pull request #181 from redgluten/master
* vendor/grammars/Sublime-VimL 6ab7e19...366fdc6 (1):
> Merge pull request #2 from yous/fix-single-quoted-string
* vendor/grammars/factor 2dc5590...2453a78 (38):
> json.writer: make sure we make hex values two digits zero padded.
> json.writer: support escaping unicode > 0x10000. Thanks @jonenst!
> mason.git: fix status check.
> compiler.cfg.*: new unit test vocabs
> compiler.cfg.*: more docs
> compiler.cfg.*: refactoring away the compute-global-sets word
> compiler.cfg.*: docs and more tests
> compiler.cfg.stacks.local: refactoring making stack-changes and height-changes take and return stuff instead of using variables and the make building
> compiler.cfg.parallel-copy: docs
> compiler.cfg.stacks.height: these words are unused
> compiler.cfg.*: more compiler docs
> compiler.cfg.stacks.finalize: initial docs
> io.launcher: fix stack effects.
> io.launcher: fix docs for with-process-reader and with-process-writer.
> io.launcher: add versions of with-process that preserve process and status.
> mason.git: fix use.
> mason.git: fix for rename.
> io.launcher: cleanup public interface, make some things private or internal.
> gopher: set 1 minute timeout by default.
> brainfuck: cleanup tests.
> json.writer: don't escape spaces, thats weird.
> unix: some using cleanups.
> python: rename startup/shutdown hooks.
> math.extras: adding the Möbius function.
> alien.c-types: move definitions of stdint.h from unix.types.
> gopher: use contents now that it works.
> io.ports: Make buffered-port not have a length because of Linux virtual files and TCP sockets. Related to issues #1256 and #1259.
> tools.deploy.backend: add word for deleting cached staging images.
> command-line: save the executable in a variable so that people don't use (command-line) directly if possible.
> bootstrap: fix this use of (command-line).
> tools.deploy.shaker: set the rest of the args to preserve current behavior.
> vm: store full command-line including executable first argument.
> gopher: fix bug where empty lines weren't printed properly in menus.
> gopher: simplify.
> gopher: change gopher-text to use split1.
> io.encodings.detect: simplify prolog-tag.
> gopher: add way to get result without converting to objects.
> tools.disassembler: allow disassemble of compose and curry.
* vendor/grammars/fsharpbinding af755c8...d097476 (24):
> Merge pull request #909 from cbowdon/issue877-vim-73-support
> Merge pull request #913 from 7sharp9/Move_GetColourizations_toBg
> Merge pull request #912 from 7sharp9/TryFind_opt
> Merge pull request #911 from 7sharp9/FoldingParser
> Merge pull request #908 from 7sharp9/TooltipOverhaul_AutoParamFix
> Merge pull request #907 from 7sharp9/Movegetdefinestomodule
> Merge pull request #906 from 7sharp9/tooltipfixforclosures
> Merge pull request #905 from 7sharp9/ResolverProvider_singletimeout
> Merge pull request #904 from fsharp/revert-903-ResolverProvider_singletimeout
> Merge pull request #903 from 7sharp9/ResolverProvider_singletimeout
> Merge pull request #902 from 7sharp9/ParameterCompletion_gatherTimeout
> Merge pull request #901 from 7sharp9/Changed_invalidate_project
> Merge pull request #900 from 7sharp9/Syntaxmode_removeextraoperation
> Merge pull request #899 from 7sharp9/tooltips_ensureTimout
> Merge pull request #898 from 7sharp9/pathextension_useAddRange
> Merge pull request #897 from 7sharp9/resolverprovider_ensuretimout
> Merge pull request #896 from 7sharp9/completion_ensuretimout
> Merge pull request #895 from cbowdon/894-Vim-fix-for-no-completions-stacktrace
> Merge pull request #890 from wangzq/gotodecl
> Merge pull request #893 from 7sharp9/fixfortooltipvaltypes
> Merge pull request #892 from 7sharp9/fixforprojecttypechecking
> Added correct indentation
> Merge pull request #891 from 7sharp9/ImproveImplementInterface
> Merge pull request #888 from VincentDondain/master
* vendor/grammars/haxe-sublime-bundle 58cad47...e2613bb (4):
> fixed goto definition / find type
> clean
> adaptations for toplevel completion
> first test
* vendor/grammars/language-gfm c6df027...7b62290 (7):
> Prepare 0.59.0 release
> scoped-properties -> settings
> Prepare 0.58.0 release
> Merge pull request #67 from davidcelis/master
> Prepare 0.57.0 release
> Prepare 0.56.0 release
> Merge pull request #64 from atom/mb-new-cpp-scope-name
* vendor/grammars/language-javascript 15dc5d1...6690feb (5):
> Prepare 0.52.0 release
> Merge pull request #82 from Hurtak/feature/snippets-for
> Merge pull request #80 from Hurtak/feature/snippets-querySelector
> Merge pull request #79 from Hurtak/feature/snippets-switch-indentation-fix
> Merge pull request #81 from Hurtak/feature/snippets-iife
* vendor/grammars/language-python 476a353...f518e49 (5):
> Prepare 0.28.0 release
> Use trailing scope name
> Merge pull request #48 from msabramo/patch-1
> Prepare 0.27.0 release
> Add pattern for nonlocal keyword
* vendor/grammars/language-sass 064a8b5...33efa33 (2):
> Prepare 0.29.0 release
> Allow + and - in selector argument
* vendor/grammars/language-shellscript e2d62af...cbec163 (2):
> Prepare 0.11.0 release
> Merge pull request #4 from hd-deman/patch-1
* vendor/grammars/latex.tmbundle 682c4b7...52b2251 (42):
> Replaced `python` with `python2.7` in shebangs
> Make the preferences compatible with Python 3
> Handle manual spacing in “Reformat” (Table)
> Fix: Reformatting of table containing empty cells
> Use more descriptive variable names in `format`
> Add documentation to `reformat`
> Fix doctest in `refresh_viewer`
> Add tests for `reformat`
> Ignore “exit discard” status in `cramtests`
> Remove print statements from `reformat` function
> Fix: Close log window option ignored
> Automatically scroll to bottom in “HTML Output”
> Handle “\” signs in the notification window
> Fix missing logname in default error message
> Extend list of auxiliary files
> Remove unused code from `latex_watch`
> Display default message in notification window
> Sort error messages by line number
> Do not store duplicate error messages anymore
> Close notification window on cleanup
> Improve reopening of closed notification windows
> Improve rewrap code in `texparser`
> Improve readability of verbose log output
> Only parse log file if there were changes
> Remove unnecessary function call in “LaTeX Watch”
> Properly close file in `guess_tex_engine`
> Handle log messages containing double quotes
> Left justify severity in notification window
> Handle manual closing of notification window
> Add additional information to notification window
> Remove unused code from `texparser`
> Close notification when typesetting succeeds
> Add support for notifications to “LaTeX Watch”
> Update bundle preference values instantly
> Make “Reformat” (Table) compatible with Ruby 2
> Ignore escaped ampersand `\&` in “Format” (Table)
> Remove warnings reported by `RuboCop`
> Format code for “Reformat” (Table)
> Move code for “Reformat” into separate script
> Save “Reformat” command with TextMate 2
> Remove unused import
> Use explicit import in “Itemize Lines In Selection”
* vendor/grammars/mercury-tmlanguage b5a4fd6...eaef0b0 (8):
> Add require_* and some, all keywords
> Highlight %f format specifiers, `` as op
> Correct implementation of '''', """" and 0'<char>
> README.md: Mention GitHub grammar compatability
> README.md: add resources and demonstration
> reformatted whitespace; added foreign mods; missing keywords
> Highlight variables, determ decls, more pragmas
> no highlighting of variables, function names, type names, inst's, etc.
* vendor/grammars/sublime-mask 2f59519...632ff3c (4):
> v0.8.7
> v0.8.7
> + expression in component nodes
< v0.8.6
* vendor/grammars/swift.tmbundle 81a0164...3c7eac5 (9):
> Use constant scope for booleans
> Use storage scope instead of keyword
> Correct typo in include
> Revamp string literal matching
> Improve punctuation scopes
> Allow for functions without a body
> Add simple folding markers for swift
> Improved matching of capture specifiers
> Add Support for UInt, Int[8|16|32|64] & Float80
We were using a fork to get the fix for
https://github.com/textmate/c.tmbundle/pull/24 before it was merged
upstream. Now it's been merged so we can go back to the upstream
repository.
We tell apt-get to download it to vendor/apt and then install it into a
vendor/icu directory.
We should be able to just specify --with-icu-dir, but apparently Ruby
2.0 (but not 1.9 or 2.1 or 2.2) has a bug that requires us to use
--with-icu-include/--with-icu-lib instead. Otherwise it can't find the
ICU libraries.
This gives us a consistent test framework across all Ruby versions which
should help avoid errors that are only found when CI runs the tests on
different Rubies. (And this fixes an immediate bug where there's no
`skip` method in the version of test-unit we're currently using only on
Ruby 2.2.)
This runs 8 `git submodule update` processes in parallel, speeding up
bootstrap from 2 minutes to 30 seconds for me. (Obviously this is
dependent on bandwidth.)
If any submodules are missing from grammars.yml, or are listed in
grammars.yml but missing from the repo, the test will fail.
Eventually it would be good to test that the scopes for each submodule
are accurate, but that will take some more work.
This makes it so we don't have to redownload all the grammars every time
we build the grammars gem. It will also let us verify that grammars.yml
is accurate in the future by checking it against the submodules on disk.
script/bootstrap now updates the submodules.
While not perfect, source.smalltalk is a better fit for highlighting STON files than source.json. When STON departs from pure JSON (often) the hightlighting is pretty bad.
This grammar uses the same scope name (source.idl) as our existing IDL
grammar. The wrong scope name was listed in grammars.yml which masked
this problem. https://github.com/andik/IDL-Syntax/pull/2 tracks getting
the grammar to use a different scope name; in the meantime we just won't
highlight these files.
It's much cleaner and more robust to specify the repo URL instead of a
URL to an individual file. If the file gets moved we'll still be able to
find it if we're using the repo URL.
Where we do need raw links, we now use github.com/owner/repo/raw/*
because it looks a bit nicer and sorts better with non-raw links.
It must be sorted, because it will get re-sorted when
script/download-grammars is next run and that would clutter up diffs.
And it must not contain any duplicate scopes.
This works better than the old Ruby Sass.tmbundle we were pulling from
svn.textmate.org.
atom/language-sass also contains an SCSS grammar, but I didn't switch to
using that grammar because it isn't obviously better than our current
one and I'm not an SCSS expert.
Adding 'erlang.mk' to list of erlang bundles; it's seeing some adoption in the Erlang community for building Erlang apps, and at 1k lines of code at present can dominate an initial check-in, project skeleton, or small library.
See https://github.com/ninenines/erlang.mk for further details.
LoomScript is the scripting language for the Loom SDK.
It has an ActionScript3-like syntax with added C#-esque capabilities.
Loom SDK: https://github.com/LoomSDK/LoomSDK
* refactor-heuristics: (43 commits)
update docs
Clean up heuristic logic
Allow disambiguate to return an Array
Rename .create to .disambiguate
docs
Remove inactive heuristics
Refactor heuristics
Not going back
docs
Move call method into existing Classifier class
Try strategies until one language is returned
Remove unneded empty blob check
Add F# and GLSL samples. Add Forth and GLSL extension .fs. Add heuristic to disambiguate between F#, Forth, and GLSL.
byebug requires ruby 2.0
Remove test for removed extension
Fix typo in test
add rake interpreter
add python3 interpreter
Remove old wrong_shebang.rb sample
Add byebug
...
Conflicts:
lib/linguist/heuristics.rb
test/test_heuristics.rb
* origin/master: (165 commits)
Add F# and GLSL samples. Add Forth and GLSL extension .fs. Add heuristic to disambiguate between F#, Forth, and GLSL.
byebug requires ruby 2.0
Remove test for removed extension
Fix typo in test
add rake interpreter
add python3 interpreter
Remove old wrong_shebang.rb sample
Add byebug
Link to Lightshow in CONTRIBUTING.md
Switch to a better F# grammar
Bump Rugged again
Checkout the master for testing
Rugged 0.22.0b3
Reordering
Bump version to 4.0.3
Add some docs for tm_scope
Change NONE to none
Checking other case for Chart.jS
Test that all languages have grammars
Fix RHTML's tm_scope
...
Conflicts:
lib/linguist/language.rb
* origin/master:
byebug requires ruby 2.0
Remove test for removed extension
Merge branch 'master' into 1233-local
Removing pry runtime dependency
Moving to fixtures
Language detection test for non-sample files
Refactoring of Language.detect
Try shebang detection if the extension is unknown
Change unknown extension of PHP sample file
* origin/master: (30 commits)
Add byebug
Link to Lightshow in CONTRIBUTING.md
Switch to a better F# grammar
Bump Rugged again
Checkout the master for testing
Rugged 0.22.0b3
Reordering
Bump version to 4.0.3
Add some docs for tm_scope
Change NONE to none
Checking other case for Chart.jS
Test that all languages have grammars
Fix RHTML's tm_scope
Chart JS is vendored
Switch to a better grammar for Bro
reorder again…
put cjsx at the top
Use a SQF grammar for SQF files
move cjsx before iced
move cjsx before iced
...
Conflicts:
lib/linguist/languages.yml
* origin/master: (31 commits)
Link to Lightshow in CONTRIBUTING.md
Switch to a better F# grammar
Bump Rugged again
Checkout the master for testing
Rugged 0.22.0b3
Reordering
Bump version to 4.0.3
Add some docs for tm_scope
Change NONE to none
Checking other case for Chart.jS
Test that all languages have grammars
Fix RHTML's tm_scope
Chart JS is vendored
Switch to a better grammar for Bro
reorder again…
put cjsx at the top
Use a SQF grammar for SQF files
move cjsx before iced
move cjsx before iced
change component name
...
Conflicts:
test/test_language.rb
This will make CI fail if someone adds a new language but neglects to
add a new grammar for it. This should make it easier for people to
review PRs, as CI will help them to make sure a new grammar gets added.
However, we currently support some languages that have no grammars, and
we may support more in the future. So you can explicitly mark the
language as having no grammar by setting `tm_scope: NONE` in
languages.yml.
Some languages are sensitive to file names in the sense that
different kinds of files contain somewhat different data.
Example: GAP .tst files contain test cases, which add some
extra data compared to regular code, and as a consequence are
not directly interchangeable with regular source code.
Heuristics may need to take this into account, thus may need
to know the name of the file being analyzed.
* origin/master:
Add Gemfile.lock sample
Remove deprecated method
#all_extensions already includes primary extension
typo
remove unused assertion
Symlink ant.xml to build.xml
Avoid shadowing variable name
Update comment
Make missing sample failure message similar
Remove blank extensions property
Fix sample tests
Add Forth extensions .f and .for; add heuristics for Forth and FORTRAN.
Add FORTRAN and Forth samples.
Extensions aren't actually required
Fix errors from pedantic test
Make pedantic test actually pedantic
Removing extensions when they should be filenames
Adding sample pom.xml files
Link to contributing docs
require samples if filename matches multiple languages
Conflicts:
test/test_pedantic.rb
We require samples for explicitly defined filenames that matches multiple languages. This is generally a good thing, but in this case they will be identical.
* origin/master:
Allow mime-types 2.x to be used with Linguist
Upgrade to rugged 0.22.0b1
Mention that languages need to be quite popular
fix vendor/cache
Gemfile.lock is nolonger considered generated
Tests for BlobHelper#empty?
remove reference to empty.js
Remove more empty samples
Bail earlier if the file is empty.
Moving comments
Use heuristics earlier to inform the rest of the classification process
Removing inconsistency of `find_by_heuristics` (was sometimes returning nil and sometimes returning and empty array)
Removing unused array of candidate languages.
Reworking most heuristics to only return one match
What do you call someone that thinks they are pedantic but actually
aren’t? All the crazy custom parsing in this test was making so it
wasn’t actually doing anything.
The purpose of this gem is to package up the language grammars that are
used for syntax highlighting on github.com. The grammars are TextMate,
Sublime Text, or Atom language grammars, converted to JSON and given the
filename SCOPE.json, where SCOPE is the language scope that the grammar
defines.
The github-linguist-grammars gem packages up all the grammars, and also
exports a Linguist::Grammars.path method to locate the directory
containing the grammars.
To build the gem, simply run `rake build_grammars_gem`. The grammars.yml
file lists all the repositories we download grammars from, as well as
which scopes are defined by each repository. The
script/download-grammars script takes that list and downloads and
processes the grammars into the format expected by the gem.
I went through all the aliases Pygments supports and removed the ones
that could already be used to find a Linguist::Language. Then I found
the Pygments::Lexer associated with each alias and found an associated
Linguist::Language for it (looking for a language with the same name as
the lexer, or by looking for the first langauge that uses that lexer).
Then I added the alias to the language's alias list.
I read all the file extensions that Pygments knows about, mapped them
back to the appropriate Linguist::Language, and added them to the
languages.yaml file.
Those files are either external libraries or builds of the repository itself. In any case they are generated automatically and shouldn't count in the language statistics. This also simplifies some of the rules that had to exclude both minified and normal dependencies.
* origin/master: (42 commits)
its always greener
that new green shell
Removing stale extension
Update README.md
Add moon interpreter for MoonScript
Bumping version for 3.4.1 release
Use text.html.erb scope for HTML+ERB files
Add sample .dyalog file for file type APL
Added extra Papyrus sample files.
Add sample Papyrus script
Add Papyrus support
Add LOLCODE support
Add ProGuard config files to vendored files
Recognise *.dyalog as APL sources
Assign a bunch more TextMate scopes
CI step for samples
Add .command as a Shell file extension
CI config
Vendored gems
Update cibuild
...
Conflicts:
Rakefile
* origin/master: (51 commits)
its always greener
that new green shell
Removing stale extension
Update README.md
Add moon interpreter for MoonScript
Bumping version for 3.4.1 release
Use text.html.erb scope for HTML+ERB files
Add sample .dyalog file for file type APL
Added extra Papyrus sample files.
Add sample Papyrus script
Add Papyrus support
Add LOLCODE support
Add ProGuard config files to vendored files
Recognise *.dyalog as APL sources
Assign a bunch more TextMate scopes
CI step for samples
Add .command as a Shell file extension
CI config
Vendored gems
Update cibuild
...
Conflicts:
Gemfile
This grammar does a better job highlighting than the text.html.ruby grammar does. It requires injection grammar support, but there's no getting around that.
Based on top of PR#1447. Adds a simple heuristic check for Hack files vs PHP files (`<?hh` vs other `<?`).
Tested by verifying that the Hack example site was detected as 100% Hack and that Laravel was detected as 100% PHP. (Without the heuristic, Laravel gets detected as about 50% Hack, just by randomness in the classifier since PHP and Hack are very hard to distinguish unless you actually parse the file and look for specific language features.)
Hack is Facebook's dialect of PHP: http://hacklang.org/. This adds support for detecting it via the ".hh" file extension; although that extension techincally conflicts with C++ headers, the files look different enough that the existing classifier based on sample code has no trouble distinguising them.
This diff deliberately does not deal with detecting ".php" as another valid extension for Hack code. That's much trickier since the code looks basically identical to PHP to the classifier, and needs a different approach.
...to avoid collision with Clean language as well
as the .dcl extension can be seen only in some special
cases -- especially in context of DCL emulation tools
for non-OpenVMS systems (probably to avoid potential
confusion with MS-DOS .com files).
jsb is a meta build system [1] which can generate actual build files for GNU make, ninja, visual studio etc.
These files are pure javascript files. Just to differentiate them from rest of the javascript files, these are marked as .jsb file.
[1] https://github.com/vivekgalatage/jsb
Updated languages.yml to associate *.pig files with PigLatin.
Added pig script example to samples/.
Updated the samples.json with to account for new sample.
The upstream pygments patches seem to have landed at GitHub as Pan code blocks
are being correctly highlighted, we should extend this to files in repositories as well.
* master: (29 commits)
Samples
Samples
example for bbx,cbx,lbx file (extracted from http://github.com/plk/biblatex)
Samples
Samples update
Adding samples for new extensions
Adding test to check that languages.yml includes all extensions represented in samples folder
Add LookML
Add Foundation js to vendor.yml, and test_blob.rb
Remove file extensions with multiple segments
Lexer for Handlebars
Add knockout.js library as vendor file
Support for Cycript language with .cy file extension
extension for biblatex
Adding Font Awesome to vendored files.
3.1.1
Add minimal support for recognizing OpenSCAD files.
Added .hqf sample.
Properly added sample.
Added SQF support
...
Conflicts:
lib/linguist/samples.json
As 3D printing becomes more popular, more OpenSCAD projects will appear
on github. This change allows linguist to recognize those projects.
Hopefully, this will make finding projects easier.
allows for using both ColdFusion Lexers provided by pigments and allows
for proper syntax highlighting of cfscript based CFCs
Signed-off-by: Sean Coyne <sean@n42designs.com>
This change includes a brief (non-sensical) sample program I wrote to
illustrate many of Cool's language constructs, as well as a simple rule
to distinguish Cool files from Common Lisp or OpenCL (it has a line that
starts with the word 'class'). Further, it includes a second example
program adapted from an example contained in the Cool distribution
(list.cl), which contains a few further language constructs and captures
the style of a Cool program.
- [ ] reviewed the [Troubleshooting](https://github.com/github/linguist#troubleshooting) docs,
- [ ] considered implementing an [override](https://github.com/github/linguist#overrides),
- [ ] verified an issue has not already been logged for your issue ([linguist issues](https://github.com/issues?utf8=%E2%9C%93&q=is%3Aissue+repo%3Agithub/linguist)).
<!-- Please review these preliminary steps before logging your issue. You may find the information referenced may answer or explain the behaviour you are seeing. It'll help us to know you've reviewed this information. -->
## Problem Description
<!--- Provide a more detailed introduction to the issue itself, and why you consider it to be a bug -->
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE).
This project adheres to the [Contributor Covenant Code of Conduct](http://contributor-covenant.org/). By participating, you are expected to uphold this code.
The majority of contributions won't need to touch any Ruby code at all.
## Getting started
Before you can start contributing to Linguist, you'll need to set up your environment first. Clone the repo and run `script/bootstrap` to install its dependencies.
git clone https://github.com/github/linguist.git
cd linguist/
script/bootstrap
To run Linguist from the cloned repository, you will need to generate the code samples first:
bundle exec rake samples
Run this command each time a [sample][samples] has been modified.
To run Linguist from the cloned repository:
bundle exec bin/linguist --breakdown
### Dependencies
Linguist uses the [`charlock_holmes`](https://github.com/brianmario/charlock_holmes) character encoding detection library which in turn uses [ICU](http://site.icu-project.org/), and the libgit2 bindings for Ruby provided by [`rugged`](https://github.com/libgit2/rugged). [Docker](https://www.docker.com/) is also required when adding or updating grammars. These components have their own dependencies - `icu4c`, and `cmake` and `pkg-config` respectively - which you may need to install before you can install Linguist.
For example, on macOS with [Homebrew](http://brew.sh/): `brew install cmake pkg-config icu4c docker` and on Ubuntu: `apt-get install cmake pkg-config libicu-dev docker-ce`.
## Adding an extension to a language
We try only to add new extensions once they have some usage on GitHub. In most cases we prefer that extensions be in use in hundreds of repositories before supporting them in Linguist.
To add support for a new extension:
1. Add your extension to the language entry in [`languages.yml`][languages], keeping the extensions in alphabetical and case-sensitive (uppercase before lowercase) order, with the exception of the primary extension; the primary extension should be first.
1. Add at least one sample for your extension to the [samples directory][samples] in the correct subdirectory. We'd prefer examples of real-world code showing common usage. The more representative of the structure of the language, the better.
1. Open a pull request, linking to a [GitHub search result](https://github.com/search?utf8=%E2%9C%93&q=extension%3Aboot+NOT+nothack&type=Code&ref=searchresults) showing in-the-wild usage.
If you are adding a sample, please state clearly the license covering the code in the sample, and if possible, link to the original source of the sample.
Additionally, if this extension is already listed in [`languages.yml`][languages] and associated with another language, then sometimes a few more steps will need to be taken:
1. Make sure that example `.yourextension` files are present in the [samples directory][samples] for each language that uses `.yourextension`.
1. Test the performance of the Bayesian classifier with a relatively large number (1000s) of sample `.yourextension` files. (ping **@lildude** to help with this) to ensure we're not misclassifying files.
1. If the Bayesian classifier does a bad job with the sample `.yourextension` files then a [heuristic](https://github.com/github/linguist/blob/master/lib/linguist/heuristics.rb) may need to be written to help.
## Adding a language
We try only to add languages once they have some usage on GitHub. In most cases we prefer that each new file extension be in use in hundreds of repositories before supporting them in Linguist.
To add support for a new language:
1. Add an entry for your language to [`languages.yml`][languages]. Omit the `language_id` field for now.
1. Add a syntax-highlighting grammar for your language using: `script/add-grammar https://github.com/JaneSmith/MyGrammar`
This command will analyze the grammar and, if no problems are found, add it to the repository. If problems are found, please report them to the grammar maintainer as you will not be able to add the grammar if problems are found.
**Please only add grammars that have [one of these licenses][licenses].**
1. Add samples for your language to the [samples directory][samples] in the correct subdirectory.
1. Add a `language_id` for your language using `script/set-language-ids`.
**You should only ever need to run `script/set-language-ids --update`. Anything other than this risks breaking GitHub search :cry:**
1. Open a pull request, linking to a [GitHub search results](https://github.com/search?utf8=%E2%9C%93&q=extension%3Aboot+NOT+nothack&type=Code&ref=searchresults) showing in-the-wild usage.
Please state clearly the license covering the code in the samples. Link directly to the original source if possible.
In addition, if your new language defines an extension that's already listed in [`languages.yml`][languages] (such as `.foo`) then sometimes a few more steps will need to be taken:
1. Make sure that example `.foo` files are present in the [samples directory][samples] for each language that uses `.foo`.
1. Test the performance of the Bayesian classifier with a relatively large number (1000s) of sample `.foo` files. (ping **@lildude** to help with this) to ensure we're not misclassifying files.
1. If the Bayesian classifier does a bad job with the sample `.foo` files then a [heuristic](https://github.com/github/linguist/blob/master/lib/linguist/heuristics.rb) may need to be written to help.
Remember, the goal here is to try and avoid false positives!
## Fixing a misclassified language
Most languages are detected by their file extension defined in [`languages.yml`][languages]. For disambiguating between files with common extensions, Linguist applies some [heuristics](/lib/linguist/heuristics.rb) and a [statistical classifier](lib/linguist/classifier.rb). This process can help differentiate between, for example, `.h` files which could be either C, C++, or Obj-C.
Misclassifications can often be solved by either adding a new filename or extension for the language or adding more [samples][samples] to make the classifier smarter.
## Fixing syntax highlighting
Syntax highlighting in GitHub is performed using TextMate-compatible grammars. These are the same grammars that TextMate, Sublime Text and Atom use. Every language in [`languages.yml`][languages] is mapped to its corresponding TextMate `scopeName`. This scope name will be used when picking up a grammar for highlighting.
Assuming your code is being detected as the right language, in most cases syntax highlighting problems are due to a bug in the language grammar rather than a bug in Linguist. [`vendor/README.md`][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. [TextMate's documentation](https://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://github-lightshow.herokuapp.com).
Once the bug has been fixed upstream, we'll pick it up for GitHub in the next release of Linguist.
## Changing the source of a syntax highlighting grammar
We'd like to ensure Linguist and GitHub.com are using the latest and greatest grammars that are consistent with the current usage but understand that sometimes a grammar can lag behind the evolution of a language or even stop being developed. This often results in someone grasping the opportunity to create a newer and better and more actively maintained grammar, and we'd love to use it and pass on it's functionality to our users.
This command will analyze the grammar and, if no problems are found, add it to the repository. If problems are found, please report these problems to the grammar maintainer as you will not be able to add the grammar if problems are found.
**Please only add grammars that have [one of these licenses][licenses].**
Please then open a pull request for the updated grammar.
## Testing
You can run the tests locally with:
bundle exec rake test
Sometimes getting the tests running can be too much work, especially if you don't have much Ruby experience. It's okay: be lazy and let our build bot [Travis](https://travis-ci.org/#!/github/linguist) run the tests for you. Just open a pull request and the bot will start cranking away.
Here's our current build status: [](https://travis-ci.org/github/linguist)
## Maintainers
Linguist is maintained with :heart: by:
- **@Alhadis**
- **@BenEddy** (GitHub staff)
- **@Caged** (GitHub staff)
- **@grantr** (GitHub staff)
- **@kivikakk** (GitHub staff)
- **@larsbrinkhoff**
- **@lildude** (GitHub staff)
- **@pchaigno**
- **@rafer** (GitHub staff)
- **@shreyasjoshis** (GitHub staff)
As Linguist is a production dependency for GitHub we have a couple of workflow restrictions:
- Anyone with commit rights can merge Pull Requests provided that there is a :+1: from a GitHub staff member.
- Releases are performed by GitHub staff so we can ensure GitHub.com always stays up to date with the latest release of Linguist and there are no regressions in production.
### Releasing
If you are the current maintainer of this gem:
1. Create a branch for the release: `git checkout -b cut-release-vxx.xx.xx`
1. Make sure your local dependencies are up to date: `script/bootstrap`
1. If grammar submodules have not been updated recently, update them: `git submodule update --remote && git commit -a`
1. Ensure that samples are updated: `bundle exec rake samples`
1. Ensure that tests are green: `bundle exec rake test`
1. Bump gem version in `lib/linguist/version.rb`, [like this](https://github.com/github/linguist/commit/8d2ea90a5ba3b2fe6e1508b7155aa4632eea2985).
1. Make a PR to github/linguist, [like this](https://github.com/github/linguist/pull/1238).
1. Build a local gem: `bundle exec rake build_gem`
1. Test the gem:
1. Bump the Gemfile and Gemfile.lock versions for an app which relies on this gem
1. Install the new gem locally
1. Test behavior locally, branch deploy, whatever needs to happen
1. Merge github/linguist PR
1. Tag and push: `git tag vx.xx.xx; git push --tags`
1. Create a GitHub release with the pushed tag (https://github.com/github/linguist/releases/new)
1. Build a grammars tarball (`./script/build-grammars-tarball`) and attach it to the GitHub release
1. Push to rubygems.org -- `gem push github-linguist-3.0.0.gem`
We use this library at GitHub to detect blob languages, highlight code, ignore binary files, suppress generated files in diffs, and generate language breakdown graphs.
This library is used on GitHub.com to detect blob languages, ignore binary or vendored files, suppress generated files in diffs, and generate language breakdown graphs.
Linguist defines a list of all languages known to GitHub in a [yaml file](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml). In order for a file to be highlighted, a language and a lexer must be defined there.
See [Troubleshooting](#troubleshooting) and [`CONTRIBUTING.md`](CONTRIBUTING.md) before filing an issue or creating a pull request.
Most languages are detected by their file extension. For disambiguating between files with common extensions, we first apply some common-sense heuristics to pick out obvious languages. After that, we use a
This process can help us tell the difference between, for example, `.h` files which could be either C, C++, or Obj-C.
## How Linguist works
Linguist takes the list of languages it knows from [`languages.yml`](/lib/linguist/languages.yml) and uses a number of methods to try and determine the language used by each file, and the overall repository breakdown.
Linguist starts by going through all the files in a repository and excludes all files that it determines to be binary data, [vendored code](#vendored-code), [generated code](#generated-code), [documentation](#documentation), or are defined as `data` (e.g. SQL) or `prose` (e.g. Markdown) languages, whilst taking into account any [overrides](#overrides).
If an [explicit language override](#using-gitattributes) has been used, that language is used for the matching files. The language of each remaining file is then determined using the following strategies, in order, with each step either identifying the precise language or reducing the number of likely languages passed down to the next strategy:
- Vim or Emacs modeline,
- commonly used filename,
- shell shebang,
- file extension,
- heuristics,
- naïve Bayesian classification
The result of this analysis is used to produce the language stats bar which displays the languages percentages for the files in the repository. The percentages are calculated based on the bytes of code for each language as reported by the [List Languages](https://developer.github.com/v3/repos/#list-languages) API.
When you push changes to a repository on GitHub.com, a low priority background job is enqueued to analyze your repository as explained above. The results of this analysis are cached for the lifetime of your repository and are only updated when the repository is updated. As this analysis is performed by a low priority background job, it can take a while, particularly during busy periods, for your language statistics bar to reflect your changes.
## Usage
Install the gem:
$ gem install github-linguist
#### Dependencies
Linguist uses the [`charlock_holmes`](https://github.com/brianmario/charlock_holmes) character encoding detection library which in turn uses [ICU](http://site.icu-project.org/), and the libgit2 bindings for Ruby provided by [`rugged`](https://github.com/libgit2/rugged). These components have their own dependencies - `icu4c`, and `cmake` and `pkg-config` respectively - which you may need to install before you can install Linguist.
For example, on macOS with [Homebrew](http://brew.sh/): `brew install cmake pkg-config icu4c` and on Ubuntu: `apt-get install cmake pkg-config libicu-dev`.
### Application usage
Linguist can be used in your application as follows:
See [lib/linguist/language.rb](https://github.com/github/linguist/blob/master/lib/linguist/language.rb) and [lib/linguist/languages.yml](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml).
### Command line usage
### Syntax Highlighting
A repository's languages stats can also be assessed from the command line using the `linguist` executable. Without any options, `linguist` will output the breakdown that correlates to what is shown in the language stats bar. The `--breakdown` flag will additionally show the breakdown of files by language.
The actual syntax highlightingis handled by our Pygments wrapper, [pygments.rb](https://github.com/tmm1/pygments.rb). It also provides a [Lexer abstraction](https://github.com/tmm1/pygments.rb/blob/master/lib/pygments/lexer.rb) that determines which highlighter should be used on a file.
You can try running `linguist` on the root directory in this repository itself:
### Stats
```console
$ bundle exec bin/linguist --breakdown
68.57% Ruby
22.90% C
6.93% Go
1.21% Lex
0.39% Shell
The Language stats bar that you see on every repository is built by aggregating the languages of each file in that repository. The top language in the graph determines the project's primary language.
The repository stats API, accessed through `#languages`, can be used on a directory:
These stats are also printed out by the `linguist` binary. You can use the
`--breakdown` flag, and the binary will also output the breakdown of files by language.
You can try running `linguist` on the `lib/` directory in this repository itself:
## Troubleshooting
$ bundle exec linguist lib/ --breakdown
### My repository is detected as the wrong language
100.00% Ruby
If the language stats bar is reporting a language that you don't expect:
Ruby:
linguist/blob_helper.rb
linguist/classifier.rb
linguist/file_blob.rb
linguist/generated.rb
linguist/heuristics.rb
linguist/language.rb
linguist/md5.rb
linguist/repository.rb
linguist/samples.rb
linguist/tokenizer.rb
linguist.rb
1. Click on the name of the language in the stats bar to see a list of the files that are identified as that language.
Keep in mind this performs a search so the [code search restrictions](https://help.github.com/articles/searching-code/#considerations-for-code-search) may result in files identified in the language statistics not appearing in the search results. [Installing Linguist locally](#usage) and running it from the [command line](#command-line-usage) will give you accurate results.
1. If you see files that you didn't write in the search results, consider moving the files into one of the [paths for vendored code](/lib/linguist/vendor.yml), or use the [manual overrides](#overrides) feature to ignore them.
1. If the files are misclassified, search for [open issues][issues] to see if anyone else has already reported the issue. Any information you can add, especially links to public repositories, is helpful. You can also use the [manual overrides](#overrides) feature to correctly classify them in your repository.
1. If there are no reported issues of this misclassification, [open an issue][new-issue] and include a link to the repository or a sample of the code that is being misclassified.
#### Ignore vendored files
Keep in mind that the repository language stats are only [updated when you push changes](#how-linguist-works-on-githubcom), and the results are cached for the lifetime of your repository. If you have not made any changes to your repository in a while, you may find pushing another change will correct the stats.
Checking other code into your git repo is a common practice. But this often inflates your project's language stats and may even cause your project to be labeled as another language. We are able to identify some of these files and directories and exclude them.
Linguist does not consider [vendored code](#vendored-code), [generated code](#generated-code), [documentation](#documentation), or `data` (e.g. SQL) or `prose` (e.g. Markdown) languages (as defined by the `type` attribute in [`languages.yml`](/lib/linguist/languages.yml)) when calculating the repository language statistics.
If the language statistics bar is not showing your language at all, it could be for a few reasons:
1. Linguist doesn't know about your language.
1. The extension you have chosen is not associated with your language in [`languages.yml`](/lib/linguist/languages.yml).
1. All the files in your repository fall into one of the categories listed above that Linguist excludes by default.
If Linguist doesn't know about the language or the extension you're using, consider [contributing](CONTRIBUTING.md) to Linguist by opening a pull request to add support for your language or extension. For everything else, you can use the [manual overrides](#overrides) feature to tell Linguist to include your files in the language statistics.
### There's a problem with the syntax highlighting of a file
Linguist detects the language of a file but the actual syntax-highlighting is powered by a set of language grammars which are included in this project as a set of submodules [as listed here](/vendor/README.md).
If you experience an issue with the syntax-highlighting on GitHub, **please report the issue to the upstream grammar repository, not here.** Grammars are updated every time we build the Linguist gem so upstream bug fixes are automatically incorporated as they are fixed.
## Overrides
Linguist supports a number of different custom override strategies for language definitions and file paths.
### Using gitattributes
Add a `.gitattributes` file to your project and use standard git-style path matchers for the files you want to override using the `linguist-documentation`, `linguist-language`, `linguist-vendored`, `linguist-generated` and `linguist-detectable` attributes. `.gitattributes` will be used to determine language statistics and will be used to syntax highlight files. You can also manually set syntax highlighting using [Vim or Emacs modelines](#using-emacs-or-vim-modelines).
```
$ cat .gitattributes
*.rb linguist-language=Java
```
See [Linguist::BlobHelper#vendored?](https://github.com/github/linguist/blob/master/lib/linguist/blob_helper.rb) and [lib/linguist/vendor.yml](https://github.com/github/linguist/blob/master/lib/linguist/vendor.yml).
#### Vendored code
#### Generated file detection
Checking code you didn't write, such as JavaScript libraries, into your git repo is a common practice, but this often inflates your project's language stats and may even cause your project to be labeled as another language. By default, Linguist treats all of the paths defined in [`vendor.yml`](/lib/linguist/vendor.yml) as vendored and therefore doesn't include them in the language statistics for a repository.
Not all plain text files are true source files. Generated files like minified js and compiled CoffeeScript can be detected and excluded from language stats. As an extra bonus, these files are suppressed in diffs.
Use the `linguist-vendored` attribute to vendor or un-vendor paths.
See [Linguist::Generated#generated?](https://github.com/github/linguist/blob/master/lib/linguist/generated.rb).
#### Documentation
## Installation
Just like vendored files, Linguist excludes documentation files from your project's language stats. [`documentation.yml`](/lib/linguist/documentation.yml) lists common documentation paths and excludes them from the language statistics for your repository.
github.com is usually running the latest version of the `github-linguist` gem that is released on [RubyGems.org](http://rubygems.org/gems/github-linguist).
Use the `linguist-documentation` attribute to mark or unmark paths as documentation.
But for development you are going to want to checkout out the source. To get it, clone the repo and run [Bundler](http://gembundler.com/) to install its dependencies.
```
$ cat .gitattributes
project-docs/* linguist-documentation
docs/formatter.rb linguist-documentation=false
```
git clone https://github.com/github/linguist.git
cd linguist/
bundle install
#### Generated code
To run the tests:
Not all plain text files are true source files. Generated files like minified JavaScript and compiled CoffeeScript can be detected and excluded from language stats. As an added bonus, unlike vendored and documentation files, these files are suppressed in diffs. [`generated.rb`](/lib/linguist/generated.rb) lists common generated paths and excludes them from the language statistics of your repository.
Use the `linguist-generated` attribute to mark or unmark paths as generated.
```
$ cat .gitattributes
Api.elm linguist-generated=true
```
#### Detectable
Only programming languages are included in the language statistics. Languages of a different type (as defined in [`languages.yml`](/lib/linguist/languages.yml)) are not "detectable" causing them not to be included in the language statistics.
Use the `linguist-detectable` attribute to mark or unmark paths as detectable.
```
$ cat .gitattributes
*.kicad_pcb linguist-detectable=true
*.sch linguist-detectable=true
tools/export_bom.py linguist-detectable=false
```
### Using Emacs or Vim modelines
If you do not want to use `.gitattributes` to override the syntax highlighting used on GitHub.com, you can use Vim or Emacs style modelines to set the language for a single file. Modelines can be placed anywhere within a file and are respected when determining how to syntax-highlight a file on GitHub.com
##### Vim
```
# Some examples of various styles:
vim: syntax=java
vim: set syntax=ruby:
vim: set filetype=prolog:
vim: set ft=cpp:
```
##### Emacs
```
-*- mode: php;-*-
```
bundle exec rake test
## Contributing
The majority of contributions won't need to touch any Ruby code at all. The [master language list](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml) is just a YAML configuration file.
Please check out our [contributing guidelines](CONTRIBUTING.md).
We try to only add languages once they have some usage on GitHub, so please note in-the-wild usage examples in your pull request.
Almost all bug fixes or new language additions should come with some additional code samples. Just drop them under [`samples/`](https://github.com/github/linguist/tree/master/samples) in the correct subdirectory and our test suite will automatically test them. In most cases you shouldn't need to add any new assertions.
## License
To update the `samples.json` after adding new files to [`samples/`](https://github.com/github/linguist/tree/master/samples):
The language grammars included in this gem are covered by their repositories'
respective licenses. [`vendor/README.md`](/vendor/README.md) lists the repository for each grammar.
bundle exec rake samples
### A note on language extensions
Linguist has a number of methods available to it for identifying the language of a particular file. The initial lookup is based upon the extension of the file, possible file extensions are defined in an array called `extensions`. Take a look at this example for example for `Perl`:
```
Perl:
type: programming
ace_mode: perl
color: "#0298c3"
extensions:
- .pl
- .PL
- .perl
- .ph
- .plx
- .pm
- .pod
- .psgi
interpreters:
- perl
```
Any of the extensions defined are valid but the first in this array should be the most popular.
### Testing
Sometimes getting the tests running can be too much work, especially if you don't have much Ruby experience. It's okay: be lazy and let our build bot [Travis](http://travis-ci.org/#!/github/linguist) run the tests for you. Just open a pull request and the bot will start cranking away.
Here's our current build status, which is hopefully green: [](http://travis-ci.org/github/linguist)
### Releasing
If you are the current maintainer of this gem:
0. Create a branch for the release: `git checkout -b cut-release-vxx.xx.xx`
0. Make sure your local dependencies are up to date: `bundle install`
0. Ensure that samples are updated: `bundle exec rake samples`
0. Ensure that tests are green: `bundle exec rake test`
0. Bump gem version in `lib/linguist/version.rb`. For example, [like this](https://github.com/github/linguist/commit/8d2ea90a5ba3b2fe6e1508b7155aa4632eea2985).
0. Make a PR to github/linguist. For example, [#1238](https://github.com/github/linguist/pull/1238).
0. Build a local gem: `gem build github-linguist.gemspec`
0. Testing:
0. Bump the Gemfile and Gemfile.lock versions for an app which relies on this gem
0. Install the new gem locally
0. Test behavior locally, branch deploy, whatever needs to happen
0. Merge github/linguist PR
0. Tag and push: `git tag vx.xx.xx; git push --tags`
0. Push to rubygems.org -- `gem push github-linguist-3.0.0.gem`
All other files are covered by the MIT license, see `LICENSE`.
s.description='We use this library at GitHub to detect blob languages, highlight code, ignore binary files, suppress generated files in diffs, and generate language breakdown graphs.'
// if game is paused, module or mode disabled, interface disabled or player character hidden, quit function
KeyboardMovement_Directions newdirection; // declare variable storing new direction
// get new direction:
if ( ((IsKeyPressed(KeyboardMovement_KeyDown)) && (IsKeyPressed(KeyboardMovement_KeyRight))) || (IsKeyPressed(KeyboardMovement_KeyDownRight)) ) newdirection = eKeyboardMovement_DownRight; // if down&right arrows or PgDn (numeric pad) held down, set new direction to Down-Right
else if ( ((IsKeyPressed(KeyboardMovement_KeyUp)) && (IsKeyPressed(KeyboardMovement_KeyRight))) || (IsKeyPressed(KeyboardMovement_KeyUpRight)) ) newdirection = eKeyboardMovement_UpRight; // up&right arrows or PgUp (numpad)
else if ( ((IsKeyPressed(KeyboardMovement_KeyDown)) && (IsKeyPressed(KeyboardMovement_KeyLeft))) || (IsKeyPressed(KeyboardMovement_KeyDownLeft)) ) newdirection = eKeyboardMovement_DownLeft; // down&left arrows or End (numpad)
else if ( ((IsKeyPressed(KeyboardMovement_KeyUp)) && (IsKeyPressed(KeyboardMovement_KeyLeft))) || (IsKeyPressed(KeyboardMovement_KeyUpLeft)) ) newdirection = eKeyboardMovement_UpLeft; // up&left arrows or Home (numpad)
else if (IsKeyPressed(KeyboardMovement_KeyDown)) newdirection = eKeyboardMovement_Down; // down arrow
else if (IsKeyPressed(KeyboardMovement_KeyLeft)) newdirection = eKeyboardMovement_Left; // left arrow
else if (IsKeyPressed(KeyboardMovement_KeyRight)) newdirection = eKeyboardMovement_Right; // right arrow
else if (IsKeyPressed(KeyboardMovement_KeyUp)) newdirection = eKeyboardMovement_Up; // up arrow
else newdirection = eKeyboardMovement_Stop; // if none of the above held down, set it to stop player character
if (IsKeyPressed(KeyboardMovement_KeyStop)) newdirection = eKeyboardMovement_Stop; // if 5 (numeric pad) held down, stop player character, regardless of whether some of the above are held down
if (newdirection != KeyboardMovement_CurrentDirection) { // if new direction is different from current direction
if (newdirection == eKeyboardMovement_Stop) player.StopMoving(); // if new direction is the Stop command, stop movement of player character
else { // if new direction is NOT the Stop command
int dx, dy; // declare variables storing new walk coordinates
if (newdirection == eKeyboardMovement_DownRight) {
dx = DISTANCE;
dy = DISTANCE;
}
else if (newdirection == eKeyboardMovement_UpRight) {
dx = DISTANCE;
dy = -DISTANCE;
}
else if (newdirection == eKeyboardMovement_DownLeft) {
dx = -DISTANCE;
dy = DISTANCE;
}
else if (newdirection == eKeyboardMovement_UpLeft) {
dx = -DISTANCE;
dy = -DISTANCE;
}
else if (newdirection == eKeyboardMovement_Down) {
dx = 0;
dy = DISTANCE;
}
else if (newdirection == eKeyboardMovement_Left) {
dx = -DISTANCE;
dy = 0;
}
else if (newdirection == eKeyboardMovement_Right) {
dx = DISTANCE;
dy = 0;
}
else if (newdirection == eKeyboardMovement_Up) {
dx = 0;
dy = -DISTANCE;
}
player.WalkStraight(player.x + dx, player.y + dy, eNoBlock); // walk player character to the new coordinates
}
KeyboardMovement_CurrentDirection = newdirection; // update current direction to new direction
// if game is paused, module or mode disabled, interface disabled or player character hidden, quit function
KeyboardMovement_Directions newdirection; // declare variable storing new direction
// get new direction:
if (keycode == KeyboardMovement_KeyDownRight) newdirection = eKeyboardMovement_DownRight; // if down-right key pressed, set new direction to Down-Right
else if (keycode == KeyboardMovement_KeyUpRight) newdirection = eKeyboardMovement_UpRight;
else if (keycode == KeyboardMovement_KeyDownLeft) newdirection = eKeyboardMovement_DownLeft;
else if (keycode == KeyboardMovement_KeyUpLeft) newdirection = eKeyboardMovement_UpLeft;
else if (keycode == KeyboardMovement_KeyDown) newdirection = eKeyboardMovement_Down;
else if (keycode == KeyboardMovement_KeyLeft) newdirection = eKeyboardMovement_Left;
else if (keycode == KeyboardMovement_KeyRight) newdirection = eKeyboardMovement_Right;
else if (keycode == KeyboardMovement_KeyUp) newdirection = eKeyboardMovement_Up;
else if (keycode == KeyboardMovement_KeyStop) newdirection = eKeyboardMovement_Stop; // if stop key pressed, set to stop player character
if (newdirection != KeyboardMovement_CurrentDirection) { // if new direction is different from current direction
if (newdirection == eKeyboardMovement_Stop) player.StopMoving(); // if new direction is the Stop command, stop movement of player character
else { // if new direction is NOT the Stop command
int dx, dy; // declare variables storing new walk coordinates
if (newdirection == eKeyboardMovement_DownRight) {
dx = DISTANCE;
dy = DISTANCE;
}
else if (newdirection == eKeyboardMovement_UpRight) {
dx = DISTANCE;
dy = -DISTANCE;
}
else if (newdirection == eKeyboardMovement_DownLeft) {
dx = -DISTANCE;
dy = DISTANCE;
}
else if (newdirection == eKeyboardMovement_UpLeft) {
dx = -DISTANCE;
dy = -DISTANCE;
}
else if (newdirection == eKeyboardMovement_Down) {
dx = 0;
dy = DISTANCE;
}
else if (newdirection == eKeyboardMovement_Left) {
dx = -DISTANCE;
dy = 0;
}
else if (newdirection == eKeyboardMovement_Right) {
dx = DISTANCE;
dy = 0;
}
else if (newdirection == eKeyboardMovement_Up) {
dx = 0;
dy = -DISTANCE;
}
player.WalkStraight(player.x + dx, player.y + dy, eNoBlock); // walk player character to the new coordinates
}
KeyboardMovement_CurrentDirection = newdirection; // update current direction to new direction
}
else { // if new direction is same as current direction
player.StopMoving(); // stop player character
KeyboardMovement_CurrentDirection = eKeyboardMovement_Stop; // update current direction
This API example demonstrates how to describe body attributes of a request or response message.
In this case, the description is complementary (and duplicate!) to the provided JSON example in the body section. The [Advanced Attributes](09.%20Advanced%20Attributes.md) API example will demonstrate how to avoid duplicates and how to reuse attributes descriptions.
## API Blueprint
+ [Previous: Parameters](07.%20Parameters.md)
+ [This: Raw API Blueprint](https://raw.github.com/apiaryio/api-blueprint/master/examples/08.%20Attributes.md)
This is one of the simplest APIs written in the **API Blueprint**.
One plain resource combined with a method and that's it! We will explain what is going on in the next installment - [Resource and Actions](02.%20Resource%20and%20Actions.md).
**Note:** As we progress through the examples, do not also forget to view the [Raw](https://raw.github.com/apiaryio/api-blueprint/master/examples/01.%20Simplest%20API.md) code to see what is really going on in the API Blueprint, as opposed to just seeing the output of the Github Markdown parser.
Also please keep in mind that every single example in this course is a **real API Blueprint** and as such you can **parse** it with the [API Blueprint parser](https://github.com/apiaryio/drafter) or one of its [bindings](https://github.com/apiaryio/drafter#bindings).
## API Blueprint
+ [This: Raw API Blueprint](https://raw.github.com/apiaryio/api-blueprint/master/examples/01.%20Simplest%20API.md)
+ [Next: Resource and Actions](02.%20Resource%20and%20Actions.md)
Notice (Copyright (c) 2010 by Brian J. Bonislawsky DBA Astigmatic (AOETI). All rights reserved. Available under the Apache 2.0 licence.http://www.apache.org/licenses/LICENSE-2.0.html)
ItalicAngle 0
IsFixedPitch false
UnderlinePosition -133
UnderlineThickness 20
Version 1.000
EncodingScheme ISO10646-1
FontBBox -33 -322 1052 959
CapHeight 714
XHeight 487
Ascender 688
Descender -225
StartCharMetrics 371
C 32 ; WX 292 ; N space ; B 0 0 0 0 ;
C 33 ; WX 276 ; N exclam ; B 73 0 207 702 ;
C 34 ; WX 352 ; N quotedbl ; B 48 449 295 704 ;
C 35 ; WX 554 ; N numbersign ; B 31 -2 524 713 ;
C 36 ; WX 526 ; N dollar ; B 31 -201 498 919 ;
C 37 ; WX 666 ; N percent ; B 32 -186 642 872 ;
C 38 ; WX 676 ; N ampersand ; B 31 -5 645 705 ;
C 39 ; WX 196 ; N quotesingle ; B 48 449 143 703 ;
C 40 ; WX 279 ; N parenleft ; B 55 -71 243 757 ;
C 41 ; WX 281 ; N parenright ; B 37 -59 229 770 ;
C 42 ; WX 522 ; N asterisk ; B 32 276 493 707 ;
C 43 ; WX 496 ; N plus ; B 29 131 465 560 ;
C 44 ; WX 336 ; N comma ; B 39 -197 290 251 ;
C 45 ; WX 636 ; N hyphen ; B 63 273 573 397 ;
C 46 ; WX 349 ; N period ; B 52 -3 298 245 ;
C 47 ; WX 557 ; N slash ; B 23 -41 536 760 ;
C 48 ; WX 610 ; N zero ; B 55 0 560 720 ;
C 49 ; WX 569 ; N one ; B 27 -12 572 712 ;
C 50 ; WX 573 ; N two ; B 50 -25 541 680 ;
C 51 ; WX 557 ; N three ; B 44 -25 514 694 ;
C 52 ; WX 612 ; N four ; B 15 4 584 708 ;
C 53 ; WX 537 ; N five ; B 47 0 505 690 ;
C 54 ; WX 588 ; N six ; B 48 -10 548 707 ;
C 55 ; WX 555 ; N seven ; B 15 -34 549 734 ;
C 56 ; WX 598 ; N eight ; B 51 1 551 720 ;
C 57 ; WX 584 ; N nine ; B 48 -2 539 715 ;
C 58 ; WX 343 ; N colon ; B 51 -3 297 518 ;
C 59 ; WX 328 ; N semicolon ; B 45 -197 297 518 ;
C 60 ; WX 463 ; N less ; B 31 120 401 565 ;
C 61 ; WX 636 ; N equal ; B 63 186 573 513 ;
C 62 ; WX 463 ; N greater ; B 62 120 433 565 ;
C 63 ; WX 470 ; N question ; B 34 2 442 729 ;
C 64 ; WX 665 ; N at ; B 46 -4 618 680 ;
C 65 ; WX 549 ; N A ; B -1 -16 550 703 ;
C 66 ; WX 604 ; N B ; B 29 -6 557 704 ;
C 67 ; WX 579 ; N C ; B 46 -13 531 700 ;
C 68 ; WX 622 ; N D ; B 36 -17 579 713 ;
C 69 ; WX 638 ; N E ; B 38 -16 587 691 ;
C 70 ; WX 605 ; N F ; B 29 -9 595 709 ;
C 71 ; WX 615 ; N G ; B 45 -3 586 710 ;
C 72 ; WX 652 ; N H ; B 40 -20 622 690 ;
C 73 ; WX 495 ; N I ; B 26 -24 469 710 ;
C 74 ; WX 541 ; N J ; B 16 -3 539 703 ;
C 75 ; WX 582 ; N K ; B 28 -5 584 711 ;
C 76 ; WX 602 ; N L ; B 23 -14 583 718 ;
C 77 ; WX 697 ; N M ; B 46 -10 655 704 ;
C 78 ; WX 627 ; N N ; B 41 -15 595 700 ;
C 79 ; WX 616 ; N O ; B 42 -30 574 702 ;
C 80 ; WX 553 ; N P ; B 30 -12 527 689 ;
C 81 ; WX 602 ; N Q ; B 42 -98 571 711 ;
C 82 ; WX 636 ; N R ; B 14 -9 624 706 ;
C 83 ; WX 588 ; N S ; B 51 -13 547 690 ;
C 84 ; WX 594 ; N T ; B 25 1 564 707 ;
C 85 ; WX 621 ; N U ; B 24 -6 611 710 ;
C 86 ; WX 611 ; N V ; B -1 -15 614 726 ;
C 87 ; WX 643 ; N W ; B 8 0 614 689 ;
C 88 ; WX 582 ; N X ; B 3 -1 580 697 ;
C 89 ; WX 561 ; N Y ; B -21 -2 562 719 ;
C 90 ; WX 592 ; N Z ; B 49 -1 551 709 ;
C 91 ; WX 312 ; N bracketleft ; B 85 -72 297 754 ;
C 92 ; WX 557 ; N backslash ; B 21 -41 534 760 ;
C 249 ; WX 639 ; N ugrave ; B 5 -28 624 679 ;
C 250 ; WX 639 ; N uacute ; B 5 -28 624 682 ;
C 251 ; WX 639 ; N ucircumflex ; B 5 -28 624 691 ;
C 252 ; WX 639 ; N udieresis ; B 5 -28 624 649 ;
C 253 ; WX 592 ; N yacute ; B 0 -232 596 666 ;
C 254 ; WX 552 ; N thorn ; B -33 -221 512 699 ;
C 255 ; WX 592 ; N ydieresis ; B 0 -232 596 643 ;
C -1 ; WX 549 ; N Amacron ; B -1 -16 550 809 ;
C -1 ; WX 565 ; N amacron ; B 38 -6 561 619 ;
C -1 ; WX 549 ; N Abreve ; B -1 -16 550 890 ;
C -1 ; WX 565 ; N abreve ; B 38 -6 561 686 ;
C -1 ; WX 549 ; N Aogonek ; B -1 -138 589 703 ;
C -1 ; WX 565 ; N aogonek ; B 38 -118 624 502 ;
C -1 ; WX 579 ; N Cacute ; B 46 -13 531 900 ;
C -1 ; WX 547 ; N cacute ; B 39 -22 506 693 ;
C -1 ; WX 579 ; N Ccircumflex ; B 46 -13 531 890 ;
C -1 ; WX 547 ; N ccircumflex ; B 39 -22 506 689 ;
C -1 ; WX 579 ; N Cdotaccent ; B 46 -13 531 859 ;
C -1 ; WX 547 ; N cdotaccent ; B 39 -22 506 657 ;
C -1 ; WX 579 ; N Ccaron ; B 46 -13 531 918 ;
C -1 ; WX 547 ; N ccaron ; B 39 -22 506 710 ;
C -1 ; WX 622 ; N Dcaron ; B 36 -17 579 924 ;
C -1 ; WX 750 ; N dcaron ; B 40 -26 716 704 ;
C -1 ; WX 623 ; N Dcroat ; B 36 -17 580 713 ;
C -1 ; WX 603 ; N dcroat ; B 40 -26 597 714 ;
C -1 ; WX 638 ; N Emacron ; B 38 -16 587 798 ;
C -1 ; WX 543 ; N emacron ; B 40 -23 501 616 ;
C -1 ; WX 638 ; N Ebreve ; B 38 -16 587 876 ;
C -1 ; WX 543 ; N ebreve ; B 40 -23 501 683 ;
C -1 ; WX 638 ; N Edotaccent ; B 38 -16 587 848 ;
C -1 ; WX 543 ; N edotaccent ; B 40 -23 501 659 ;
C -1 ; WX 638 ; N Eogonek ; B 38 -113 610 691 ;
C -1 ; WX 543 ; N eogonek ; B 40 -145 501 499 ;
C -1 ; WX 638 ; N Ecaron ; B 38 -16 587 913 ;
C -1 ; WX 543 ; N ecaron ; B 40 -23 501 714 ;
C -1 ; WX 615 ; N Gcircumflex ; B 45 -3 586 906 ;
C -1 ; WX 583 ; N gcircumflex ; B 42 -224 562 676 ;
C -1 ; WX 615 ; N Gbreve ; B 45 -3 586 899 ;
C -1 ; WX 583 ; N gbreve ; B 42 -224 562 667 ;
C -1 ; WX 615 ; N Gdotaccent ; B 45 -3 586 871 ;
C -1 ; WX 583 ; N gdotaccent ; B 42 -224 562 637 ;
C -1 ; WX 615 ; N Gcommaaccent ; B 45 -253 586 710 ;
C -1 ; WX 583 ; N gcommaaccent ; B 42 -224 562 734 ;
C -1 ; WX 652 ; N Hcircumflex ; B 40 -20 622 897 ;
C -1 ; WX 616 ; N hcircumflex ; B 5 -29 601 688 ;
C -1 ; WX 652 ; N Hbar ; B 40 -20 622 690 ;
C -1 ; WX 616 ; N hbar ; B 5 -29 601 683 ;
C -1 ; WX 495 ; N Itilde ; B 26 -24 469 859 ;
C -1 ; WX 568 ; N itilde ; B 36 -42 568 615 ;
C -1 ; WX 495 ; N Imacron ; B 26 -24 469 819 ;
C -1 ; WX 568 ; N imacron ; B 36 -42 568 585 ;
C -1 ; WX 495 ; N Ibreve ; B 26 -24 469 901 ;
C -1 ; WX 568 ; N ibreve ; B 36 -42 568 661 ;
C -1 ; WX 495 ; N Iogonek ; B 26 -154 469 710 ;
C -1 ; WX 568 ; N iogonek ; B 36 -149 568 674 ;
C -1 ; WX 495 ; N Idotaccent ; B 26 -24 469 873 ;
C -1 ; WX 568 ; N dotlessi ; B 36 -42 568 468 ;
C -1 ; WX 1036 ; N IJ ; B 26 -24 1034 710 ;
C -1 ; WX 983 ; N ij ; B 36 -236 913 683 ;
C -1 ; WX 541 ; N Jcircumflex ; B 16 -3 539 913 ;
C -1 ; WX 415 ; N jcircumflex ; B -12 -236 405 699 ;
C -1 ; WX 582 ; N Kcommaaccent ; B 28 -253 584 711 ;
C -1 ; WX 620 ; N kcommaaccent ; B 11 -253 600 683 ;
C -1 ; WX 620 ; N kgreenlandic ; B 11 -28 600 482 ;
C -1 ; WX 602 ; N Lacute ; B 23 -14 583 923 ;
C -1 ; WX 540 ; N lacute ; B 4 -28 538 902 ;
C -1 ; WX 602 ; N Lcommaaccent ; B 23 -267 583 718 ;
C -1 ; WX 540 ; N lcommaaccent ; B 4 -267 538 682 ;
C -1 ; WX 602 ; N Lcaron ; B 23 -14 583 794 ;
C -1 ; WX 582 ; N lcaron ; B 4 -28 549 704 ;
C -1 ; WX 781 ; N Ldot ; B 23 -14 748 718 ;
C -1 ; WX 571 ; N ldotaccent ; B 4 -28 538 682 ;
C -1 ; WX 603 ; N Lslash ; B 24 -14 584 718 ;
C -1 ; WX 541 ; N lslash ; B 4 -28 538 682 ;
C -1 ; WX 627 ; N Nacute ; B 41 -15 595 894 ;
C -1 ; WX 632 ; N nacute ; B 32 -23 612 696 ;
C -1 ; WX 627 ; N Ncommaaccent ; B 41 -268 595 700 ;
C -1 ; WX 632 ; N ncommaaccent ; B 32 -268 612 491 ;
C -1 ; WX 627 ; N Ncaron ; B 41 -15 595 900 ;
C -1 ; WX 632 ; N ncaron ; B 32 -23 612 712 ;
C -1 ; WX 815 ; N napostrophe ; B 34 -23 795 704 ;
C -1 ; WX 627 ; N Eng ; B 41 -320 595 700 ;
C -1 ; WX 605 ; N eng ; B 32 -322 534 491 ;
C -1 ; WX 616 ; N Omacron ; B 42 -30 574 815 ;
C -1 ; WX 583 ; N omacron ; B 40 -34 543 598 ;
C -1 ; WX 616 ; N Obreve ; B 42 -30 574 891 ;
C -1 ; WX 583 ; N obreve ; B 40 -34 543 675 ;
C -1 ; WX 616 ; N Ohungarumlaut ; B 42 -30 574 907 ;
C -1 ; WX 583 ; N ohungarumlaut ; B 40 -34 545 693 ;
C -1 ; WX 1018 ; N OE ; B 42 -30 967 702 ;
C -1 ; WX 958 ; N oe ; B 40 -34 916 499 ;
C -1 ; WX 636 ; N Racute ; B 14 -9 624 910 ;
C -1 ; WX 579 ; N racute ; B 28 -16 566 693 ;
C -1 ; WX 636 ; N Rcommaaccent ; B 14 -268 624 706 ;
C -1 ; WX 579 ; N rcommaaccent ; B 28 -272 566 495 ;
C -1 ; WX 636 ; N Rcaron ; B 14 -9 624 927 ;
C -1 ; WX 579 ; N rcaron ; B 28 -16 566 698 ;
C -1 ; WX 588 ; N Sacute ; B 51 -13 547 900 ;
C -1 ; WX 519 ; N sacute ; B 48 -31 481 713 ;
C -1 ; WX 588 ; N Scircumflex ; B 51 -13 547 904 ;
C -1 ; WX 519 ; N scircumflex ; B 48 -31 481 710 ;
C -1 ; WX 588 ; N Scedilla ; B 51 -145 547 690 ;
C -1 ; WX 519 ; N scedilla ; B 48 -145 481 496 ;
C -1 ; WX 588 ; N Scaron ; B 51 -13 547 904 ;
C -1 ; WX 519 ; N scaron ; B 48 -31 481 710 ;
C -1 ; WX 594 ; N Tcommaaccent ; B 25 -263 564 707 ;
C -1 ; WX 510 ; N tcommaaccent ; B 0 -282 488 694 ;
C -1 ; WX 594 ; N Tcaron ; B 25 1 564 920 ;
C -1 ; WX 713 ; N tcaron ; B 0 -34 680 704 ;
C -1 ; WX 594 ; N Tbar ; B 25 1 564 707 ;
C -1 ; WX 510 ; N tbar ; B 0 -34 488 694 ;
C -1 ; WX 621 ; N Utilde ; B 24 -6 611 850 ;
C -1 ; WX 638 ; N utilde ; B 5 -28 624 636 ;
C -1 ; WX 621 ; N Umacron ; B 24 -6 611 811 ;
C -1 ; WX 638 ; N umacron ; B 5 -28 624 587 ;
C -1 ; WX 621 ; N Ubreve ; B 24 -6 611 888 ;
C -1 ; WX 638 ; N ubreve ; B 5 -28 624 665 ;
C -1 ; WX 621 ; N Uring ; B 24 -6 611 959 ;
C -1 ; WX 638 ; N uring ; B 5 -28 624 738 ;
C -1 ; WX 621 ; N Uhungarumlaut ; B 24 -6 611 918 ;
C -1 ; WX 638 ; N uhungarumlaut ; B 5 -28 624 691 ;
C -1 ; WX 621 ; N Uogonek ; B 24 -136 611 710 ;
C -1 ; WX 638 ; N uogonek ; B 5 -147 671 487 ;
C -1 ; WX 643 ; N Wcircumflex ; B 8 0 614 901 ;
C -1 ; WX 678 ; N wcircumflex ; B 5 -10 674 685 ;
C -1 ; WX 561 ; N Ycircumflex ; B -21 -2 562 934 ;
C -1 ; WX 592 ; N ycircumflex ; B 0 -232 596 691 ;
C -1 ; WX 561 ; N Ydieresis ; B -21 -2 562 885 ;
C -1 ; WX 592 ; N Zacute ; B 49 -1 551 905 ;
C -1 ; WX 528 ; N zacute ; B 45 -22 487 684 ;
C -1 ; WX 592 ; N Zdotaccent ; B 49 -1 551 866 ;
C -1 ; WX 528 ; N zdotaccent ; B 45 -22 487 632 ;
C -1 ; WX 592 ; N Zcaron ; B 49 -1 551 917 ;
C -1 ; WX 528 ; N zcaron ; B 45 -22 487 688 ;
C -1 ; WX 915 ; N AEacute ; B -11 -16 864 904 ;
C -1 ; WX 888 ; N aeacute ; B 38 -23 846 670 ;
C -1 ; WX 617 ; N Oslashacute ; B 43 -41 574 912 ;
C -1 ; WX 583 ; N oslashacute ; B 40 -73 543 697 ;
C -1 ; WX 415 ; N dotlessj ; B -12 -236 344 478 ;
C -1 ; WX 281 ; N circumflex ; B 0 558 282 746 ;
C -1 ; WX 281 ; N caron ; B 0 558 282 746 ;
C -1 ; WX 281 ; N breve ; B 0 585 282 746 ;
C -1 ; WX 132 ; N dotaccent ; B 0 600 133 729 ;
C -1 ; WX 214 ; N ring ; B 0 547 215 780 ;
C -1 ; WX 211 ; N ogonek ; B 0 -145 212 13 ;
C -1 ; WX 283 ; N tilde ; B 0 583 284 701 ;
C -1 ; WX 352 ; N hungarumlaut ; B 0 591 353 763 ;
C -1 ; WX 185 ; N uni0312 ; B 28 474 152 694 ;
C -1 ; WX 185 ; N uni0315 ; B 38 470 162 690 ;
C -1 ; WX 192 ; N uni0326 ; B 32 -253 156 -33 ;
C -1 ; WX 666 ; N mu ; B 24 -219 643 487 ;
C -1 ; WX 643 ; N Wgrave ; B 8 0 614 895 ;
C -1 ; WX 678 ; N wgrave ; B 5 -10 674 688 ;
C -1 ; WX 643 ; N Wacute ; B 8 0 614 898 ;
C -1 ; WX 678 ; N wacute ; B 5 -10 674 682 ;
C -1 ; WX 643 ; N Wdieresis ; B 8 0 614 868 ;
C -1 ; WX 678 ; N wdieresis ; B 5 -10 674 649 ;
C -1 ; WX 561 ; N Ygrave ; B -21 -2 562 900 ;
C -1 ; WX 592 ; N ygrave ; B 0 -232 596 666 ;
C -1 ; WX 611 ; N endash ; B 50 270 551 391 ;
C -1 ; WX 1113 ; N emdash ; B 51 270 1052 391 ;
C -1 ; WX 265 ; N quoteleft ; B 41 390 217 704 ;
C -1 ; WX 264 ; N quoteright ; B 54 390 230 704 ;
C -1 ; WX 274 ; N quotesinglbase ; B 46 -138 223 176 ;
C -1 ; WX 470 ; N quotedblleft ; B 41 390 422 704 ;
C -1 ; WX 469 ; N quotedblright ; B 54 390 436 704 ;
C -1 ; WX 479 ; N quotedblbase ; B 46 -138 428 176 ;
C -1 ; WX 389 ; N dagger ; B 30 -16 359 724 ;
C -1 ; WX 396 ; N daggerdbl ; B 35 -16 364 728 ;
C -1 ; WX 316 ; N bullet ; B 50 246 266 479 ;
C -1 ; WX 1063 ; N ellipsis ; B 52 -3 1016 245 ;
C -1 ; WX 897 ; N perthousand ; B 33 -230 873 828 ;
C -1 ; WX 296 ; N guilsinglleft ; B 44 149 232 434 ;
C -1 ; WX 295 ; N guilsinglright ; B 63 149 251 434 ;
C -1 ; WX 486 ; N fraction ; B -11 -53 501 748 ;
C -1 ; WX 732 ; N Euro ; B 31 71 683 590 ;
C -1 ; WX 757 ; N trademark ; B 60 303 703 693 ;
C -1 ; WX 585 ; N partialdiff ; B 36 -47 553 772 ;
C -1 ; WX 564 ; N product ; B 26 -17 534 707 ;
C -1 ; WX 577 ; N minus ; B 63 282 514 395 ;
C -1 ; WX 565 ; N approxequal ; B 59 137 513 522 ;
@doc:Description{value:"By default Ballerina assumes that the service is to be exposed via HTTP/1.1 using the system default port and that all requests coming to the HTTP server will be delivered to this service."}
service<http>helloWorld{
@doc:Description{value:"All resources are invoked with an argument of type message, the built-in reference type representing a network invocation."}
resourcesayHello(messagem){
// Creates an empty message.
messageresponse={};
// A util method that can be used to set string payload.
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.