mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Compare commits
	
		
			136 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					7bbb3da010 | ||
| 
						 | 
					76a85b7637 | ||
| 
						 | 
					80f72a5093 | ||
| 
						 | 
					df552c241e | ||
| 
						 | 
					9e020dd15d | ||
| 
						 | 
					c7c0c30ecf | ||
| 
						 | 
					60deead669 | ||
| 
						 | 
					6d843eca60 | ||
| 
						 | 
					12c22d0311 | ||
| 
						 | 
					d28f5e87c0 | ||
| 
						 | 
					471fabfff5 | ||
| 
						 | 
					2e1a6d9d43 | ||
| 
						 | 
					d2d22e849e | ||
| 
						 | 
					6c41bfa44d | ||
| 
						 | 
					d54bcc85e7 | ||
| 
						 | 
					6d94ddb114 | ||
| 
						 | 
					7fd720bf39 | ||
| 
						 | 
					e10558e444 | ||
| 
						 | 
					7c48d5ee1f | ||
| 
						 | 
					10ffd870e2 | ||
| 
						 | 
					3a4ab156b0 | ||
| 
						 | 
					651d863069 | ||
| 
						 | 
					a3c595a4a9 | ||
| 
						 | 
					7660714a9e | ||
| 
						 | 
					71002dfb65 | ||
| 
						 | 
					013cfdcdaf | ||
| 
						 | 
					5ad6add91e | ||
| 
						 | 
					2f5b49f4ae | ||
| 
						 | 
					353479fe72 | ||
| 
						 | 
					6f5c935837 | ||
| 
						 | 
					1bf91d4281 | ||
| 
						 | 
					8d2dd55c94 | ||
| 
						 | 
					6a86e8ea97 | ||
| 
						 | 
					a817d95d6c | ||
| 
						 | 
					22b8d462c2 | ||
| 
						 | 
					066052ddd2 | ||
| 
						 | 
					d673010420 | ||
| 
						 | 
					fffd1b986d | ||
| 
						 | 
					64471be009 | ||
| 
						 | 
					d43ffe09b3 | ||
| 
						 | 
					e0c1107a25 | ||
| 
						 | 
					3475aefd04 | ||
| 
						 | 
					4e4a18c71a | ||
| 
						 | 
					9a2f2c1fb2 | ||
| 
						 | 
					b2ee2cc7b8 | ||
| 
						 | 
					ee0b4f96a8 | ||
| 
						 | 
					665f9ee5b5 | ||
| 
						 | 
					4eb8903bed | ||
| 
						 | 
					d11b2f05bb | ||
| 
						 | 
					11f7e6e1b4 | ||
| 
						 | 
					72acbc567b | ||
| 
						 | 
					1170ac6105 | ||
| 
						 | 
					bdc724d548 | ||
| 
						 | 
					74cd03de0b | ||
| 
						 | 
					0ba6a7adf0 | ||
| 
						 | 
					0019abe5e7 | ||
| 
						 | 
					30d2883436 | ||
| 
						 | 
					cc5881dca2 | ||
| 
						 | 
					d17f5dfd9e | ||
| 
						 | 
					4c037c644f | ||
| 
						 | 
					a08f0da30d | ||
| 
						 | 
					654cfd7a47 | ||
| 
						 | 
					88e79cd3a8 | ||
| 
						 | 
					4543c7a0b3 | ||
| 
						 | 
					f5bc9735af | ||
| 
						 | 
					107a27aa25 | ||
| 
						 | 
					5c29ce0695 | ||
| 
						 | 
					462a570d3c | ||
| 
						 | 
					7f1af4215a | ||
| 
						 | 
					7a141a923c | ||
| 
						 | 
					0db1d1c8ca | ||
| 
						 | 
					201b0ba53c | ||
| 
						 | 
					6d770ab68f | ||
| 
						 | 
					6ca149de1d | ||
| 
						 | 
					2e76ce740e | ||
| 
						 | 
					a664b9dd0c | ||
| 
						 | 
					d49701f470 | ||
| 
						 | 
					67fae52b32 | ||
| 
						 | 
					bb9f6ff082 | ||
| 
						 | 
					ad7fc977df | ||
| 
						 | 
					0479a89982 | ||
| 
						 | 
					d7b9791514 | ||
| 
						 | 
					832d379ace | ||
| 
						 | 
					b8f3078966 | ||
| 
						 | 
					d496aaae55 | ||
| 
						 | 
					87e60cfd78 | ||
| 
						 | 
					2077fa3837 | ||
| 
						 | 
					eaa03e15ed | ||
| 
						 | 
					95bedf0bfc | ||
| 
						 | 
					3a1b17f1f9 | ||
| 
						 | 
					9fe9bf617f | ||
| 
						 | 
					3c34da8bd3 | ||
| 
						 | 
					9fa7adaa61 | ||
| 
						 | 
					54a2f5347a | ||
| 
						 | 
					a716d3ad49 | ||
| 
						 | 
					8f70604466 | ||
| 
						 | 
					2044e191a2 | ||
| 
						 | 
					8fe9ec0521 | ||
| 
						 | 
					034e510ba5 | ||
| 
						 | 
					bdec1ac64d | ||
| 
						 | 
					36a0d760e9 | ||
| 
						 | 
					a901e85c3c | ||
| 
						 | 
					6e9dc2339d | ||
| 
						 | 
					3864e712ef | ||
| 
						 | 
					8376f1e4a4 | ||
| 
						 | 
					1b0fd752d3 | ||
| 
						 | 
					bef473a48b | ||
| 
						 | 
					0c60078d27 | ||
| 
						 | 
					2f65462ce0 | ||
| 
						 | 
					ace6156c65 | ||
| 
						 | 
					ada8feba34 | ||
| 
						 | 
					75d685a7f4 | ||
| 
						 | 
					6b7f20323b | ||
| 
						 | 
					c2ab5bc09d | ||
| 
						 | 
					95d5b8bdbc | ||
| 
						 | 
					da7b3182e8 | ||
| 
						 | 
					08790f2f0a | ||
| 
						 | 
					896270e617 | ||
| 
						 | 
					fb40ee986f | ||
| 
						 | 
					20b82e4bc9 | ||
| 
						 | 
					513347911e | ||
| 
						 | 
					1a3960e95d | ||
| 
						 | 
					7d9a47b7c3 | ||
| 
						 | 
					c80d085e33 | ||
| 
						 | 
					98518e5c8c | ||
| 
						 | 
					ef9e1c4e4f | ||
| 
						 | 
					cf483c28e3 | ||
| 
						 | 
					3886c406ab | ||
| 
						 | 
					b56671c20d | ||
| 
						 | 
					f3cbad065f | ||
| 
						 | 
					4b3b1a80f6 | ||
| 
						 | 
					a5b915d571 | ||
| 
						 | 
					2c5e8c4308 | ||
| 
						 | 
					506b75c5e8 | ||
| 
						 | 
					af4b64070f | ||
| 
						 | 
					29d8e58d69 | 
							
								
								
									
										80
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										80
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							@@ -249,7 +249,7 @@
 | 
			
		||||
	url = https://github.com/shellderp/sublime-robot-plugin
 | 
			
		||||
[submodule "vendor/grammars/actionscript3-tmbundle"]
 | 
			
		||||
	path = vendor/grammars/actionscript3-tmbundle
 | 
			
		||||
	url = https://github.com/simongregory/actionscript3-tmbundle
 | 
			
		||||
	url = https://github.com/honzabrecka/actionscript3-tmbundle
 | 
			
		||||
[submodule "vendor/grammars/Sublime-QML"]
 | 
			
		||||
	path = vendor/grammars/Sublime-QML
 | 
			
		||||
	url = https://github.com/skozlovf/Sublime-QML
 | 
			
		||||
@@ -528,9 +528,6 @@
 | 
			
		||||
[submodule "vendor/grammars/sublime-bsv"]
 | 
			
		||||
	path = vendor/grammars/sublime-bsv
 | 
			
		||||
	url = https://github.com/thotypous/sublime-bsv
 | 
			
		||||
[submodule "vendor/grammars/AutoHotkey"]
 | 
			
		||||
	path = vendor/grammars/AutoHotkey
 | 
			
		||||
	url = https://github.com/robertcollier4/AutoHotkey
 | 
			
		||||
[submodule "vendor/grammars/Sublime-HTTP"]
 | 
			
		||||
	path = vendor/grammars/Sublime-HTTP
 | 
			
		||||
	url = https://github.com/httpspec/sublime-highlighting
 | 
			
		||||
@@ -555,3 +552,78 @@
 | 
			
		||||
[submodule "vendor/grammars/liquid.tmbundle"]
 | 
			
		||||
	path = vendor/grammars/liquid.tmbundle
 | 
			
		||||
	url = https://github.com/bastilian/validcode-textmate-bundles
 | 
			
		||||
[submodule "vendor/grammars/ats.sublime"]
 | 
			
		||||
	path = vendor/grammars/ats.sublime
 | 
			
		||||
	url = https://github.com/steinwaywhw/ats-mode-sublimetext
 | 
			
		||||
[submodule "vendor/grammars/Modelica"]
 | 
			
		||||
	path = vendor/grammars/Modelica
 | 
			
		||||
	url = https://github.com/BorisChumichev/modelicaSublimeTextPackage
 | 
			
		||||
[submodule "vendor/grammars/sublime-apl"]
 | 
			
		||||
	path = vendor/grammars/sublime-apl
 | 
			
		||||
	url = https://github.com/StoneCypher/sublime-apl
 | 
			
		||||
[submodule "vendor/grammars/CLIPS-sublime"]
 | 
			
		||||
	path = vendor/grammars/CLIPS-sublime
 | 
			
		||||
	url = https://github.com/psicomante/CLIPS-sublime
 | 
			
		||||
[submodule "vendor/grammars/Creole"]
 | 
			
		||||
	path = vendor/grammars/Creole
 | 
			
		||||
	url = https://github.com/Siddley/Creole
 | 
			
		||||
[submodule "vendor/grammars/GDScript-sublime"]
 | 
			
		||||
	path = vendor/grammars/GDScript-sublime
 | 
			
		||||
	url = https://github.com/beefsack/GDScript-sublime
 | 
			
		||||
[submodule "vendor/grammars/sublime-golo"]
 | 
			
		||||
	path = vendor/grammars/sublime-golo
 | 
			
		||||
	url = https://github.com/TypeUnsafe/sublime-golo
 | 
			
		||||
[submodule "vendor/grammars/JSyntax"]
 | 
			
		||||
	path = vendor/grammars/JSyntax
 | 
			
		||||
	url = https://github.com/bcj/JSyntax
 | 
			
		||||
[submodule "vendor/grammars/TXL"]
 | 
			
		||||
	path = vendor/grammars/TXL
 | 
			
		||||
	url = https://github.com/MikeHoffert/Sublime-Text-TXL-syntax
 | 
			
		||||
[submodule "vendor/grammars/G-Code"]
 | 
			
		||||
	path = vendor/grammars/G-Code
 | 
			
		||||
	url = https://github.com/robotmaster/sublime-text-syntax-highlighting
 | 
			
		||||
[submodule "vendor/grammars/grace-tmbundle"]
 | 
			
		||||
	path = vendor/grammars/grace-tmbundle
 | 
			
		||||
	url = https://github.com/zmthy/grace-tmbundle
 | 
			
		||||
[submodule "vendor/grammars/sublime-text-ox"]
 | 
			
		||||
	path = vendor/grammars/sublime-text-ox
 | 
			
		||||
	url = https://github.com/andreashetland/sublime-text-ox
 | 
			
		||||
[submodule "vendor/grammars/AutoHotkey"]
 | 
			
		||||
	path = vendor/grammars/AutoHotkey
 | 
			
		||||
	url = https://github.com/ahkscript/SublimeAutoHotkey
 | 
			
		||||
[submodule "vendor/grammars/ec.tmbundle"]
 | 
			
		||||
	path = vendor/grammars/ec.tmbundle
 | 
			
		||||
	url = https://github.com/ecere/ec.tmbundle
 | 
			
		||||
[submodule "vendor/grammars/InnoSetup"]
 | 
			
		||||
	path = vendor/grammars/InnoSetup
 | 
			
		||||
	url = https://github.com/idleberg/InnoSetup-Sublime-Text
 | 
			
		||||
[submodule "vendor/grammars/gap-tmbundle"]
 | 
			
		||||
	path = vendor/grammars/gap-tmbundle
 | 
			
		||||
	url = https://github.com/dhowden/gap-tmbundle
 | 
			
		||||
[submodule "vendor/grammars/SublimePapyrus"]
 | 
			
		||||
	path = vendor/grammars/SublimePapyrus
 | 
			
		||||
	url = https://github.com/Kapiainen/SublimePapyrus
 | 
			
		||||
[submodule "vendor/grammars/sublime-spintools"]
 | 
			
		||||
	path = vendor/grammars/sublime-spintools
 | 
			
		||||
	url = https://github.com/bitbased/sublime-spintools
 | 
			
		||||
[submodule "vendor/grammars/PogoScript.tmbundle"]
 | 
			
		||||
	path = vendor/grammars/PogoScript.tmbundle
 | 
			
		||||
	url = https://github.com/featurist/PogoScript.tmbundle
 | 
			
		||||
[submodule "vendor/grammars/sublime-opal"]
 | 
			
		||||
	path = vendor/grammars/sublime-opal
 | 
			
		||||
	url = https://github.com/artifactz/sublime-opal
 | 
			
		||||
[submodule "vendor/grammars/mediawiki.tmbundle"]
 | 
			
		||||
	path = vendor/grammars/mediawiki.tmbundle
 | 
			
		||||
	url = https://github.com/textmate/mediawiki.tmbundle
 | 
			
		||||
[submodule "vendor/grammars/BrightScript.tmbundle"]
 | 
			
		||||
	path = vendor/grammars/BrightScript.tmbundle
 | 
			
		||||
	url = https://github.com/cmink/BrightScript.tmbundle
 | 
			
		||||
[submodule "vendor/grammars/Stylus"]
 | 
			
		||||
	path = vendor/grammars/Stylus
 | 
			
		||||
	url = https://github.com/billymoon/Stylus
 | 
			
		||||
[submodule "vendor/grammars/asciidoc.tmbundle"]
 | 
			
		||||
	path = vendor/grammars/asciidoc.tmbundle
 | 
			
		||||
	url = https://github.com/zuckschwerdt/asciidoc.tmbundle
 | 
			
		||||
[submodule "vendor/grammars/sublime-text-pig-latin"]
 | 
			
		||||
	path = vendor/grammars/sublime-text-pig-latin
 | 
			
		||||
	url = https://github.com/goblindegook/sublime-text-pig-latin
 | 
			
		||||
 
 | 
			
		||||
@@ -1,41 +1,81 @@
 | 
			
		||||
## Contributing
 | 
			
		||||
# Contributing
 | 
			
		||||
 | 
			
		||||
