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.
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.
* 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.
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. The majority of contributions won't need to touch any Ruby code at all.
## 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:
0. Add your extension to the language entry in [`languages.yml`][languages].
0. Add at least one sample for your extension to the [samples directory][samples] in the correct subdirectory.
0. 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.
In addition, if this extension is already listed in [`languages.yml`][languages] then sometimes a few more steps will need to be taken:
0. Make sure that example `.yourextension` files are present in the [samples directory][samples] for each language that uses `.yourextension`.
0. Test the performance of the Bayesian classifier with a relatively large number (1000s) of sample `.yourextension` files. (ping @arfon or @bkeepers to help with this) to ensure we're not misclassifying files.
0. 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:
0. Add an entry for your language to [`languages.yml`][languages].
0. Add a grammar for your language. Please only add grammars that have a license that permits redistribution.
0. Add your grammar as a submodule: `git submodule add https://github.com/JaneSmith/MyGrammar vendor/grammars/MyGrammar`.
0. Add your grammar to [`grammars.yml`][grammars] by running `script/convert-grammars --add vendor/grammars/MyGrammar`.
0. Add samples for your language to the [samples directory][samples] in the correct subdirectory.
0. 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.
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:
0. Make sure that example `.foo` files are present in the [samples directory][samples] for each language that uses `.foo`.
0. Test the performance of the Bayesian classifier with a relatively large number (1000s) of sample `.foo` files. (ping @arfon or @bkeepers to help with this) to ensure we're not misclassifying files.
0. 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 TM `scope`. This scope will be used when picking up a grammar for highlighting.
Assuming your code is being detected as the right language, in most cases this is due to a bug in the language grammar rather than a bug in Linguist. [`grammars.yml`][grammars] lists all the grammars we use for syntax highlighting on github.com. Find the one corresponding to your code's programming language and submit a bug report upstream. If you can, try to reproduce the highlighting problem in the text editor that the grammar is designed for (TextMate, Sublime Text, or Atom) and include that information in your bug report.
You can also try to fix the bug yourself and submit a Pull Request. [TextMate's documentation](http://manual.macromates.com/en/language_grammars) offers a good introduction on how to work with TextMate-compatible grammars. You can test grammars using [Lightshow](https://github-lightshow.herokuapp.com).
Once the bug has been fixed upstream, we'll pick it up for GitHub in the next release of Linguist.
## Testing
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.
git clone https://github.com/github/linguist.git
cd linguist/
script/bootstrap
To run the tests:
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](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: [](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: `script/bootstrap`
0. If grammar submodules have not been updated recently, update them: `git submodule update --remote && git commit -a`
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`, [like this](https://github.com/github/linguist/commit/8d2ea90a5ba3b2fe6e1508b7155aa4632eea2985).
0. Make a PR to github/linguist, [like this](https://github.com/github/linguist/pull/1238).
0. Build a local gem: `bundle exec rake build_gem`
0. Test the gem:
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`
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.
### Language detection
See [Troubleshooting](#troubleshooting) and [`CONTRIBUTING.md`](/CONTRIBUTING.md) before filing an issue or creating a pull request.
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.
## Troubleshooting
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
0. Click on the name of the language in the stats bar to see a list of the files that are identified as that language.
0. If you see files that you didn't write, consider moving the files into one of the [paths for vendored code](https://github.com/github/linguist/blob/master/lib/linguist/vendor.yml), or use the [manual overrides](#overrides) feature to ignore them.
0. If the files are being misclassified, search for [open issues][issues] to see if anyone else has already reported the issue. Any information you an add, especially links to public repositories, is helpful.
0. 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.
## Overrides
Linguist supports a number of different custom overrides strategies for language definitions and vendored paths.
### Using gitattributes
Add a `.gitattributes` file to your project and use standard git-style path matchers for the files you want to override to set `linguist-documentation`, `linguist-language`, and `linguist-vendored`. `.gitattributes` will be used to determine language statistics, but will not be used to syntax highlight files. To manually set syntax highlighting, use [Vim or Emacs modelines](#using-emacs-or-vim-modelines).
```
$ cat .gitattributes
*.rb linguist-language=Java
```
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).
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 [lib/linguist/vendor.yml](https://github.com/github/linguist/blob/master/lib/linguist/vendor.yml) as vendored and therefore doesn't include them in the language statistics for a repository. Vendored files are also hidden by default in diffs on github.com.
### Syntax Highlighting
Use the `linguist-vendored` attribute to vendor or un-vendor paths. Please note, overriding the vendored (or un-vendored) status of a file only affects the language statistics for the repository and not the behavior in diffs on github.com.
The actual syntax highlighting is 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.
### Stats
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
Similar to vendored files, Linguist excludes documentation files from your project's language stats. (Unlike vendored files, documentation files are displayed in diffs on github.com.) [lib/linguist/documentation.yml](lib/linguist/documentation.yml) lists common documentation paths and excludes them from the language statistics for your repository.
Use the `linguist-documentation` attribute to mark or unmark paths as documentation.
```
$ cat .gitattributes
project-docs/* linguist-documentation
docs/formatter.rb linguist-documentation=false
```
### Using Emacs or Vim modelines
Alternatively, 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
These stats are also printed out by the `linguist` executable. 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:
You can try running `linguist` on the root directory in this repository itself:
$ bundle exec linguist lib/ --breakdown
100.00% Ruby
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
#### Ignore vendored files
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.
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).
100.00% Ruby
#### Generated file detection
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.
See [Linguist::Generated#generated?](https://github.com/github/linguist/blob/master/lib/linguist/generated.rb).
## Installation
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).
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.
git clone https://github.com/github/linguist.git
cd linguist/
bundle install
To run the tests:
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.
To update the `samples.json` after adding new files to [`samples/`](https://github.com/github/linguist/tree/master/samples):
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`
// 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)
GLKMatrix4SetColumn expects that the vector for column 3 will contain the translation values tx, ty, and tz as its first three components, respectively.
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.