The majority of contributions won't need to touch any Ruby code at all. The [master language list][languages] is just a YAML configuration file.
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
Almost all bug fixes or new language additions should come with some additional code samples. Just drop them under [`samples/`][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.
 | 
			
		||||
## Adding a language
 | 
			
		||||
 | 
			
		||||
### My code is detected as the wrong language
 | 
			
		||||
We try only to add languages once they have some usage on GitHub. In most cases we prefer that languages be in use in hundreds of repositories before supporting them in Linguist.
 | 
			
		||||
 | 
			
		||||
This can usually be solved either by adding a new filename or file name extension to the language's entry in [`languages.yml`][languages] or adding more [samples][samples] for your language to the repository to make Linguist's classifier smarter.
 | 
			
		||||
 | 
			
		||||
### Syntax highlighting looks wrong
 | 
			
		||||
 | 
			
		||||
Assuming your code is being detected as the right language (see above), in most cases this is due to a bug in the language grammar rather than a bug in Linguist. [`grammars.yml`][grammars] lists all the grammars we use for syntax highlighting on github.com. Find the one corresponding to your code's programming language and submit a bug report upstream. If you can, try to reproduce the highlighting problem in the text editor that the grammar is designed for (TextMate, Sublime Text, or Atom) and include that information in your bug report.
 | 
			
		||||
 | 
			
		||||
You can also try to fix the bug yourself and submit a Pull Request. [This piece from TextMate's documentation](http://manual.macromates.com/en/language_grammars) offers a good introduction on how to work with TextMate-compatible grammars. You can test grammars using [Lightshow](https://lightshow.githubapp.com).
 | 
			
		||||
 | 
			
		||||
Once the bug has been fixed upstream, please let us know and we'll pick it up for GitHub.
 | 
			
		||||
 | 
			
		||||
### I want to add support for the `X` programming language
 | 
			
		||||
 | 
			
		||||
Great! You'll need to:
 | 
			
		||||
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].
 | 
			
		||||
  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. 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!
 | 
			
		||||
 | 
			
		||||
We try only to add languages once they have some usage on GitHub, so please note in-the-wild usage examples in your pull request. In most cases we prefer that languages already be in use in hundreds of repositories before supporting them in Linguist.
 | 
			
		||||
## 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, please let us know and we'll pick it up for GitHub.
 | 
			
		||||
 | 
			
		||||
## 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`
 | 
			
		||||
 | 
			
		||||
[grammars]: /grammars.yml
 | 
			
		||||
[languages]: /lib/linguist/languages.yml
 | 
			
		||||
[samples]: /samples
 | 
			
		||||
[new-issue]: https://github.com/github/linguist/issues/new
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										225
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										225
									
								
								README.md
									
									
									
									
									
								
							@@ -1,45 +1,80 @@
 | 
			
		||||
# Linguist
 | 
			
		||||
 | 
			
		||||
We use this library at GitHub to detect blob languages, ignore binary files, suppress generated files in diffs, and generate language breakdown graphs.
 | 
			
		||||
[issues]: https://github.com/github/linguist/issues
 | 
			
		||||
[new-issue]: https://github.com/github/linguist/issues/new
 | 
			
		||||
 | 
			
		||||
Tips for filing issues and creating pull requests can be found in [`CONTRIBUTING.md`](/CONTRIBUTING.md).
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
## Features
 | 
			
		||||
See [Troubleshooting](#troubleshooting) and [`CONTRIBUTING.md`](/CONTRIBUTING.md) before filing an issue or creating a pull request.
 | 
			
		||||
 | 
			
		||||
### Language detection
 | 
			
		||||
## Troubleshooting
 | 
			
		||||
 | 
			
		||||
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).
 | 
			
		||||
### My repository is detected as the wrong language
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
[statistical
 | 
			
		||||
classifier](https://github.com/github/linguist/blob/master/lib/linguist/classifier.rb).
 | 
			
		||||
This process can help us tell the difference between, for example, `.h` files which could be either C, C++, or Obj-C.
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
```ruby
 | 
			
		||||
The Language stats bar is built by aggregating the languages of each file in that repository. If it is reporting a language that you don't expect:
 | 
			
		||||
 | 
			
		||||
Linguist::FileBlob.new("lib/linguist.rb").language.name #=> "Ruby"
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
Linguist::FileBlob.new("bin/linguist").language.name #=> "Ruby"
 | 
			
		||||
## 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`.
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
$ 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.
 | 
			
		||||
 | 
			
		||||
Syntax highlighting in GitHub is performed using TextMate-compatible grammars. These are the same grammars that TextMate, Sublime Text and Atom use.
 | 
			
		||||
```
 | 
			
		||||
$ cat .gitattributes
 | 
			
		||||
special-vendored-path/* linguist-vendored
 | 
			
		||||
jquery.js linguist-vendored=false
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Every language in `languages.yml` is mapped to its corresponding TM `scope`. This scope will be used when picking up a grammar for highlighting. **When adding a new language to Linguist, please add its corresponding scope too (assuming there's an existing TextMate bundle, Sublime Text package, or Atom package) so syntax highlighting works for it**.
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
### Stats
 | 
			
		||||
Use the `linguist-documentation` attribute to mark or unmark paths as documentation.
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
```
 | 
			
		||||
$ cat .gitattributes
 | 
			
		||||
project-docs/* linguist-documentation
 | 
			
		||||
docs/formatter.rb linguist-documentation=false
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The repository stats API, accessed through `#languages`, can be used on a directory:
 | 
			
		||||
### Using Emacs and Vim modelines
 | 
			
		||||
 | 
			
		||||
***API UPDATE***
 | 
			
		||||
Alternatively, you can use Vim and 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
 | 
			
		||||
 | 
			
		||||
Since [Version 3.0.0](https://github.com/github/linguist/releases/tag/v3.0.0) Linguist expects a git repository (in the form of a [Rugged::Repository](https://github.com/libgit2/rugged#repositories)) to be passed when initializing `Linguist::Repository`.
 | 
			
		||||
```
 | 
			
		||||
Vim
 | 
			
		||||
vim: set filetype=prolog:
 | 
			
		||||
vim: set ft=cpp:
 | 
			
		||||
 | 
			
		||||
Emacs
 | 
			
		||||
-*- mode: php;-*-
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
 | 
			
		||||
Install the gem:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
$ gem install github-linguist
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Then use it in your application:
 | 
			
		||||
 | 
			
		||||
```ruby
 | 
			
		||||
require 'rugged'
 | 
			
		||||
@@ -51,147 +86,27 @@ project.language       #=> "Ruby"
 | 
			
		||||
project.languages      #=> { "Ruby" => 119387 }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
These stats are also printed out by the `linguist` binary. You can use the
 | 
			
		||||
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 root directory in this repository itself:
 | 
			
		||||
 | 
			
		||||
    $ bundle exec linguist --breakdown
 | 
			
		||||
```
 | 
			
		||||
$ bundle exec linguist --breakdown
 | 
			
		||||
 | 
			
		||||
    100.00% Ruby
 | 
			
		||||
100.00% Ruby
 | 
			
		||||
 | 
			
		||||
    Ruby:
 | 
			
		||||
    Gemfile
 | 
			
		||||
    Rakefile
 | 
			
		||||
    bin/linguist
 | 
			
		||||
    github-linguist.gemspec
 | 
			
		||||
    lib/linguist.rb
 | 
			
		||||
    lib/linguist/blob_helper.rb
 | 
			
		||||
    lib/linguist/classifier.rb
 | 
			
		||||
    lib/linguist/file_blob.rb
 | 
			
		||||
    lib/linguist/generated.rb
 | 
			
		||||
    lib/linguist/heuristics.rb
 | 
			
		||||
    lib/linguist/language.rb
 | 
			
		||||
    lib/linguist/lazy_blob.rb
 | 
			
		||||
    lib/linguist/md5.rb
 | 
			
		||||
    lib/linguist/repository.rb
 | 
			
		||||
    lib/linguist/samples.rb
 | 
			
		||||
    lib/linguist/tokenizer.rb
 | 
			
		||||
    lib/linguist/version.rb
 | 
			
		||||
    test/test_blob.rb
 | 
			
		||||
    test/test_classifier.rb
 | 
			
		||||
    test/test_heuristics.rb
 | 
			
		||||
    test/test_language.rb
 | 
			
		||||
    test/test_md5.rb
 | 
			
		||||
    test/test_pedantic.rb
 | 
			
		||||
    test/test_repository.rb
 | 
			
		||||
    test/test_samples.rb
 | 
			
		||||
    test/test_tokenizer.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.
 | 
			
		||||
 | 
			
		||||
```ruby
 | 
			
		||||
Linguist::FileBlob.new("vendor/plugins/foo.rb").vendored? # => true
 | 
			
		||||
Ruby:
 | 
			
		||||
Gemfile
 | 
			
		||||
Rakefile
 | 
			
		||||
bin/linguist
 | 
			
		||||
github-linguist.gemspec
 | 
			
		||||
lib/linguist.rb
 | 
			
		||||
…
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
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).
 | 
			
		||||
## Contributing
 | 
			
		||||
 | 
			
		||||
#### Generated file detection
 | 
			
		||||
Please check out our [contributing guidelines](CONTRIBUTING.md).
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
```ruby
 | 
			
		||||
Linguist::FileBlob.new("underscore.min.js").generated? # => true
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
See [Linguist::Generated#generated?](https://github.com/github/linguist/blob/master/lib/linguist/generated.rb).
 | 
			
		||||
 | 
			
		||||
## Overrides
 | 
			
		||||
 | 
			
		||||
Linguist supports custom overrides for language definitions and vendored paths. Add a `.gitattributes` file to your project using the keys `linguist-language` and `linguist-vendored` with the standard git-style path matchers for the files you want to override.
 | 
			
		||||
 | 
			
		||||
Please note that the overrides currently only affect the language statistics for a repository and not the syntax-highlighting of files.
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
$ cat .gitattributes
 | 
			
		||||
*.rb linguist-language=Java
 | 
			
		||||
 | 
			
		||||
$ linguist --breakdown
 | 
			
		||||
100.00% Java
 | 
			
		||||
 | 
			
		||||
Java:
 | 
			
		||||
ruby_file.rb
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
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. Use the `linguist-vendored` attribute to vendor or un-vendor paths.
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
$ cat .gitattributes
 | 
			
		||||
special-vendored-path/* linguist-vendored
 | 
			
		||||
jquery.js linguist-vendored=false
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## 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/
 | 
			
		||||
    script/bootstrap
 | 
			
		||||
 | 
			
		||||
To run the tests:
 | 
			
		||||
 | 
			
		||||
    bundle exec rake test
 | 
			
		||||
 | 
			
		||||
### 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: `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`.  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: `bundle exec rake build_gem`
 | 
			
		||||
 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`
 | 
			
		||||
##
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										59
									
								
								grammars.yml
									
									
									
									
									
								
							
							
						
						
									
										59
									
								
								grammars.yml
									
									
									
									
									
								
							@@ -24,28 +24,49 @@ vendor/grammars/Agda.tmbundle:
 | 
			
		||||
- source.agda
 | 
			
		||||
vendor/grammars/Alloy.tmbundle:
 | 
			
		||||
- source.alloy
 | 
			
		||||
vendor/grammars/AutoHotkey:
 | 
			
		||||
vendor/grammars/AutoHotkey/:
 | 
			
		||||
- source.ahk
 | 
			
		||||
vendor/grammars/BrightScript.tmbundle/:
 | 
			
		||||
- source.brightauthorproject
 | 
			
		||||
- source.brightscript
 | 
			
		||||
vendor/grammars/CLIPS-sublime:
 | 
			
		||||
- source.clips
 | 
			
		||||
vendor/grammars/ColdFusion:
 | 
			
		||||
- source.cfscript
 | 
			
		||||
- source.cfscript.cfc
 | 
			
		||||
- text.cfml.basic
 | 
			
		||||
- text.html.cfm
 | 
			
		||||
vendor/grammars/Creole:
 | 
			
		||||
- text.html.creole
 | 
			
		||||
vendor/grammars/Docker.tmbundle:
 | 
			
		||||
- source.dockerfile
 | 
			
		||||
vendor/grammars/Elm.tmLanguage:
 | 
			
		||||
- source.elm
 | 
			
		||||
vendor/grammars/G-Code/:
 | 
			
		||||
- source.LS
 | 
			
		||||
- source.MCPOST
 | 
			
		||||
- source.MOD
 | 
			
		||||
- source.apt
 | 
			
		||||
- source.gcode
 | 
			
		||||
vendor/grammars/GDScript-sublime/:
 | 
			
		||||
- source.gdscript
 | 
			
		||||
vendor/grammars/Handlebars:
 | 
			
		||||
- text.html.handlebars
 | 
			
		||||
vendor/grammars/IDL-Syntax:
 | 
			
		||||
- source.webidl
 | 
			
		||||
vendor/grammars/InnoSetup/:
 | 
			
		||||
- source.inno
 | 
			
		||||
vendor/grammars/Isabelle.tmbundle:
 | 
			
		||||
- source.isabelle.root
 | 
			
		||||
- source.isabelle.theory
 | 
			
		||||
vendor/grammars/JSyntax/:
 | 
			
		||||
- source.j
 | 
			
		||||
vendor/grammars/Julia.tmbundle:
 | 
			
		||||
- source.julia
 | 
			
		||||
vendor/grammars/LiveScript.tmbundle:
 | 
			
		||||
- source.livescript
 | 
			
		||||
vendor/grammars/Modelica/:
 | 
			
		||||
- source.modelica
 | 
			
		||||
vendor/grammars/NSIS:
 | 
			
		||||
- source.nsis
 | 
			
		||||
vendor/grammars/NimLime:
 | 
			
		||||
@@ -54,6 +75,8 @@ vendor/grammars/NimLime:
 | 
			
		||||
- source.nimcfg
 | 
			
		||||
vendor/grammars/PHP-Twig.tmbundle:
 | 
			
		||||
- text.html.twig
 | 
			
		||||
vendor/grammars/PogoScript.tmbundle/:
 | 
			
		||||
- source.pogoscript
 | 
			
		||||
vendor/grammars/RDoc.tmbundle:
 | 
			
		||||
- text.rdoc
 | 
			
		||||
vendor/grammars/Racket:
 | 
			
		||||
@@ -68,6 +91,8 @@ vendor/grammars/Slash.tmbundle:
 | 
			
		||||
vendor/grammars/Stata.tmbundle:
 | 
			
		||||
- source.mata
 | 
			
		||||
- source.stata
 | 
			
		||||
vendor/grammars/Stylus/:
 | 
			
		||||
- source.stylus
 | 
			
		||||
vendor/grammars/Sublime-Coq:
 | 
			
		||||
- source.coq
 | 
			
		||||
vendor/grammars/Sublime-HTTP:
 | 
			
		||||
@@ -94,8 +119,14 @@ vendor/grammars/Sublime-VimL:
 | 
			
		||||
- source.viml
 | 
			
		||||
vendor/grammars/SublimeBrainfuck:
 | 
			
		||||
- source.bf
 | 
			
		||||
vendor/grammars/SublimePapyrus/:
 | 
			
		||||
- source.compiled-papyrus
 | 
			
		||||
- source.papyrus
 | 
			
		||||
- source.papyrus-assembly
 | 
			
		||||
vendor/grammars/SublimeXtend:
 | 
			
		||||
- source.xtend
 | 
			
		||||
vendor/grammars/TXL/:
 | 
			
		||||
- source.txl
 | 
			
		||||
vendor/grammars/Textmate-Gosu-Bundle:
 | 
			
		||||
- source.gosu.2
 | 
			
		||||
vendor/grammars/VBDotNetSyntax:
 | 
			
		||||
@@ -119,6 +150,8 @@ vendor/grammars/apache.tmbundle:
 | 
			
		||||
- source.apache-config.mod_perl
 | 
			
		||||
vendor/grammars/applescript.tmbundle:
 | 
			
		||||
- source.applescript
 | 
			
		||||
vendor/grammars/asciidoc.tmbundle/:
 | 
			
		||||
- text.html.asciidoc
 | 
			
		||||
vendor/grammars/asp.tmbundle:
 | 
			
		||||
- source.asp
 | 
			
		||||
- text.html.asp
 | 
			
		||||
@@ -128,6 +161,8 @@ vendor/grammars/assembly.tmbundle:
 | 
			
		||||
vendor/grammars/atom-salt:
 | 
			
		||||
- source.python.salt
 | 
			
		||||
- source.yaml.salt
 | 
			
		||||
vendor/grammars/ats.sublime:
 | 
			
		||||
- source.ats
 | 
			
		||||
vendor/grammars/autoitv3-tmbundle:
 | 
			
		||||
- source.autoit.3
 | 
			
		||||
vendor/grammars/awk-sublime:
 | 
			
		||||
@@ -180,6 +215,8 @@ vendor/grammars/dylan.tmbundle:
 | 
			
		||||
- source.makegen
 | 
			
		||||
vendor/grammars/ebundles/Bundles/MSDOS batch file.tmbundle:
 | 
			
		||||
- source.dosbatch
 | 
			
		||||
vendor/grammars/ec.tmbundle/:
 | 
			
		||||
- source.c.ec
 | 
			
		||||
vendor/grammars/eiffel.tmbundle:
 | 
			
		||||
- source.eiffel
 | 
			
		||||
vendor/grammars/elixir-tmbundle:
 | 
			
		||||
@@ -201,12 +238,16 @@ vendor/grammars/fortran.tmbundle:
 | 
			
		||||
- source.fortran.modern
 | 
			
		||||
vendor/grammars/fsharpbinding:
 | 
			
		||||
- source.fsharp
 | 
			
		||||
vendor/grammars/gap-tmbundle/:
 | 
			
		||||
- source.gap
 | 
			
		||||
vendor/grammars/gettext.tmbundle:
 | 
			
		||||
- source.po
 | 
			
		||||
vendor/grammars/gnuplot-tmbundle:
 | 
			
		||||
- source.gnuplot
 | 
			
		||||
vendor/grammars/go-tmbundle:
 | 
			
		||||
- source.go
 | 
			
		||||
vendor/grammars/grace-tmbundle/:
 | 
			
		||||
- source.grace
 | 
			
		||||
vendor/grammars/gradle.tmbundle:
 | 
			
		||||
- source.groovy.gradle
 | 
			
		||||
vendor/grammars/graphviz.tmbundle:
 | 
			
		||||
@@ -312,6 +353,8 @@ vendor/grammars/matlab.tmbundle:
 | 
			
		||||
- source.octave
 | 
			
		||||
vendor/grammars/maven.tmbundle:
 | 
			
		||||
- text.xml.pom
 | 
			
		||||
vendor/grammars/mediawiki.tmbundle/:
 | 
			
		||||
- text.html.mediawiki
 | 
			
		||||
vendor/grammars/mercury-tmlanguage:
 | 
			
		||||
- source.mercury
 | 
			
		||||
vendor/grammars/monkey.tmbundle:
 | 
			
		||||
@@ -404,6 +447,8 @@ vendor/grammars/standard-ml.tmbundle:
 | 
			
		||||
- source.ml
 | 
			
		||||
vendor/grammars/sublime-MuPAD:
 | 
			
		||||
- source.mupad
 | 
			
		||||
vendor/grammars/sublime-apl/:
 | 
			
		||||
- source.apl
 | 
			
		||||
vendor/grammars/sublime-befunge:
 | 
			
		||||
- source.befunge
 | 
			
		||||
vendor/grammars/sublime-better-typescript:
 | 
			
		||||
@@ -415,6 +460,8 @@ vendor/grammars/sublime-cirru:
 | 
			
		||||
vendor/grammars/sublime-glsl:
 | 
			
		||||
- source.essl
 | 
			
		||||
- source.glsl
 | 
			
		||||
vendor/grammars/sublime-golo/:
 | 
			
		||||
- source.golo
 | 
			
		||||
vendor/grammars/sublime-idris:
 | 
			
		||||
- source.idris
 | 
			
		||||
vendor/grammars/sublime-mask:
 | 
			
		||||
@@ -423,14 +470,24 @@ vendor/grammars/sublime-nginx:
 | 
			
		||||
- source.nginx
 | 
			
		||||
vendor/grammars/sublime-nix:
 | 
			
		||||
- source.nix
 | 
			
		||||
vendor/grammars/sublime-opal/:
 | 
			
		||||
- source.opal
 | 
			
		||||
- source.opalsysdefs
 | 
			
		||||
vendor/grammars/sublime-robot-plugin:
 | 
			
		||||
- text.robot
 | 
			
		||||
vendor/grammars/sublime-rust:
 | 
			
		||||
- source.rust
 | 
			
		||||
vendor/grammars/sublime-sourcepawn:
 | 
			
		||||
- source.sp
 | 
			
		||||
vendor/grammars/sublime-spintools/:
 | 
			
		||||
- source.regexp.spin
 | 
			
		||||
- source.spin
 | 
			
		||||
vendor/grammars/sublime-tea:
 | 
			
		||||
- source.tea
 | 
			
		||||
vendor/grammars/sublime-text-ox/:
 | 
			
		||||
- source.ox
 | 
			
		||||
vendor/grammars/sublime-text-pig-latin/:
 | 
			
		||||
- source.pig_latin
 | 
			
		||||
vendor/grammars/sublime_cobol:
 | 
			
		||||
- source.acucobol
 | 
			
		||||
- source.cobol
 | 
			
		||||
 
 | 
			
		||||
@@ -236,6 +236,21 @@ module Linguist
 | 
			
		||||
      name =~ VendoredRegexp ? true : false
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    documentation_paths = YAML.load_file(File.expand_path("../documentation.yml", __FILE__))
 | 
			
		||||
    DocumentationRegexp = Regexp.new(documentation_paths.join('|'))
 | 
			
		||||
 | 
			
		||||
    # Public: Is the blob in a documentation directory?
 | 
			
		||||
    #
 | 
			
		||||
    # Documentation files are ignored by language statistics.
 | 
			
		||||
    #
 | 
			
		||||
    # See "documentation.yml" for a list of documentation conventions that match
 | 
			
		||||
    # this pattern.
 | 
			
		||||
    #
 | 
			
		||||
    # Return true or false
 | 
			
		||||
    def documentation?
 | 
			
		||||
      name =~ DocumentationRegexp ? true : false
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Public: Get each line of data
 | 
			
		||||
    #
 | 
			
		||||
    # Requires Blob#data
 | 
			
		||||
@@ -317,5 +332,15 @@ module Linguist
 | 
			
		||||
    def tm_scope
 | 
			
		||||
      language && language.tm_scope
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    DETECTABLE_TYPES = [:programming, :markup].freeze
 | 
			
		||||
 | 
			
		||||
    # Internal: Should this blob be included in repository language statistics?
 | 
			
		||||
    def include_in_language_stats?
 | 
			
		||||
      !vendored? &&
 | 
			
		||||
      !documentation? &&
 | 
			
		||||
      !generated? &&
 | 
			
		||||
      language && DETECTABLE_TYPES.include?(language.type)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										23
									
								
								lib/linguist/documentation.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								lib/linguist/documentation.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
# Documentation files and directories are excluded from language
 | 
			
		||||
# statistics.
 | 
			
		||||
#
 | 
			
		||||
# Lines in this file are Regexps that are matched against the file
 | 
			
		||||
# pathname.
 | 
			
		||||
#
 | 
			
		||||
# Please add additional test coverage to
 | 
			
		||||
# `test/test_blob.rb#test_documentation` if you make any changes.
 | 
			
		||||
 | 
			
		||||
## Documentation directories ##
 | 
			
		||||
 | 
			
		||||
- ^docs?/
 | 
			
		||||
- (^|/)[Dd]ocumentation/
 | 
			
		||||
- (^|/)javadoc/
 | 
			
		||||
- ^man/
 | 
			
		||||
 | 
			
		||||
## Documentation files ##
 | 
			
		||||
 | 
			
		||||
- (^|/)CONTRIBUTING(\.|$)
 | 
			
		||||
- (^|/)COPYING(\.|$)
 | 
			
		||||
- (^|/)INSTALL(\.|$)
 | 
			
		||||
- (^|/)LICEN[CS]E(\.|$)
 | 
			
		||||
- (^|/)README(\.|$)
 | 
			
		||||
@@ -92,7 +92,7 @@ module Linguist
 | 
			
		||||
    disambiguate "Perl", "Perl6", "Prolog" do |data|
 | 
			
		||||
      if data.include?("use v6")
 | 
			
		||||
        Language["Perl6"]
 | 
			
		||||
      elsif data.include?("use strict")
 | 
			
		||||
      elsif data.match(/use strict|use\s+v?5\./)
 | 
			
		||||
        Language["Perl"]
 | 
			
		||||
      elsif data.include?(":-")
 | 
			
		||||
        Language["Prolog"]
 | 
			
		||||
@@ -150,14 +150,20 @@ module Linguist
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    disambiguate "AsciiDoc", "AGS Script" do |data|
 | 
			
		||||
      Language["AsciiDoc"] if /^=+(\s|\n)/.match(data)
 | 
			
		||||
    disambiguate "AsciiDoc", "AGS Script", "Public Key" do |data|
 | 
			
		||||
      if /^[=-]+(\s|\n)|{{[A-Za-z]/.match(data)
 | 
			
		||||
        Language["AsciiDoc"]
 | 
			
		||||
      elsif /^(\/\/.+|((import|export)\s+)?(function|int|float|char)\s+((room|repeatedly|on|game)_)?([A-Za-z]+[A-Za-z_0-9]+)\s*[;\(])/.match(data)
 | 
			
		||||
        Language["AGS Script"]
 | 
			
		||||
      elsif /^-----BEGIN/.match(data)
 | 
			
		||||
        Language["Public Key"]
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    disambiguate "FORTRAN", "Forth" do |data|
 | 
			
		||||
      if /^: /.match(data)
 | 
			
		||||
        Language["Forth"]
 | 
			
		||||
      elsif /^([c*][^a-z]|      (subroutine|program)\s|!)/i.match(data)
 | 
			
		||||
      elsif /^([c*][^a-z]|      (subroutine|program)\s|\s*!)/i.match(data)
 | 
			
		||||
        Language["FORTRAN"]
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 
 | 
			
		||||
@@ -32,13 +32,6 @@ module Linguist
 | 
			
		||||
    # Valid Languages types
 | 
			
		||||
    TYPES = [:data, :markup, :programming, :prose]
 | 
			
		||||
 | 
			
		||||
    # Names of non-programming languages that we will still detect
 | 
			
		||||
    #
 | 
			
		||||
    # Returns an array
 | 
			
		||||
    def self.detectable_markup
 | 
			
		||||
      ["CSS", "Less", "Sass", "SCSS", "Stylus", "TeX"]
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Detect languages by a specific type
 | 
			
		||||
    #
 | 
			
		||||
    # type - A symbol that exists within TYPES
 | 
			
		||||
@@ -96,8 +89,8 @@ module Linguist
 | 
			
		||||
 | 
			
		||||
    STRATEGIES = [
 | 
			
		||||
      Linguist::Strategy::Modeline,
 | 
			
		||||
      Linguist::Strategy::Filename,
 | 
			
		||||
      Linguist::Shebang,
 | 
			
		||||
      Linguist::Strategy::Filename,
 | 
			
		||||
      Linguist::Heuristics,
 | 
			
		||||
      Linguist::Classifier
 | 
			
		||||
    ]
 | 
			
		||||
 
 | 
			
		||||
@@ -54,7 +54,7 @@ APL:
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .apl
 | 
			
		||||
  - .dyalog
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: source.apl
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
ASP:
 | 
			
		||||
@@ -82,10 +82,9 @@ ATS:
 | 
			
		||||
  - ats2
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .dats
 | 
			
		||||
  - .atxt
 | 
			
		||||
  - .hats
 | 
			
		||||
  - .sats
 | 
			
		||||
  tm_scope: source.ocaml
 | 
			
		||||
  tm_scope: source.ats
 | 
			
		||||
  ace_mode: ocaml
 | 
			
		||||
 | 
			
		||||
ActionScript:
 | 
			
		||||
@@ -187,7 +186,7 @@ AsciiDoc:
 | 
			
		||||
  - .asciidoc
 | 
			
		||||
  - .adoc
 | 
			
		||||
  - .asc
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: text.html.asciidoc
 | 
			
		||||
 | 
			
		||||
AspectJ:
 | 
			
		||||
  type: programming
 | 
			
		||||
@@ -199,7 +198,7 @@ AspectJ:
 | 
			
		||||
 | 
			
		||||
Assembly:
 | 
			
		||||
  type: programming
 | 
			
		||||
  color: "#a67219"
 | 
			
		||||
  color: "#6E4C13"
 | 
			
		||||
  search_term: nasm
 | 
			
		||||
  aliases:
 | 
			
		||||
  - nasm
 | 
			
		||||
@@ -207,6 +206,7 @@ Assembly:
 | 
			
		||||
  - .asm
 | 
			
		||||
  - .ASM
 | 
			
		||||
  - .a51
 | 
			
		||||
  - .nasm
 | 
			
		||||
  tm_scope: source.asm.x86
 | 
			
		||||
  ace_mode: assembly_x86
 | 
			
		||||
 | 
			
		||||
@@ -336,7 +336,7 @@ Brightscript:
 | 
			
		||||
  type: programming
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .brs
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: source.brightscript
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
Bro:
 | 
			
		||||
@@ -382,6 +382,7 @@ C++:
 | 
			
		||||
  - .cpp
 | 
			
		||||
  - .c++
 | 
			
		||||
  - .cc
 | 
			
		||||
  - .cp
 | 
			
		||||
  - .cxx
 | 
			
		||||
  - .h
 | 
			
		||||
  - .h++
 | 
			
		||||
@@ -414,7 +415,7 @@ CLIPS:
 | 
			
		||||
  type: programming
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .clp
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: source.clips
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
CMake:
 | 
			
		||||
@@ -438,6 +439,8 @@ COBOL:
 | 
			
		||||
  ace_mode: cobol
 | 
			
		||||
 | 
			
		||||
CSS:
 | 
			
		||||
  type: markup
 | 
			
		||||
  tm_scope: source.css
 | 
			
		||||
  ace_mode: css
 | 
			
		||||
  color: "#563d7c"
 | 
			
		||||
  extensions:
 | 
			
		||||
@@ -623,7 +626,7 @@ Creole:
 | 
			
		||||
  wrap: true
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .creole
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: text.html.creole
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
Crystal:
 | 
			
		||||
@@ -918,6 +921,7 @@ Forth:
 | 
			
		||||
  color: "#341708"
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .fth
 | 
			
		||||
  - .4TH
 | 
			
		||||
  - .4th
 | 
			
		||||
  - .F
 | 
			
		||||
  - .f
 | 
			
		||||
@@ -942,7 +946,7 @@ G-code:
 | 
			
		||||
  - .g
 | 
			
		||||
  - .gco
 | 
			
		||||
  - .gcode
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: source.gcode
 | 
			
		||||
  ace_mode: gcode
 | 
			
		||||
 | 
			
		||||
GAMS:
 | 
			
		||||
@@ -960,7 +964,7 @@ GAP:
 | 
			
		||||
  - .gd
 | 
			
		||||
  - .gi
 | 
			
		||||
  - .tst
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: source.gap
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
GAS:
 | 
			
		||||
@@ -976,7 +980,7 @@ GDScript:
 | 
			
		||||
  type: programming
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .gd
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: source.gdscript
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
GLSL:
 | 
			
		||||
@@ -1074,7 +1078,7 @@ Golo:
 | 
			
		||||
  color: "#f6a51f"
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .golo
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: source.golo
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
Gosu:
 | 
			
		||||
@@ -1092,7 +1096,7 @@ Grace:
 | 
			
		||||
  type: programming
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .grace
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: source.grace
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
Gradle:
 | 
			
		||||
@@ -1171,6 +1175,7 @@ HTML:
 | 
			
		||||
  type: markup
 | 
			
		||||
  tm_scope: text.html.basic
 | 
			
		||||
  ace_mode: html
 | 
			
		||||
  color: "#e44b23"
 | 
			
		||||
  aliases:
 | 
			
		||||
  - xhtml
 | 
			
		||||
  extensions:
 | 
			
		||||
@@ -1240,6 +1245,7 @@ Handlebars:
 | 
			
		||||
  type: markup
 | 
			
		||||
  aliases:
 | 
			
		||||
  - hbs
 | 
			
		||||
  - htmlbars
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .handlebars
 | 
			
		||||
  - .hbs
 | 
			
		||||
@@ -1344,7 +1350,7 @@ Inform 7:
 | 
			
		||||
Inno Setup:
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .iss
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: source.inno
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
Io:
 | 
			
		||||
@@ -1375,7 +1381,7 @@ J:
 | 
			
		||||
  type: programming
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .ijs
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: source.j
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
JSON:
 | 
			
		||||
@@ -1805,7 +1811,7 @@ MediaWiki:
 | 
			
		||||
  wrap: true
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .mediawiki
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: text.html.mediawiki
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
Mercury:
 | 
			
		||||
@@ -1839,6 +1845,13 @@ Mirah:
 | 
			
		||||
  tm_scope: source.ruby
 | 
			
		||||
  ace_mode: ruby
 | 
			
		||||
 | 
			
		||||
Modelica:
 | 
			
		||||
  type: programming
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .mo
 | 
			
		||||
  tm_scope: source.modelica
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
Monkey:
 | 
			
		||||
  type: programming
 | 
			
		||||
  extensions:
 | 
			
		||||
@@ -2043,7 +2056,7 @@ Opal:
 | 
			
		||||
  color: "#f7ede0"
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .opal
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: source.opal
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
OpenCL:
 | 
			
		||||
@@ -2088,7 +2101,7 @@ Ox:
 | 
			
		||||
  - .ox
 | 
			
		||||
  - .oxh
 | 
			
		||||
  - .oxo
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: source.ox
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
Oxygene:
 | 
			
		||||
@@ -2149,7 +2162,7 @@ Papyrus:
 | 
			
		||||
  color: "#6600cc"
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .psc
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: source.papyrus
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
Parrot:
 | 
			
		||||
@@ -2241,7 +2254,7 @@ PigLatin:
 | 
			
		||||
  color: "#fcd7de"
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .pig
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: source.pig_latin
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
Pike:
 | 
			
		||||
@@ -2267,7 +2280,7 @@ PogoScript:
 | 
			
		||||
  color: "#d80074"
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .pogo
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: source.pogoscript
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
PostScript:
 | 
			
		||||
@@ -2314,7 +2327,7 @@ Propeller Spin:
 | 
			
		||||
  color: "#2b446d"
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .spin
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: source.spin
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
Protocol Buffer:
 | 
			
		||||
@@ -2674,6 +2687,13 @@ STON:
 | 
			
		||||
  tm_scope: source.smalltalk
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
SVG:
 | 
			
		||||
  type: data
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .svg
 | 
			
		||||
  tm_scope: text.xml
 | 
			
		||||
  ace_mode: xml
 | 
			
		||||
 | 
			
		||||
Sage:
 | 
			
		||||
  type: programming
 | 
			
		||||
  group: Python
 | 
			
		||||
@@ -2874,7 +2894,7 @@ Stylus:
 | 
			
		||||
  group: CSS
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .styl
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: source.stylus
 | 
			
		||||
  ace_mode: stylus
 | 
			
		||||
 | 
			
		||||
SuperCollider:
 | 
			
		||||
@@ -2913,7 +2933,7 @@ TXL:
 | 
			
		||||
  type: programming
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .txl
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: source.txl
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
Tcl:
 | 
			
		||||
@@ -3145,7 +3165,7 @@ XC:
 | 
			
		||||
  ace_mode: c_cpp
 | 
			
		||||
 | 
			
		||||
XML:
 | 
			
		||||
  type: markup
 | 
			
		||||
  type: data
 | 
			
		||||
  ace_mode: xml
 | 
			
		||||
  aliases:
 | 
			
		||||
  - rss
 | 
			
		||||
@@ -3189,7 +3209,6 @@ XML:
 | 
			
		||||
  - .srdf
 | 
			
		||||
  - .stTheme
 | 
			
		||||
  - .sublime-snippet
 | 
			
		||||
  - .svg
 | 
			
		||||
  - .targets
 | 
			
		||||
  - .tmCommand
 | 
			
		||||
  - .tmLanguage
 | 
			
		||||
@@ -3323,7 +3342,7 @@ eC:
 | 
			
		||||
  extensions:
 | 
			
		||||
  - .ec
 | 
			
		||||
  - .eh
 | 
			
		||||
  tm_scope: none
 | 
			
		||||
  tm_scope: source.c.ec
 | 
			
		||||
  ace_mode: text
 | 
			
		||||
 | 
			
		||||
edn:
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ require 'rugged'
 | 
			
		||||
 | 
			
		||||
module Linguist
 | 
			
		||||
  class LazyBlob
 | 
			
		||||
    GIT_ATTR = ['linguist-language', 'linguist-vendored']
 | 
			
		||||
    GIT_ATTR = ['linguist-documentation', 'linguist-language', 'linguist-vendored']
 | 
			
		||||
    GIT_ATTR_OPTS = { :priority => [:index], :skip_system => true }
 | 
			
		||||
    GIT_ATTR_FLAGS = Rugged::Repository::Attributes.parse_opts(GIT_ATTR_OPTS)
 | 
			
		||||
 | 
			
		||||
@@ -37,6 +37,14 @@ module Linguist
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def documentation?
 | 
			
		||||
      if attr = git_attributes['linguist-documentation']
 | 
			
		||||
        boolean_attribute(attr)
 | 
			
		||||
      else
 | 
			
		||||
        super
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def language
 | 
			
		||||
      return @language if defined?(@language)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -156,13 +156,8 @@ module Linguist
 | 
			
		||||
 | 
			
		||||
          blob = Linguist::LazyBlob.new(repository, delta.new_file[:oid], new, mode.to_s(8))
 | 
			
		||||
 | 
			
		||||
          # Skip vendored or generated blobs
 | 
			
		||||
          next if blob.vendored? || blob.generated? || blob.language.nil?
 | 
			
		||||
 | 
			
		||||
          # Only include programming languages and acceptable markup languages
 | 
			
		||||
          if blob.language.type == :programming || Language.detectable_markup.include?(blob.language.name)
 | 
			
		||||
            file_map[new] = [blob.language.group.name, blob.size]
 | 
			
		||||
          end
 | 
			
		||||
          next unless blob.include_in_language_stats?
 | 
			
		||||
          file_map[new] = [blob.language.group.name, blob.size]
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
module Linguist
 | 
			
		||||
  module Strategy
 | 
			
		||||
    class Modeline
 | 
			
		||||
      EmacsModeline = /-\*-\s*(?:mode:)?\s*(\w+);?\s*-\*-/
 | 
			
		||||
      VimModeline = /\/\*\s*vim:\s*set\s*(?:ft|filetype)=(\w+):\s*\*\//
 | 
			
		||||
      EmacsModeline = /-\*-\s*mode:\s*(\w+);?\s*-\*-/i
 | 
			
		||||
      VimModeline = /\/\*\s*vim:\s*set\s*(?:ft|filetype)=(\w+):\s*\*\//i
 | 
			
		||||
 | 
			
		||||
      # Public: Detects language based on Vim and Emacs modelines
 | 
			
		||||
      #
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,7 @@
 | 
			
		||||
# Minified JavaScript and CSS
 | 
			
		||||
- (\.|-)min\.(js|css)$
 | 
			
		||||
 | 
			
		||||
#Stylesheets imported from packages
 | 
			
		||||
# Stylesheets imported from packages
 | 
			
		||||
- ([^\s]*)import\.(css|less|scss|styl)$
 | 
			
		||||
 | 
			
		||||
# Bootstrap css and js
 | 
			
		||||
@@ -251,3 +251,6 @@
 | 
			
		||||
# ProGuard
 | 
			
		||||
- proguard.pro
 | 
			
		||||
- proguard-rules.pro
 | 
			
		||||
 | 
			
		||||
# Android Google APIs
 | 
			
		||||
- (^|/)\.google_apis/
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,3 @@
 | 
			
		||||
module Linguist
 | 
			
		||||
  VERSION = "4.3.0"
 | 
			
		||||
  VERSION = "4.4.2"
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "repository": "https://github.com/github/linguist",
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "season": "~>3.0"
 | 
			
		||||
    "season": "~>5.0"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,215 +0,0 @@
 | 
			
		||||
%{
 | 
			
		||||
#include "./../ATEXT/atextfun.hats"
 | 
			
		||||
%}
 | 
			
		||||
 | 
			
		||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
 | 
			
		||||
   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 | 
			
		||||
<html xmlns="http://www.w3.org/1999/xhtml">
 | 
			
		||||
 | 
			
		||||
<head>
 | 
			
		||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
 | 
			
		||||
<title>EFFECTIVATS-DiningPhil2</title>
 | 
			
		||||
#patscode_style()
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<body>
 | 
			
		||||
 | 
			
		||||
<h1>
 | 
			
		||||
Effective ATS: Dining Philosophers
 | 
			
		||||
</h1>
 | 
			
		||||
 | 
			
		||||
In this article, I present an implementation of a slight variant of the
 | 
			
		||||
famous problem of 5-Dining-Philosophers by Dijkstra that makes simple but
 | 
			
		||||
convincing use of linear types.
 | 
			
		||||
 | 
			
		||||
<h2>
 | 
			
		||||
The Original Problem 
 | 
			
		||||
</h2>
 | 
			
		||||
 | 
			
		||||
There are five philosophers sitting around a table and there are also 5
 | 
			
		||||
forks placed on the table such that each fork is located between the left
 | 
			
		||||
hand of a philosopher and the right hand of another philosopher. Each
 | 
			
		||||
philosopher does the following routine repeatedly: thinking and dining.  In
 | 
			
		||||
order to dine, a philosopher needs to first acquire two forks: one located
 | 
			
		||||
on his left-hand side and the other on his right-hand side. After
 | 
			
		||||
finishing dining, a philosopher puts the two acquired forks onto the table:
 | 
			
		||||
one on his left-hand side and the other on his right-hand side.
 | 
			
		||||
 | 
			
		||||
<h2>
 | 
			
		||||
A Variant of the Original Problem 
 | 
			
		||||
</h2>
 | 
			
		||||
 | 
			
		||||
The following twist is added to the original version:
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
 | 
			
		||||
After a fork is used, it becomes a "dirty" fork and needs to be put in a
 | 
			
		||||
tray for dirty forks. There is a cleaner who cleans dirty forks and then
 | 
			
		||||
puts them back on the table.
 | 
			
		||||
 | 
			
		||||
<h2>
 | 
			
		||||
Channels for Communication
 | 
			
		||||
</h2>
 | 
			
		||||
 | 
			
		||||
A channel is just a shared queue of fixed capacity. The following two
 | 
			
		||||
functions are for inserting an element into and taking an element out of a
 | 
			
		||||
given channel:
 | 
			
		||||
 | 
			
		||||
<pre
 | 
			
		||||
class="patsyntax">
 | 
			
		||||
#pats2xhtml_sats("\
 | 
			
		||||
fun{a:vt0p} channel_insert (channel (a), a): void
 | 
			
		||||
fun{a:vt0p} channel_takeout (chan: channel (a)): (a) 
 | 
			
		||||
")</pre>
 | 
			
		||||
 | 
			
		||||
If [channel_insert] is called on a channel that is full, then the caller is
 | 
			
		||||
blocked until an element is taken out of the channel.  If [channel_takeout]
 | 
			
		||||
is called on a channel that is empty, then the caller is blocked until an
 | 
			
		||||
element is inserted into the channel.
 | 
			
		||||
 | 
			
		||||
<h2>
 | 
			
		||||
A Channel for Each Fork
 | 
			
		||||
</h2>
 | 
			
		||||
 | 
			
		||||
Forks are resources given a linear type. Each fork is initially stored in a
 | 
			
		||||
channel, which can be obtained by calling the following function:
 | 
			
		||||
 | 
			
		||||
<pre
 | 
			
		||||
class="patsyntax">
 | 
			
		||||
#pats2xhtml_sats("\
 | 
			
		||||
fun fork_changet (n: nphil): channel(fork)
 | 
			
		||||
")</pre>
 | 
			
		||||
 | 
			
		||||
where the type [nphil] is defined to be [natLt(5)] (for natural numbers
 | 
			
		||||
less than 5). The channels for storing forks are chosen to be of capacity
 | 
			
		||||
2. The reason that channels of capacity 2 are chosen to store at most one
 | 
			
		||||
element (in each of them) is to guarantee that these channels can never be
 | 
			
		||||
full (so that there is no attempt made to send signals to awake callers
 | 
			
		||||
supposedly being blocked due to channels being full).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h2>
 | 
			
		||||
A Channel for the Fork Tray
 | 
			
		||||
</h2>
 | 
			
		||||
 | 
			
		||||
A tray for storing "dirty" forks is also a channel, which can be obtained
 | 
			
		||||
by calling the following function:
 | 
			
		||||
 | 
			
		||||
<pre
 | 
			
		||||
class="patsyntax">
 | 
			
		||||
#pats2xhtml_sats("\
 | 
			
		||||
fun forktray_changet ((*void*)): channel(fork)
 | 
			
		||||
")</pre>
 | 
			
		||||
 | 
			
		||||
The capacity chosen for the channel is 6 (instead of 5) so that it can
 | 
			
		||||
never become full (as there are only 5 forks in total).
 | 
			
		||||
 | 
			
		||||
<h2>
 | 
			
		||||
Philosopher Loop
 | 
			
		||||
</h2>
 | 
			
		||||
 | 
			
		||||
Each philosopher is implemented as a loop:
 | 
			
		||||
 | 
			
		||||
<pre
 | 
			
		||||
class="patsyntax">
 | 
			
		||||
#pats2xhtml_dats('\
 | 
			
		||||
implement
 | 
			
		||||
phil_loop (n) = let
 | 
			
		||||
//
 | 
			
		||||
val () = phil_think (n)
 | 
			
		||||
//
 | 
			
		||||
val nl = phil_left (n) // = n
 | 
			
		||||
val nr = phil_right (n) // = (n+1) % 5
 | 
			
		||||
//
 | 
			
		||||
val ch_lfork = fork_changet (nl)
 | 
			
		||||
val ch_rfork = fork_changet (nr)
 | 
			
		||||
//
 | 
			
		||||
val lf = channel_takeout (ch_lfork)
 | 
			
		||||
val () = println! ("phil_loop(", n, ") picks left fork")
 | 
			
		||||
//
 | 
			
		||||
val () = randsleep (2) // sleep up to 2 seconds
 | 
			
		||||
//
 | 
			
		||||
val rf = channel_takeout (ch_rfork)
 | 
			
		||||
val () = println! ("phil_loop(", n, ") picks right fork")
 | 
			
		||||
//
 | 
			
		||||
val () = phil_dine (n, lf, rf)
 | 
			
		||||
//
 | 
			
		||||
val ch_forktray = forktray_changet ()
 | 
			
		||||
val () = channel_insert (ch_forktray, lf) // left fork to dirty tray
 | 
			
		||||
val () = channel_insert (ch_forktray, rf) // right fork to dirty tray
 | 
			
		||||
//
 | 
			
		||||
in
 | 
			
		||||
  phil_loop (n)
 | 
			
		||||
end // end of [phil_loop]
 | 
			
		||||
')</pre>
 | 
			
		||||
 | 
			
		||||
It should be straighforward to follow the code for [phil_loop].
 | 
			
		||||
 | 
			
		||||
<h2>
 | 
			
		||||
Fork Cleaner Loop
 | 
			
		||||
</h2>
 | 
			
		||||
 | 
			
		||||
A cleaner is implemented as a loop:
 | 
			
		||||
 | 
			
		||||
<pre
 | 
			
		||||
class="patsyntax">
 | 
			
		||||
#pats2xhtml_dats('\
 | 
			
		||||
implement
 | 
			
		||||
cleaner_loop () = let
 | 
			
		||||
//
 | 
			
		||||
val ch = forktray_changet ()
 | 
			
		||||
val f0 = channel_takeout (ch) // [f0] is dirty
 | 
			
		||||
//
 | 
			
		||||
val () = cleaner_wash (f0) // washes dirty [f0]
 | 
			
		||||
val () = cleaner_return (f0) // puts back cleaned [f0]
 | 
			
		||||
//
 | 
			
		||||
in
 | 
			
		||||
  cleaner_loop ()
 | 
			
		||||
end // end of [cleaner_loop]
 | 
			
		||||
')</pre>
 | 
			
		||||
 | 
			
		||||
The function [cleaner_return] first finds out the number of a given fork
 | 
			
		||||
and then uses the number to locate the channel for storing the fork. Its
 | 
			
		||||
actual implementation is given as follows:
 | 
			
		||||
 | 
			
		||||
<pre
 | 
			
		||||
class="patsyntax">
 | 
			
		||||
#pats2xhtml_dats('\
 | 
			
		||||
implement
 | 
			
		||||
cleaner_return (f) =
 | 
			
		||||
{
 | 
			
		||||
  val n = fork_get_num (f)
 | 
			
		||||
  val ch = fork_changet (n)
 | 
			
		||||
  val () = channel_insert (ch, f)
 | 
			
		||||
}
 | 
			
		||||
')</pre>
 | 
			
		||||
 | 
			
		||||
It should now be straighforward to follow the code for [cleaner_loop].
 | 
			
		||||
 | 
			
		||||
<h2>
 | 
			
		||||
Testing
 | 
			
		||||
</h2>
 | 
			
		||||
 | 
			
		||||
The entire code of this implementation is stored in the following files:
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
DiningPhil2.sats
 | 
			
		||||
DiningPhil2.dats
 | 
			
		||||
DiningPhil2_fork.dats
 | 
			
		||||
DiningPhil2_thread.dats
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
There is also a Makefile available for compiling the ATS source code into
 | 
			
		||||
an excutable for testing. One should be able to encounter a deadlock after
 | 
			
		||||
running the simulation for a while.
 | 
			
		||||
 | 
			
		||||
<hr size="2">
 | 
			
		||||
 | 
			
		||||
This article is written by <a href="http://www.cs.bu.edu/~hwxi/">Hongwei Xi</a>.
 | 
			
		||||
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
 | 
			
		||||
%{
 | 
			
		||||
implement main () = fprint_filsub (stdout_ref, "main_atxt.txt")
 | 
			
		||||
%}
 | 
			
		||||
							
								
								
									
										2841
									
								
								samples/Assembly/forth.nasm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2841
									
								
								samples/Assembly/forth.nasm
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										116
									
								
								samples/C++/qsciprinter.cp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										116
									
								
								samples/C++/qsciprinter.cp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,116 @@
 | 
			
		||||
// This module defines interface to the QsciPrinter class.
 | 
			
		||||
//
 | 
			
		||||
// Copyright (c) 2011 Riverbank Computing Limited <info@riverbankcomputing.com>
 | 
			
		||||
// 
 | 
			
		||||
// This file is part of QScintilla.
 | 
			
		||||
// 
 | 
			
		||||
// This file may be used under the terms of the GNU General Public
 | 
			
		||||
// License versions 2.0 or 3.0 as published by the Free Software
 | 
			
		||||
// Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
 | 
			
		||||
// included in the packaging of this file.  Alternatively you may (at
 | 
			
		||||
// your option) use any later version of the GNU General Public
 | 
			
		||||
// License if such license has been publicly approved by Riverbank
 | 
			
		||||
// Computing Limited (or its successors, if any) and the KDE Free Qt
 | 
			
		||||
// Foundation. In addition, as a special exception, Riverbank gives you
 | 
			
		||||
// certain additional rights. These rights are described in the Riverbank
 | 
			
		||||
// GPL Exception version 1.1, which can be found in the file
 | 
			
		||||
// GPL_EXCEPTION.txt in this package.
 | 
			
		||||
// 
 | 
			
		||||
// If you are unsure which license is appropriate for your use, please
 | 
			
		||||
// contact the sales department at sales@riverbankcomputing.com.
 | 
			
		||||
// 
 | 
			
		||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 | 
			
		||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifndef QSCIPRINTER_H
 | 
			
		||||
#define QSCIPRINTER_H
 | 
			
		||||
 | 
			
		||||
#ifdef __APPLE__
 | 
			
		||||
extern "C++" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <qprinter.h>
 | 
			
		||||
 | 
			
		||||
#include <Qsci/qsciglobal.h>
 | 
			
		||||
#include <Qsci/qsciscintilla.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
QT_BEGIN_NAMESPACE
 | 
			
		||||
class QRect;
 | 
			
		||||
class QPainter;
 | 
			
		||||
QT_END_NAMESPACE
 | 
			
		||||
 | 
			
		||||
class QsciScintillaBase;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//! \brief The QsciPrinter class is a sub-class of the Qt QPrinter class that
 | 
			
		||||
//! is able to print the text of a Scintilla document.
 | 
			
		||||
//!
 | 
			
		||||
//! The class can be further sub-classed to alter to layout of the text, adding
 | 
			
		||||
//! headers and footers for example.
 | 
			
		||||
class QSCINTILLA_EXPORT QsciPrinter : public QPrinter
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    //! Constructs a printer paint device with mode \a mode.
 | 
			
		||||
    QsciPrinter(PrinterMode mode = ScreenResolution);
 | 
			
		||||
 | 
			
		||||
    //! Destroys the QsciPrinter instance.
 | 
			
		||||
    virtual ~QsciPrinter();
 | 
			
		||||
 | 
			
		||||
    //! Format a page, by adding headers and footers for example, before the
 | 
			
		||||
    //! document text is drawn on it.  \a painter is the painter to be used to
 | 
			
		||||
    //! add customised text and graphics.  \a drawing is true if the page is
 | 
			
		||||
    //! actually being drawn rather than being sized.  \a painter drawing
 | 
			
		||||
    //! methods must only be called when \a drawing is true.  \a area is the
 | 
			
		||||
    //! area of the page that will be used to draw the text.  This should be
 | 
			
		||||
    //! modified if it is necessary to reserve space for any customised text or
 | 
			
		||||
    //! graphics.  By default the area is relative to the printable area of the
 | 
			
		||||
    //! page.  Use QPrinter::setFullPage() because calling printRange() if you
 | 
			
		||||
    //! want to try and print over the whole page.  \a pagenr is the number of
 | 
			
		||||
    //! the page.  The first page is numbered 1.
 | 
			
		||||
    virtual void formatPage(QPainter &painter, bool drawing, QRect &area,
 | 
			
		||||
            int pagenr);
 | 
			
		||||
 | 
			
		||||
    //! Return the number of points to add to each font when printing.
 | 
			
		||||
    //!
 | 
			
		||||
    //! \sa setMagnification()
 | 
			
		||||
    int magnification() const {return mag;}
 | 
			
		||||
 | 
			
		||||
    //! Sets the number of points to add to each font when printing to \a
 | 
			
		||||
    //! magnification.
 | 
			
		||||
    //!
 | 
			
		||||
    //! \sa magnification()
 | 
			
		||||
    virtual void setMagnification(int magnification);
 | 
			
		||||
 | 
			
		||||
    //! Print a range of lines from the Scintilla instance \a qsb.  \a from is
 | 
			
		||||
    //! the first line to print and a negative value signifies the first line
 | 
			
		||||
    //! of text.  \a to is the last line to print and a negative value
 | 
			
		||||
    //! signifies the last line of text.  true is returned if there was no
 | 
			
		||||
    //! error.
 | 
			
		||||
    virtual int printRange(QsciScintillaBase *qsb, int from = -1, int to = -1);
 | 
			
		||||
 | 
			
		||||
    //! Return the line wrap mode used when printing.  The default is
 | 
			
		||||
    //! QsciScintilla::WrapWord.
 | 
			
		||||
    //!
 | 
			
		||||
    //! \sa setWrapMode()
 | 
			
		||||
    QsciScintilla::WrapMode wrapMode() const {return wrap;}
 | 
			
		||||
 | 
			
		||||
    //! Sets the line wrap mode used when printing to \a wmode.
 | 
			
		||||
    //!
 | 
			
		||||
    //! \sa wrapMode()
 | 
			
		||||
    virtual void setWrapMode(QsciScintilla::WrapMode wmode);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    int mag;
 | 
			
		||||
    QsciScintilla::WrapMode wrap;
 | 
			
		||||
 | 
			
		||||
    QsciPrinter(const QsciPrinter &);
 | 
			
		||||
    QsciPrinter &operator=(const QsciPrinter &);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#ifdef __APPLE__
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										343
									
								
								samples/CLIPS/demo.clp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										343
									
								
								samples/CLIPS/demo.clp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,343 @@
 | 
			
		||||
;;;***************************
 | 
			
		||||
;;;* DEFFACTS KNOWLEDGE BASE *
 | 
			
		||||
;;;***************************
 | 
			
		||||
 | 
			
		||||
(deffacts MAIN::knowledge-base
 | 
			
		||||
   (welcome (message WelcomeMessage))
 | 
			
		||||
   (goal (variable type.animal))
 | 
			
		||||
   (legalanswers (values yes no))
 | 
			
		||||
   (displayanswers (values "Yes" "No"))
 | 
			
		||||
   (rule (if backbone is yes) 
 | 
			
		||||
         (then superphylum is backbone))
 | 
			
		||||
   (rule (if backbone is no) 
 | 
			
		||||
         (then superphylum is jellyback))
 | 
			
		||||
   (question (variable backbone)
 | 
			
		||||
             (query backbone.query))
 | 
			
		||||
   (rule (if superphylum is backbone and
 | 
			
		||||
          warm.blooded is yes) 
 | 
			
		||||
         (then phylum is warm))
 | 
			
		||||
   (rule (if superphylum is backbone and
 | 
			
		||||
          warm.blooded is no) 
 | 
			
		||||
         (then phylum is cold))
 | 
			
		||||
   (question (variable warm.blooded)
 | 
			
		||||
             (query warm.blooded.query))
 | 
			
		||||
   (rule (if superphylum is jellyback and
 | 
			
		||||
          live.prime.in.soil is yes) 
 | 
			
		||||
         (then phylum is soil))
 | 
			
		||||
   (rule (if superphylum is jellyback and
 | 
			
		||||
          live.prime.in.soil is no) 
 | 
			
		||||
         (then phylum is elsewhere))
 | 
			
		||||
   (question (variable live.prime.in.soil)
 | 
			
		||||
             (query live.prime.in.soil.query))
 | 
			
		||||
   (rule (if phylum is warm and
 | 
			
		||||
          has.breasts is yes) 
 | 
			
		||||
         (then class is breasts))
 | 
			
		||||
   (rule (if phylum is warm and
 | 
			
		||||
          has.breasts is no) 
 | 
			
		||||
         (then type.animal is bird))
 | 
			
		||||
   (question (variable has.breasts)
 | 
			
		||||
             (query has.breasts.query))
 | 
			
		||||
   (rule (if phylum is cold and
 | 
			
		||||
          always.in.water is yes) 
 | 
			
		||||
         (then class is water))
 | 
			
		||||
   (rule (if phylum is cold and
 | 
			
		||||
          always.in.water is no) 
 | 
			
		||||
         (then class is dry))
 | 
			
		||||
   (question (variable always.in.water)
 | 
			
		||||
             (query always.in.water.query))
 | 
			
		||||
   (rule (if phylum is soil and
 | 
			
		||||
          flat.bodied is yes) 
 | 
			
		||||
         (then type.animal is flatworm))
 | 
			
		||||
   (rule (if phylum is soil and
 | 
			
		||||
          flat.bodied is no) 
 | 
			
		||||
         (then type.animal is worm.leech))
 | 
			
		||||
   (question (variable flat.bodied)
 | 
			
		||||
             (query flat.bodied.query))
 | 
			
		||||
   (rule (if phylum is elsewhere and
 | 
			
		||||
          body.in.segments is yes) 
 | 
			
		||||
         (then class is segments))
 | 
			
		||||
   (rule (if phylum is elsewhere and
 | 
			
		||||
          body.in.segments is no) 
 | 
			
		||||
         (then class is unified))
 | 
			
		||||
   (question (variable body.in.segments)
 | 
			
		||||
             (query body.in.segments.query))
 | 
			
		||||
   (rule (if class is breasts and
 | 
			
		||||
          can.eat.meat is yes) 
 | 
			
		||||
         (then order is meat))
 | 
			
		||||
   (rule (if class is breasts and
 | 
			
		||||
          can.eat.meat is no) 
 | 
			
		||||
         (then order is vegy))
 | 
			
		||||
   (question (variable can.eat.meat)
 | 
			
		||||
             (query can.eat.meat.query))
 | 
			
		||||
   (rule (if class is water and
 | 
			
		||||
          boney is yes) 
 | 
			
		||||
         (then type.animal is fish))
 | 
			
		||||
   (rule (if class is water and
 | 
			
		||||
          boney is no) 
 | 
			
		||||
         (then type.animal is shark.ray))
 | 
			
		||||
   (question (variable boney)
 | 
			
		||||
             (query boney.query))
 | 
			
		||||
   (rule (if class is dry and
 | 
			
		||||
          scaly is yes) 
 | 
			
		||||
         (then order is scales))
 | 
			
		||||
   (rule (if class is dry and
 | 
			
		||||
          scaly is no) 
 | 
			
		||||
         (then order is soft))
 | 
			
		||||
   (question (variable scaly)
 | 
			
		||||
             (query scaly.query))
 | 
			
		||||
   (rule (if class is segments and
 | 
			
		||||
          shell is yes) 
 | 
			
		||||
         (then order is shell))
 | 
			
		||||
   (rule (if class is segments and
 | 
			
		||||
          shell is no) 
 | 
			
		||||
         (then type.animal is centipede.millipede.insect))
 | 
			
		||||
   (question (variable shell)
 | 
			
		||||
             (query shell.query))
 | 
			
		||||
   (rule (if class is unified and
 | 
			
		||||
          digest.cells is yes) 
 | 
			
		||||
         (then order is cells))
 | 
			
		||||
   (rule (if class is unified and
 | 
			
		||||
          digest.cells is no) 
 | 
			
		||||
         (then order is stomach))
 | 
			
		||||
   (question (variable digest.cells)
 | 
			
		||||
             (query digest.cells.query))
 | 
			
		||||
   (rule (if order is meat and
 | 
			
		||||
          fly is yes) 
 | 
			
		||||
         (then type.animal is bat))
 | 
			
		||||
   (rule (if order is meat and
 | 
			
		||||
          fly is no) 
 | 
			
		||||
         (then family is nowings))
 | 
			
		||||
   (question (variable fly)
 | 
			
		||||
             (query fly.query))
 | 
			
		||||
   (rule (if order is vegy and
 | 
			
		||||
          hooves is yes) 
 | 
			
		||||
         (then family is hooves))
 | 
			
		||||
   (rule (if order is vegy and
 | 
			
		||||
          hooves is no) 
 | 
			
		||||
         (then family is feet))
 | 
			
		||||
   (question (variable hooves)
 | 
			
		||||
             (query hooves.query))
 | 
			
		||||
   (rule (if order is scales and
 | 
			
		||||
          rounded.shell is yes) 
 | 
			
		||||
         (then type.animal is turtle))
 | 
			
		||||
   (rule (if order is scales and
 | 
			
		||||
          rounded.shell is no) 
 | 
			
		||||
         (then family is noshell))
 | 
			
		||||
   (question (variable rounded.shell)
 | 
			
		||||
             (query rounded.shell.query))
 | 
			
		||||
   (rule (if order is soft and
 | 
			
		||||
          jump is yes) 
 | 
			
		||||
         (then type.animal is frog))
 | 
			
		||||
   (rule (if order is soft and
 | 
			
		||||
          jump is no) 
 | 
			
		||||
         (then type.animal is salamander))
 | 
			
		||||
   (question (variable jump)
 | 
			
		||||
             (query jump.query))
 | 
			
		||||
   (rule (if order is shell and
 | 
			
		||||
          tail is yes) 
 | 
			
		||||
         (then type.animal is lobster))
 | 
			
		||||
   (rule (if order is shell and
 | 
			
		||||
          tail is no) 
 | 
			
		||||
         (then type.animal is crab))
 | 
			
		||||
   (question (variable tail)
 | 
			
		||||
             (query tail.query))
 | 
			
		||||
   (rule (if order is cells and
 | 
			
		||||
          stationary is yes) 
 | 
			
		||||
         (then family is stationary))
 | 
			
		||||
   (rule (if order is cells and
 | 
			
		||||
          stationary is no) 
 | 
			
		||||
         (then type.animal is jellyfish))
 | 
			
		||||
   (question (variable stationary)
 | 
			
		||||
             (query stationary.query))
 | 
			
		||||
   (rule (if order is stomach and
 | 
			
		||||
          multicelled is yes) 
 | 
			
		||||
         (then family is multicelled))
 | 
			
		||||
   (rule (if order is stomach and
 | 
			
		||||
          multicelled is no) 
 | 
			
		||||
         (then type.animal is protozoa))
 | 
			
		||||
   (question (variable multicelled)
 | 
			
		||||
             (query multicelled.query))
 | 
			
		||||
   (rule (if family is nowings and
 | 
			
		||||
          opposing.thumb is yes) 
 | 
			
		||||
         (then genus is thumb))
 | 
			
		||||
   (rule (if family is nowings and
 | 
			
		||||
          opposing.thumb is no) 
 | 
			
		||||
         (then genus is nothumb))
 | 
			
		||||
   (question (variable opposing.thumb)
 | 
			
		||||
             (query opposing.thumb.query))
 | 
			
		||||
   (rule (if family is hooves and
 | 
			
		||||
          two.toes is yes) 
 | 
			
		||||
         (then genus is twotoes))
 | 
			
		||||
   (rule (if family is hooves and
 | 
			
		||||
          two.toes is no) 
 | 
			
		||||
         (then genus is onetoe))
 | 
			
		||||
   (question (variable two.toes)
 | 
			
		||||
             (query two.toes.query))
 | 
			
		||||
   (rule (if family is feet and
 | 
			
		||||
          live.in.water is yes) 
 | 
			
		||||
         (then genus is water))
 | 
			
		||||
   (rule (if family is feet and
 | 
			
		||||
          live.in.water is no) 
 | 
			
		||||
         (then genus is dry))
 | 
			
		||||
   (question (variable live.in.water)
 | 
			
		||||
             (query live.in.water.query))
 | 
			
		||||
   (rule (if family is noshell and
 | 
			
		||||
          limbs is yes) 
 | 
			
		||||
         (then type.animal is crocodile.alligator))
 | 
			
		||||
   (rule (if family is noshell and
 | 
			
		||||
          limbs is no) 
 | 
			
		||||
         (then type.animal is snake))
 | 
			
		||||
   (question (variable limbs)
 | 
			
		||||
             (query limbs.query))
 | 
			
		||||
   (rule (if family is stationary and
 | 
			
		||||
          spikes is yes) 
 | 
			
		||||
         (then type.animal is sea.anemone))
 | 
			
		||||
   (rule (if family is stationary and
 | 
			
		||||
          spikes is no) 
 | 
			
		||||
         (then type.animal is coral.sponge))
 | 
			
		||||
   (question (variable spikes)
 | 
			
		||||
             (query spikes.query))
 | 
			
		||||
   (rule (if family is multicelled and
 | 
			
		||||
          spiral.shell is yes) 
 | 
			
		||||
         (then type.animal is snail))
 | 
			
		||||
   (rule (if family is multicelled and
 | 
			
		||||
          spiral.shell is no) 
 | 
			
		||||
         (then genus is noshell))
 | 
			
		||||
   (question (variable spiral.shell)
 | 
			
		||||
             (query spiral.shell.query))
 | 
			
		||||
   (rule (if genus is thumb and
 | 
			
		||||
          prehensile.tail is yes) 
 | 
			
		||||
         (then type.animal is monkey))
 | 
			
		||||
   (rule (if genus is thumb and
 | 
			
		||||
          prehensile.tail is no) 
 | 
			
		||||
         (then species is notail))
 | 
			
		||||
   (question (variable prehensile.tail)
 | 
			
		||||
             (query prehensile.tail.query))
 | 
			
		||||
   (rule (if genus is nothumb and
 | 
			
		||||
          over.400 is yes) 
 | 
			
		||||
         (then species is 400))
 | 
			
		||||
   (rule (if genus is nothumb and
 | 
			
		||||
          over.400 is no) 
 | 
			
		||||
         (then species is under400))
 | 
			
		||||
   (question (variable over.400)
 | 
			
		||||
             (query over.400.query))
 | 
			
		||||
   (rule (if genus is twotoes and
 | 
			
		||||
          horns is yes) 
 | 
			
		||||
         (then species is horns))
 | 
			
		||||
   (rule (if genus is twotoes and
 | 
			
		||||
          horns is no) 
 | 
			
		||||
         (then species is nohorns))
 | 
			
		||||
   (question (variable horns)
 | 
			
		||||
             (query horns.query))
 | 
			
		||||
   (rule (if genus is onetoe and
 | 
			
		||||
          plating is yes) 
 | 
			
		||||
         (then type.animal is rhinoceros))
 | 
			
		||||
   (rule (if genus is onetoe and
 | 
			
		||||
          plating is no) 
 | 
			
		||||
         (then type.animal is horse.zebra))
 | 
			
		||||
   (question (variable plating)
 | 
			
		||||
             (query plating.query))
 | 
			
		||||
   (rule (if genus is water and
 | 
			
		||||
          hunted is yes) 
 | 
			
		||||
         (then type.animal is whale))
 | 
			
		||||
   (rule (if genus is water and
 | 
			
		||||
          hunted is no) 
 | 
			
		||||
         (then type.animal is dolphin.porpoise))
 | 
			
		||||
   (question (variable hunted)
 | 
			
		||||
             (query hunted.query))
 | 
			
		||||
   (rule (if genus is dry and
 | 
			
		||||
          front.teeth is yes) 
 | 
			
		||||
         (then species is teeth))
 | 
			
		||||
   (rule (if genus is dry and
 | 
			
		||||
          front.teeth is no) 
 | 
			
		||||
         (then species is noteeth))
 | 
			
		||||
   (question (variable front.teeth)
 | 
			
		||||
             (query front.teeth.query))
 | 
			
		||||
   (rule (if genus is noshell and
 | 
			
		||||
          bivalve is yes) 
 | 
			
		||||
         (then type.animal is clam.oyster))
 | 
			
		||||
   (rule (if genus is noshell and
 | 
			
		||||
          bivalve is no) 
 | 
			
		||||
         (then type.animal is squid.octopus))
 | 
			
		||||
   (question (variable bivalve)
 | 
			
		||||
             (query bivalve.query))
 | 
			
		||||
   (rule (if species is notail and
 | 
			
		||||
          nearly.hairless is yes) 
 | 
			
		||||
         (then type.animal is man))
 | 
			
		||||
   (rule (if species is notail and
 | 
			
		||||
          nearly.hairless is no) 
 | 
			
		||||
         (then subspecies is hair))
 | 
			
		||||
   (question (variable nearly.hairless)
 | 
			
		||||
             (query nearly.hairless.query))
 | 
			
		||||
   (rule (if species is 400 and
 | 
			
		||||
          land.based is yes) 
 | 
			
		||||
         (then type.animal is bear.tiger.lion))
 | 
			
		||||
   (rule (if species is 400 and
 | 
			
		||||
          land.based is no) 
 | 
			
		||||
         (then type.animal is walrus))
 | 
			
		||||
   (question (variable land.based)
 | 
			
		||||
             (query land.based.query))
 | 
			
		||||
   (rule (if species is under400 and
 | 
			
		||||
          thintail is yes) 
 | 
			
		||||
         (then type.animal is cat))
 | 
			
		||||
   (rule (if species is under400 and
 | 
			
		||||
          thintail is no) 
 | 
			
		||||
         (then type.animal is coyote.wolf.fox.dog))
 | 
			
		||||
   (question (variable thintail)
 | 
			
		||||
             (query thintail.query))
 | 
			
		||||
   (rule (if species is nohorns and
 | 
			
		||||
          lives.in.desert is yes) 
 | 
			
		||||
         (then type.animal is camel))
 | 
			
		||||
   (rule (if species is nohorns and
 | 
			
		||||
          lives.in.desert is no and
 | 
			
		||||
          semi.aquatic is no) 
 | 
			
		||||
         (then type.animal is giraffe))
 | 
			
		||||
   (rule (if species is nohorns and
 | 
			
		||||
          lives.in.desert is no and
 | 
			
		||||
          semi.aquatic is yes) 
 | 
			
		||||
         (then type.animal is hippopotamus))
 | 
			
		||||
   (question (variable lives.in.desert)
 | 
			
		||||
             (query lives.in.desert.query))
 | 
			
		||||
   (question (variable semi.aquatic)
 | 
			
		||||
             (query semi.aquatic.query))
 | 
			
		||||
   (rule (if species is teeth and
 | 
			
		||||
          large.ears is yes) 
 | 
			
		||||
         (then type.animal is rabbit))
 | 
			
		||||
   (rule (if species is teeth and
 | 
			
		||||
          large.ears is no)
 | 
			
		||||
         (then type.animal is rat.mouse.squirrel.beaver.porcupine))
 | 
			
		||||
   (question (variable large.ears)
 | 
			
		||||
             (query large.ears.query))
 | 
			
		||||
   (rule (if species is noteeth and
 | 
			
		||||
          pouch is yes) 
 | 
			
		||||
         (then type.animal is kangaroo.koala.bear))
 | 
			
		||||
   (rule (if species is noteeth and
 | 
			
		||||
          pouch is no) 
 | 
			
		||||
         (then type.animal is mole.shrew.elephant))
 | 
			
		||||
   (question (variable pouch)
 | 
			
		||||
             (query pouch.query))
 | 
			
		||||
   (rule (if subspecies is hair and
 | 
			
		||||
          long.powerful.arms is yes) 
 | 
			
		||||
         (then type.animal is orangutan.gorilla.chimpanzee))
 | 
			
		||||
   (rule (if subspecies is hair and
 | 
			
		||||
          long.powerful.arms is no) 
 | 
			
		||||
         (then type.animal is baboon))
 | 
			
		||||
   (question (variable long.powerful.arms)
 | 
			
		||||
             (query long.powerful.arms.query))
 | 
			
		||||
   (rule (if species is horns and
 | 
			
		||||
          fleece is yes) 
 | 
			
		||||
         (then type.animal is sheep.goat))
 | 
			
		||||
   (rule (if species is horns and
 | 
			
		||||
          fleece is no) 
 | 
			
		||||
         (then subsubspecies is nofleece))
 | 
			
		||||
   (question (variable fleece)
 | 
			
		||||
             (query fleece.query))
 | 
			
		||||
   (rule (if subsubspecies is nofleece and
 | 
			
		||||
          domesticated is yes) 
 | 
			
		||||
         (then type.animal is cow))
 | 
			
		||||
   (rule (if subsubspecies is nofleece and
 | 
			
		||||
          domesticated is no) 
 | 
			
		||||
         (then type.animal is deer.moose.antelope))
 | 
			
		||||
   (question (variable domesticated)
 | 
			
		||||
             (query domesticated.query))
 | 
			
		||||
   (answer (prefix "I think your animal is a ") (variable type.animal) (postfix ".")))
 | 
			
		||||
							
								
								
									
										281
									
								
								samples/CLIPS/sudoku.clp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										281
									
								
								samples/CLIPS/sudoku.clp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,281 @@
 | 
			
		||||
;;; http://www.angusj.com/sudoku/hints
 | 
			
		||||
;;; http://www.scanraid.com/BasicStrategies.htm
 | 
			
		||||
;;; http://www.sudokuoftheday.com/pages/techniques-overview
 | 
			
		||||
;;; http://www.sudokuonline.us/sudoku_solving_techniques
 | 
			
		||||
;;; http://www.sadmansoftware.com/sudoku/techniques.htm
 | 
			
		||||
;;; http://www.krazydad.com/blog/2005/09/29/an-index-of-sudoku-strategies/
 | 
			
		||||
 | 
			
		||||
;;; #######################
 | 
			
		||||
;;; DEFTEMPLATES & DEFFACTS
 | 
			
		||||
;;; #######################
 | 
			
		||||
 | 
			
		||||
(deftemplate possible
 | 
			
		||||
   (slot row)
 | 
			
		||||
   (slot column)
 | 
			
		||||
   (slot value)
 | 
			
		||||
   (slot group)
 | 
			
		||||
   (slot id))
 | 
			
		||||
   
 | 
			
		||||
(deftemplate impossible
 | 
			
		||||
   (slot id)
 | 
			
		||||
   (slot value)
 | 
			
		||||
   (slot priority)
 | 
			
		||||
   (slot reason))
 | 
			
		||||
   
 | 
			
		||||
(deftemplate technique-employed
 | 
			
		||||
   (slot reason)
 | 
			
		||||
   (slot priority))
 | 
			
		||||
 | 
			
		||||
(deftemplate technique
 | 
			
		||||
   (slot name)
 | 
			
		||||
   (slot priority))
 | 
			
		||||
   
 | 
			
		||||
(deffacts startup
 | 
			
		||||
   (phase grid-values))
 | 
			
		||||
 | 
			
		||||
(deftemplate size-value
 | 
			
		||||
   (slot size)
 | 
			
		||||
   (slot value))
 | 
			
		||||
   
 | 
			
		||||
(deffacts values
 | 
			
		||||
   (size-value (size 1) (value 1))
 | 
			
		||||
   (size-value (size 2) (value 2))
 | 
			
		||||
   (size-value (size 2) (value 3))
 | 
			
		||||
   (size-value (size 2) (value 4))
 | 
			
		||||
   (size-value (size 3) (value 5))
 | 
			
		||||
   (size-value (size 3) (value 6))
 | 
			
		||||
   (size-value (size 3) (value 7))
 | 
			
		||||
   (size-value (size 3) (value 8))
 | 
			
		||||
   (size-value (size 3) (value 9))
 | 
			
		||||
   (size-value (size 4) (value 10))
 | 
			
		||||
   (size-value (size 4) (value 11))
 | 
			
		||||
   (size-value (size 4) (value 12))
 | 
			
		||||
   (size-value (size 4) (value 13))
 | 
			
		||||
   (size-value (size 4) (value 14))
 | 
			
		||||
   (size-value (size 4) (value 15))
 | 
			
		||||
   (size-value (size 4) (value 16))
 | 
			
		||||
   (size-value (size 5) (value 17))
 | 
			
		||||
   (size-value (size 5) (value 18))
 | 
			
		||||
   (size-value (size 5) (value 19))
 | 
			
		||||
   (size-value (size 5) (value 20))
 | 
			
		||||
   (size-value (size 5) (value 21))
 | 
			
		||||
   (size-value (size 5) (value 22))
 | 
			
		||||
   (size-value (size 5) (value 23))
 | 
			
		||||
   (size-value (size 5) (value 24))
 | 
			
		||||
   (size-value (size 5) (value 25)))
 | 
			
		||||
   
 | 
			
		||||
;;; ###########
 | 
			
		||||
;;; SETUP RULES
 | 
			
		||||
;;; ###########
 | 
			
		||||
 | 
			
		||||
;;; ***********
 | 
			
		||||
;;; stress-test
 | 
			
		||||
;;; ***********
 | 
			
		||||
 | 
			
		||||
(defrule stress-test
 | 
			
		||||
   
 | 
			
		||||
   (declare (salience 10))
 | 
			
		||||
   
 | 
			
		||||
   (phase match)
 | 
			
		||||
   
 | 
			
		||||
   (stress-test)
 | 
			
		||||
   
 | 
			
		||||
   (priority ?last)
 | 
			
		||||
   
 | 
			
		||||
   (not (priority ?p&:(> ?p ?last)))
 | 
			
		||||
   
 | 
			
		||||
   (technique (priority ?next&:(> ?next ?last)))
 | 
			
		||||
   
 | 
			
		||||
   (not (technique (priority ?p&:(> ?p ?last)&:(< ?p ?next))))
 | 
			
		||||
   
 | 
			
		||||
   =>
 | 
			
		||||
   
 | 
			
		||||
   (assert (priority ?next)))
 | 
			
		||||
   
 | 
			
		||||
;;; *****************
 | 
			
		||||
;;; enable-techniques
 | 
			
		||||
;;; *****************
 | 
			
		||||
 | 
			
		||||
(defrule enable-techniques
 | 
			
		||||
 | 
			
		||||
   (declare (salience 10))
 | 
			
		||||
   
 | 
			
		||||
   (phase match)
 | 
			
		||||
   
 | 
			
		||||
   (size ?)
 | 
			
		||||
   
 | 
			
		||||
   (not (possible (value any)))
 | 
			
		||||
   
 | 
			
		||||
   =>
 | 
			
		||||
   
 | 
			
		||||
   (assert (priority 1)))
 | 
			
		||||
 | 
			
		||||
;;; **********
 | 
			
		||||
;;; expand-any
 | 
			
		||||
;;; **********
 | 
			
		||||
 | 
			
		||||
(defrule expand-any
 | 
			
		||||
 | 
			
		||||
   (declare (salience 10))
 | 
			
		||||
 | 
			
		||||
   (phase expand-any)
 | 
			
		||||
   
 | 
			
		||||
   ?f <- (possible (row ?r) (column ?c) (value any) (group ?g) (id ?id))
 | 
			
		||||
  
 | 
			
		||||
   (not (possible (value any) (id ?id2&:(< ?id2 ?id))))
 | 
			
		||||
   
 | 
			
		||||
   (size ?s)
 | 
			
		||||
   
 | 
			
		||||
   (size-value (size ?as&:(<= ?as ?s)) (value ?v))
 | 
			
		||||
   
 | 
			
		||||
   (not (possible (row ?r) (column ?c) (value ?v)))
 | 
			
		||||
  
 | 
			
		||||
   (not (and (size-value (value ?v2&:(< ?v2 ?v)))
 | 
			
		||||
               
 | 
			
		||||
             (not (possible (row ?r) (column ?c) (value ?v2)))))
 | 
			
		||||
   
 | 
			
		||||
   =>
 | 
			
		||||
   
 | 
			
		||||
   (assert (possible (row ?r) (column ?c) (value ?v) (group ?g) (id ?id))))
 | 
			
		||||
   
 | 
			
		||||
;;; *****************
 | 
			
		||||
;;; position-expanded
 | 
			
		||||
;;; *****************
 | 
			
		||||
 | 
			
		||||
(defrule position-expanded
 | 
			
		||||
 | 
			
		||||
   (declare (salience 10))
 | 
			
		||||
 | 
			
		||||
   (phase expand-any)
 | 
			
		||||
   
 | 
			
		||||
   ?f <- (possible (row ?r) (column ?c) (value any) (group ?g) (id ?id))
 | 
			
		||||
     
 | 
			
		||||
   (size ?s)
 | 
			
		||||
   
 | 
			
		||||
   (not (and (size-value (size ?as&:(<= ?as ?s)) (value ?v))
 | 
			
		||||
   
 | 
			
		||||
             (not (possible (row ?r) (column ?c) (value ?v)))))
 | 
			
		||||
 | 
			
		||||
   =>
 | 
			
		||||
   
 | 
			
		||||
   (retract ?f))
 | 
			
		||||
   
 | 
			
		||||
;;; ###########
 | 
			
		||||
;;; PHASE RULES
 | 
			
		||||
;;; ###########
 | 
			
		||||
 | 
			
		||||
;;; ***************
 | 
			
		||||
;;; expand-any-done
 | 
			
		||||
;;; ***************
 | 
			
		||||
 | 
			
		||||
(defrule expand-any-done
 | 
			
		||||
 | 
			
		||||
   (declare (salience 10))
 | 
			
		||||
 | 
			
		||||
   ?f <- (phase expand-any)
 | 
			
		||||
 | 
			
		||||
   (not (possible (value any)))
 | 
			
		||||
   
 | 
			
		||||
   =>
 | 
			
		||||
   
 | 
			
		||||
   (retract ?f)
 | 
			
		||||
   
 | 
			
		||||
   (assert (phase initial-output))
 | 
			
		||||
   (assert (print-position 1 1)))
 | 
			
		||||
   
 | 
			
		||||
;;; ***********
 | 
			
		||||
;;; begin-match
 | 
			
		||||
;;; ***********
 | 
			
		||||
 | 
			
		||||
(defrule begin-match
 | 
			
		||||
 | 
			
		||||
   (declare (salience -20))
 | 
			
		||||
   
 | 
			
		||||
   ?f <- (phase initial-output)
 | 
			
		||||
      
 | 
			
		||||
   =>
 | 
			
		||||
   
 | 
			
		||||
   (retract ?f)
 | 
			
		||||
   
 | 
			
		||||
   (assert (phase match)))
 | 
			
		||||
 | 
			
		||||
;;; *****************
 | 
			
		||||
;;; begin-elimination
 | 
			
		||||
;;; *****************
 | 
			
		||||
 | 
			
		||||
(defrule begin-elimination
 | 
			
		||||
 | 
			
		||||
   (declare (salience -20))
 | 
			
		||||
   
 | 
			
		||||
   ?f <- (phase match)
 | 
			
		||||
   
 | 
			
		||||
   (not (not (impossible)))
 | 
			
		||||
   
 | 
			
		||||
   =>
 | 
			
		||||
   
 | 
			
		||||
   (retract ?f)
 | 
			
		||||
   
 | 
			
		||||
   (assert (phase elimination)))
 | 
			
		||||
 | 
			
		||||
;;; *************
 | 
			
		||||
;;; next-priority
 | 
			
		||||
;;; *************
 | 
			
		||||
 | 
			
		||||
(defrule next-priority
 | 
			
		||||
 | 
			
		||||
   (declare (salience -20))
 | 
			
		||||
   
 | 
			
		||||
   (phase match)
 | 
			
		||||
   
 | 
			
		||||
   (not (impossible))
 | 
			
		||||
   
 | 
			
		||||
   (priority ?last)
 | 
			
		||||
   
 | 
			
		||||
   (not (priority ?p&:(> ?p ?last)))
 | 
			
		||||
   
 | 
			
		||||
   (technique (priority ?next&:(> ?next ?last)))
 | 
			
		||||
   
 | 
			
		||||
   (not (technique (priority ?p&:(> ?p ?last)&:(< ?p ?next))))
 | 
			
		||||
   
 | 
			
		||||
   =>
 | 
			
		||||
   
 | 
			
		||||
   (assert (priority ?next)))
 | 
			
		||||
 | 
			
		||||
;;; ************
 | 
			
		||||
;;; begin-output
 | 
			
		||||
;;; ************
 | 
			
		||||
 | 
			
		||||
(defrule begin-output
 | 
			
		||||
 | 
			
		||||
   (declare (salience -20))
 | 
			
		||||
   
 | 
			
		||||
   ?f <- (phase match)
 | 
			
		||||
   
 | 
			
		||||
   (not (impossible))
 | 
			
		||||
   
 | 
			
		||||
   (priority ?last)
 | 
			
		||||
   
 | 
			
		||||
   (not (priority ?p&:(> ?p ?last)))
 | 
			
		||||
 | 
			
		||||
   (not (technique (priority ?next&:(> ?next ?last))))
 | 
			
		||||
   
 | 
			
		||||
   =>
 | 
			
		||||
   
 | 
			
		||||
   (retract ?f)
 | 
			
		||||
   
 | 
			
		||||
   (assert (phase final-output))
 | 
			
		||||
   (assert (print-position 1 1)))
 | 
			
		||||
 | 
			
		||||
   
 | 
			
		||||
 | 
			
		||||
  
 | 
			
		||||
    
 | 
			
		||||
   
 | 
			
		||||
   
 | 
			
		||||
   
 | 
			
		||||
   
 | 
			
		||||
   
 | 
			
		||||
   
 | 
			
		||||
   
 | 
			
		||||
   
 | 
			
		||||
   
 | 
			
		||||
							
								
								
									
										133
									
								
								samples/Forth/tools.4TH
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										133
									
								
								samples/Forth/tools.4TH
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,133 @@
 | 
			
		||||
\ -*- forth -*- Copyright 2004, 2013 Lars Brinkhoff
 | 
			
		||||
 | 
			
		||||
( Tools words. )
 | 
			
		||||
 | 
			
		||||
: .s ( -- )
 | 
			
		||||
    [char] < emit  depth (.)  ." > "
 | 
			
		||||
    'SP @ >r r@ depth 1- cells +
 | 
			
		||||
    begin
 | 
			
		||||
	dup r@ <>
 | 
			
		||||
    while
 | 
			
		||||
	dup @ .
 | 
			
		||||
	/cell -
 | 
			
		||||
    repeat r> 2drop ;
 | 
			
		||||
 | 
			
		||||
: ?   @ . ;
 | 
			
		||||
 | 
			
		||||
: c?   c@ . ;
 | 
			
		||||
 | 
			
		||||
: dump   bounds do i ? /cell +loop cr ;
 | 
			
		||||
 | 
			
		||||
: cdump   bounds do i c? loop cr ;
 | 
			
		||||
 | 
			
		||||
: again   postpone branch , ; immediate
 | 
			
		||||
 | 
			
		||||
: see-find ( caddr -- end xt )
 | 
			
		||||
    >r here lastxt @
 | 
			
		||||
    begin
 | 
			
		||||
	dup 0= abort" Undefined word"
 | 
			
		||||
	dup r@ word= if r> drop exit then
 | 
			
		||||
	nip dup >nextxt
 | 
			
		||||
    again ;
 | 
			
		||||
 | 
			
		||||
: cabs ( char -- |char| )   dup 127 > if 256 swap - then ;
 | 
			
		||||
 | 
			
		||||
: xt. ( xt -- )
 | 
			
		||||
    ( >name ) count cabs type ;
 | 
			
		||||
 | 
			
		||||
: xt? ( xt -- flag )
 | 
			
		||||
    >r lastxt @ begin
 | 
			
		||||
	?dup
 | 
			
		||||
    while
 | 
			
		||||
	dup r@ = if r> 2drop -1 exit then
 | 
			
		||||
	>nextxt
 | 
			
		||||
    repeat r> drop 0 ;
 | 
			
		||||
 | 
			
		||||
: disassemble ( x -- )
 | 
			
		||||
    dup xt? if
 | 
			
		||||
        ( >name ) count
 | 
			
		||||
        dup 127 > if ." postpone " then
 | 
			
		||||
        cabs type
 | 
			
		||||
    else
 | 
			
		||||
        .
 | 
			
		||||
    then ;
 | 
			
		||||
 | 
			
		||||
: .addr  dup . ;
 | 
			
		||||
 | 
			
		||||
: see-line ( addr -- )
 | 
			
		||||
    cr ."     ( " .addr ." ) "  @ disassemble ;
 | 
			
		||||
 | 
			
		||||
: see-word ( end xt -- )
 | 
			
		||||
    >r ." : " r@ xt.
 | 
			
		||||
    r@ >body do i see-line /cell +loop
 | 
			
		||||
    ."  ;" r> c@ 127 > if ."  immediate" then ;
 | 
			
		||||
 | 
			
		||||
: see   bl word see-find see-word cr ;
 | 
			
		||||
 | 
			
		||||
: #body   bl word see-find >body - ;
 | 
			
		||||
 | 
			
		||||
: type-word ( end xt -- flag )
 | 
			
		||||
    xt. space drop 0 ;
 | 
			
		||||
 | 
			
		||||
: traverse-dictionary ( in.. xt -- out.. )
 | 
			
		||||
    \ xt execution: ( in.. end xt2 -- in.. 0 | in.. end xt2 -- out.. true )
 | 
			
		||||
    >r  here lastxt @  begin
 | 
			
		||||
	?dup
 | 
			
		||||
    while
 | 
			
		||||
	r> 2dup >r >r execute
 | 
			
		||||
	if r> r> 2drop exit then
 | 
			
		||||
	r> dup >nextxt
 | 
			
		||||
    repeat r> 2drop ;
 | 
			
		||||
 | 
			
		||||
: words ( -- )
 | 
			
		||||
    ['] type-word traverse-dictionary cr ;
 | 
			
		||||
 | 
			
		||||
\ ----------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
( Tools extension words. )
 | 
			
		||||
 | 
			
		||||
\ ;code
 | 
			
		||||
 | 
			
		||||
\ assembler
 | 
			
		||||
 | 
			
		||||
\ in kernel: bye
 | 
			
		||||
 | 
			
		||||
\ code
 | 
			
		||||
 | 
			
		||||
\ cs-pick
 | 
			
		||||
 | 
			
		||||
\ cs-roll
 | 
			
		||||
 | 
			
		||||
\ editor
 | 
			
		||||
 | 
			
		||||
: forget   ' dup >nextxt lastxt !  'here !  reveal ;
 | 
			
		||||
 | 
			
		||||
\ Kernel: state
 | 
			
		||||
 | 
			
		||||
\ [else]
 | 
			
		||||
 | 
			
		||||
\ [if]
 | 
			
		||||
 | 
			
		||||
\ [then]
 | 
			
		||||
 | 
			
		||||
\ ----------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
( Forth2012 tools extension words. )
 | 
			
		||||
 | 
			
		||||
\ TODO: n>r
 | 
			
		||||
 | 
			
		||||
\ TODO: nr>
 | 
			
		||||
 | 
			
		||||
\ TODO: synonym
 | 
			
		||||
 | 
			
		||||
: [undefined]   bl-word find nip 0= ; immediate
 | 
			
		||||
 | 
			
		||||
: [defined]   postpone [undefined] invert ; immediate
 | 
			
		||||
 | 
			
		||||
\ ----------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
: @+ ( addr -- addr+/cell x )   dup cell+ swap @ ;
 | 
			
		||||
 | 
			
		||||
: !+ ( x addr -- addr+/cell )   tuck ! cell+ ;
 | 
			
		||||
 | 
			
		||||
: -rot   swap >r swap r> ;
 | 
			
		||||
							
								
								
									
										69
									
								
								samples/Inno Setup/expat.iss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								samples/Inno Setup/expat.iss
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,69 @@
 | 
			
		||||
; Basic setup script for the Inno Setup installer builder.  For more
 | 
			
		||||
; information on the free installer builder, see www.jrsoftware.org.
 | 
			
		||||
;
 | 
			
		||||
; This script was contributed by Tim Peters.
 | 
			
		||||
; It was designed for Inno Setup 2.0.19 but works with later versions as well.
 | 
			
		||||
 | 
			
		||||
[Setup]
 | 
			
		||||
AppName=Expat
 | 
			
		||||
AppId=expat
 | 
			
		||||
AppVersion=2.1.0
 | 
			
		||||
AppVerName=Expat 2.1.0
 | 
			
		||||
AppCopyright=Copyright 1998-2012 Thai Open Source Software Center, Clark Cooper, and the Expat maintainers
 | 
			
		||||
AppPublisher=The Expat Developers
 | 
			
		||||
AppPublisherURL=http://www.libexpat.org/
 | 
			
		||||
AppSupportURL=http://www.libexpat.org/
 | 
			
		||||
AppUpdatesURL=http://www.libexpat.org/
 | 
			
		||||
UninstallDisplayName=Expat XML Parser 2.1.0
 | 
			
		||||
VersionInfoVersion=2.1.0
 | 
			
		||||
 | 
			
		||||
DefaultDirName={pf}\Expat 2.1.0
 | 
			
		||||
UninstallFilesDir={app}\Uninstall
 | 
			
		||||
 | 
			
		||||
Compression=lzma
 | 
			
		||||
SolidCompression=yes
 | 
			
		||||
SourceDir=..
 | 
			
		||||
OutputDir=win32
 | 
			
		||||
DisableStartupPrompt=yes
 | 
			
		||||
AllowNoIcons=yes
 | 
			
		||||
DisableProgramGroupPage=yes
 | 
			
		||||
DisableReadyPage=yes
 | 
			
		||||
 | 
			
		||||
[Files]
 | 
			
		||||
Flags: ignoreversion; Source: win32\bin\Release\xmlwf.exe;  DestDir: "{app}\Bin"
 | 
			
		||||
Flags: ignoreversion; Source: win32\MANIFEST.txt;           DestDir: "{app}"
 | 
			
		||||
Flags: ignoreversion; Source: Changes;                      DestDir: "{app}"; DestName: Changes.txt
 | 
			
		||||
Flags: ignoreversion; Source: COPYING;                      DestDir: "{app}"; DestName: COPYING.txt
 | 
			
		||||
Flags: ignoreversion; Source: README;                       DestDir: "{app}"; DestName: README.txt
 | 
			
		||||
Flags: ignoreversion; Source: doc\*.html;                   DestDir: "{app}\Doc"
 | 
			
		||||
Flags: ignoreversion; Source: doc\*.css;                    DestDir: "{app}\Doc"
 | 
			
		||||
Flags: ignoreversion; Source: doc\*.png;                    DestDir: "{app}\Doc"
 | 
			
		||||
Flags: ignoreversion; Source: win32\bin\Release\*.dll;      DestDir: "{app}\Bin"
 | 
			
		||||
Flags: ignoreversion; Source: win32\bin\Release\*.lib;      DestDir: "{app}\Bin"
 | 
			
		||||
Flags: ignoreversion; Source: expat.dsw;                    DestDir: "{app}\Source"
 | 
			
		||||
Flags: ignoreversion; Source: win32\README.txt;             DestDir: "{app}\Source"
 | 
			
		||||
Flags: ignoreversion; Source: bcb5\*.bp*;                   DestDir: "{app}\Source\bcb5"
 | 
			
		||||
Flags: ignoreversion; Source: bcb5\*.mak;                   DestDir: "{app}\Source\bcb5"
 | 
			
		||||
Flags: ignoreversion; Source: bcb5\*.def;                   DestDir: "{app}\Source\bcb5"
 | 
			
		||||
Flags: ignoreversion; Source: bcb5\*.txt;                   DestDir: "{app}\Source\bcb5"
 | 
			
		||||
Flags: ignoreversion; Source: bcb5\*.bat;                   DestDir: "{app}\Source\bcb5"
 | 
			
		||||
Flags: ignoreversion; Source: lib\*.c;                      DestDir: "{app}\Source\lib"
 | 
			
		||||
Flags: ignoreversion; Source: lib\*.h;                      DestDir: "{app}\Source\lib"
 | 
			
		||||
Flags: ignoreversion; Source: lib\*.def;                    DestDir: "{app}\Source\lib"
 | 
			
		||||
Flags: ignoreversion; Source: lib\*.dsp;                    DestDir: "{app}\Source\lib"
 | 
			
		||||
Flags: ignoreversion; Source: examples\*.c;                 DestDir: "{app}\Source\examples"
 | 
			
		||||
Flags: ignoreversion; Source: examples\*.dsp;               DestDir: "{app}\Source\examples"
 | 
			
		||||
Flags: ignoreversion; Source: tests\*.c;                    DestDir: "{app}\Source\tests"
 | 
			
		||||
Flags: ignoreversion; Source: tests\*.cpp;                  DestDir: "{app}\Source\tests"
 | 
			
		||||
Flags: ignoreversion; Source: tests\*.h;                    DestDir: "{app}\Source\tests"
 | 
			
		||||
Flags: ignoreversion; Source: tests\README.txt;             DestDir: "{app}\Source\tests"
 | 
			
		||||
Flags: ignoreversion; Source: tests\benchmark\*.c;          DestDir: "{app}\Source\tests\benchmark"
 | 
			
		||||
Flags: ignoreversion; Source: tests\benchmark\*.ds*;        DestDir: "{app}\Source\tests\benchmark"
 | 
			
		||||
Flags: ignoreversion; Source: tests\benchmark\README.txt;   DestDir: "{app}\Source\tests\benchmark"
 | 
			
		||||
Flags: ignoreversion; Source: xmlwf\*.c*;                   DestDir: "{app}\Source\xmlwf"
 | 
			
		||||
Flags: ignoreversion; Source: xmlwf\*.h;                    DestDir: "{app}\Source\xmlwf"
 | 
			
		||||
Flags: ignoreversion; Source: xmlwf\*.dsp;                  DestDir: "{app}\Source\xmlwf"
 | 
			
		||||
 | 
			
		||||
[Messages]
 | 
			
		||||
WelcomeLabel1=Welcome to the Expat XML Parser Setup Wizard
 | 
			
		||||
WelcomeLabel2=This will install [name/ver] on your computer.%n%nExpat is an XML parser with a C-language API, and is primarily made available to allow developers to build applications which use XML using a portable API and fast implementation.%n%nIt is strongly recommended that you close all other applications you have running before continuing. This will help prevent any conflicts during the installation process.
 | 
			
		||||
							
								
								
									
										73
									
								
								samples/J/stwij.ijs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								samples/J/stwij.ijs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,73 @@
 | 
			
		||||
NB. From "Continuing to write in J".
 | 
			
		||||
NB. See http://www.jsoftware.com/help/jforc/continuing_to_write_in_j.htm
 | 
			
		||||
 | 
			
		||||
empno=: 316 317 319 320
 | 
			
		||||
payrate=: 60 42 44 54
 | 
			
		||||
billrate=: 120 90 90 108
 | 
			
		||||
clientlist=: 10011 10012 10025
 | 
			
		||||
emp_client=: 10012 10025 10012 10025
 | 
			
		||||
hoursworked=: 4 31 $ 8 0 3 10 9 8 8 9 4 0 8 7 10 10 12 9 0 6 8 9 9 9 0 0 10 11 9 7 10 2 0 8 0 0 9 9 8 9 10 0 0 8 8 10 7 10 0 0 7 8 9 8 9 0 4 9 8 9 8 9 0 0 5 0 0 8 9 9 9 9 0 0 8 7 0 0 9 0 2 10 10 9 11 8 0 0 8 9 10 8 9 0 0 9 0 0 9 10 8 6 6 8 0 9 8 10 6 9 7 0 6 8 8 8 9 0 5 8 9 8 8 12 0 0
 | 
			
		||||
 | 
			
		||||
NB. Finds the number of hours each employee worked in the given month.
 | 
			
		||||
emphours=: 3 : '+/"1 hoursworked'
 | 
			
		||||
 | 
			
		||||
NB. Determines the wages earned by each employee in the given month.
 | 
			
		||||
empearnings=: 3 : 'payrate * +/"1 hoursworked'
 | 
			
		||||
 | 
			
		||||
NB. Determines the profit brought in by each employee.
 | 
			
		||||
empprofit=: 3 : 0
 | 
			
		||||
(billrate - payrate) * +/"1 hoursworked
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
NB. Returns the amount to bill a given client.
 | 
			
		||||
billclient=: 3 : 0
 | 
			
		||||
mask=. emp_client = y
 | 
			
		||||
+/ (mask # billrate) * +/"1 mask # hoursworked
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
NB. Finds for each day of the month the employee who billed the most hours.
 | 
			
		||||
dailydrudge=: 3 : 0
 | 
			
		||||
((|: hoursworked) i."1 0 >./ hoursworked) { empno
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
NB. Returns the employees, in descending order of the profit brought in by each.
 | 
			
		||||
producers=: 3 : 'empno \: empprofit 0'
 | 
			
		||||
 | 
			
		||||
NB. Returns the clients, in descending order of the profit generated by each.
 | 
			
		||||
custbyprofit=: 3 : 0
 | 
			
		||||
clientlist \: +/ (clientlist ="1 0 emp_client) * empprofit 0
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
NB. Calculates withholding tax on each employee's earnings.
 | 
			
		||||
renderuntocaesar=: 3 : 0
 | 
			
		||||
bktmin=. 0 6000 10000 20000     NB. Four brackets, 0..6000..10000..20000.._
 | 
			
		||||
bktrate=. 0.05 0.10 0.20 0.30
 | 
			
		||||
bktearns=. 0 >. ((1 |.!._ bktmin) <."1 0 empearnings'') -"1 bktmin
 | 
			
		||||
+/"1 bktrate *"1 bktearns
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
NB. Main
 | 
			
		||||
 | 
			
		||||
echo 'Problem 1'
 | 
			
		||||
echo emphours''
 | 
			
		||||
 | 
			
		||||
echo 'Problem 2'
 | 
			
		||||
echo empearnings''
 | 
			
		||||
 | 
			
		||||
echo 'Problem 3'
 | 
			
		||||
echo empprofit''
 | 
			
		||||
 | 
			
		||||
echo 'Problem 4'
 | 
			
		||||
echo billclient 10025
 | 
			
		||||
 | 
			
		||||
echo 'Problem 5'
 | 
			
		||||
echo dailydrudge''
 | 
			
		||||
 | 
			
		||||
echo 'Problem 6'
 | 
			
		||||
echo producers''
 | 
			
		||||
 | 
			
		||||
echo 'Problem 7'
 | 
			
		||||
echo custbyprofit''
 | 
			
		||||
 | 
			
		||||
echo 'Problem 8'
 | 
			
		||||
echo 0j2 ": renderuntocaesar''
 | 
			
		||||
							
								
								
									
										5281
									
								
								samples/Modelica/Translational.mo
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5281
									
								
								samples/Modelica/Translational.mo
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										285
									
								
								samples/Modelica/modelica.mo
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										285
									
								
								samples/Modelica/modelica.mo
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,285 @@
 | 
			
		||||
within Modelica.Electrical.Analog;
 | 
			
		||||
package Sensors "Potential, voltage, current, and power sensors"
 | 
			
		||||
 | 
			
		||||
  extends Modelica.Icons.SensorsPackage;
 | 
			
		||||
 | 
			
		||||
  model PotentialSensor "Sensor to measure the potential"
 | 
			
		||||
    extends Modelica.Icons.RotationalSensor;
 | 
			
		||||
 | 
			
		||||
    Interfaces.PositivePin p "pin to be measured" annotation (Placement(
 | 
			
		||||
          transformation(extent={{-110,-10},{-90,10}}, rotation=0)));
 | 
			
		||||
    Modelica.Blocks.Interfaces.RealOutput phi
 | 
			
		||||
      "Absolute voltage potential as output signal"
 | 
			
		||||
        annotation (Placement(transformation(extent={{100,-10},{120,10}},
 | 
			
		||||
            rotation=0)));
 | 
			
		||||
  equation
 | 
			
		||||
    p.i = 0;
 | 
			
		||||
    phi = p.v;
 | 
			
		||||
    annotation (
 | 
			
		||||
      Icon(coordinateSystem(
 | 
			
		||||
          preserveAspectRatio=true,
 | 
			
		||||
          extent={{-100,-100},{100,100}},
 | 
			
		||||
          grid={1,1}), graphics={
 | 
			
		||||
          Text(
 | 
			
		||||
            extent={{-29,-11},{30,-70}},
 | 
			
		||||
            lineColor={0,0,0},
 | 
			
		||||
            textString="V"),
 | 
			
		||||
          Line(points={{-70,0},{-90,0}}, color={0,0,0}),
 | 
			
		||||
          Line(points={{100,0},{70,0}}, color={0,0,255}),
 | 
			
		||||
          Text(
 | 
			
		||||
            extent={{-150,80},{150,120}},
 | 
			
		||||
            textString="%name",
 | 
			
		||||
            lineColor={0,0,255})}),
 | 
			
		||||
      Diagram(coordinateSystem(
 | 
			
		||||
          preserveAspectRatio=true,
 | 
			
		||||
          extent={{-100,-100},{100,100}},
 | 
			
		||||
          grid={1,1}), graphics={Line(points={{-70,0},{-96,0}}, color={0,0,0}),
 | 
			
		||||
            Line(points={{100,0},{70,0}}, color={0,0,255})}),
 | 
			
		||||
      Documentation(revisions="<html>
 | 
			
		||||
<ul>
 | 
			
		||||
<li><i> 1998   </i>
 | 
			
		||||
       by Christoph Clauss<br> initially implemented<br>
 | 
			
		||||
       </li>
 | 
			
		||||
</ul>
 | 
			
		||||
</html>", info="<html>
 | 
			
		||||
<p>The potential sensor converts the voltage of a node (with respect to the ground node) into a real valued signal. It does not influence the current sum at the node which voltage is measured, therefore, the electrical behavior is not influenced by the sensor.</p>
 | 
			
		||||
</html>"));
 | 
			
		||||
  end PotentialSensor;
 | 
			
		||||
 | 
			
		||||
  model VoltageSensor "Sensor to measure the voltage between two pins"
 | 
			
		||||
    extends Modelica.Icons.RotationalSensor;
 | 
			
		||||
 | 
			
		||||
    Interfaces.PositivePin p "positive pin" annotation (Placement(
 | 
			
		||||
          transformation(extent={{-110,-10},{-90,10}}, rotation=0)));
 | 
			
		||||
    Interfaces.NegativePin n "negative pin" annotation (Placement(
 | 
			
		||||
          transformation(extent={{90,-10},{110,10}}, rotation=0)));
 | 
			
		||||
    Modelica.Blocks.Interfaces.RealOutput v
 | 
			
		||||
      "Voltage between pin p and n (= p.v - n.v) as output signal"
 | 
			
		||||
       annotation (Placement(transformation(
 | 
			
		||||
          origin={0,-100},
 | 
			
		||||
          extent={{10,-10},{-10,10}},
 | 
			
		||||
          rotation=90)));
 | 
			
		||||
 | 
			
		||||
  equation
 | 
			
		||||
    p.i = 0;
 | 
			
		||||
    n.i = 0;
 | 
			
		||||
    v = p.v - n.v;
 | 
			
		||||
    annotation (
 | 
			
		||||
      Icon(coordinateSystem(
 | 
			
		||||
          preserveAspectRatio=true,
 | 
			
		||||
          extent={{-100,-100},{100,100}},
 | 
			
		||||
          grid={1,1}), graphics={
 | 
			
		||||
          Text(
 | 
			
		||||
            extent={{-29,-11},{30,-70}},
 | 
			
		||||
            lineColor={0,0,0},
 | 
			
		||||
            textString="V"),
 | 
			
		||||
          Line(points={{-70,0},{-90,0}}, color={0,0,0}),
 | 
			
		||||
          Line(points={{70,0},{90,0}}, color={0,0,0}),
 | 
			
		||||
          Line(points={{0,-90},{0,-70}}, color={0,0,255}),
 | 
			
		||||
          Text(
 | 
			
		||||
            extent={{-150,80},{150,120}},
 | 
			
		||||
            textString="%name",
 | 
			
		||||
            lineColor={0,0,255})}),
 | 
			
		||||
      Diagram(coordinateSystem(
 | 
			
		||||
          preserveAspectRatio=true,
 | 
			
		||||
          extent={{-100,-100},{100,100}},
 | 
			
		||||
          grid={1,1}), graphics={
 | 
			
		||||
          Line(points={{-70,0},{-96,0}}, color={0,0,0}),
 | 
			
		||||
          Line(points={{70,0},{96,0}}, color={0,0,0}),
 | 
			
		||||
          Line(points={{0,-90},{0,-70}}, color={0,0,255})}),
 | 
			
		||||
      Documentation(revisions="<html>
 | 
			
		||||
<ul>
 | 
			
		||||
<li><i> 1998   </i>
 | 
			
		||||
       by Christoph Clauss<br> initially implemented<br>
 | 
			
		||||
       </li>
 | 
			
		||||
</ul>
 | 
			
		||||
</html>", info="<html>
 | 
			
		||||
<p>The voltage  sensor converts the voltage between the two connectors into a real valued signal. It does not influence the current sum at the nodes in between the voltage is measured, therefore, the electrical behavior is not influenced by the sensor.</p>
 | 
			
		||||
</html>"));
 | 
			
		||||
  end VoltageSensor;
 | 
			
		||||
 | 
			
		||||
  model CurrentSensor "Sensor to measure the current in a branch"
 | 
			
		||||
    extends Modelica.Icons.RotationalSensor;
 | 
			
		||||
 | 
			
		||||
    Interfaces.PositivePin p "positive pin" annotation (Placement(
 | 
			
		||||
          transformation(extent={{-110,-10},{-90,10}}, rotation=0)));
 | 
			
		||||
    Interfaces.NegativePin n "negative pin" annotation (Placement(
 | 
			
		||||
          transformation(extent={{90,-10},{110,10}}, rotation=0)));
 | 
			
		||||
    Modelica.Blocks.Interfaces.RealOutput i
 | 
			
		||||
      "current in the branch from p to n as output signal"
 | 
			
		||||
       annotation (Placement(transformation(
 | 
			
		||||
          origin={0,-100},
 | 
			
		||||
          extent={{10,-10},{-10,10}},
 | 
			
		||||
          rotation=90)));
 | 
			
		||||
 | 
			
		||||
  equation
 | 
			
		||||
    p.v = n.v;
 | 
			
		||||
    p.i = i;
 | 
			
		||||
    n.i = -i;
 | 
			
		||||
    annotation (
 | 
			
		||||
      Icon(coordinateSystem(
 | 
			
		||||
          preserveAspectRatio=true,
 | 
			
		||||
          extent={{-100,-100},{100,100}},
 | 
			
		||||
          grid={1,1}), graphics={
 | 
			
		||||
          Text(
 | 
			
		||||
            extent={{-29,-11},{30,-70}},
 | 
			
		||||
            lineColor={0,0,0},
 | 
			
		||||
            textString="A"),
 | 
			
		||||
          Line(points={{-70,0},{-90,0}}, color={0,0,0}),
 | 
			
		||||
          Text(
 | 
			
		||||
            extent={{-150,80},{150,120}},
 | 
			
		||||
            textString="%name",
 | 
			
		||||
            lineColor={0,0,255}),
 | 
			
		||||
          Line(points={{70,0},{90,0}}, color={0,0,0}),
 | 
			
		||||
          Line(points={{0,-90},{0,-70}}, color={0,0,255})}),
 | 
			
		||||
      Diagram(coordinateSystem(
 | 
			
		||||
          preserveAspectRatio=true,
 | 
			
		||||
          extent={{-100,-100},{100,100}},
 | 
			
		||||
          grid={1,1}), graphics={
 | 
			
		||||
          Text(
 | 
			
		||||
            extent={{-153,79},{147,119}},
 | 
			
		||||
            textString="%name",
 | 
			
		||||
            lineColor={0,0,255}),
 | 
			
		||||
          Line(points={{-70,0},{-96,0}}, color={0,0,0}),
 | 
			
		||||
          Line(points={{70,0},{96,0}}, color={0,0,0}),
 | 
			
		||||
          Line(points={{0,-90},{0,-70}}, color={0,0,255})}),
 | 
			
		||||
      Documentation(revisions="<html>
 | 
			
		||||
<ul>
 | 
			
		||||
<li><i> 1998   </i>
 | 
			
		||||
       by Christoph Clauss<br> initially implemented<br>
 | 
			
		||||
       </li>
 | 
			
		||||
</ul>
 | 
			
		||||
</html>", info="<html>
 | 
			
		||||
<p>The current  sensor converts the current flowing between the two connectors into a real valued signal. The two connectors are in the sensor connected like a short cut. The sensor has to be placed within an electrical connection in series.  It does not influence the current sum at the connected nodes. Therefore, the electrical behavior is not influenced by the sensor.</p>
 | 
			
		||||
</html>"));
 | 
			
		||||
  end CurrentSensor;
 | 
			
		||||
 | 
			
		||||
model PowerSensor "Sensor to measure the power"
 | 
			
		||||
 | 
			
		||||
  Modelica.Electrical.Analog.Interfaces.PositivePin pc
 | 
			
		||||
      "Positive pin, current path"
 | 
			
		||||
    annotation (Placement(transformation(extent={{-90,-10},{-110,10}}, rotation=
 | 
			
		||||
             0)));
 | 
			
		||||
  Modelica.Electrical.Analog.Interfaces.NegativePin nc
 | 
			
		||||
      "Negative pin, current path"
 | 
			
		||||
    annotation (Placement(transformation(extent={{110,-10},{90,10}}, rotation=0)));
 | 
			
		||||
  Modelica.Electrical.Analog.Interfaces.PositivePin pv
 | 
			
		||||
      "Positive pin, voltage path"
 | 
			
		||||
    annotation (Placement(transformation(extent={{-10,110},{10,90}}, rotation=0)));
 | 
			
		||||
  Modelica.Electrical.Analog.Interfaces.NegativePin nv
 | 
			
		||||
      "Negative pin, voltage path"
 | 
			
		||||
    annotation (Placement(transformation(extent={{10,-110},{-10,-90}}, rotation=
 | 
			
		||||
             0)));
 | 
			
		||||
  Modelica.Blocks.Interfaces.RealOutput power
 | 
			
		||||
    annotation (Placement(transformation(
 | 
			
		||||
          origin={-80,-110},
 | 
			
		||||
          extent={{-10,10},{10,-10}},
 | 
			
		||||
          rotation=270)));
 | 
			
		||||
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltageSensor
 | 
			
		||||
    annotation (Placement(transformation(
 | 
			
		||||
          origin={0,-30},
 | 
			
		||||
          extent={{10,-10},{-10,10}},
 | 
			
		||||
          rotation=90)));
 | 
			
		||||
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
 | 
			
		||||
    annotation (Placement(transformation(extent={{-50,-10},{-30,10}}, rotation=
 | 
			
		||||
              0)));
 | 
			
		||||
  Modelica.Blocks.Math.Product product
 | 
			
		||||
    annotation (Placement(transformation(
 | 
			
		||||
          origin={-30,-50},
 | 
			
		||||
          extent={{-10,-10},{10,10}},
 | 
			
		||||
          rotation=270)));
 | 
			
		||||
 | 
			
		||||
equation
 | 
			
		||||
  connect(pv, voltageSensor.p) annotation (Line(points={{0,100},{0,-20},{
 | 
			
		||||
            6.12323e-016,-20}}, color={0,0,255}));
 | 
			
		||||
  connect(voltageSensor.n, nv) annotation (Line(points={{-6.12323e-016,-40},{
 | 
			
		||||
            -6.12323e-016,-63},{0,-63},{0,-100}}, color={0,0,255}));
 | 
			
		||||
  connect(pc, currentSensor.p)
 | 
			
		||||
    annotation (Line(points={{-100,0},{-50,0}}, color={0,0,255}));
 | 
			
		||||
  connect(currentSensor.n, nc)
 | 
			
		||||
    annotation (Line(points={{-30,0},{100,0}}, color={0,0,255}));
 | 
			
		||||
  connect(currentSensor.i, product.u2) annotation (Line(points={{-40,-10},{-40,
 | 
			
		||||
            -30},{-36,-30},{-36,-38}}, color={0,0,127}));
 | 
			
		||||
  connect(voltageSensor.v, product.u1) annotation (Line(points={{10,-30},{-24,
 | 
			
		||||
          -30},{-24,-38}},   color={0,0,127}));
 | 
			
		||||
  connect(product.y, power) annotation (Line(points={{-30,-61},{-30,-80},{-80,
 | 
			
		||||
            -80},{-80,-110}}, color={0,0,127}));
 | 
			
		||||
  annotation (Icon(coordinateSystem(
 | 
			
		||||
          preserveAspectRatio=true,
 | 
			
		||||
          extent={{-100,-100},{100,100}},
 | 
			
		||||
          grid={2,2}), graphics={
 | 
			
		||||
          Ellipse(
 | 
			
		||||
            extent={{-70,70},{70,-70}},
 | 
			
		||||
            lineColor={0,0,0},
 | 
			
		||||
            fillColor={255,255,255},
 | 
			
		||||
            fillPattern=FillPattern.Solid),
 | 
			
		||||
          Line(points={{0,100},{0,70}}, color={0,0,255}),
 | 
			
		||||
          Line(points={{0,-70},{0,-100}}, color={0,0,255}),
 | 
			
		||||
          Line(points={{-80,-100},{-80,0}}, color={0,0,255}),
 | 
			
		||||
          Line(points={{-100,0},{100,0}}, color={0,0,255}),
 | 
			
		||||
          Text(
 | 
			
		||||
            extent={{150,120},{-150,160}},
 | 
			
		||||
            textString="%name",
 | 
			
		||||
            lineColor={0,0,255}),
 | 
			
		||||
          Line(points={{0,70},{0,40}}, color={0,0,0}),
 | 
			
		||||
          Line(points={{22.9,32.8},{40.2,57.3}}, color={0,0,0}),
 | 
			
		||||
          Line(points={{-22.9,32.8},{-40.2,57.3}}, color={0,0,0}),
 | 
			
		||||
          Line(points={{37.6,13.7},{65.8,23.9}}, color={0,0,0}),
 | 
			
		||||
          Line(points={{-37.6,13.7},{-65.8,23.9}}, color={0,0,0}),
 | 
			
		||||
          Line(points={{0,0},{9.02,28.6}}, color={0,0,0}),
 | 
			
		||||
          Polygon(
 | 
			
		||||
            points={{-0.48,31.6},{18,26},{18,57.2},{-0.48,31.6}},
 | 
			
		||||
            lineColor={0,0,0},
 | 
			
		||||
            fillColor={0,0,0},
 | 
			
		||||
            fillPattern=FillPattern.Solid),
 | 
			
		||||
          Ellipse(
 | 
			
		||||
            extent={{-5,5},{5,-5}},
 | 
			
		||||
            lineColor={0,0,0},
 | 
			
		||||
            fillColor={0,0,0},
 | 
			
		||||
            fillPattern=FillPattern.Solid),
 | 
			
		||||
          Text(
 | 
			
		||||
            extent={{-29,-11},{30,-70}},
 | 
			
		||||
            lineColor={0,0,0},
 | 
			
		||||
            textString="P")}),
 | 
			
		||||
    Diagram(coordinateSystem(
 | 
			
		||||
          preserveAspectRatio=true,
 | 
			
		||||
          extent={{-100,-100},{100,100}},
 | 
			
		||||
          grid={2,2}), graphics),
 | 
			
		||||
    Documentation(info="<html>
 | 
			
		||||
<p>This power sensor measures instantaneous electrical power of a singlephase system and has a separated voltage and current path. The pins of the voltage path are pv and nv, the pins of the current path are pc and nc. The internal resistance of the current path is zero, the internal resistance of the voltage path is infinite.</p>
 | 
			
		||||
</html>", revisions="<html>
 | 
			
		||||
<ul>
 | 
			
		||||
<li><i>January 12, 2006</i> by Anton Haumer implemented</li>
 | 
			
		||||
</ul>
 | 
			
		||||
</html>"));
 | 
			
		||||
end PowerSensor;
 | 
			
		||||
  annotation (
 | 
			
		||||
    Documentation(info="<html>
 | 
			
		||||
<p>This package contains potential, voltage, and current sensors. The sensors can be used to convert voltages or currents into real signal values o be connected to components of the Blocks package. The sensors are designed in such a way that they do not influence the electrical behavior.</p>
 | 
			
		||||
</html>",
 | 
			
		||||
   revisions="<html>
 | 
			
		||||
<dl>
 | 
			
		||||
<dt>
 | 
			
		||||
<b>Main Authors:</b>
 | 
			
		||||
<dd>
 | 
			
		||||
Christoph Clauß
 | 
			
		||||
    <<a href=\"mailto:Christoph.Clauss@eas.iis.fraunhofer.de\">Christoph.Clauss@eas.iis.fraunhofer.de</a>><br>
 | 
			
		||||
    André Schneider
 | 
			
		||||
    <<a href=\"mailto:Andre.Schneider@eas.iis.fraunhofer.de\">Andre.Schneider@eas.iis.fraunhofer.de</a>><br>
 | 
			
		||||
    Fraunhofer Institute for Integrated Circuits<br>
 | 
			
		||||
    Design Automation Department<br>
 | 
			
		||||
    Zeunerstraße 38<br>
 | 
			
		||||
    D-01069 Dresden<br>
 | 
			
		||||
<p>
 | 
			
		||||
<dt>
 | 
			
		||||
<b>Copyright:</b>
 | 
			
		||||
<dd>
 | 
			
		||||
Copyright © 1998-2010, Modelica Association and Fraunhofer-Gesellschaft.<br>
 | 
			
		||||
<i>The Modelica package is <b>free</b> software; it can be redistributed and/or modified
 | 
			
		||||
under the terms of the <b>Modelica license</b>, see the license conditions
 | 
			
		||||
and the accompanying <b>disclaimer</b> in the documentation of package
 | 
			
		||||
Modelica in file \"Modelica/package.mo\".</i><br>
 | 
			
		||||
<p>
 | 
			
		||||
</dl>
 | 
			
		||||
</html>"));
 | 
			
		||||
end Sensors;
 | 
			
		||||
							
								
								
									
										3
									
								
								samples/Perl/use5.pl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								samples/Perl/use5.pl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
use Mojolicious::Lite;
 | 
			
		||||
use 5.20.0;
 | 
			
		||||
use experimental 'signatures';
 | 
			
		||||
							
								
								
									
										337
									
								
								samples/eC/Designer.ec
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										337
									
								
								samples/eC/Designer.ec
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,337 @@
 | 
			
		||||
import "ide"
 | 
			
		||||
 | 
			
		||||
class Designer : DesignerBase
 | 
			
		||||
{
 | 
			
		||||
   ~Designer()
 | 
			
		||||
   {
 | 
			
		||||
      if(GetActiveDesigner() == this)
 | 
			
		||||
      {
 | 
			
		||||
         SetActiveDesigner(null);
 | 
			
		||||
      }
 | 
			
		||||
      if(classDesigner)
 | 
			
		||||
         delete classDesigner;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   // *** DesignerBase Implementation ***
 | 
			
		||||
 | 
			
		||||
   void ModifyCode()
 | 
			
		||||
   {
 | 
			
		||||
      codeEditor.ModifyCode();
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   void UpdateProperties()
 | 
			
		||||
   {
 | 
			
		||||
      codeEditor.DesignerModifiedObject();
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   void CodeAddObject(Instance instance, ObjectInfo * object)
 | 
			
		||||
   {
 | 
			
		||||
      codeEditor.AddObject(instance, object);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   void SheetAddObject(ObjectInfo object)
 | 
			
		||||
   {
 | 
			
		||||
      codeEditor.sheet.AddObject(object, object.name, typeData, true); //className, true);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   void AddToolBoxClass(Class _class)
 | 
			
		||||
   {
 | 
			
		||||
      ((IDEWorkSpace)master).toolBox.AddControl(_class);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   void AddDefaultMethod(Instance instance, Instance classInstance)
 | 
			
		||||
   {
 | 
			
		||||
      Class _class = instance._class;
 | 
			
		||||
      Method defaultMethod = null;
 | 
			
		||||
 | 
			
		||||
      for( ; _class; _class = _class.base)
 | 
			
		||||
      {
 | 
			
		||||
         Method method;
 | 
			
		||||
         int minID = MAXINT;
 | 
			
		||||
         for(method = (Method)_class.methods.first; method; method = (Method)((BTNode)method).next)
 | 
			
		||||
         {
 | 
			
		||||
            if(method.type == virtualMethod)
 | 
			
		||||
            {
 | 
			
		||||
               if(!method.dataType)
 | 
			
		||||
                  method.dataType = ProcessTypeString(method.dataTypeString, false);
 | 
			
		||||
               if(method.vid < minID && (instance == classInstance || (method.dataType.thisClass && eClass_IsDerived(classInstance._class, method.dataType.thisClass.registered))))
 | 
			
		||||
               {
 | 
			
		||||
                  defaultMethod = method;
 | 
			
		||||
                  minID = method.vid;
 | 
			
		||||
               }
 | 
			
		||||
            }
 | 
			
		||||
         }
 | 
			
		||||
         if(defaultMethod)
 | 
			
		||||
            break;
 | 
			
		||||
      }
 | 
			
		||||
      codeEditor.AddMethod(defaultMethod);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   bool ObjectContainsCode(ObjectInfo object)
 | 
			
		||||
   {
 | 
			
		||||
      // Confirmation if control contains code
 | 
			
		||||
      if(object.instCode)
 | 
			
		||||
      {
 | 
			
		||||
         MembersInit members;
 | 
			
		||||
         if(object.instCode.members)
 | 
			
		||||
         {
 | 
			
		||||
            for(members = object.instCode.members->first; members; members = members.next)
 | 
			
		||||
            {
 | 
			
		||||
               if(members.type == methodMembersInit)
 | 
			
		||||
               {
 | 
			
		||||
                  //if(!Code_IsFunctionEmpty(members.function))
 | 
			
		||||
                  {
 | 
			
		||||
                     return true;
 | 
			
		||||
                  }
 | 
			
		||||
               }
 | 
			
		||||
            }
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
      return false;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   void DeleteObject(ObjectInfo object)
 | 
			
		||||
   {
 | 
			
		||||
      if(codeEditor)
 | 
			
		||||
         codeEditor.DeleteObject(object);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   void RenameObject(ObjectInfo object, const char * name)
 | 
			
		||||
   {
 | 
			
		||||
      if(object && (name || !object.classDefinition))
 | 
			
		||||
         codeEditor.RenameObject(object, name);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   bool FindObject(Instance * object, const char * string)
 | 
			
		||||
   {
 | 
			
		||||
      ObjectInfo classObject;
 | 
			
		||||
      for(classObject = codeEditor.classes.first; classObject; classObject = classObject.next)
 | 
			
		||||
      {
 | 
			
		||||
         ObjectInfo check;
 | 
			
		||||
         if(classObject.name && !strcmp(string, classObject.name))
 | 
			
		||||
         {
 | 
			
		||||
            *object = classObject.instance;
 | 
			
		||||
            break;
 | 
			
		||||
         }
 | 
			
		||||
         for(check = classObject.instances.first; check; check = check.next)
 | 
			
		||||
         {
 | 
			
		||||
            if(check.name && !strcmp(string, check.name))
 | 
			
		||||
            {
 | 
			
		||||
               *object = check.instance;
 | 
			
		||||
               break;
 | 
			
		||||
            }
 | 
			
		||||
         }
 | 
			
		||||
         if(check)
 | 
			
		||||
            return true;
 | 
			
		||||
      }
 | 
			
		||||
      return false;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   void SelectObjectFromDesigner(ObjectInfo object)
 | 
			
		||||
   {
 | 
			
		||||
      codeEditor.SelectObjectFromDesigner(object);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   borderStyle = sizable;
 | 
			
		||||
   isActiveClient = true;
 | 
			
		||||
   hasVertScroll = true;
 | 
			
		||||
   hasHorzScroll = true;
 | 
			
		||||
   hasClose = true;
 | 
			
		||||
   hasMaximize = true;
 | 
			
		||||
   hasMinimize = true;
 | 
			
		||||
   text = $"Designer";
 | 
			
		||||
   menu = Menu { };
 | 
			
		||||
   anchor = Anchor { left = 300, right = 150, top = 0, bottom = 0 };
 | 
			
		||||
 | 
			
		||||
   ToolBox toolBox;
 | 
			
		||||
   CodeEditor codeEditor;
 | 
			
		||||
 | 
			
		||||
   Menu fileMenu { menu, $"File", f };
 | 
			
		||||
   MenuItem fileSaveItem
 | 
			
		||||
   {
 | 
			
		||||
      fileMenu, $"Save", s, ctrlS;
 | 
			
		||||
      bool NotifySelect(MenuItem selection, Modifiers mods)
 | 
			
		||||
      {
 | 
			
		||||
         return codeEditor.MenuFileSave(selection, mods);
 | 
			
		||||
      }
 | 
			
		||||
   };
 | 
			
		||||
   MenuItem fileSaveAsItem
 | 
			
		||||
   {
 | 
			
		||||
      fileMenu, $"Save As...", a;
 | 
			
		||||
      bool NotifySelect(MenuItem selection, Modifiers mods)
 | 
			
		||||
      {
 | 
			
		||||
         return codeEditor.MenuFileSaveAs(selection, mods);
 | 
			
		||||
      }
 | 
			
		||||
   };
 | 
			
		||||
   bool debugClosing;
 | 
			
		||||
 | 
			
		||||
   bool OnClose(bool parentClosing)
 | 
			
		||||
   {
 | 
			
		||||
      if(!parentClosing)
 | 
			
		||||
      {
 | 
			
		||||
         if(codeEditor && codeEditor.inUseDebug && !debugClosing)
 | 
			
		||||
         {
 | 
			
		||||
            debugClosing = true;
 | 
			
		||||
            closing = false;
 | 
			
		||||
            if(CloseConfirmation(false))
 | 
			
		||||
            {
 | 
			
		||||
               visible = false;
 | 
			
		||||
               if(modifiedDocument)
 | 
			
		||||
                  OnFileModified({ modified = true }, null);
 | 
			
		||||
            }
 | 
			
		||||
            debugClosing = false;
 | 
			
		||||
            return false;
 | 
			
		||||
         }
 | 
			
		||||
         if(codeEditor && !codeEditor.closing && !debugClosing)
 | 
			
		||||
         {
 | 
			
		||||
            if(!codeEditor.visible)
 | 
			
		||||
            {
 | 
			
		||||
               if(!codeEditor.Destroy(0))
 | 
			
		||||
                  return false;
 | 
			
		||||
               else
 | 
			
		||||
                  codeEditor = null;
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
               visible = false;
 | 
			
		||||
               return false;
 | 
			
		||||
            }
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
      return true;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
 | 
			
		||||
   {
 | 
			
		||||
      if(active)
 | 
			
		||||
      {
 | 
			
		||||
         codeEditor.EnsureUpToDate();
 | 
			
		||||
         codeEditor.fixCaret = true;
 | 
			
		||||
         /*
 | 
			
		||||
         if(classDesigner)
 | 
			
		||||
            classDesigner.Activate();
 | 
			
		||||
         */
 | 
			
		||||
      }
 | 
			
		||||
      return true;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   bool OnKeyHit(Key key, unichar ch)
 | 
			
		||||
   {
 | 
			
		||||
      return codeEditor.sheet.OnKeyHit(key, ch);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   watch(modifiedDocument)
 | 
			
		||||
   {
 | 
			
		||||
      fileSaveItem.disabled = !modifiedDocument && codeEditor.fileName;
 | 
			
		||||
   };
 | 
			
		||||
 | 
			
		||||
   // *** METHODS ACCESSED FROM PROPERTY SHEET/TOOLBOX/CODE EDITOR ***
 | 
			
		||||
   void Reset()
 | 
			
		||||
   {
 | 
			
		||||
      if(classDesigner)
 | 
			
		||||
      {
 | 
			
		||||
         classDesigner.Reset();
 | 
			
		||||
         classDesigner.SelectObject(null, null);
 | 
			
		||||
         classDesigner.Destroy(0);
 | 
			
		||||
         delete classDesigner;
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   void FillToolBox()
 | 
			
		||||
   {
 | 
			
		||||
      if(this && classDesigner)
 | 
			
		||||
         classDesigner.ListToolBoxClasses(this);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   void SelectObject(ObjectInfo object, Instance instance)
 | 
			
		||||
   {
 | 
			
		||||
      ClassDesignerBase classDesigner = this.classDesigner;
 | 
			
		||||
#ifdef _DEBUG
 | 
			
		||||
      if(instance && instance._class.module.application != codeEditor.privateModule)
 | 
			
		||||
         printf("warning: SelectObject: instance._class.module.application != codeEditor.privateModule\n");
 | 
			
		||||
#endif
 | 
			
		||||
      if(!classDesigner || !instance || classDesigner._class != (Class)eInstance_GetDesigner(instance))
 | 
			
		||||
      {
 | 
			
		||||
         if(classDesigner)
 | 
			
		||||
         {
 | 
			
		||||
            classDesigner.SelectObject(null, null);
 | 
			
		||||
            classDesigner.Destroy(0);
 | 
			
		||||
            classDesigner = null;
 | 
			
		||||
            delete this.classDesigner;
 | 
			
		||||
         }
 | 
			
		||||
         if(instance)
 | 
			
		||||
         {
 | 
			
		||||
            this.classDesigner = classDesigner = eInstance_New(eInstance_GetDesigner(instance));
 | 
			
		||||
            incref classDesigner;
 | 
			
		||||
            //if(!classDesigner.parent)
 | 
			
		||||
            {
 | 
			
		||||
               classDesigner.parent = this;
 | 
			
		||||
               classDesigner.anchor = Anchor { left = 0, right = 0, top = 0, bottom = 0 };
 | 
			
		||||
            }
 | 
			
		||||
            classDesigner.Create();
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
      // Call class editor SelectObject
 | 
			
		||||
      if(classDesigner)
 | 
			
		||||
         classDesigner.SelectObject(object, instance);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   void AddObject()
 | 
			
		||||
   {
 | 
			
		||||
      // Call class editor AddObject
 | 
			
		||||
      if(classDesigner)
 | 
			
		||||
         classDesigner.AddObject();
 | 
			
		||||
      if(visible)
 | 
			
		||||
         Activate();
 | 
			
		||||
      else
 | 
			
		||||
         codeEditor.Activate();
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   void CreateObject(Instance instance, ObjectInfo object, bool isClass, Instance iclass)
 | 
			
		||||
   {
 | 
			
		||||
      subclass(ClassDesignerBase) designerClass = eInstance_GetDesigner(instance);
 | 
			
		||||
 | 
			
		||||
      // Call class editor CreateObject
 | 
			
		||||
      if(designerClass)
 | 
			
		||||
         designerClass.CreateObject(this, instance, object, isClass, iclass);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   void ::PostCreateObject(Instance instance, ObjectInfo object, bool isClass, Instance iclass)
 | 
			
		||||
   {
 | 
			
		||||
      subclass(ClassDesignerBase) designerClass = eInstance_GetDesigner(instance);
 | 
			
		||||
 | 
			
		||||
      // Call class editor PostCreateObject
 | 
			
		||||
      if(designerClass)
 | 
			
		||||
         designerClass.PostCreateObject(instance, object, isClass, iclass);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   void ::DroppedObject(Instance instance, ObjectInfo object, bool isClass, Instance iclass)
 | 
			
		||||
   {
 | 
			
		||||
      subclass(ClassDesignerBase) designerClass = eInstance_GetDesigner(instance);
 | 
			
		||||
 | 
			
		||||
      // Call class editor PostCreateObject
 | 
			
		||||
      if(designerClass)
 | 
			
		||||
         designerClass.DroppedObject(instance, object, isClass, iclass);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   void PrepareTestObject(Instance instance)
 | 
			
		||||
   {
 | 
			
		||||
      subclass(ClassDesignerBase) designerClass = eInstance_GetDesigner(instance);
 | 
			
		||||
      if(designerClass)
 | 
			
		||||
         designerClass.PrepareTestObject(this, instance);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   void ::DestroyObject(Instance instance)
 | 
			
		||||
   {
 | 
			
		||||
      subclass(ClassDesignerBase) designerClass = eInstance_GetDesigner(instance);
 | 
			
		||||
      if(designerClass)
 | 
			
		||||
         designerClass.DestroyObject(instance);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   void ::FixProperty(Property prop, Instance instance)
 | 
			
		||||
   {
 | 
			
		||||
      subclass(ClassDesignerBase) designerClass = eInstance_GetDesigner(instance);
 | 
			
		||||
      if(designerClass)
 | 
			
		||||
         designerClass.FixProperty(prop, instance);
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
@@ -1 +1 @@
 | 
			
		||||
; -*-Smalltalk-*-
 | 
			
		||||
; -*-mode:Smalltalk-*-
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								test/fixtures/Data/Modelines/iamphp.inc
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								test/fixtures/Data/Modelines/iamphp.inc
									
									
									
									
										vendored
									
									
								
							@@ -1 +1 @@
 | 
			
		||||
; -*- mode: php;-*-
 | 
			
		||||
; -*- MoDe: PhP;-*-
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								test/fixtures/Data/Modelines/not_perl.pl
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								test/fixtures/Data/Modelines/not_perl.pl
									
									
									
									
										vendored
									
									
								
							@@ -1,3 +1,3 @@
 | 
			
		||||
/* vim: set filetype=prolog: */
 | 
			
		||||
/* vim: set filEtype=pRoloG: */
 | 
			
		||||
 | 
			
		||||
# I am Prolog
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										57
									
								
								test/fixtures/Shell/crossbuild_liblua5.1
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								test/fixtures/Shell/crossbuild_liblua5.1
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,57 @@
 | 
			
		||||
#! /bin/sh
 | 
			
		||||
#
 | 
			
		||||
# Builds and installs liblua5.1 for the cross toolchain.
 | 
			
		||||
# Executed by build-uqm-dependencies.chroot
 | 
			
		||||
 | 
			
		||||
# Include our common functions
 | 
			
		||||
. /usr/lib/crossbuild/crossbuild.subr
 | 
			
		||||
 | 
			
		||||
# envvar LIBLUA51_URL
 | 
			
		||||
#
 | 
			
		||||
# Specifies the URL of the liblua5.1 source tarball you want to use.
 | 
			
		||||
export LIBLUA51_URL="http://www.lua.org/ftp/lua-5.1.5.tar.gz"
 | 
			
		||||
 | 
			
		||||
# envvar INSTALL_TOP
 | 
			
		||||
#
 | 
			
		||||
# This determines where lua's makefiles install everything (we don't want to use
 | 
			
		||||
# /usr/local!).
 | 
			
		||||
export INSTALL_TOP="/usr/${HOST_TRIPLET}"
 | 
			
		||||
 | 
			
		||||
# envvar TO_BIN
 | 
			
		||||
#
 | 
			
		||||
# Names of the binary files to install (that's right, lua's makefiles don't
 | 
			
		||||
# determine this automatically, and since we end up with files named according
 | 
			
		||||
# to Windows conventions the install chokes without these)
 | 
			
		||||
export TO_BIN="lua.exe luac.exe"
 | 
			
		||||
 | 
			
		||||
# envvar TO_LIB
 | 
			
		||||
#
 | 
			
		||||
# Names of the libraries to install, see TO_BIN
 | 
			
		||||
export TO_LIB="liblua.a lua51.dll"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# liblua5.1 uses custom makefiles and does not natively support cross-building.
 | 
			
		||||
# However, with our cross toolchain in its PATH it successfully builds the mingw
 | 
			
		||||
# target.
 | 
			
		||||
export PATH=/usr/${HOST_TRIPLET}/bin:${PATH}
 | 
			
		||||
 | 
			
		||||
echo "*************************************************************************"
 | 
			
		||||
echo "--- BEGIN: crossbuild_liblua5.1 ---"
 | 
			
		||||
 | 
			
		||||
get_tarball "liblua5.1" "${LIBLUA51_URL}" gz
 | 
			
		||||
 | 
			
		||||
cd ${SRC_ROOT_DIR}/liblua5.1/*
 | 
			
		||||
 | 
			
		||||
if [ -f Makefile ]; then
 | 
			
		||||
  make clean
 | 
			
		||||
  make --environment-overrides mingw install
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
else
 | 
			
		||||
  echo "crossbuild_liblua5.1 failed: Could not find Makefile"
 | 
			
		||||
  echo "(is the liblua5.1 source tarball sane?)"
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
echo "--- END: crossbuild_liblua5.1 ---"
 | 
			
		||||
echo "*************************************************************************"
 | 
			
		||||
							
								
								
									
										99
									
								
								test/fixtures/Shell/graylog2-server.init.d
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										99
									
								
								test/fixtures/Shell/graylog2-server.init.d
									
									
									
									
										vendored
									
									
										Executable file
									
								
							@@ -0,0 +1,99 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
### BEGIN INIT INFO
 | 
			
		||||
# Provides:        graylog2-server
 | 
			
		||||
# Required-Start:  $network
 | 
			
		||||
# Required-Stop:   $network
 | 
			
		||||
# Default-Start:   2 3 4 5
 | 
			
		||||
# Default-Stop:    1
 | 
			
		||||
# Short-Description: Start Graylog2 server
 | 
			
		||||
### END INIT INFO
 | 
			
		||||
 | 
			
		||||
# Written by Lital Natan <litaln@gmail.com>
 | 
			
		||||
 | 
			
		||||
PREFIX=/usr
 | 
			
		||||
SHAREDIR=$PREFIX/share/graylog2-server
 | 
			
		||||
SERVER_JAR=$SHAREDIR/graylog2-server.jar
 | 
			
		||||
SYSLOG4J_JAR=$SHAREDIR/syslog4j-0.9.46-bin.jar
 | 
			
		||||
SVCNAME="graylog2-server"
 | 
			
		||||
 | 
			
		||||
CONFIG="/etc/graylog2.conf"
 | 
			
		||||
LOGFILE="/var/log/graylog2.log"
 | 
			
		||||
PIDFILE="/var/run/graylog2.pid"
 | 
			
		||||
 | 
			
		||||
start() {
 | 
			
		||||
    if [ ! -e $CONFIG ]; then
 | 
			
		||||
        echo "Config file $CONFIG does not exist"
 | 
			
		||||
        return 1
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    echo "Starting ${SVCNAME}"
 | 
			
		||||
        nohup `which java` -cp $SERVER_JAR:$SYSLOG4J_JAR org.graylog2.Main \
 | 
			
		||||
      -p ${PIDFILE} -f ${CONFIG} > $LOGFILE 2>&1 &
 | 
			
		||||
 | 
			
		||||
    # Sleep before testing the service
 | 
			
		||||
    sleep 2
 | 
			
		||||
 | 
			
		||||
    graylog2_test || return 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
stop() {
 | 
			
		||||
    pid=`< $PIDFILE`
 | 
			
		||||
    kill $pid
 | 
			
		||||
    rm -f ${PIDFILE} # just in case
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
graylog2_test() {
 | 
			
		||||
    # Graylog2 only deletes its PID file if it hits a config error
 | 
			
		||||
    if [ ! -e ${PIDFILE} ]; then
 | 
			
		||||
        echo "Configuration error, check ${CONFIG}"
 | 
			
		||||
        return 1
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    local pid=`cat ${PIDFILE}`
 | 
			
		||||
 | 
			
		||||
    # Graylog2 isn't running, so that means there was a problem
 | 
			
		||||
    if [ ! -e /proc/$pid ]; then
 | 
			
		||||
        echo "Something went wrong, check ${LOGFILE}"
 | 
			
		||||
        rm -f ${PIDFILE}
 | 
			
		||||
        return 1
 | 
			
		||||
    else
 | 
			
		||||
        return 0
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
status() {
 | 
			
		||||
    graylog2_test > /dev/null 2>&1
 | 
			
		||||
    if [ "$?" == "0" ]; then
 | 
			
		||||
       echo "Graylog2 server is up"
 | 
			
		||||
       return 0
 | 
			
		||||
    else
 | 
			
		||||
       echo "Graylog2 server is down"
 | 
			
		||||
       return 1
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
restart() {
 | 
			
		||||
    stop
 | 
			
		||||
    start
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
case "$1" in
 | 
			
		||||
    start)
 | 
			
		||||
  start
 | 
			
		||||
  ;;
 | 
			
		||||
    stop)
 | 
			
		||||
  stop
 | 
			
		||||
  ;;
 | 
			
		||||
    status)
 | 
			
		||||
        status
 | 
			
		||||
        ;;
 | 
			
		||||
    restart)
 | 
			
		||||
  restart
 | 
			
		||||
  ;;
 | 
			
		||||
    *)
 | 
			
		||||
  echo "Usage $0 {start|stop|restart|status}"
 | 
			
		||||
  RETVAL=1
 | 
			
		||||
esac
 | 
			
		||||
@@ -439,6 +439,54 @@ class TestBlob < Minitest::Test
 | 
			
		||||
    assert sample_blob("activator.bat").vendored?
 | 
			
		||||
    assert sample_blob("subproject/activator").vendored?
 | 
			
		||||
    assert sample_blob("subproject/activator.bat").vendored?
 | 
			
		||||
 | 
			
		||||
    assert_predicate fixture_blob(".google_apis/bar.jar"), :vendored?
 | 
			
		||||
    assert_predicate fixture_blob("foo/.google_apis/bar.jar"), :vendored?
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_documentation
 | 
			
		||||
    assert_predicate fixture_blob("doc/foo.html"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("docs/foo.html"), :documentation?
 | 
			
		||||
    refute_predicate fixture_blob("project/doc/foo.html"), :documentation?
 | 
			
		||||
    refute_predicate fixture_blob("project/docs/foo.html"), :documentation?
 | 
			
		||||
 | 
			
		||||
    assert_predicate fixture_blob("Documentation/foo.md"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("documentation/foo.md"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("project/Documentation/foo.md"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("project/documentation/foo.md"), :documentation?
 | 
			
		||||
 | 
			
		||||
    assert_predicate fixture_blob("javadoc/foo.html"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("project/javadoc/foo.html"), :documentation?
 | 
			
		||||
 | 
			
		||||
    assert_predicate fixture_blob("man/foo.html"), :documentation?
 | 
			
		||||
    refute_predicate fixture_blob("project/man/foo.html"), :documentation?
 | 
			
		||||
 | 
			
		||||
    assert_predicate fixture_blob("README"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("README.md"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("README.txt"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("foo/README"), :documentation?
 | 
			
		||||
 | 
			
		||||
    assert_predicate fixture_blob("CONTRIBUTING"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("CONTRIBUTING.md"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("CONTRIBUTING.txt"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("foo/CONTRIBUTING"), :documentation?
 | 
			
		||||
 | 
			
		||||
    assert_predicate fixture_blob("LICENSE"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("LICENCE.md"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("LICENSE.txt"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("foo/LICENSE"), :documentation?
 | 
			
		||||
 | 
			
		||||
    assert_predicate fixture_blob("COPYING"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("COPYING.md"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("COPYING.txt"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("foo/COPYING"), :documentation?
 | 
			
		||||
 | 
			
		||||
    assert_predicate fixture_blob("INSTALL"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("INSTALL.md"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("INSTALL.txt"), :documentation?
 | 
			
		||||
    assert_predicate fixture_blob("foo/INSTALL"), :documentation?
 | 
			
		||||
 | 
			
		||||
    refute_predicate fixture_blob("foo.md"), :documentation?
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_language
 | 
			
		||||
@@ -485,4 +533,29 @@ class TestBlob < Minitest::Test
 | 
			
		||||
    refute blob.new(" ").empty?
 | 
			
		||||
    refute blob.new("nope").empty?
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_include_in_language_stats
 | 
			
		||||
    vendored = sample_blob("bower_components/custom/custom.js")
 | 
			
		||||
    assert_predicate vendored, :vendored?
 | 
			
		||||
    refute_predicate vendored, :include_in_language_stats?
 | 
			
		||||
 | 
			
		||||
    documentation = fixture_blob("README")
 | 
			
		||||
    assert_predicate documentation, :documentation?
 | 
			
		||||
    refute_predicate documentation, :include_in_language_stats?
 | 
			
		||||
 | 
			
		||||
    generated = sample_blob("CSS/bootstrap.min.css")
 | 
			
		||||
    assert_predicate generated, :generated?
 | 
			
		||||
    refute_predicate generated, :include_in_language_stats?
 | 
			
		||||
 | 
			
		||||
    data = sample_blob("Ant Build System/filenames/ant.xml")
 | 
			
		||||
    assert_equal :data, data.language.type
 | 
			
		||||
    refute_predicate data, :include_in_language_stats?
 | 
			
		||||
 | 
			
		||||
    prose = sample_blob("Markdown/tender.md")
 | 
			
		||||
    assert_equal :prose, prose.language.type
 | 
			
		||||
    refute_predicate prose, :include_in_language_stats?
 | 
			
		||||
 | 
			
		||||
    included = sample_blob("HTML/pages.html")
 | 
			
		||||
    assert_predicate included, :include_in_language_stats?
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -3,12 +3,18 @@ require_relative "./helper"
 | 
			
		||||
class TestGrammars < Minitest::Test
 | 
			
		||||
  ROOT = File.expand_path("../..", __FILE__)
 | 
			
		||||
 | 
			
		||||
  # These grammars have no license but have been grandfathered in. New grammars
 | 
			
		||||
  # must have a license that allows redistribution.
 | 
			
		||||
  UNLICENSED_GRAMMARS_WHITELIST = %w[
 | 
			
		||||
    vendor/grammars/Sublime-Lasso
 | 
			
		||||
    vendor/grammars/Sublime-REBOL
 | 
			
		||||
    vendor/grammars/x86-assembly-textmate-bundle
 | 
			
		||||
  LICENSE_WHITELIST = [
 | 
			
		||||
    # This grammar's MIT license is inside a subdirectory.
 | 
			
		||||
    "vendor/grammars/SublimePapyrus",
 | 
			
		||||
 | 
			
		||||
    # This grammar has a nonstandard but acceptable license.
 | 
			
		||||
    "vendor/grammars/gap-tmbundle",
 | 
			
		||||
 | 
			
		||||
    # These grammars have no license but have been grandfathered in. New grammars
 | 
			
		||||
    # must have a license that allows redistribution.
 | 
			
		||||
    "vendor/grammars/Sublime-Lasso",
 | 
			
		||||
    "vendor/grammars/Sublime-REBOL",
 | 
			
		||||
    "vendor/grammars/x86-assembly-textmate-bundle",
 | 
			
		||||
  ].freeze
 | 
			
		||||
 | 
			
		||||
  def setup
 | 
			
		||||
@@ -77,9 +83,9 @@ class TestGrammars < Minitest::Test
 | 
			
		||||
 | 
			
		||||
    unlicensed = categories[:unlicensed] || []
 | 
			
		||||
    unrecognized = categories[:unrecognized] || []
 | 
			
		||||
    disallowed_unlicensed = unlicensed - UNLICENSED_GRAMMARS_WHITELIST
 | 
			
		||||
    disallowed_unrecognized = unrecognized - UNLICENSED_GRAMMARS_WHITELIST
 | 
			
		||||
    extra_whitelist_entries = UNLICENSED_GRAMMARS_WHITELIST - (unlicensed | unrecognized)
 | 
			
		||||
    disallowed_unlicensed = unlicensed - LICENSE_WHITELIST
 | 
			
		||||
    disallowed_unrecognized = unrecognized - LICENSE_WHITELIST
 | 
			
		||||
    extra_whitelist_entries = LICENSE_WHITELIST - (unlicensed | unrecognized)
 | 
			
		||||
 | 
			
		||||
    message = ""
 | 
			
		||||
    if disallowed_unlicensed.any?
 | 
			
		||||
@@ -93,7 +99,7 @@ class TestGrammars < Minitest::Test
 | 
			
		||||
    end
 | 
			
		||||
    if extra_whitelist_entries.any?
 | 
			
		||||
      message << "\n\n" unless message.empty?
 | 
			
		||||
      message << "The following grammar submodules are listed in UNLICENSED_GRAMMARS_WHITELIST but either have a license (yay!)\n"
 | 
			
		||||
      message << "The following grammar submodules are listed in LICENSE_WHITELIST but either have a license (yay!)\n"
 | 
			
		||||
      message << "or have been removed from the repository. Please remove them from the whitelist.\n"
 | 
			
		||||
      message << extra_whitelist_entries.sort.join("\n")
 | 
			
		||||
    end
 | 
			
		||||
@@ -131,6 +137,8 @@ class TestGrammars < Minitest::Test
 | 
			
		||||
      "unlicense"
 | 
			
		||||
    elsif content.include?("http://www.wtfpl.net/txt/copying/")
 | 
			
		||||
      "WTFPL"
 | 
			
		||||
    elsif content.include?("zlib") && content.include?("license") && content.include?("2. Altered source versions must be plainly marked as such")
 | 
			
		||||
      "zlib"
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -48,7 +48,7 @@ class TestHeuristcs < Minitest::Test
 | 
			
		||||
  def test_pl_prolog_perl_by_heuristics
 | 
			
		||||
    assert_heuristics({
 | 
			
		||||
      "Prolog" => "Prolog/turing.pl",
 | 
			
		||||
      "Perl" => "Perl/perl-test.t",
 | 
			
		||||
      "Perl" => ["Perl/perl-test.t", "Perl/use5.pl"]
 | 
			
		||||
    })
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
@@ -68,11 +68,12 @@ class TestHeuristcs < Minitest::Test
 | 
			
		||||
    })
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  # Candidate languages = ["AGS Script", "AsciiDoc"]
 | 
			
		||||
  def test_asc_asciidoc_by_heuristics
 | 
			
		||||
  # Candidate languages = ["AGS Script", "AsciiDoc", "Public Key"]
 | 
			
		||||
  def test_asc_by_heuristics
 | 
			
		||||
    assert_heuristics({
 | 
			
		||||
      "AsciiDoc" => "AsciiDoc/list.asc",
 | 
			
		||||
      "AGS Script" => nil
 | 
			
		||||
      "AGS Script" => "AGS Script/GlobalScript.asc",
 | 
			
		||||
      "Public Key" => "Public Key/sunCert.asc"
 | 
			
		||||
    })
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -99,4 +99,16 @@ class TestRepository < Minitest::Test
 | 
			
		||||
    # overridden .gitattributes
 | 
			
		||||
    assert !override_unvendored.vendored?
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_linguist_override_documentation?
 | 
			
		||||
    attr_commit = "d4c8fb8a28e91f97a7e53428a365c0abbac36d3d"
 | 
			
		||||
    repo = linguist_repo(attr_commit).read_index
 | 
			
		||||
 | 
			
		||||
    readme = Linguist::LazyBlob.new(rugged_repository, attr_commit, "README.md")
 | 
			
		||||
    arduino = Linguist::LazyBlob.new(rugged_repository, attr_commit, "samples/Arduino/hello.ino")
 | 
			
		||||
 | 
			
		||||
    # overridden by .gitattributes
 | 
			
		||||
    refute_predicate readme, :documentation?
 | 
			
		||||
    assert_predicate arduino, :documentation?
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/grammars/AutoHotkey
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/AutoHotkey
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/AutoHotkey updated: 371f9b2307...9b42c86e75
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/BrightScript.tmbundle
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/BrightScript.tmbundle
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/BrightScript.tmbundle added at 905791b02b
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/CLIPS-sublime
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/CLIPS-sublime
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/CLIPS-sublime added at f6904baa78
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/Creole
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/Creole
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/Creole added at bac4656c8d
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/G-Code
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/G-Code
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/G-Code added at 81e8b03e3d
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/GDScript-sublime
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/GDScript-sublime
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/GDScript-sublime added at 44ac5c4af2
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/InnoSetup
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/InnoSetup
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/InnoSetup added at 875ba96c32
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/JSyntax
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/JSyntax
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/JSyntax added at 74971149b5
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/Modelica
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/Modelica
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/Modelica added at e1fd853290
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/NimLime
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/NimLime
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/NimLime updated: 1be33dac08...fac6b182e8
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/PogoScript.tmbundle
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/PogoScript.tmbundle
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/PogoScript.tmbundle added at 2255586f9e
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/Stylus
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/Stylus
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/Stylus added at b9214d1ffd
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/Sublime-SQF-Language
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/Sublime-SQF-Language
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/Sublime-SQF-Language updated: 708c78a0ba...0313fbe6fb
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/SublimePapyrus
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/SublimePapyrus
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/SublimePapyrus added at 27313007d9
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/TXL
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/TXL
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/TXL added at c1c98dfa86
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/actionscript3-tmbundle
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/actionscript3-tmbundle
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/actionscript3-tmbundle updated: d69fcc8884...d24ad7dec9
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/asciidoc.tmbundle
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/asciidoc.tmbundle
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/asciidoc.tmbundle added at 28063ea46c
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/ats.sublime
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/ats.sublime
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/ats.sublime added at 2565468fd4
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/c.tmbundle
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/c.tmbundle
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/c.tmbundle updated: f825425262...f6048afe69
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/ceylon-sublimetext
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/ceylon-sublimetext
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/ceylon-sublimetext updated: a81ad702b4...070298013e
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/dart-sublime-bundle
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/dart-sublime-bundle
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/dart-sublime-bundle updated: fecdbc5f24...d55b1d4278
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/ec.tmbundle
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/ec.tmbundle
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/ec.tmbundle added at b8ec2d32af
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/elixir-tmbundle
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/elixir-tmbundle
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/elixir-tmbundle updated: dcf1fc125c...9c63ff09bd
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/factor
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/factor
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/factor updated: 14b3261bef...ec896cd5ad
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/fsharpbinding
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/fsharpbinding
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/fsharpbinding updated: f8dd50c35c...0cd6439b51
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/gap-tmbundle
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/gap-tmbundle
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/gap-tmbundle added at 291a0469dd
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/grace-tmbundle
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/grace-tmbundle
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/grace-tmbundle added at acbf9a247c
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/haxe-sublime-bundle
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/haxe-sublime-bundle
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/haxe-sublime-bundle updated: 6359431d88...50c5aa0e10
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/java.tmbundle
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/java.tmbundle
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/java.tmbundle updated: a74cb835b8...ccdebdf888
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/javadoc.tmbundle
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/javadoc.tmbundle
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/javadoc.tmbundle updated: 484d468f47...5276d7a93f
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/language-csharp
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/language-csharp
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/language-csharp updated: fba368a839...d07ba8f168
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/language-gfm
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/language-gfm
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/language-gfm updated: 18400b22cd...5f5df3064c
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/language-javascript
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/language-javascript
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/language-javascript updated: ac37d2a87c...d58edec655
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/language-python
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/language-python
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/language-python updated: 0141d44946...8daa10089a
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/latex.tmbundle
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/latex.tmbundle
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/latex.tmbundle updated: 2e8d7c9397...669040b893
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/mako-tmbundle
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/mako-tmbundle
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/mako-tmbundle updated: e039636f3d...da79638669
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/mediawiki.tmbundle
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/mediawiki.tmbundle
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/mediawiki.tmbundle added at f8dead507a
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/mercury-tmlanguage
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/mercury-tmlanguage
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/mercury-tmlanguage updated: eaef0b0643...1cb8e94922
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/objective-c.tmbundle
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/objective-c.tmbundle
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/objective-c.tmbundle updated: 33c6be4028...1bade8a1c9
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/php.tmbundle
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/php.tmbundle
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/php.tmbundle updated: 1ae104d86b...7178a102ce
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/sublime-apl
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/sublime-apl
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/sublime-apl added at a8c36775d5
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/sublime-golo
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/sublime-golo
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/sublime-golo added at 2c0707bd4f
									
								
							
							
								
								
									
										2
									
								
								vendor/grammars/sublime-nix
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								vendor/grammars/sublime-nix
									
									
									
									
										vendored
									
									
								
							 Submodule vendor/grammars/sublime-nix updated: 412f7e1da5...217ffe591f
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/sublime-opal
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/sublime-opal
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/sublime-opal added at 55ae90b910
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/sublime-spintools
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/sublime-spintools
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/sublime-spintools added at 56d326a44e
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/sublime-text-ox
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/sublime-text-ox
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/sublime-text-ox added at 10ca88362c
									
								
							
							
								
								
									
										1
									
								
								vendor/grammars/sublime-text-pig-latin
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/grammars/sublime-text-pig-latin
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/grammars/sublime-text-pig-latin added at 54ed29189f
									
								
							
		Reference in New Issue
	
	Block a user