diff --git a/.gitignore b/.gitignore index 4c0e6662..c0ab5df0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ lib/linguist/samples.json /grammars /node_modules test/fixtures/ace_modes.json +/vendor/gems/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..79209740 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,551 @@ +[submodule "vendor/grammars/go-tmbundle"] + path = vendor/grammars/go-tmbundle + url = https://github.com/AlanQuatermain/go-tmbundle +[submodule "vendor/grammars/PHP-Twig.tmbundle"] + path = vendor/grammars/PHP-Twig.tmbundle + url = https://github.com/Anomareh/PHP-Twig.tmbundle +[submodule "vendor/grammars/sublime-cirru"] + path = vendor/grammars/sublime-cirru + url = https://github.com/Cirru/sublime-cirru +[submodule "vendor/grammars/Sublime-Logos"] + path = vendor/grammars/Sublime-Logos + url = https://github.com/Cykey/Sublime-Logos +[submodule "vendor/grammars/SublimeBrainfuck"] + path = vendor/grammars/SublimeBrainfuck + url = https://github.com/Drako/SublimeBrainfuck +[submodule "vendor/grammars/awk-sublime"] + path = vendor/grammars/awk-sublime + url = https://github.com/JohnNilsson/awk-sublime +[submodule "vendor/grammars/Sublime-SQF-Language"] + path = vendor/grammars/Sublime-SQF-Language + url = https://github.com/JonBons/Sublime-SQF-Language +[submodule "vendor/grammars/SCSS.tmbundle"] + path = vendor/grammars/SCSS.tmbundle + url = https://github.com/MarioRicalde/SCSS.tmbundle +[submodule "vendor/grammars/Sublime-REBOL"] + path = vendor/grammars/Sublime-REBOL + url = https://github.com/Oldes/Sublime-REBOL +[submodule "vendor/grammars/Sublime-Inform"] + path = vendor/grammars/Sublime-Inform + url = https://github.com/PogiNate/Sublime-Inform +[submodule "vendor/grammars/autoitv3-tmbundle"] + path = vendor/grammars/autoitv3-tmbundle + url = https://github.com/Red-Nova-Technologies/autoitv3-tmbundle +[submodule "vendor/grammars/Sublime-VimL"] + path = vendor/grammars/Sublime-VimL + url = https://github.com/SalGnt/Sublime-VimL +[submodule "vendor/grammars/boo-sublime"] + path = vendor/grammars/boo-sublime + url = https://github.com/Shammah/boo-sublime +[submodule "vendor/grammars/ColdFusion"] + path = vendor/grammars/ColdFusion + url = https://github.com/SublimeText/ColdFusion +[submodule "vendor/grammars/NSIS"] + path = vendor/grammars/NSIS + url = https://github.com/SublimeText/NSIS +[submodule "vendor/grammars/NimLime"] + path = vendor/grammars/NimLime + url = https://github.com/Varriount/NimLime +[submodule "vendor/grammars/gradle.tmbundle"] + path = vendor/grammars/gradle.tmbundle + url = https://github.com/alkemist/gradle.tmbundle +[submodule "vendor/grammars/Sublime-Loom"] + path = vendor/grammars/Sublime-Loom + url = https://github.com/ambethia/Sublime-Loom +[submodule "vendor/grammars/VBDotNetSyntax"] + path = vendor/grammars/VBDotNetSyntax + url = https://github.com/angryant0007/VBDotNetSyntax +[submodule "vendor/grammars/cool-tmbundle"] + path = vendor/grammars/cool-tmbundle + url = https://github.com/anunayk/cool-tmbundle +[submodule "vendor/grammars/Docker.tmbundle"] + path = vendor/grammars/Docker.tmbundle + url = https://github.com/asbjornenge/Docker.tmbundle +[submodule "vendor/grammars/jasmin-sublime"] + path = vendor/grammars/jasmin-sublime + url = https://github.com/atmarksharp/jasmin-sublime +[submodule "vendor/grammars/language-clojure"] + path = vendor/grammars/language-clojure + url = https://github.com/atom/language-clojure +[submodule "vendor/grammars/language-coffee-script"] + path = vendor/grammars/language-coffee-script + url = https://github.com/atom/language-coffee-script +[submodule "vendor/grammars/language-csharp"] + path = vendor/grammars/language-csharp + url = https://github.com/atom/language-csharp +[submodule "vendor/grammars/language-gfm"] + path = vendor/grammars/language-gfm + url = https://github.com/atom/language-gfm +[submodule "vendor/grammars/language-javascript"] + path = vendor/grammars/language-javascript + url = https://github.com/atom/language-javascript +[submodule "vendor/grammars/language-python"] + path = vendor/grammars/language-python + url = https://github.com/atom/language-python +[submodule "vendor/grammars/language-shellscript"] + path = vendor/grammars/language-shellscript + url = https://github.com/atom/language-shellscript +[submodule "vendor/grammars/language-yaml"] + path = vendor/grammars/language-yaml + url = https://github.com/atom/language-yaml +[submodule "vendor/grammars/sublime-sourcepawn"] + path = vendor/grammars/sublime-sourcepawn + url = https://github.com/austinwagner/sublime-sourcepawn +[submodule "vendor/grammars/Sublime-Lasso"] + path = vendor/grammars/Sublime-Lasso + url = https://github.com/bfad/Sublime-Lasso +[submodule "vendor/grammars/chapel-tmbundle"] + path = vendor/grammars/chapel-tmbundle + url = https://github.com/bholt/chapel-tmbundle +[submodule "vendor/grammars/sublime-nginx"] + path = vendor/grammars/sublime-nginx + url = https://github.com/brandonwamboldt/sublime-nginx +[submodule "vendor/grammars/bro-sublime"] + path = vendor/grammars/bro-sublime + url = https://github.com/bro/bro-sublime +[submodule "vendor/grammars/sublime_man_page_support"] + path = vendor/grammars/sublime_man_page_support + url = https://github.com/carsonoid/sublime_man_page_support +[submodule "vendor/grammars/sublime-MuPAD"] + path = vendor/grammars/sublime-MuPAD + url = https://github.com/ccreutzig/sublime-MuPAD +[submodule "vendor/grammars/nesC.tmbundle"] + path = vendor/grammars/nesC.tmbundle + url = https://github.com/cdwilson/nesC.tmbundle +[submodule "vendor/grammars/haxe-sublime-bundle"] + path = vendor/grammars/haxe-sublime-bundle + url = https://github.com/clemos/haxe-sublime-bundle +[submodule "vendor/grammars/cucumber-tmbundle"] + path = vendor/grammars/cucumber-tmbundle + url = https://github.com/cucumber/cucumber-tmbundle +[submodule "vendor/grammars/Handlebars"] + path = vendor/grammars/Handlebars + url = https://github.com/daaain/Handlebars +[submodule "vendor/grammars/powershell.tmbundle"] + path = vendor/grammars/powershell.tmbundle + url = https://github.com/davidpeckham/powershell.tmbundle +[submodule "vendor/grammars/jade-tmbundle"] + path = vendor/grammars/jade-tmbundle + url = https://github.com/davidrios/jade-tmbundle +[submodule "vendor/grammars/elixir-tmbundle"] + path = vendor/grammars/elixir-tmbundle + url = https://github.com/elixir-lang/elixir-tmbundle +[submodule "vendor/grammars/sublime-glsl"] + path = vendor/grammars/sublime-glsl + url = https://github.com/euler0/sublime-glsl +[submodule "vendor/grammars/fancy-tmbundle"] + path = vendor/grammars/fancy-tmbundle + url = https://github.com/fancy-lang/fancy-tmbundle +[submodule "vendor/grammars/fsharpbinding"] + path = vendor/grammars/fsharpbinding + url = https://github.com/fsharp/fsharpbinding +[submodule "vendor/grammars/monkey.tmbundle"] + path = vendor/grammars/monkey.tmbundle + url = https://github.com/gingerbeardman/monkey.tmbundle +[submodule "vendor/grammars/dart-sublime-bundle"] + path = vendor/grammars/dart-sublime-bundle + url = https://github.com/guillermooo/dart-sublime-bundle +[submodule "vendor/grammars/sublimetext-cuda-cpp"] + path = vendor/grammars/sublimetext-cuda-cpp + url = https://github.com/harrism/sublimetext-cuda-cpp +[submodule "vendor/grammars/pike-textmate"] + path = vendor/grammars/pike-textmate + url = https://github.com/hww3/pike-textmate +[submodule "vendor/grammars/ceylon-sublimetext"] + path = vendor/grammars/ceylon-sublimetext + url = https://github.com/jeancharles-roger/ceylon-sublimetext +[submodule "vendor/grammars/Sublime-Text-2-OpenEdge-ABL"] + path = vendor/grammars/Sublime-Text-2-OpenEdge-ABL + url = https://github.com/jfairbank/Sublime-Text-2-OpenEdge-ABL +[submodule "vendor/grammars/sublime-rust"] + path = vendor/grammars/sublime-rust + url = https://github.com/jhasse/sublime-rust +[submodule "vendor/grammars/sublime-befunge"] + path = vendor/grammars/sublime-befunge + url = https://github.com/johanasplund/sublime-befunge +[submodule "vendor/grammars/RDoc.tmbundle"] + path = vendor/grammars/RDoc.tmbundle + url = https://github.com/joshaven/RDoc.tmbundle +[submodule "vendor/grammars/Textmate-Gosu-Bundle"] + path = vendor/grammars/Textmate-Gosu-Bundle + url = https://github.com/jpcamara/Textmate-Gosu-Bundle +[submodule "vendor/grammars/jquery-tmbundle"] + path = vendor/grammars/jquery-tmbundle + url = https://github.com/kswedberg/jquery-tmbundle +[submodule "vendor/grammars/fish-tmbundle"] + path = vendor/grammars/fish-tmbundle + url = https://github.com/l15n/fish-tmbundle +[submodule "vendor/grammars/sublime-idris"] + path = vendor/grammars/sublime-idris + url = https://github.com/laughedelic/sublime-idris +[submodule "vendor/grammars/sublime-better-typescript"] + path = vendor/grammars/sublime-better-typescript + url = https://github.com/lavrton/sublime-better-typescript +[submodule "vendor/grammars/moonscript-tmbundle"] + path = vendor/grammars/moonscript-tmbundle + url = https://github.com/leafo/moonscript-tmbundle +[submodule "vendor/grammars/Isabelle.tmbundle"] + path = vendor/grammars/Isabelle.tmbundle + url = https://github.com/lsf37/Isabelle.tmbundle +[submodule "vendor/grammars/x86-assembly-textmate-bundle"] + path = vendor/grammars/x86-assembly-textmate-bundle + url = https://github.com/lunixbochs/x86-assembly-textmate-bundle +[submodule "vendor/grammars/Alloy.tmbundle"] + path = vendor/grammars/Alloy.tmbundle + url = https://github.com/macekond/Alloy.tmbundle +[submodule "vendor/grammars/opa.tmbundle"] + path = vendor/grammars/opa.tmbundle + url = https://github.com/mads379/opa.tmbundle +[submodule "vendor/grammars/scala.tmbundle"] + path = vendor/grammars/scala.tmbundle + url = https://github.com/mads379/scala.tmbundle +[submodule "vendor/grammars/mako-tmbundle"] + path = vendor/grammars/mako-tmbundle + url = https://github.com/marconi/mako-tmbundle +[submodule "vendor/grammars/gnuplot-tmbundle"] + path = vendor/grammars/gnuplot-tmbundle + url = https://github.com/mattfoster/gnuplot-tmbundle +[submodule "vendor/grammars/idl.tmbundle"] + path = vendor/grammars/idl.tmbundle + url = https://github.com/mgalloy/idl.tmbundle +[submodule "vendor/grammars/protobuf-tmbundle"] + path = vendor/grammars/protobuf-tmbundle + url = https://github.com/michaeledgar/protobuf-tmbundle +[submodule "vendor/grammars/Sublime-Coq"] + path = vendor/grammars/Sublime-Coq + url = https://github.com/mkolosick/Sublime-Coq +[submodule "vendor/grammars/Agda.tmbundle"] + path = vendor/grammars/Agda.tmbundle + url = https://github.com/mokus0/Agda.tmbundle +[submodule "vendor/grammars/Julia.tmbundle"] + path = vendor/grammars/Julia.tmbundle + url = https://github.com/nanoant/Julia.tmbundle +[submodule "vendor/grammars/assembly.tmbundle"] + path = vendor/grammars/assembly.tmbundle + url = https://github.com/nanoant/assembly.tmbundle +[submodule "vendor/grammars/ooc.tmbundle"] + path = vendor/grammars/ooc.tmbundle + url = https://github.com/nilium/ooc.tmbundle +[submodule "vendor/grammars/LiveScript.tmbundle"] + path = vendor/grammars/LiveScript.tmbundle + url = https://github.com/paulmillr/LiveScript.tmbundle +[submodule "vendor/grammars/sublime-tea"] + path = vendor/grammars/sublime-tea + url = https://github.com/pferruggiaro/sublime-tea +[submodule "vendor/grammars/puppet-textmate-bundle"] + path = vendor/grammars/puppet-textmate-bundle + url = https://github.com/puppet-textmate-bundle/puppet-textmate-bundle +[submodule "vendor/grammars/abap.tmbundle"] + path = vendor/grammars/abap.tmbundle + url = https://github.com/pvl/abap.tmbundle +[submodule "vendor/grammars/mercury-tmlanguage"] + path = vendor/grammars/mercury-tmlanguage + url = https://github.com/sebgod/mercury-tmlanguage +[submodule "vendor/grammars/mathematica-tmbundle"] + path = vendor/grammars/mathematica-tmbundle + url = https://github.com/shadanan/mathematica-tmbundle +[submodule "vendor/grammars/sublime-robot-plugin"] + path = vendor/grammars/sublime-robot-plugin + 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 +[submodule "vendor/grammars/Sublime-QML"] + path = vendor/grammars/Sublime-QML + url = https://github.com/skozlovf/Sublime-QML +[submodule "vendor/grammars/Slash.tmbundle"] + path = vendor/grammars/Slash.tmbundle + url = https://github.com/slash-lang/Slash.tmbundle +[submodule "vendor/grammars/factor"] + path = vendor/grammars/factor + url = https://github.com/slavapestov/factor +[submodule "vendor/grammars/ruby-slim.tmbundle"] + path = vendor/grammars/ruby-slim.tmbundle + url = https://github.com/slim-template/ruby-slim.tmbundle +[submodule "vendor/grammars/SublimeXtend"] + path = vendor/grammars/SublimeXtend + url = https://github.com/staltz/SublimeXtend +[submodule "vendor/grammars/Stata.tmbundle"] + path = vendor/grammars/Stata.tmbundle + url = https://github.com/statatmbundle/Stata.tmbundle +[submodule "vendor/grammars/Vala-TMBundle"] + path = vendor/grammars/Vala-TMBundle + url = https://github.com/technosophos/Vala-TMBundle +[submodule "vendor/grammars/ant.tmbundle"] + path = vendor/grammars/ant.tmbundle + url = https://github.com/textmate/ant.tmbundle +[submodule "vendor/grammars/antlr.tmbundle"] + path = vendor/grammars/antlr.tmbundle + url = https://github.com/textmate/antlr.tmbundle +[submodule "vendor/grammars/apache.tmbundle"] + path = vendor/grammars/apache.tmbundle + url = https://github.com/textmate/apache.tmbundle +[submodule "vendor/grammars/applescript.tmbundle"] + path = vendor/grammars/applescript.tmbundle + url = https://github.com/textmate/applescript.tmbundle +[submodule "vendor/grammars/asp.tmbundle"] + path = vendor/grammars/asp.tmbundle + url = https://github.com/textmate/asp.tmbundle +[submodule "vendor/grammars/bison.tmbundle"] + path = vendor/grammars/bison.tmbundle + url = https://github.com/textmate/bison.tmbundle +[submodule "vendor/grammars/capnproto.tmbundle"] + path = vendor/grammars/capnproto.tmbundle + url = https://github.com/textmate/capnproto.tmbundle +[submodule "vendor/grammars/cmake.tmbundle"] + path = vendor/grammars/cmake.tmbundle + url = https://github.com/textmate/cmake.tmbundle +[submodule "vendor/grammars/cpp-qt.tmbundle"] + path = vendor/grammars/cpp-qt.tmbundle + url = https://github.com/textmate/cpp-qt.tmbundle +[submodule "vendor/grammars/css.tmbundle"] + path = vendor/grammars/css.tmbundle + url = https://github.com/textmate/css.tmbundle +[submodule "vendor/grammars/d.tmbundle"] + path = vendor/grammars/d.tmbundle + url = https://github.com/textmate/d.tmbundle +[submodule "vendor/grammars/diff.tmbundle"] + path = vendor/grammars/diff.tmbundle + url = https://github.com/textmate/diff.tmbundle +[submodule "vendor/grammars/dylan.tmbundle"] + path = vendor/grammars/dylan.tmbundle + url = https://github.com/textmate/dylan.tmbundle +[submodule "vendor/grammars/eiffel.tmbundle"] + path = vendor/grammars/eiffel.tmbundle + url = https://github.com/textmate/eiffel.tmbundle +[submodule "vendor/grammars/erlang.tmbundle"] + path = vendor/grammars/erlang.tmbundle + url = https://github.com/textmate/erlang.tmbundle +[submodule "vendor/grammars/fortran.tmbundle"] + path = vendor/grammars/fortran.tmbundle + url = https://github.com/textmate/fortran.tmbundle +[submodule "vendor/grammars/gettext.tmbundle"] + path = vendor/grammars/gettext.tmbundle + url = https://github.com/textmate/gettext.tmbundle +[submodule "vendor/grammars/graphviz.tmbundle"] + path = vendor/grammars/graphviz.tmbundle + url = https://github.com/textmate/graphviz.tmbundle +[submodule "vendor/grammars/groovy.tmbundle"] + path = vendor/grammars/groovy.tmbundle + url = https://github.com/textmate/groovy.tmbundle +[submodule "vendor/grammars/haskell.tmbundle"] + path = vendor/grammars/haskell.tmbundle + url = https://github.com/textmate/haskell.tmbundle +[submodule "vendor/grammars/html.tmbundle"] + path = vendor/grammars/html.tmbundle + url = https://github.com/textmate/html.tmbundle +[submodule "vendor/grammars/ini.tmbundle"] + path = vendor/grammars/ini.tmbundle + url = https://github.com/textmate/ini.tmbundle +[submodule "vendor/grammars/io.tmbundle"] + path = vendor/grammars/io.tmbundle + url = https://github.com/textmate/io.tmbundle +[submodule "vendor/grammars/java.tmbundle"] + path = vendor/grammars/java.tmbundle + url = https://github.com/textmate/java.tmbundle +[submodule "vendor/grammars/javadoc.tmbundle"] + path = vendor/grammars/javadoc.tmbundle + url = https://github.com/textmate/javadoc.tmbundle +[submodule "vendor/grammars/javascript-objective-j.tmbundle"] + path = vendor/grammars/javascript-objective-j.tmbundle + url = https://github.com/textmate/javascript-objective-j.tmbundle +[submodule "vendor/grammars/json.tmbundle"] + path = vendor/grammars/json.tmbundle + url = https://github.com/textmate/json.tmbundle +[submodule "vendor/grammars/latex.tmbundle"] + path = vendor/grammars/latex.tmbundle + url = https://github.com/textmate/latex.tmbundle +[submodule "vendor/grammars/less.tmbundle"] + path = vendor/grammars/less.tmbundle + url = https://github.com/textmate/less.tmbundle +[submodule "vendor/grammars/lilypond.tmbundle"] + path = vendor/grammars/lilypond.tmbundle + url = https://github.com/textmate/lilypond.tmbundle +[submodule "vendor/grammars/lisp.tmbundle"] + path = vendor/grammars/lisp.tmbundle + url = https://github.com/textmate/lisp.tmbundle +[submodule "vendor/grammars/logtalk.tmbundle"] + path = vendor/grammars/logtalk.tmbundle + url = https://github.com/textmate/logtalk.tmbundle +[submodule "vendor/grammars/lua.tmbundle"] + path = vendor/grammars/lua.tmbundle + url = https://github.com/textmate/lua.tmbundle +[submodule "vendor/grammars/make.tmbundle"] + path = vendor/grammars/make.tmbundle + url = https://github.com/textmate/make.tmbundle +[submodule "vendor/grammars/matlab.tmbundle"] + path = vendor/grammars/matlab.tmbundle + url = https://github.com/textmate/matlab.tmbundle +[submodule "vendor/grammars/maven.tmbundle"] + path = vendor/grammars/maven.tmbundle + url = https://github.com/textmate/maven.tmbundle +[submodule "vendor/grammars/nemerle.tmbundle"] + path = vendor/grammars/nemerle.tmbundle + url = https://github.com/textmate/nemerle.tmbundle +[submodule "vendor/grammars/ninja.tmbundle"] + path = vendor/grammars/ninja.tmbundle + url = https://github.com/textmate/ninja.tmbundle +[submodule "vendor/grammars/objective-c.tmbundle"] + path = vendor/grammars/objective-c.tmbundle + url = https://github.com/textmate/objective-c.tmbundle +[submodule "vendor/grammars/ocaml.tmbundle"] + path = vendor/grammars/ocaml.tmbundle + url = https://github.com/textmate/ocaml.tmbundle +[submodule "vendor/grammars/pascal.tmbundle"] + path = vendor/grammars/pascal.tmbundle + url = https://github.com/textmate/pascal.tmbundle +[submodule "vendor/grammars/perl.tmbundle"] + path = vendor/grammars/perl.tmbundle + url = https://github.com/textmate/perl.tmbundle +[submodule "vendor/grammars/php-smarty.tmbundle"] + path = vendor/grammars/php-smarty.tmbundle + url = https://github.com/textmate/php-smarty.tmbundle +[submodule "vendor/grammars/php.tmbundle"] + path = vendor/grammars/php.tmbundle + url = https://github.com/textmate/php.tmbundle +[submodule "vendor/grammars/postscript.tmbundle"] + path = vendor/grammars/postscript.tmbundle + url = https://github.com/textmate/postscript.tmbundle +[submodule "vendor/grammars/processing.tmbundle"] + path = vendor/grammars/processing.tmbundle + url = https://github.com/textmate/processing.tmbundle +[submodule "vendor/grammars/prolog.tmbundle"] + path = vendor/grammars/prolog.tmbundle + url = https://github.com/textmate/prolog.tmbundle +[submodule "vendor/grammars/python-django.tmbundle"] + path = vendor/grammars/python-django.tmbundle + url = https://github.com/textmate/python-django.tmbundle +[submodule "vendor/grammars/r.tmbundle"] + path = vendor/grammars/r.tmbundle + url = https://github.com/textmate/r.tmbundle +[submodule "vendor/grammars/restructuredtext.tmbundle"] + path = vendor/grammars/restructuredtext.tmbundle + url = https://github.com/textmate/restructuredtext.tmbundle +[submodule "vendor/grammars/ruby-haml.tmbundle"] + path = vendor/grammars/ruby-haml.tmbundle + url = https://github.com/textmate/ruby-haml.tmbundle +[submodule "vendor/grammars/ruby-on-rails-tmbundle"] + path = vendor/grammars/ruby-on-rails-tmbundle + url = https://github.com/textmate/ruby-on-rails-tmbundle +[submodule "vendor/grammars/scheme.tmbundle"] + path = vendor/grammars/scheme.tmbundle + url = https://github.com/textmate/scheme.tmbundle +[submodule "vendor/grammars/scilab.tmbundle"] + path = vendor/grammars/scilab.tmbundle + url = https://github.com/textmate/scilab.tmbundle +[submodule "vendor/grammars/sql.tmbundle"] + path = vendor/grammars/sql.tmbundle + url = https://github.com/textmate/sql.tmbundle +[submodule "vendor/grammars/standard-ml.tmbundle"] + path = vendor/grammars/standard-ml.tmbundle + url = https://github.com/textmate/standard-ml.tmbundle +[submodule "vendor/grammars/swift.tmbundle"] + path = vendor/grammars/swift.tmbundle + url = https://github.com/textmate/swift.tmbundle +[submodule "vendor/grammars/tcl.tmbundle"] + path = vendor/grammars/tcl.tmbundle + url = https://github.com/textmate/tcl.tmbundle +[submodule "vendor/grammars/text.tmbundle"] + path = vendor/grammars/text.tmbundle + url = https://github.com/textmate/text.tmbundle +[submodule "vendor/grammars/textile.tmbundle"] + path = vendor/grammars/textile.tmbundle + url = https://github.com/textmate/textile.tmbundle +[submodule "vendor/grammars/textmate.tmbundle"] + path = vendor/grammars/textmate.tmbundle + url = https://github.com/textmate/textmate.tmbundle +[submodule "vendor/grammars/thrift.tmbundle"] + path = vendor/grammars/thrift.tmbundle + url = https://github.com/textmate/thrift.tmbundle +[submodule "vendor/grammars/toml.tmbundle"] + path = vendor/grammars/toml.tmbundle + url = https://github.com/textmate/toml.tmbundle +[submodule "vendor/grammars/verilog.tmbundle"] + path = vendor/grammars/verilog.tmbundle + url = https://github.com/textmate/verilog.tmbundle +[submodule "vendor/grammars/xml.tmbundle"] + path = vendor/grammars/xml.tmbundle + url = https://github.com/textmate/xml.tmbundle +[submodule "vendor/grammars/smalltalk-tmbundle"] + path = vendor/grammars/smalltalk-tmbundle + url = https://github.com/tomas-stefano/smalltalk-tmbundle +[submodule "vendor/grammars/ioke-outdated"] + path = vendor/grammars/ioke-outdated + url = https://github.com/vic/ioke-outdated +[submodule "vendor/grammars/kotlin-sublime-package"] + path = vendor/grammars/kotlin-sublime-package + url = https://github.com/vkostyukov/kotlin-sublime-package +[submodule "vendor/grammars/c.tmbundle"] + path = vendor/grammars/c.tmbundle + url = https://github.com/textmate/c.tmbundle +[submodule "vendor/grammars/zephir-sublime"] + path = vendor/grammars/zephir-sublime + url = https://github.com/vmg/zephir-sublime +[submodule "vendor/grammars/llvm.tmbundle"] + path = vendor/grammars/llvm.tmbundle + url = https://github.com/whitequark/llvm.tmbundle +[submodule "vendor/grammars/sublime-nix"] + path = vendor/grammars/sublime-nix + url = https://github.com/wmertens/sublime-nix +[submodule "vendor/grammars/ada.tmbundle"] + path = vendor/grammars/ada.tmbundle + url = https://github.com/aroben/ada.tmbundle + branch = better-with-highlighting +[submodule "vendor/grammars/oz-tmbundle"] + path = vendor/grammars/oz-tmbundle + url = https://github.com/eregon/oz-tmbundle +[submodule "vendor/grammars/ebundles"] + path = vendor/grammars/ebundles + url = https://github.com/ericzou/ebundles +[submodule "vendor/grammars/sublime-mask"] + path = vendor/grammars/sublime-mask + url = https://github.com/tenbits/sublime-mask +[submodule "vendor/grammars/sublime_cobol"] + path = vendor/grammars/sublime_cobol + url = https://bitbucket.org/bitlang/sublime_cobol +[submodule "vendor/grammars/ruby.tmbundle"] + path = vendor/grammars/ruby.tmbundle + url = https://github.com/aroben/ruby.tmbundle + branch = pl +[submodule "vendor/grammars/IDL-Syntax"] + path = vendor/grammars/IDL-Syntax + url = https://github.com/andik/IDL-Syntax +[submodule "vendor/grammars/sas.tmbundle"] + path = vendor/grammars/sas.tmbundle + url = https://github.com/rpardee/sas.tmbundle +[submodule "vendor/grammars/atom-salt"] + path = vendor/grammars/atom-salt + url = https://github.com/saltstack/atom-salt +[submodule "vendor/grammars/Scalate.tmbundle"] + path = vendor/grammars/Scalate.tmbundle + url = https://github.com/scalate/Scalate.tmbundle +[submodule "vendor/grammars/Elm.tmLanguage"] + path = vendor/grammars/Elm.tmLanguage + url = https://github.com/deadfoxygrandpa/Elm.tmLanguage +[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 +[submodule "vendor/grammars/sass-textmate-bundle"] + path = vendor/grammars/sass-textmate-bundle + url = https://github.com/nathos/sass-textmate-bundle +[submodule "vendor/grammars/carto-atom"] + path = vendor/grammars/carto-atom + url = https://github.com/yohanboniface/carto-atom +[submodule "vendor/grammars/Sublime-Nit"] + path = vendor/grammars/Sublime-Nit + url = https://github.com/R4PaSs/Sublime-Nit +[submodule "vendor/grammars/language-hy"] + path = vendor/grammars/language-hy + url = https://github.com/rwtolbert/language-hy +[submodule "vendor/grammars/Racket"] + path = vendor/grammars/Racket + url = https://github.com/soegaard/racket-highlight-for-github +[submodule "vendor/grammars/turtle.tmbundle"] + path = vendor/grammars/turtle.tmbundle + url = https://github.com/peta/turtle.tmbundle diff --git a/.travis.yml b/.travis.yml index 7b013349..4d0c2351 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,5 @@ -before_install: - - git fetch origin master:master - - git fetch origin v2.0.0:v2.0.0 - - git fetch origin test/attributes:test/attributes - - git fetch origin test/master:test/master - - sudo apt-get install libicu-dev -y +sudo: false +before_install: script/travis/before_install rvm: - 1.9.3 - 2.0.0 @@ -11,3 +7,6 @@ rvm: - 2.2 notifications: disabled: true +git: + submodules: false +cache: bundler diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 658931b3..b6b682f6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,9 +21,19 @@ Once the bug has been fixed upstream, please let us know and we'll pick it up fo Great! You'll need to: 0. Add an entry for your language to [`languages.yml`][languages]. -0. Add a grammar for your language to [`grammars.yml`][grammars] by running `script/download-grammars --add URL`. Please only add grammars that have a license that permits redistribution. +0. Add a grammar for your language. Please only add grammars that have a license that permits redistribution. + 0. Add your grammar as a submodule: `git submodule add https://github.com/JaneSmith/MyGrammar vendor/grammars/MyGrammar`. + 0. Add your grammar to [`grammars.yml`][grammars] by running `script/convert-grammars --add vendor/grammars/MyGrammar`. 0. Add samples for your language to the [samples directory][samples]. +In addition, if your new language defines an extension that's already listed in [`languages.yml`][languages] (such as `.foo`) then sometimes a few more steps will need to be taken: + +0. Make sure that example `.foo` files are present in the [samples directory][samples] for each language that uses `.foo`. +0. Test the performance of the Bayesian classifier with a relatively large number (1000s) of sample `.foo` files. (ping @arfon or @bkeepers to help with this) to ensure we're not misclassifying files. +0. If the Bayesian classifier does a bad job with the sample `.foo` files then a [heuristic](https://github.com/github/linguist/blob/master/lib/linguist/heuristics.rb) may need to be written to help. + +Remember, the goal here is to try and avoid false positives! + 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. [grammars]: /grammars.yml diff --git a/Gemfile b/Gemfile index 95769569..c5f2cc3b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,4 @@ source 'https://rubygems.org' gemspec :name => "github-linguist" gemspec :name => "github-linguist-grammars" -gem 'test-unit', require: false if RUBY_VERSION >= '2.2' gem 'byebug' if RUBY_VERSION >= '2.0' diff --git a/README.md b/README.md index 5eaa2f20..2bebfafe 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ But for development you are going to want to checkout out the source. To get it, git clone https://github.com/github/linguist.git cd linguist/ - bundle install + script/bootstrap To run the tests: @@ -181,7 +181,8 @@ Here's our current build status, which is hopefully green: [![Build Status](http If you are the current maintainer of this gem: 0. Create a branch for the release: `git checkout -b cut-release-vxx.xx.xx` - 0. Make sure your local dependencies are up to date: `bundle install` + 0. 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). diff --git a/Rakefile b/Rakefile index 068af0bb..b38486c0 100644 --- a/Rakefile +++ b/Rakefile @@ -48,7 +48,7 @@ end task :build_grammars_gem do rm_rf "grammars" - sh "script/download-grammars" + sh "script/convert-grammars" sh "gem", "build", "github-linguist-grammars.gemspec" end diff --git a/github-linguist.gemspec b/github-linguist.gemspec index 578e823c..983db982 100644 --- a/github-linguist.gemspec +++ b/github-linguist.gemspec @@ -18,6 +18,7 @@ Gem::Specification.new do |s| s.add_dependency 'mime-types', '>= 1.19' s.add_dependency 'rugged', '~> 0.22.0b4' + s.add_development_dependency 'minitest', '>= 5.0' s.add_development_dependency 'mocha' s.add_development_dependency 'pry' s.add_development_dependency 'rake' diff --git a/grammars.yml b/grammars.yml index 7e9b7053..c85b2de6 100644 --- a/grammars.yml +++ b/grammars.yml @@ -18,413 +18,449 @@ http://svn.textmate.org/trunk/Review/Bundles/XQuery.tmbundle: https://bitbucket.org/Clams/sublimesystemverilog/get/default.tar.gz: - source.systemverilog - source.ucfconstraints -https://bitbucket.org/bitlang/sublime_cobol/raw/b0e9c44ac5f7a2fb553421aa986b35854cbfda4a/COBOL.tmLanguage: -- source.cobol https://fan.googlecode.com/hg-history/Build%201.0.55/adm/tools/textmate/Fan.tmbundle/Syntaxes/Fan.tmLanguage: - source.fan -https://github.com/AlanQuatermain/go-tmbundle: -- source.go -https://github.com/Anomareh/PHP-Twig.tmbundle: -- text.html.twig -https://github.com/Cirru/sublime-cirru/raw/master/Cirru.tmLanguage: -- source.cirru -https://github.com/Cykey/Sublime-Logos: -- source.logos -https://github.com/Drako/SublimeBrainfuck/raw/master/Brainfuck.tmLanguage: -- source.bf -https://github.com/JohnNilsson/awk-sublime/raw/master/AWK.tmLanguage: -- source.awk -https://github.com/JonBons/Sublime-SQF-Language: -- source.sqf -https://github.com/MarioRicalde/SCSS.tmbundle: -- source.scss -https://github.com/Oldes/Sublime-REBOL: -- source.rebol -https://github.com/PogiNate/Sublime-Inform: -- source.Inform7 -https://github.com/Red-Nova-Technologies/autoitv3-tmbundle: -- source.autoit.3 -https://github.com/SalGnt/Sublime-VimL: -- source.viml -https://github.com/Shammah/boo-sublime/raw/master/Boo.tmLanguage: -- source.boo -https://github.com/SublimeText/ColdFusion: +vendor/grammars/Agda.tmbundle: +- source.agda +vendor/grammars/Alloy.tmbundle: +- source.alloy +vendor/grammars/AutoHotkey: +- source.ahk +vendor/grammars/ColdFusion: - source.cfscript - source.cfscript.cfc - text.cfml.basic - text.html.cfm -https://github.com/SublimeText/NSIS: -- source.nsis -https://github.com/Varriount/NimLime: -- source.nimrod -- source.nimrod_filter -- source.nimrodcfg -https://github.com/alkemist/gradle.tmbundle: -- source.groovy.gradle -https://github.com/ambethia/Sublime-Loom: -- source.loomscript -https://github.com/angryant0007/VBDotNetSyntax: -- source.vbnet -https://github.com/anunayk/cool-tmbundle: -- source.cool -https://github.com/aroben/ada.tmbundle/raw/c45eed4d5f98fe3bcbbffbb9e436601ab5bbde4b/Syntaxes/Ada.plist: -- source.ada -https://github.com/aroben/ruby.tmbundle@4636a3023153c3034eb6ffc613899ba9cf33b41f: -- source.ruby -- text.html.erb -https://github.com/asbjornenge/Docker.tmbundle: +vendor/grammars/Docker.tmbundle: - source.dockerfile -https://github.com/atom/language-clojure: -- source.clojure -https://github.com/atom/language-coffee-script: -- source.coffee -- source.litcoffee -https://github.com/atom/language-csharp: -- source.cs -- source.csx -- source.nant-build -https://github.com/atom/language-gfm: -- text.html.markdown -https://github.com/atom/language-javascript: -- source.js -- source.js.regexp -https://github.com/atom/language-python: -- source.python -- source.regexp.python -- text.python.traceback -https://github.com/atom/language-sass: -- source.css.scss -- source.sass -https://github.com/atom/language-shellscript: -- source.shell -- text.shell-session -https://github.com/austinwagner/sublime-sourcepawn: -- source.sp -https://github.com/bfad/Sublime-Lasso: -- file.lasso -https://github.com/bholt/chapel-tmbundle: -- source.chapel -https://github.com/brandonwamboldt/sublime-nginx: -- source.nginx -https://github.com/bro/bro-sublime: -- source.bro -https://github.com/carsonoid/sublime_man_page_support/raw/master/man-groff.tmLanguage: -- text.groff -https://github.com/ccreutzig/sublime-MuPAD: -- source.mupad -https://github.com/cdwilson/nesC.tmbundle: -- source.nesc -https://github.com/christophevg/racket-tmbundle: +vendor/grammars/Elm.tmLanguage: +- source.elm +vendor/grammars/Handlebars: +- text.html.handlebars +vendor/grammars/IDL-Syntax: +- source.webidl +vendor/grammars/Isabelle.tmbundle: +- source.isabelle.root +- source.isabelle.theory +vendor/grammars/Julia.tmbundle: +- source.julia +vendor/grammars/LiveScript.tmbundle: +- source.livescript +vendor/grammars/NSIS: +- source.nsis +vendor/grammars/NimLime: +- source.nim +- source.nim_filter +- source.nimcfg +vendor/grammars/PHP-Twig.tmbundle: +- text.html.twig +vendor/grammars/RDoc.tmbundle: +- text.rdoc +vendor/grammars/Racket: - source.racket -https://github.com/clemos/haxe-sublime-bundle: +vendor/grammars/SCSS.tmbundle: +- source.scss +vendor/grammars/Scalate.tmbundle: +- source.scaml +- text.html.ssp +vendor/grammars/Slash.tmbundle: +- text.html.slash +vendor/grammars/Stata.tmbundle: +- source.mata +- source.stata +vendor/grammars/Sublime-Coq: +- source.coq +vendor/grammars/Sublime-HTTP: +- source.httpspec +vendor/grammars/Sublime-Inform: +- source.Inform7 +vendor/grammars/Sublime-Lasso: +- file.lasso +vendor/grammars/Sublime-Logos: +- source.logos +vendor/grammars/Sublime-Loom: +- source.loomscript +vendor/grammars/Sublime-Nit: +- source.nit +vendor/grammars/Sublime-QML: +- source.qml +vendor/grammars/Sublime-REBOL: +- source.rebol +vendor/grammars/Sublime-SQF-Language: +- source.sqf +vendor/grammars/Sublime-Text-2-OpenEdge-ABL: +- source.abl +vendor/grammars/Sublime-VimL: +- source.viml +vendor/grammars/SublimeBrainfuck: +- source.bf +vendor/grammars/SublimeXtend: +- source.xtend +vendor/grammars/Textmate-Gosu-Bundle: +- source.gosu.2 +vendor/grammars/VBDotNetSyntax: +- source.vbnet +vendor/grammars/Vala-TMBundle: +- source.vala +vendor/grammars/abap.tmbundle: +- source.abap +vendor/grammars/actionscript3-tmbundle: +- source.actionscript.3 +- text.html.asdoc +- text.xml.flex-config +vendor/grammars/ada.tmbundle: +- source.ada +vendor/grammars/ant.tmbundle: +- text.xml.ant +vendor/grammars/antlr.tmbundle: +- source.antlr +vendor/grammars/apache.tmbundle: +- source.apache-config +- source.apache-config.mod_perl +vendor/grammars/applescript.tmbundle: +- source.applescript +vendor/grammars/asp.tmbundle: +- source.asp +- text.html.asp +vendor/grammars/assembly.tmbundle: +- objdump.x86asm +- source.x86asm +vendor/grammars/atom-salt: +- source.python.salt +- source.yaml.salt +vendor/grammars/autoitv3-tmbundle: +- source.autoit.3 +vendor/grammars/awk-sublime: +- source.awk +vendor/grammars/bison.tmbundle: +- source.bison +vendor/grammars/boo-sublime: +- source.boo +vendor/grammars/bro-sublime: +- source.bro +vendor/grammars/c.tmbundle: +- source.c +- source.c++ +- source.c.platform +vendor/grammars/capnproto.tmbundle: +- source.capnp +vendor/grammars/carto-atom: +- source.css.mss +vendor/grammars/ceylon-sublimetext: +- module.ceylon +- source.ceylon +vendor/grammars/chapel-tmbundle: +- source.chapel +vendor/grammars/cmake.tmbundle: +- source.cache.cmake +- source.cmake +vendor/grammars/cool-tmbundle: +- source.cool +vendor/grammars/cpp-qt.tmbundle: +- source.c++.qt +- source.qmake +vendor/grammars/css.tmbundle: +- source.css +vendor/grammars/cucumber-tmbundle: +- source.ruby.rspec.cucumber.steps +- text.gherkin.feature +vendor/grammars/d.tmbundle: +- source.d +vendor/grammars/dart-sublime-bundle: +- source.dart +- source.pubspec +- text.dart-doccomments +vendor/grammars/diff.tmbundle: +- source.diff +vendor/grammars/dylan.tmbundle: +- source.dylan +- source.lid +- source.makegen +vendor/grammars/ebundles/Bundles/MSDOS batch file.tmbundle: +- source.dosbatch +vendor/grammars/eiffel.tmbundle: +- source.eiffel +vendor/grammars/elixir-tmbundle: +- source.elixir +- text.elixir +- text.html.elixir +vendor/grammars/erlang.tmbundle: +- source.erlang +- text.html.erlang.yaws +vendor/grammars/factor: +- source.factor +- text.html.factor +vendor/grammars/fancy-tmbundle: +- source.fancy +vendor/grammars/fish-tmbundle: +- source.fish +vendor/grammars/fortran.tmbundle: +- source.fortran +- source.fortran.modern +vendor/grammars/fsharpbinding: +- source.fsharp +vendor/grammars/gettext.tmbundle: +- source.po +vendor/grammars/gnuplot-tmbundle: +- source.gnuplot +vendor/grammars/go-tmbundle: +- source.go +vendor/grammars/gradle.tmbundle: +- source.groovy.gradle +vendor/grammars/graphviz.tmbundle: +- source.dot +vendor/grammars/groovy.tmbundle: +- source.groovy +vendor/grammars/haskell.tmbundle: +- source.haskell +- text.tex.latex.haskell +vendor/grammars/haxe-sublime-bundle: - source.erazor - source.haxe.2 - source.hss.1 - source.hxml - source.nmml -https://github.com/cucumber/cucumber-tmbundle: -- source.ruby.rspec.cucumber.steps -- text.gherkin.feature -https://github.com/daaain/Handlebars/raw/master/Handlebars.tmLanguage: -- text.html.handlebars -https://github.com/davidpeckham/powershell.tmbundle: -- source.powershell -https://github.com/davidrios/jade-tmbundle: -- source.jade -- source.pyjade -https://github.com/elixir-lang/elixir-tmbundle: -- source.elixir -- text.elixir -- text.html.elixir -https://github.com/ericzou/ebundles/raw/master/Bundles/MSDOS%20batch%20file.tmbundle/Syntaxes/MSDOS%20batch%20file.tmLanguage: -- source.dosbatch -https://github.com/euler0/sublime-glsl/raw/master/GLSL.tmLanguage: -- source.glsl -https://github.com/fancy-lang/fancy-tmbundle: -- source.fancy -https://github.com/fsharp/fsharpbinding: -- source.fsharp -https://github.com/gingerbeardman/monkey.tmbundle: -- source.monkey -https://github.com/guillermooo/dart-sublime-bundle/raw/master/Dart.tmLanguage: -- source.dart -https://github.com/harrism/sublimetext-cuda-cpp/raw/master/cuda-c%2B%2B.tmLanguage: -- source.cuda-c++ -https://github.com/hww3/pike-textmate: -- source.pike -https://github.com/jeancharles-roger/ceylon-sublimetext/raw/master/Ceylon.tmLanguage: -- source.ceylon -https://github.com/jfairbank/Sublime-Text-2-OpenEdge-ABL: -- source.abl -https://github.com/jhasse/sublime-rust: -- source.rust -https://github.com/johanasplund/sublime-befunge/raw/master/Befunge-93.tmLanguage: -- source.befunge -https://github.com/joshaven/RDoc.tmbundle: -- text.rdoc -https://github.com/jpcamara/Textmate-Gosu-Bundle/raw/master/Gosu.tmbundle/Syntaxes/Gosu.tmLanguage: -- source.gosu.2 -https://github.com/kswedberg/jquery-tmbundle: -- source.js.jquery -https://github.com/laughedelic/sublime-idris/raw/master/Idris.tmLanguage: -- source.idris -https://github.com/lavrton/sublime-better-typescript: -- source.ts -https://github.com/leafo/moonscript-tmbundle: -- source.moonscript -https://github.com/lsf37/Isabelle.tmbundle: -- source.isabelle.root -- source.isabelle.theory -https://github.com/lunixbochs/x86-assembly-textmate-bundle: -- source.asm.x86 -https://github.com/macekond/Alloy.tmbundle: -- source.alloy -https://github.com/mads379/opa.tmbundle: -- source.opa -https://github.com/mads379/scala.tmbundle: -- source.sbt -- source.scala -https://github.com/marconi/mako-tmbundle: -- text.html.mako -https://github.com/mattfoster/gnuplot-tmbundle: -- source.gnuplot -https://github.com/mgalloy/idl.tmbundle: +vendor/grammars/html.tmbundle: +- text.html.basic +vendor/grammars/idl.tmbundle: - source.idl - source.idl-dlm - text.idl-idldoc -https://github.com/michaeledgar/protobuf-tmbundle: -- source.protobuf -https://github.com/mkolosick/Sublime-Coq/raw/master/Coq.tmLanguage: -- source.coq -https://github.com/mokus0/Agda.tmbundle: -- source.agda -https://github.com/nanoant/Julia.tmbundle: -- source.julia -https://github.com/nanoant/assembly.tmbundle/raw/master/Syntaxes/objdump%20C%2B%2B.tmLanguage: -- objdump.x86asm -https://github.com/nilium/ooc.tmbundle: -- source.ooc -https://github.com/paulmillr/LiveScript.tmbundle: -- source.livescript -https://github.com/pferruggiaro/sublime-tea: -- source.tea -https://github.com/puppet-textmate-bundle/puppet-textmate-bundle: -- source.puppet -https://github.com/pvl/abap.tmbundle: -- source.abap -https://github.com/scalate/Scalate.tmbundle: -- source.scaml -- text.html.ssp -https://github.com/shadanan/mathematica-tmbundle: -- source.mathematica -https://github.com/shellderp/sublime-robot-plugin: -- text.robot -https://github.com/simongregory/actionscript3-tmbundle: -- source.actionscript.3 -- text.html.asdoc -- text.xml.flex-config -https://github.com/skozlovf/Sublime-QML: -- source.qml -https://github.com/slash-lang/Slash.tmbundle: -- text.html.slash -https://github.com/slavapestov/factor/raw/master/misc/Factor.tmbundle/Syntaxes/Factor.tmLanguage: -- source.factor -https://github.com/slim-template/ruby-slim.tmbundle: -- text.slim -https://github.com/staltz/SublimeXtend: -- source.xtend -https://github.com/statatmbundle/Stata.tmbundle: -- source.mata -- source.stata -https://github.com/technosophos/Vala-TMBundle: -- source.vala -https://github.com/textmate/ant.tmbundle: -- text.xml.ant -https://github.com/textmate/antlr.tmbundle: -- source.antlr -https://github.com/textmate/apache.tmbundle: -- source.apache-config -- source.apache-config.mod_perl -https://github.com/textmate/applescript.tmbundle: -- source.applescript -https://github.com/textmate/asp.tmbundle: -- source.asp -- text.html.asp -https://github.com/textmate/bison.tmbundle: -- source.bison -https://github.com/textmate/c.tmbundle: -- source.c -- source.c++ -- source.c.platform -https://github.com/textmate/capnproto.tmbundle: -- source.capnp -https://github.com/textmate/cmake.tmbundle: -- source.cache.cmake -- source.cmake -https://github.com/textmate/cpp-qt.tmbundle: -- source.c++.qt -- source.qmake -https://github.com/textmate/css.tmbundle: -- source.css -https://github.com/textmate/d.tmbundle: -- source.d -https://github.com/textmate/diff.tmbundle: -- source.diff -https://github.com/textmate/dylan.tmbundle: -- source.dylan -- source.lid -- source.makegen -https://github.com/textmate/eiffel.tmbundle: -- source.eiffel -https://github.com/textmate/erlang.tmbundle: -- source.erlang -- text.html.erlang.yaws -https://github.com/textmate/fortran.tmbundle: -- source.fortran -- source.fortran.modern -https://github.com/textmate/gettext.tmbundle: -- source.po -https://github.com/textmate/graphviz.tmbundle: -- source.dot -https://github.com/textmate/groovy.tmbundle: -- source.groovy -https://github.com/textmate/haskell.tmbundle: -- source.haskell -- text.tex.latex.haskell -https://github.com/textmate/html.tmbundle: -- text.html.basic -https://github.com/textmate/ini.tmbundle: +vendor/grammars/ini.tmbundle: - source.ini -https://github.com/textmate/io.tmbundle: +vendor/grammars/io.tmbundle: - source.io -https://github.com/textmate/java.tmbundle: +vendor/grammars/ioke-outdated: +- source.ioke +vendor/grammars/jade-tmbundle: +- source.jade +- source.pyjade +vendor/grammars/jasmin-sublime: +- source.jasmin +vendor/grammars/java.tmbundle: - source.java - source.java-properties - text.html.jsp - text.junit-test-report -https://github.com/textmate/javadoc.tmbundle: +vendor/grammars/javadoc.tmbundle: - text.html.javadoc -https://github.com/textmate/javascript-objective-j.tmbundle: +vendor/grammars/javascript-objective-j.tmbundle: - source.js.objj -https://github.com/textmate/json.tmbundle: +vendor/grammars/jquery-tmbundle: +- source.js.jquery +vendor/grammars/json.tmbundle: - source.json -https://github.com/textmate/latex.tmbundle: +vendor/grammars/kotlin-sublime-package: +- source.Kotlin +vendor/grammars/language-clojure: +- source.clojure +vendor/grammars/language-coffee-script: +- source.coffee +- source.litcoffee +vendor/grammars/language-csharp: +- source.cs +- source.csx +- source.nant-build +vendor/grammars/language-gfm: +- source.gfm +vendor/grammars/language-hy: +- source.hy +vendor/grammars/language-javascript: +- source.js +- source.js.regexp +vendor/grammars/language-python: +- source.python +- source.regexp.python +- text.python.console +- text.python.traceback +vendor/grammars/language-shellscript: +- source.shell +- text.shell-session +vendor/grammars/language-yaml: +- source.yaml +vendor/grammars/latex.tmbundle: - text.bibtex - text.log.latex - text.tex - text.tex.latex - text.tex.latex.beamer - text.tex.latex.memoir -https://github.com/textmate/less.tmbundle: +vendor/grammars/less.tmbundle: - source.css.less -https://github.com/textmate/lilypond.tmbundle: +vendor/grammars/lilypond.tmbundle: - source.lilypond -https://github.com/textmate/lisp.tmbundle: +vendor/grammars/lisp.tmbundle: - source.lisp -https://github.com/textmate/logtalk.tmbundle: +vendor/grammars/llvm.tmbundle: +- source.llvm +vendor/grammars/logtalk.tmbundle: - source.logtalk -https://github.com/textmate/lua.tmbundle: +vendor/grammars/lua.tmbundle: - source.lua -https://github.com/textmate/make.tmbundle: +vendor/grammars/make.tmbundle: - source.makefile -https://github.com/textmate/matlab.tmbundle: +vendor/grammars/mako-tmbundle: +- text.html.mako +vendor/grammars/mathematica-tmbundle: +- source.mathematica +vendor/grammars/matlab.tmbundle: - source.matlab - source.octave -https://github.com/textmate/maven.tmbundle: +vendor/grammars/maven.tmbundle: - text.xml.pom -https://github.com/textmate/nemerle.tmbundle: +vendor/grammars/mercury-tmlanguage: +- source.mercury +vendor/grammars/monkey.tmbundle: +- source.monkey +vendor/grammars/moonscript-tmbundle: +- source.moonscript +vendor/grammars/nemerle.tmbundle: - source.nemerle -https://github.com/textmate/ninja.tmbundle: +vendor/grammars/nesC.tmbundle: +- source.nesc +vendor/grammars/ninja.tmbundle: - source.ninja -https://github.com/textmate/objective-c.tmbundle: +vendor/grammars/objective-c.tmbundle: - source.objc - source.objc++ - source.objc.platform - source.strings -https://github.com/textmate/ocaml.tmbundle: +vendor/grammars/ocaml.tmbundle: - source.camlp4.ocaml - source.ocaml - source.ocamllex - source.ocamlyacc -https://github.com/textmate/pascal.tmbundle: +vendor/grammars/ooc.tmbundle: +- source.ooc +vendor/grammars/opa.tmbundle: +- source.opa +vendor/grammars/oz-tmbundle/Syntaxes/Oz.tmLanguage: +- source.oz +vendor/grammars/pascal.tmbundle: - source.pascal -https://github.com/textmate/perl.tmbundle: +vendor/grammars/perl.tmbundle: - source.perl -https://github.com/textmate/php-smarty.tmbundle: +vendor/grammars/php-smarty.tmbundle: - source.smarty -https://github.com/textmate/php.tmbundle: +vendor/grammars/php.tmbundle: - text.html.php -https://github.com/textmate/postscript.tmbundle: +vendor/grammars/pike-textmate: +- source.pike +vendor/grammars/postscript.tmbundle: - source.postscript -https://github.com/textmate/processing.tmbundle: +vendor/grammars/powershell.tmbundle: +- source.powershell +vendor/grammars/processing.tmbundle: - source.processing -https://github.com/textmate/prolog.tmbundle: +vendor/grammars/prolog.tmbundle: - source.prolog -https://github.com/textmate/python-django.tmbundle: +vendor/grammars/protobuf-tmbundle: +- source.protobuf +vendor/grammars/puppet-textmate-bundle: +- source.puppet +vendor/grammars/python-django.tmbundle: - source.python.django - text.html.django -https://github.com/textmate/r.tmbundle: +vendor/grammars/r.tmbundle: - source.r - text.tex.latex.rd -https://github.com/textmate/restructuredtext.tmbundle: +vendor/grammars/restructuredtext.tmbundle: - text.restructuredtext -https://github.com/textmate/ruby-haml.tmbundle: +vendor/grammars/ruby-haml.tmbundle: - text.haml -https://github.com/textmate/ruby-on-rails-tmbundle: +vendor/grammars/ruby-on-rails-tmbundle: - source.js.erb.rails - source.ruby.rails - source.ruby.rails.rjs - source.sql.ruby - text.html.erb.rails -https://github.com/textmate/scheme.tmbundle: +vendor/grammars/ruby-slim.tmbundle: +- text.slim +vendor/grammars/ruby.tmbundle: +- source.ruby +- text.html.erb +vendor/grammars/sas.tmbundle: +- source.SASLog +- source.sas +vendor/grammars/sass-textmate-bundle: +- source.sass +vendor/grammars/scala.tmbundle: +- source.sbt +- source.scala +vendor/grammars/scheme.tmbundle: - source.scheme -https://github.com/textmate/scilab.tmbundle: +vendor/grammars/scilab.tmbundle: - source.scilab -https://github.com/textmate/sql.tmbundle: +vendor/grammars/smalltalk-tmbundle: +- source.smalltalk +vendor/grammars/sql.tmbundle: - source.sql -https://github.com/textmate/standard-ml.tmbundle: +vendor/grammars/standard-ml.tmbundle: - source.cm - source.ml -https://github.com/textmate/swift.tmbundle: +vendor/grammars/sublime-MuPAD: +- source.mupad +vendor/grammars/sublime-befunge: +- source.befunge +vendor/grammars/sublime-better-typescript: +- source.ts +vendor/grammars/sublime-bsv: +- source.bsv +vendor/grammars/sublime-cirru: +- source.cirru +vendor/grammars/sublime-glsl: +- source.essl +- source.glsl +vendor/grammars/sublime-idris: +- source.idris +vendor/grammars/sublime-mask: +- source.mask +vendor/grammars/sublime-nginx: +- source.nginx +vendor/grammars/sublime-nix: +- source.nix +vendor/grammars/sublime-robot-plugin: +- text.robot +vendor/grammars/sublime-rust: +- source.rust +vendor/grammars/sublime-sourcepawn: +- source.sp +vendor/grammars/sublime-tea: +- source.tea +vendor/grammars/sublime_cobol: +- source.acucobol +- source.cobol +- source.opencobol +vendor/grammars/sublime_man_page_support: +- source.man +- text.groff +vendor/grammars/sublimetext-cuda-cpp: +- source.cuda-c++ +vendor/grammars/swift.tmbundle: - source.swift -https://github.com/textmate/tcl.tmbundle: +vendor/grammars/tcl.tmbundle: - source.tcl - text.html.tcl -https://github.com/textmate/text.tmbundle: +vendor/grammars/text.tmbundle: - text.plain -https://github.com/textmate/textile.tmbundle: +vendor/grammars/textile.tmbundle: - text.html.textile -https://github.com/textmate/textmate.tmbundle: +vendor/grammars/textmate.tmbundle: - source.regexp.oniguruma - source.tm-properties -https://github.com/textmate/thrift.tmbundle: +vendor/grammars/thrift.tmbundle: - source.thrift -https://github.com/textmate/toml.tmbundle: +vendor/grammars/toml.tmbundle: - source.toml -https://github.com/textmate/verilog.tmbundle: +vendor/grammars/turtle.tmbundle: +- source.sparql +- source.turtle +vendor/grammars/verilog.tmbundle: - source.verilog -https://github.com/textmate/xml.tmbundle: +vendor/grammars/x86-assembly-textmate-bundle: +- source.asm.x86 +vendor/grammars/xml.tmbundle: - text.xml - text.xml.xsl -https://github.com/textmate/yaml.tmbundle: -- source.yaml -https://github.com/tomas-stefano/smalltalk-tmbundle: -- source.smalltalk -https://github.com/vic/ioke-outdated/raw/master/share/TextMate/Ioke.tmbundle/Syntaxes/Ioke.tmLanguage: -- source.ioke -https://github.com/vkostyukov/kotlin-sublime-package: -- source.Kotlin -https://github.com/vmg/zephir-sublime: +vendor/grammars/zephir-sublime: - source.php.zephir -https://github.com/whitequark/llvm.tmbundle: -- source.llvm -https://github.com/wmertens/sublime-nix: -- source.nix -https://raw.githubusercontent.com/eregon/oz-tmbundle/master/Syntaxes/Oz.tmLanguage: -- source.oz -https://raw.githubusercontent.com/tenbits/sublime-mask/release/Syntaxes/mask.tmLanguage: -- source.mask -https://github.com/l15n/fish-tmbundle: -- source.fish -https://raw.githubusercontent.com/andik/IDL-Syntax/master/IDL.tmLanguage: -- source.webidl diff --git a/lib/linguist/generated.rb b/lib/linguist/generated.rb index 291fa8bd..50dbc58d 100644 --- a/lib/linguist/generated.rb +++ b/lib/linguist/generated.rb @@ -51,20 +51,20 @@ module Linguist # # Return true or false def generated? - minified_files? || - compiled_coffeescript? || xcode_file? || - generated_parser? || - generated_net_docfile? || generated_net_designer_file? || - generated_postscript? || - generated_protocol_buffer? || - generated_jni_header? || composer_lock? || node_modules? || godeps? || - vcr_cassette? || - generated_by_zephir? + generated_by_zephir? || + minified_files? || + compiled_coffeescript? || + generated_parser? || + generated_net_docfile? || + generated_postscript? || + generated_protocol_buffer? || + generated_jni_header? || + vcr_cassette? end # Internal: Is the blob an Xcode file? diff --git a/lib/linguist/heuristics.rb b/lib/linguist/heuristics.rb index 58847559..c512a38e 100644 --- a/lib/linguist/heuristics.rb +++ b/lib/linguist/heuristics.rb @@ -69,11 +69,19 @@ module Linguist end end + disambiguate "C#", "Smalltalk" do |data| + if /![\w\s]+methodsFor: /.match(data) + Language["Smalltalk"] + elsif /^\s*namespace\s*[\w\.]+\s*{/.match(data) || /^\s*\/\//.match(data) + Language["C#"] + end + end + disambiguate "Objective-C", "C++", "C" do |data| - if (/@(interface|class|protocol|property|end|synchronised|selector|implementation)\b/.match(data)) + if (/^[ \t]*@(interface|class|protocol|property|end|synchronised|selector|implementation)\b/.match(data)) Language["Objective-C"] elsif (/^\s*#\s*include <(cstdint|string|vector|map|list|array|bitset|queue|stack|forward_list|unordered_map|unordered_set|(i|o|io)stream)>/.match(data) || - /^\s*template\s* ")) + Language["GAP"] + # Heads up - we don't usually write heuristics like this (with no regex match) + else + Language["Scilab"] + end + end + disambiguate "Common Lisp", "OpenCL", "Cool" do |data| if data.include?("(defun ") Language["Common Lisp"] @@ -183,7 +200,7 @@ module Linguist disambiguate "Frege", "Forth", "Text" do |data| if /^(: |also |new-device|previous )/.match(data) Language["Forth"] - elsif /\s*(import|module|package|data|type) /.match(data) + elsif /^\s*(import|module|package|data|type) /.match(data) Language["Frege"] else Language["Text"] diff --git a/lib/linguist/language.rb b/lib/linguist/language.rb index 210b244d..5f1808ce 100644 --- a/lib/linguist/language.rb +++ b/lib/linguist/language.rb @@ -548,7 +548,7 @@ module Linguist if extnames = extensions[name] extnames.each do |extname| - if !options['extensions'].include?(extname) + if !options['extensions'].index { |x| x.end_with? extname } warn "#{name} has a sample with extension (#{extname}) that isn't explicitly defined in languages.yml" unless extname == '.script!' options['extensions'] << extname end diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index ebd5b127..f90d472d 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -224,7 +224,7 @@ AutoHotkey: extensions: - .ahk - .ahkl - tm_scope: none + tm_scope: source.ahk ace_mode: autohotkey AutoIt: @@ -314,7 +314,7 @@ Bluespec: type: programming extensions: - .bsv - tm_scope: source.verilog + tm_scope: source.bsv ace_mode: verilog Boo: @@ -419,7 +419,7 @@ CLIPS: CMake: extensions: - .cmake - - .in + - .cmake.in filenames: - CMakeLists.txt ace_mode: text @@ -449,6 +449,15 @@ Cap'n Proto: - .capnp ace_mode: text +CartoCSS: + type: programming + aliases: + - Carto + extensions: + - .mss + ace_mode: text + tm_scope: source.css.mss + Ceylon: type: programming extensions: @@ -495,10 +504,10 @@ Clojure: - .cl2 - .cljc - .cljs + - .cljs.hl - .cljscm - .cljx - .hic - - .hl filenames: - riemann.config @@ -787,9 +796,10 @@ Elixir: Elm: type: programming + color: "#60B5CC" extensions: - .elm - tm_scope: source.haskell + tm_scope: source.elm ace_mode: elm Emacs Lisp: @@ -941,11 +951,13 @@ GAMS: GAP: type: programming + lexer: GAP extensions: - .g - .gap - .gd - .gi + - .tst tm_scope: none ace_mode: text @@ -990,8 +1002,8 @@ Game Maker Language: color: "#8ad353" extensions: - .gml - tm_scope: source.js - ace_mode: javascript + tm_scope: source.c++ + ace_mode: c_cpp Genshi: extensions: @@ -1162,6 +1174,7 @@ HTML: extensions: - .html - .htm + - .html.hl - .st - .xht - .xhtml @@ -1187,7 +1200,7 @@ HTML+ERB: - erb extensions: - .erb - - .deface + - .erb.deface ace_mode: html_ruby HTML+PHP: @@ -1202,7 +1215,7 @@ HTTP: type: data extensions: - .http - tm_scope: none + tm_scope: source.httpspec ace_mode: text Hack: @@ -1211,14 +1224,14 @@ Hack: extensions: - .hh - .php - tm_scope: none + tm_scope: text.html.php Haml: group: HTML type: markup extensions: - .haml - - .deface + - .haml.deface ace_mode: haml Handlebars: @@ -1258,13 +1271,13 @@ Haxe: Hy: type: programming - ace_mode: clojure + ace_mode: text color: "#7891b1" extensions: - .hy aliases: - hylang - tm_scope: none + tm_scope: source.hy IDL: type: programming @@ -1372,13 +1385,6 @@ JSON: extensions: - .json - .lock - - .sublime-keymap - - .sublime-mousemap - - .sublime-project - - .sublime-settings - - .sublime-workspace - - .sublime_metrics - - .sublime_session filenames: - .jshintrc - composer.lock @@ -1413,6 +1419,13 @@ Jade: tm_scope: source.jade ace_mode: jade +Jasmin: + type: programming + ace_mode: java + extensions: + - .j + tm_scope: source.jasmin + Java: type: programming ace_mode: java @@ -1455,6 +1468,19 @@ JavaScript: - .pac - .sjs - .ssjs + - .sublime-build + - .sublime-commands + - .sublime-completions + - .sublime-keymap + - .sublime-macro + - .sublime-menu + - .sublime-mousemap + - .sublime-project + - .sublime-settings + - .sublime-theme + - .sublime-workspace + - .sublime_metrics + - .sublime_session - .xsjs - .xsjslib filenames: @@ -1718,7 +1744,7 @@ Markdown: - .mkdn - .mkdown - .ron - tm_scope: text.html.markdown + tm_scope: source.gfm Mask: type: markup @@ -1789,7 +1815,7 @@ Mercury: extensions: - .m - .moo - tm_scope: source.prolog + tm_scope: source.mercury ace_mode: prolog MiniD: # Legacy @@ -1888,6 +1914,7 @@ Nimrod: - .nim - .nimrod ace_mode: text + tm_scope: source.nim Ninja: type: data @@ -1901,7 +1928,7 @@ Nit: color: "#0d8921" extensions: - .nit - tm_scope: none + tm_scope: source.nit ace_mode: text Nix: @@ -2043,7 +2070,7 @@ OpenSCAD: extensions: - .scad tm_scope: none - ace_mode: text + ace_mode: scad Org: type: prose @@ -2200,6 +2227,8 @@ Perl6: - .pm - .pm6 - .t + filenames: + - Rexfile interpreters: - perl6 tm_scope: none @@ -2219,6 +2248,8 @@ Pike: extensions: - .pike - .pmod + interpreters: + - pike ace_mode: text Pod: @@ -2319,6 +2350,15 @@ Pure Data: tm_scope: none ace_mode: text +PureBasic: + type: programming + color: "#5a6986" + extensions: + - .pb + - .pbi + tm_scope: none + ace_mode: text + PureScript: type: programming color: "#bcdc53" @@ -2582,7 +2622,7 @@ SAS: color: "#1E90FF" extensions: - .sas - tm_scope: none + tm_scope: source.sas ace_mode: text SCSS: @@ -2593,6 +2633,14 @@ SCSS: extensions: - .scss +SPARQL: + type: data + tm_scope: source.sparql + ace_mode: text + extensions: + - .sparql + - .rq + SQF: type: programming color: "#FFCB1F" @@ -2608,6 +2656,8 @@ SQL: ace_mode: sql extensions: - .sql + - .cql + - .ddl - .prc - .tab - .udf @@ -2618,17 +2668,29 @@ STON: group: Smalltalk extensions: - .ston - tm_scope: source.json - ace_mode: lisp + tm_scope: source.smalltalk + ace_mode: text Sage: type: programming group: Python extensions: - .sage + - .sagews tm_scope: source.python ace_mode: python +SaltStack: + type: data + group: YAML + aliases: + - saltstate + - salt + extensions: + - .sls + tm_scope: source.yaml.salt + ace_mode: yaml + Sass: type: markup tm_scope: source.sass @@ -2752,6 +2814,7 @@ Smalltalk: color: "#596706" extensions: - .st + - .cs aliases: - squeak ace_mode: text @@ -2935,6 +2998,13 @@ Turing: tm_scope: none ace_mode: text +Turtle: + type: data + extensions: + - .ttl + tm_scope: source.turtle + ace_mode: text + Twig: type: markup group: PHP @@ -3049,6 +3119,14 @@ Volt: tm_scope: source.d ace_mode: d +Web Ontology Language: + type: markup + color: "#3994bc" + extensions: + - .owl + tm_scope: text.xml + ace_mode: xml + WebIDL: type: programming extensions: @@ -3082,8 +3160,10 @@ XML: - .dita - .ditamap - .ditaval + - .dll.config - .filters - .fsproj + - .fxml - .glade - .grxml - .ivy @@ -3104,6 +3184,8 @@ XML: - .rss - .scxml - .srdf + - .stTheme + - .sublime-snippet - .svg - .targets - .tmCommand @@ -3129,18 +3211,18 @@ XML: - .xlf - .xliff - .xmi + - .xml.dist - .xsd - .xul - .zcml filenames: - .classpath - .project + - Settings.StyleCop - Web.Debug.config - Web.Release.config - Web.config - - build.xml.dist - packages.config - - phpunit.xml.dist XProc: type: programming diff --git a/lib/linguist/vendor.yml b/lib/linguist/vendor.yml index 4b8299f4..4ba241ca 100644 --- a/lib/linguist/vendor.yml +++ b/lib/linguist/vendor.yml @@ -40,24 +40,27 @@ # Minified JavaScript and CSS - (\.|-)min\.(js|css)$ +#Stylesheets imported from packages +- ([^\s]*)import\.(css|less|scss|styl)$ + # Bootstrap css and js -- (^|/)bootstrap([^.]*)\.(js|css)$ +- (^|/)bootstrap([^.]*)\.(js|css|less|scss|styl)$ +- (^|/)custom\.bootstrap([^\s]*)(js|css|less|scss|styl)$ # Font Awesome -- font-awesome.css +- (^|/)font-awesome\.(css|less|scss|styl)$ # Foundation css -- foundation.css +- (^|/)foundation\.(css|less|scss|styl)$ # Normalize.css -- normalize.css +- (^|/)normalize\.(css|less|scss|styl)$ -# Bourbon SCSS -- (^|/)[Bb]ourbon/.*\.css$ -- (^|/)[Bb]ourbon/.*\.scss$ +# Bourbon css +- (^|/)[Bb]ourbon/.*\.(css|less|scss|styl)$ # Animate.css -- animate.css +- (^|/)animate\.(css|less|scss|styl)$ # Vendored dependencies - third[-_]?party/ diff --git a/lib/linguist/version.rb b/lib/linguist/version.rb index 45fb0292..73b6c63a 100644 --- a/lib/linguist/version.rb +++ b/lib/linguist/version.rb @@ -1,3 +1,3 @@ module Linguist - VERSION = "4.2.3" + VERSION = "4.2.7" end diff --git a/samples/C#/AssemblyInfo.cs b/samples/C#/AssemblyInfo.cs new file mode 100644 index 00000000..1ef68427 --- /dev/null +++ b/samples/C#/AssemblyInfo.cs @@ -0,0 +1,26 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("Simple")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] diff --git a/samples/C#/BsonPropertyValue.cs b/samples/C#/BsonPropertyValue.cs new file mode 100644 index 00000000..94d27c88 --- /dev/null +++ b/samples/C#/BsonPropertyValue.cs @@ -0,0 +1,20 @@ +using System; + +namespace MongoDB.Serialization.Descriptors +{ + internal class BsonPropertyValue + { + public bool IsDictionary { get; private set; } + + public Type Type { get; private set; } + + public object Value { get; private set; } + + public BsonPropertyValue(Type type, object value, bool isDictionary) + { + Type = type; + Value = value; + IsDictionary = isDictionary; + } + } +} \ No newline at end of file diff --git a/samples/C#/MongoExpressionVisitor.cs b/samples/C#/MongoExpressionVisitor.cs new file mode 100644 index 00000000..b7a1effe --- /dev/null +++ b/samples/C#/MongoExpressionVisitor.cs @@ -0,0 +1,153 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Linq.Expressions; + +namespace MongoDB.Linq.Expressions +{ + internal class MongoExpressionVisitor : ExpressionVisitor + { + protected override Expression Visit(Expression exp) + { + if (exp == null) + return null; + switch ((MongoExpressionType)exp.NodeType) + { + case MongoExpressionType.Collection: + return VisitCollection((CollectionExpression)exp); + case MongoExpressionType.Field: + return VisitField((FieldExpression)exp); + case MongoExpressionType.Projection: + return VisitProjection((ProjectionExpression)exp); + case MongoExpressionType.Select: + return VisitSelect((SelectExpression)exp); + case MongoExpressionType.Aggregate: + return VisitAggregate((AggregateExpression)exp); + case MongoExpressionType.AggregateSubquery: + return VisitAggregateSubquery((AggregateSubqueryExpression)exp); + case MongoExpressionType.Scalar: + return VisitScalar((ScalarExpression)exp); + default: + return base.Visit(exp); + } + } + + protected virtual Expression VisitAggregate(AggregateExpression aggregate) + { + var exp = Visit(aggregate.Argument); + if (exp != aggregate.Argument) + return new AggregateExpression(aggregate.Type, aggregate.AggregateType, exp, aggregate.Distinct); + + return aggregate; + } + + protected virtual Expression VisitAggregateSubquery(AggregateSubqueryExpression aggregateSubquery) + { + Expression e = Visit(aggregateSubquery.AggregateAsSubquery); + ScalarExpression subquery = (ScalarExpression)e; + if (subquery != aggregateSubquery.AggregateAsSubquery) + return new AggregateSubqueryExpression(aggregateSubquery.GroupByAlias, aggregateSubquery.AggregateInGroupSelect, subquery); + return aggregateSubquery; + } + + protected virtual Expression VisitCollection(CollectionExpression collection) + { + return collection; + } + + protected virtual Expression VisitField(FieldExpression field) + { + var e = Visit(field.Expression); + if (field.Expression != e) + field = new FieldExpression(e, field.Alias, field.Name); + + return field; + } + + protected virtual Expression VisitProjection(ProjectionExpression projection) + { + var source = (SelectExpression)Visit(projection.Source); + var projector = Visit(projection.Projector); + if (source != projection.Source || projector != projection.Projector) + return new ProjectionExpression(source, projector, projection.Aggregator); + return projection; + } + + protected ReadOnlyCollection VisitOrderBy(ReadOnlyCollection orderBys) + { + if (orderBys != null) + { + List alternate = null; + for (int i = 0, n = orderBys.Count; i < n; i++) + { + OrderExpression expr = orderBys[i]; + Expression e = this.Visit(expr.Expression); + if (alternate == null && e != expr.Expression) + alternate = orderBys.Take(i).ToList(); + if (alternate != null) + alternate.Add(new OrderExpression(expr.OrderType, e)); + } + if (alternate != null) + return alternate.AsReadOnly(); + } + return orderBys; + } + + protected virtual Expression VisitScalar(ScalarExpression scalar) + { + SelectExpression select = (SelectExpression)Visit(scalar.Select); + if (select != scalar.Select) + return new ScalarExpression(scalar.Type, select); + return scalar; + } + + protected virtual Expression VisitSelect(SelectExpression select) + { + var from = VisitSource(select.From); + var where = Visit(select.Where); + var groupBy = Visit(select.GroupBy); + var orderBy = VisitOrderBy(select.OrderBy); + var skip = Visit(select.Skip); + var take = Visit(select.Take); + var fields = VisitFieldDeclarationList(select.Fields); + if (from != select.From || where != select.Where || orderBy != select.OrderBy || groupBy != select.GroupBy || skip != select.Skip || take != select.Take || fields != select.Fields) + return new SelectExpression(select.Alias, fields, from, where, orderBy, groupBy, select.IsDistinct, skip, take); + return select; + } + + protected virtual Expression VisitSource(Expression source) + { + return Visit(source); + } + + protected virtual Expression VisitSubquery(SubqueryExpression subquery) + { + switch ((MongoExpressionType)subquery.NodeType) + { + case MongoExpressionType.Scalar: + return VisitScalar((ScalarExpression)subquery); + } + return subquery; + } + + protected virtual ReadOnlyCollection VisitFieldDeclarationList(ReadOnlyCollection fields) + { + if (fields == null) + return fields; + + List alternate = null; + for (int i = 0, n = fields.Count; i < n; i++) + { + var f = fields[i]; + var e = Visit(f.Expression); + if (f.Expression != e && alternate == null) + alternate = fields.Take(i).ToList(); + if (alternate != null) + alternate.Add(new FieldDeclaration(f.Name, e)); + } + if (alternate != null) + return alternate.AsReadOnly(); + return fields; + } + } +} \ No newline at end of file diff --git a/samples/C++/Entity.h b/samples/C++/Entity.h new file mode 100644 index 00000000..619fc1d1 --- /dev/null +++ b/samples/C++/Entity.h @@ -0,0 +1,98 @@ +/** +* @file Entity.h +* @page EntityPage Entity +* @brief represent an entity in the game +* @author vinz243 +* @version 0.1.0 +* This file represents an Entity in the game system +* This parent type is a static entity which is shown and loaded into the Physics engine but never updated +*/ + +#ifndef ENTITY_H +#define ENTITY_H + +#include "base.h" +/// @namespace Whitedrop +namespace Whitedrop { + /** @class Entity + * This parent type is a static entity which is shown and loaded into the Physics engine but never updated + */ + class Entity { + public: + /** + * @brief Create static entity + * @details creates a static entity instance according to the mesh and the id, the position + * This needs to be attached to a World after! + * The material name is not the file name but the material name! + * @ref WorldPage + * @param mesh the name of the mesh for the object, file must be in media/meshes + * @param id an unique identifier for the object, shortest as possible + * @param dimensions an Ogre::Vector3 which contains the dimensions in meter + * @param position the Vector3 which contains it position + * @param material the material name + */ + Entity(std::string mesh, std::string id, Ogre::Vector3 dimensions, Ogre::Vector3 position, std::string material); + /** + * @brief The copy constructor + * @details A copy constr + * + * @param ref the Entity to be copied from + */ + Entity(const Entity &ref); + + /** + * @brief The assignement operator + * @details + * + * @param ent the entity to be copied + */ + Entity& operator=(const Entity ent); + + /** + * @brief destrctor + * @details + */ + virtual ~Entity(void); + + /** + * @brief a constance type of the entity + * @details depends of the class. + * May contain STATIC, DYNAMIC or ETHERAL + */ + const std::string type = "STATIC"; + + /** + * @brief Attach the entity to specified sceneManager + * @details This creates the OgreEntity using sceneMgr, + * set material, create a Node with name as `_n`, + * scale it to match dimensions and translate the node to pos + * @param sceneMgr the scene manager to use + */ + virtual void setup(Ogre::SceneManager* sceneMgr); + + /** + * @brief the update method + * @details this method should be called on each world update. + * Even though the method is necessary declared, the main impl of + * a static entity should be empty since it is not updated by physics + * However, a Dynamic entity should implement this function in order to: + * 1) Get from the physics engine the actor position in the physic world + * 2) Update the OgreEntity position and rotation from the previous actor + * @return whether it was successful or not, if falsey engine should stop + */ + virtual bool update(void); + + protected: + std::string mMesh = "cube.mesh"; + std::string mId; + std::string mMaterial; + Ogre::Vector3 mDimensions; + Ogre::Vector3 mPosition; + Ogre::Entity* mEntity; + Ogre::SceneNode* mNode; + + }; +} + + +#endif \ No newline at end of file diff --git a/samples/Zephir/filenames/exception.zep.c b/samples/C/exception.zep.c similarity index 100% rename from samples/Zephir/filenames/exception.zep.c rename to samples/C/exception.zep.c diff --git a/samples/Zephir/filenames/exception.zep.h b/samples/C/exception.zep.h similarity index 100% rename from samples/Zephir/filenames/exception.zep.h rename to samples/C/exception.zep.h diff --git a/samples/CMake/sample1.cmake b/samples/CMake/sample1.cmake new file mode 100644 index 00000000..c4b23485 --- /dev/null +++ b/samples/CMake/sample1.cmake @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.6) + +enable_testing() + +set(CMAKE_BUILD_TYPE debug) + +include_directories("/usr/local/include") + +find_library(ssl_LIBRARY NAMES ssl PATHS "/usr/local/lib") + +add_custom_command(OUTPUT "ver.c" "ver.h" COMMAND ./ver.sh) + +add_executable(foo foo.c bar.c baz.c ver.c) + +target_link_libraries(foo ${ssl_LIBRARY}) diff --git a/samples/CMake/sample2.cmake b/samples/CMake/sample2.cmake new file mode 100644 index 00000000..7411b5d6 --- /dev/null +++ b/samples/CMake/sample2.cmake @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 2.8 FATAL_ERROR) + +project(PCLVisualizer) +target_link_libraries (PCLVisualizer ${PCL_LIBRARIES}) + +#it seems it's needed only on OS X 10.9 +find_package(GLEW REQUIRED) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/include -v") + +find_package(PCL 1.7 REQUIRED) + +include_directories(${PCL_INCLUDE_DIRS}) +link_directories(${PCL_LIBRARY_DIRS}) +add_definitions(${PCL_DEFINITIONS}) + +set(PCL_BUILD_TYPE Release) + +file(GLOB PCL_openni_viewer_SRC + "src/*.h" + "src/*.cpp" +) +add_executable(PCLVisualizer ${PCL_openni_viewer_SRC}) + +#add this line to solve probem in mac os x 10.9 +target_link_libraries(PCLVisualizer ${PCL_COMMON_LIBRARIES} ${PCL_IO_LIBRARIES} ${PCL_VISUALIZATION_LIBRARIES} ${PCL_FEATURES_LIBRARIES}) \ No newline at end of file diff --git a/samples/CMake/sample3.cmake b/samples/CMake/sample3.cmake new file mode 100644 index 00000000..7bd9ea77 --- /dev/null +++ b/samples/CMake/sample3.cmake @@ -0,0 +1,33 @@ +# Specifications for building user and development documentation. +# +# ==================================================================== +# Copyright (c) 2009 Ian Blumel. All rights reserved. +# +# This software is licensed as described in the file LICENSE, which +# you should have received as part of this distribution. +# ==================================================================== + +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +FIND_FILE( SPHINX sphinx-build.exe) + +# If we are windows call to the make.bat file, otherwise rely on the Makefile +# to handle the processing. +IF(WIN32) + SET(SPHINX_MAKE make.bat) +ELSE(WIN32) + SET(SPHINX_MAKE make) +ENDIF(WIN32) + +ADD_CUSTOM_TARGET( + doc_usr + COMMAND ${SPHINX_MAKE} html + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/usr +) + +ADD_CUSTOM_TARGET( + doc_dev + COMMAND ${SPHINX_MAKE} html + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/dev +) + diff --git a/samples/CMake/sample4.cmake b/samples/CMake/sample4.cmake new file mode 100644 index 00000000..e3c123a0 --- /dev/null +++ b/samples/CMake/sample4.cmake @@ -0,0 +1,33 @@ +cmake_minimum_required (VERSION 2.6) + +set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin") + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/vala) +find_package(Vala REQUIRED) +include(ValaPrecompile) +include(ValaVersion) +ensure_vala_version("0.11.0" MINIMUM) + +project (template C) + +find_package(PkgConfig) + +pkg_check_modules(GOBJECT REQUIRED gobject-2.0) +add_definitions(${GOBJECT_CFLAGS} ${GOBJECT_CFLAGS_OTHER}) +link_libraries(${GOBJECT_LIBRARIES}) +link_directories(${GOBJECT_LIBRARY_DIRS}) + + +vala_precompile(VALA_C + src/template.vala +PACKAGES +OPTIONS + --thread +CUSTOM_VAPIS +GENERATE_VAPI +GENERATE_HEADER +DIRECTORY + gen +) + +add_executable("template" ${VALA_C}) diff --git a/samples/CMake/sample5.cmake b/samples/CMake/sample5.cmake new file mode 100644 index 00000000..f87136e7 --- /dev/null +++ b/samples/CMake/sample5.cmake @@ -0,0 +1,89 @@ +# - Check if the STDCALL function exists. +# This works for non-cdecl functions (kernel32 functions, for example) +# CHECK_STDCALL_FUNCTION_EXISTS(FUNCTION FUNCTION_DUMMY_ARGS VARIABLE) +# - macro which checks if the stdcall function exists +# FUNCTION_DECLARATION - the definition of the function ( e.g.: Sleep(500) ) +# VARIABLE - variable to store the result +# +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_EXTRA_INCLUDE_FILES = list of extra includes to check in + +MACRO(CHECK_STDCALL_FUNCTION_EXISTS FUNCTION_DECLARATION VARIABLE) + IF("${VARIABLE}" MATCHES "^${VARIABLE}$") + #get includes + SET(CHECK_STDCALL_FUNCTION_PREMAIN) + FOREACH(def ${CMAKE_EXTRA_INCLUDE_FILES}) + SET(CHECK_STDCALL_FUNCTION_PREMAIN "${CHECK_STDCALL_FUNCTION_PREMAIN}#include \"${def}\"\n") + ENDFOREACH(def) + + #add some default includes + IF ( HAVE_WINDOWS_H ) + SET(CHECK_STDCALL_FUNCTION_PREMAIN "${CHECK_STDCALL_FUNCTION_PREMAIN}#include \"windows.h\"\n") + ENDIF ( HAVE_WINDOWS_H ) + IF ( HAVE_UNISTD_H ) + SET(CHECK_STDCALL_FUNCTION_PREMAIN "${CHECK_STDCALL_FUNCTION_PREMAIN}#include \"unistd.h\"\n") + ENDIF ( HAVE_UNISTD_H ) + IF ( HAVE_DIRECT_H ) + SET(CHECK_STDCALL_FUNCTION_PREMAIN "${CHECK_STDCALL_FUNCTION_PREMAIN}#include \"direct.h\"\n") + ENDIF ( HAVE_DIRECT_H ) + IF ( HAVE_IO_H ) + SET(CHECK_STDCALL_FUNCTION_PREMAIN "${CHECK_STDCALL_FUNCTION_PREMAIN}#include \"io.h\"\n") + ENDIF ( HAVE_IO_H ) + IF ( HAVE_SYS_TIMEB_H ) + SET(CHECK_STDCALL_FUNCTION_PREMAIN "${CHECK_STDCALL_FUNCTION_PREMAIN}#include \"sys/timeb.h\"\n") + ENDIF ( HAVE_SYS_TIMEB_H ) + + STRING(REGEX REPLACE "(\\(.*\\))" "" CHECK_STDCALL_FUNCTION_EXISTS_FUNCTION ${FUNCTION_DECLARATION} ) + + SET(MACRO_CHECK_STDCALL_FUNCTION_DEFINITIONS "${CMAKE_REQUIRED_FLAGS}") + MESSAGE(STATUS "Looking for ${CHECK_STDCALL_FUNCTION_EXISTS_FUNCTION}") + + IF(CMAKE_REQUIRED_LIBRARIES) + SET(CHECK_STDCALL_FUNCTION_EXISTS_ADD_LIBRARIES + "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + ELSE(CMAKE_REQUIRED_LIBRARIES) + SET(CHECK_STDCALL_FUNCTION_EXISTS_ADD_LIBRARIES) + ENDIF(CMAKE_REQUIRED_LIBRARIES) + + IF(CMAKE_REQUIRED_INCLUDES) + SET(CHECK_STDCALL_FUNCTION_EXISTS_ADD_INCLUDES + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + ELSE(CMAKE_REQUIRED_INCLUDES) + SET(CHECK_STDCALL_FUNCTION_EXISTS_ADD_INCLUDES) + ENDIF(CMAKE_REQUIRED_INCLUDES) + + SET(CHECK_STDCALL_FUNCTION_DECLARATION ${FUNCTION_DECLARATION}) + CONFIGURE_FILE("${clucene-shared_SOURCE_DIR}/cmake/CheckStdCallFunctionExists.cpp.in" + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckStdCallFunctionExists.cpp" IMMEDIATE @ONLY) + FILE(READ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckStdCallFunctionExists.cpp" + CHECK_STDCALL_FUNCTION_CONTENT) + + TRY_COMPILE(${VARIABLE} + ${CMAKE_BINARY_DIR} + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckStdCallFunctionExists.cpp" + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_STDCALL_FUNCTION_DEFINITIONS} + "${CHECK_STDCALL_FUNCTION_EXISTS_ADD_LIBRARIES}" + "${CHECK_STDCALL_FUNCTION_EXISTS_ADD_INCLUDES}" + OUTPUT_VARIABLE OUTPUT) + IF(${VARIABLE}) + SET(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION_DECLARATION}") + MESSAGE(STATUS "Looking for ${FUNCTION_DECLARATION} - found") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the stdcall function ${FUNCTION_DECLARATION} exists passed with the following output:\n" + "${OUTPUT}\nCheckStdCallFunctionExists.cpp:\n${CHECK_STDCALL_FUNCTION_CONTENT}\n\n") + ELSE(${VARIABLE}) + MESSAGE(STATUS "Looking for ${FUNCTION_DECLARATION} - not found") + SET(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION_DECLARATION}") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the stdcall function ${FUNCTION_DECLARATION} exists failed with the following output:\n" + "${OUTPUT}\nCheckStdCallFunctionExists.cpp:\n${CHECK_STDCALL_FUNCTION_CONTENT}\n\n") + ENDIF(${VARIABLE}) + ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$") +ENDMACRO(CHECK_STDCALL_FUNCTION_EXISTS) diff --git a/samples/CMake/uninstall.cmake.in b/samples/CMake/uninstall.cmake.in new file mode 100644 index 00000000..a5b7436f --- /dev/null +++ b/samples/CMake/uninstall.cmake.in @@ -0,0 +1,22 @@ +IF (NOT EXISTS "@PROJECT_BINARY_DIR@/install_manifest.txt") + MESSAGE (FATAL_ERROR "Cannot find install manifest: \"@PROJECT_BINARY_DIR@/install_manifest.txt\"") +ENDIF (NOT EXISTS "@PROJECT_BINARY_DIR@/install_manifest.txt") + +FILE (READ "@PROJECT_BINARY_DIR@/install_manifest.txt" files) +STRING (REGEX REPLACE "\n" ";" files "${files}") +FOREACH (file ${files}) + MESSAGE (STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + IF (EXISTS "$ENV{DESTDIR}${file}") + EXEC_PROGRAM ( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + IF (NOT "${rm_retval}" STREQUAL 0) + MESSAGE (FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + ENDIF (NOT "${rm_retval}" STREQUAL 0) + ELSE (EXISTS "$ENV{DESTDIR}${file}") + MESSAGE (STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + ENDIF (EXISTS "$ENV{DESTDIR}${file}") +ENDFOREACH (file) + diff --git a/samples/CartoCSS/amenity-points.mss b/samples/CartoCSS/amenity-points.mss new file mode 100644 index 00000000..a7b94ea0 --- /dev/null +++ b/samples/CartoCSS/amenity-points.mss @@ -0,0 +1,1879 @@ +@marina-text: #576ddf; // also swimming_pool +@wetland-text: darken(#017fff, 10%); /* Also for marsh */ +@mud-text: darken(#aea397, 20%); +@shop-icon: #ac39ac; +@transportation-icon: #0092da; +@transportation-text: #0066ff; +@airtransport: #8461C4; + +@landcover-font-size: 10; +@landcover-font-size-big: 12; +@landcover-font-size-bigger: 15; +@landcover-wrap-width-size: 25; +@landcover-wrap-width-size-big: 35; +@landcover-wrap-width-size-bigger: 45; +@landcover-face-name: @oblique-fonts; + +@standard-wrap-width: 30; + +.points { + [feature = 'tourism_alpine_hut'][zoom >= 13] { + point-file: url('symbols/alpinehut.p.16.png'); + point-placement: interior; + } + + [feature = 'amenity_shelter'][zoom >= 16] { + point-file: url('symbols/shelter2.p.16.png'); + point-placement: interior; + } + + [feature = 'amenity_atm'][zoom >= 17] { + point-file: url('symbols/atm2.p.16.png'); + point-placement: interior; + } + + [feature = 'amenity_bank'][zoom >= 17] { + point-file: url('symbols/bank2.p.16.png'); + point-placement: interior; + } + + [feature = 'amenity_bar'][zoom >= 17] { + point-file: url('symbols/bar.p.20.png'); + point-placement: interior; + } + + [feature = 'amenity_bicycle_rental'][zoom >= 17] { + point-file: url('symbols/rental_bicycle.p.20.png'); + point-placement: interior; + } + + [feature = 'highway_bus_stop'] { + [zoom >= 16] { + marker-file: url('symbols/square.svg'); + marker-fill: @transportation-icon; + marker-placement: interior; + marker-width: 6; + } + [zoom >= 17] { + marker-file: url('symbols/bus_stop.p.12.png'); + marker-width: 12; + } + } + + [feature = 'amenity_bus_station'][zoom >= 16] { + point-file: url('symbols/bus_station.n.16.png'); + point-placement: interior; + } + + [feature = 'highway_traffic_signals'][zoom >= 17] { + marker-file: url('symbols/traffic_light.svg'); + marker-fill: #0a0a0a; + marker-placement: interior; + } + + [feature = 'amenity_cafe'][zoom >= 17] { + point-file: url('symbols/cafe.p.16.png'); + point-placement: interior; + } + + [feature = 'tourism_camp_site'][zoom >= 16] { + point-file: url('symbols/camping.n.16.png'); + point-placement: interior; + } + + [feature = 'highway_ford'][zoom >= 16] { + point-file: url('symbols/transport_ford.p.16.png'); + point-placement: interior; + } + + [feature = 'tourism_caravan_site'][zoom >= 16] { + point-file: url('symbols/caravan_park.p.24.png'); + point-placement: interior; + } + + [feature = 'amenity_car_sharing'][zoom >= 16] { + point-file: url('symbols/car_share.p.16.png'); + point-placement: interior; + } + + [feature = 'tourism_chalet'][zoom >= 17] { + point-file: url('symbols/chalet.p.16.png'); + point-placement: interior; + } + + [feature = 'amenity_cinema'][zoom >= 16] { + point-file: url('symbols/cinema.p.24.png'); + point-placement: interior; + } + + [feature = 'amenity_fire_station'][zoom >= 16] { + point-file: url('symbols/firestation.p.16.png'); + point-placement: interior; + } + + [feature = 'amenity_fuel'][zoom >= 17] { + point-file: url('symbols/fuel.p.16.png'); + point-placement: interior; + } + + [feature = 'tourism_guest_house'][zoom >= 17] { + point-file: url('symbols/guest_house.p.16.png'); + point-placement: interior; + } + + [feature = 'amenity_hospital'][zoom >= 15] { + point-file: url('symbols/hospital.p.16.png'); + point-placement: interior; + } + + [feature = 'tourism_hostel'][zoom >= 17] { + point-file: url('symbols/hostel.p.20.png'); + point-placement: interior; + } + + [feature = 'tourism_hotel'][zoom >= 17] { + point-file: url('symbols/hotel2.p.20.png'); + point-placement: interior; + } + + [feature = 'tourism_motel'][zoom >= 17] { + point-file: url('symbols/motel.p.20.png'); + point-placement: interior; + } + + [feature = 'tourism_information'][zoom >= 17] { + point-file: url('symbols/information.p.16.png'); + point-placement: interior; + } + + [feature = 'amenity_embassy'][zoom >= 17] { + point-file: url('symbols/embassy.png'); + point-placement: interior; + } + + [feature = 'amenity_library'][zoom >= 16] { + point-file: url('symbols/library.p.20.png'); + point-placement: interior; + } + + [feature = 'amenity_courthouse'][zoom > 16] { + point-file: url('symbols/amenity_court.p.20.png'); + point-placement: interior; + } + + [feature = 'waterway_lock'], + [feature = 'lock_yes'] { + [zoom >= 15] { + marker-fill: #969494; + marker-width: 9; + marker-line-width: 0; + marker-placement: interior; + } + } + + [feature = 'man_made_mast'][zoom >= 17] { + point-file: url('symbols/communications.p.20.png'); + point-placement: interior; + } + + [feature = 'tourism_museum'][zoom >= 16] { + point-file: url('symbols/museum.p.16.png'); + point-placement: interior; + } + + [feature = 'amenity_parking'][zoom >= 16] { + marker-file: url('symbols/parking.svg'); + marker-placement: interior; + marker-clip: false; + marker-fill: @transportation-icon; + [access != ''][access != 'public'][access != 'yes'] { + marker-opacity: 0.33; + } + } + + [feature = 'amenity_pharmacy'][zoom >= 17] { + point-file: url('symbols/pharmacy.p.16.png'); + point-placement: interior; + } + + [feature = 'amenity_place_of_worship'][zoom >= 16] { + point-file: url('symbols/place_of_worship3.p.16.png'); + point-placement: interior; + [religion = 'christian'] { + point-file: url('symbols/christian3.p.14.png'); + [denomination = 'jehovahs_witness']{ + point-file: url('symbols/place_of_worship3.p.16.png'); + } + } + [religion = 'muslim'] { + point-file: url('symbols/islamic3.p.16.png'); + } + [religion = 'sikh'] { + point-file: url('symbols/sikh3.p.16.png'); + } + [religion = 'jewish'] { + point-file: url('symbols/jewish3.p.16.png'); + } + [religion = 'hindu'] { + point-file: url('symbols/hindu.png'); + } + [religion = 'buddhist'] { + point-file: url('symbols/buddhist.png'); + } + [religion = 'shinto'] { + point-file: url('symbols/shinto.png'); + } + [religion = 'taoist'] { + point-file: url('symbols/taoist.png'); + } + } + + [feature = 'amenity_police'][zoom >= 16] { + point-file: url('symbols/police.p.16.png'); + point-placement: interior; + } + + [feature = 'amenity_post_box'][zoom >= 17] { + point-file: url('symbols/post_box.p.16.png'); + point-placement: interior; + } + + [feature = 'amenity_post_office'][zoom >= 17] { + point-file: url('symbols/post_office.p.16.png'); + point-placement: interior; + } + + [feature = 'amenity_pub'][zoom >= 17] { + point-file: url('symbols/pub.p.16.png'); + point-placement: interior; + } + + [feature = 'amenity_biergarten'][zoom >= 17] { + point-file: url('symbols/biergarten.p.16.png'); + point-placement: interior; + } + + [feature = 'amenity_recycling'][zoom >= 16] { + point-file: url('symbols/recycling.p.16.png'); + point-placement: interior; + } + + [feature = 'amenity_restaurant'][zoom >= 17] { + point-file: url('symbols/restaurant.p.16.png'); + point-placement: interior; + } + + [feature = 'amenity_fast_food'][zoom >= 17] { + point-file: url('symbols/fast_food.png'); + point-placement: interior; + } + + [feature = 'amenity_telephone'][zoom >= 17] { + point-file: url('symbols/telephone.p.16.png'); + point-placement: interior; + } + + [feature = 'amenity_emergency_phone'][zoom >= 17] { + point-file: url('symbols/sosphone.png'); + point-placement: interior; + } + + [feature = 'amenity_theatre'][zoom >= 16] { + point-file: url('symbols/theatre.p.20.png'); + point-placement: interior; + } + + [feature = 'amenity_toilets'][zoom >= 17] { + point-file: url('symbols/toilets.p.20.png'); + point-placement: interior; + } + + [feature = 'amenity_drinking_water'][zoom >= 17] { + point-file: url('symbols/food_drinkingtap.p.20.png'); + point-placement: interior; + } + + [feature = 'amenity_prison'][zoom >= 17] { + point-file: url('symbols/amenity_prison.p.20.png'); + point-placement: interior; + } + + [feature = 'tourism_viewpoint'][zoom >= 16] { + point-file: url('symbols/view_point.p.16.png'); + point-placement: interior; + } + + [feature = 'man_made_water_tower'][zoom >= 17] { + point-file: url('symbols/tower_water.p.20.png'); + point-placement: interior; + } + + [feature = 'historic_memorial'][zoom >= 17] { + point-file: url('symbols/tourist_memorial.p.20.png'); + point-placement: interior; + } + + [feature = 'historic_archaeological_site'][zoom >= 16] { + point-file: url('symbols/tourist_archaeological2.glow.24.png'); + point-placement: interior; + } + + [feature = 'shop_other'][zoom >= 17] { + marker-fill: @shop-icon; + marker-width: 6; + marker-line-width: 0; + marker-placement: interior; + marker-clip: false; + } + + [feature = 'shop_supermarket'][zoom >= 16] { + marker-file: url('symbols/shop_supermarket.svg'); + marker-placement: interior; + marker-clip: false; + marker-fill: @shop-icon; + } + + [feature = 'shop_bakery'][zoom >= 17] { + marker-file: url('symbols/shop_bakery.p.16.png'); + marker-placement: interior; + marker-clip: false; + } + + [feature = 'shop_butcher'][zoom >= 17] { + marker-file: url('symbols/shop_butcher.png'); + marker-placement: interior; + marker-clip: false; + } + + [feature = 'shop_clothes'], + [feature = 'shop_fashion'] { + [zoom >= 17] { + marker-file: url('symbols/shop_clothes.svg'); + marker-placement: interior; + marker-clip: false; + marker-fill: @shop-icon; + } + } + + [feature = 'shop_convenience'][zoom >= 17] { + marker-file: url('symbols/shop_convenience.svg'); + marker-placement: interior; + marker-clip: false; + marker-fill: @shop-icon; + } + + [feature = 'shop_department_store'][zoom >= 16] { + point-file: url('symbols/department_store.p.16.png'); + point-placement: interior; + } + + [feature = 'shop_doityourself'][zoom >= 17] { + marker-file: url('symbols/shop_diy.p.16.png'); + marker-placement: interior; + marker-clip: false; + } + + [feature = 'shop_florist'][zoom >= 17] { + marker-file: url('symbols/florist.p.16.png'); + marker-placement: interior; + marker-clip: false; + } + + [feature = 'shop_hairdresser'][zoom >= 17] { + marker-file: url('symbols/shop_hairdresser.p.16.png'); + marker-placement: interior; + marker-clip: false; + } + + [feature = 'shop_car'][zoom >= 17] { + marker-file: url('symbols/shop_car.svg'); + marker-placement: interior; + marker-clip: false; + marker-fill: @shop-icon; + } + + [feature = 'shop_car_repair'][zoom >= 17] { + marker-file: url('symbols/shopping_car_repair.p.16.png'); + marker-placement: interior; + marker-clip: false; + } + + [feature = 'shop_bicycle'][zoom >= 17] { + marker-file: url('symbols/shopping_bicycle.p.16.png'); + marker-placement: interior; + marker-clip: false; + } + + [feature = 'leisure_playground'][zoom >= 17] { + point-file: url('symbols/playground.p.20.png'); + point-placement: interior; + } + + [feature = 'tourism_picnic_site'][zoom >= 16] { + point-file: url('symbols/picnic.p.16.png'); + point-placement: interior; + } + + [feature = 'leisure_picnic_table'][zoom >= 17] { + point-file: url('symbols/picnic.p.16.png'); + point-placement: interior; + } + + [feature = 'leisure_slipway'][zoom >= 17] { + point-file: url('symbols/transport_slipway.p.20.png'); + point-placement: interior; + } + + [feature = 'aeroway_helipad'][zoom >= 16]::aeroway { + marker-file: url('symbols/helipad.svg'); + marker-clip: false; + marker-fill: @airtransport; + } + + [feature = 'aeroway_aerodrome'][zoom >= 10][zoom < 14]::aeroway { + marker-file: url('symbols/aerodrome.svg'); + marker-clip: false; + marker-fill: @airtransport; + } + + [feature = 'man_made_lighthouse'][zoom >= 15]::man_made { + point-file: url('symbols/lighthouse.p.20.png'); + point-placement: interior; + } + + [feature = 'natural_peak'][zoom >= 11]::natural { + marker-file: url('symbols/peak.svg'); + marker-fill: #d08f55; + marker-placement: interior; + } + + [feature = 'natural_volcano'][zoom >= 11]::natural { + marker-file: url('symbols/peak.svg'); + marker-fill: #d40000; + marker-placement: interior; + } + + [feature = 'natural_saddle'][zoom >= 15]::natural { + marker-file: url('symbols/saddle.svg'); + marker-fill: #d08f55; + marker-placement: interior; + } + + [feature = 'natural_cave_entrance'][zoom >= 15]::natural { + point-file: url('symbols/poi_cave.p.16.png'); + point-placement: interior; + } + + [feature = 'natural_spring'][zoom >= 14]::natural { + marker-file: url('symbols/spring.svg'); + marker-placement: interior; + } + + [feature = 'natural_tree'][zoom >= 16]::natural { + marker-placement: interior; + marker-ignore-placement: true; + marker-line-width: 0; + marker-width: 3; + marker-fill: #239c45; + [zoom >= 17] { + marker-line-width: 1; + marker-line-color: #8ef2ab; + marker-width: 4; + } + } + + [feature = 'power_generator']['generator:source' = 'wind']::power, + [feature = 'power_generator'][power_source = 'wind']::power { + [zoom >= 15] { + point-file: url('symbols/power_wind.png'); + point-placement: interior; + } + } + + [feature = 'man_made_windmill'][zoom >= 16]::man_made { + point-file: url('symbols/windmill.png'); + point-placement: interior; + } + + [feature = 'man_made_mast'][zoom >= 17]::man_made { + point-file: url('symbols/communications.p.20.png'); + point-placement: interior; + } +} + +.amenity-low-priority { + [railway = 'level_crossing'][zoom >= 14]::railway { + point-file: url('symbols/level_crossing.svg'); + point-placement: interior; + [zoom >= 16] { + point-file: url('symbols/level_crossing2.svg'); + } + } + + [highway = 'mini_roundabout'][zoom >= 16]::highway { + marker-file: url('symbols/mini_roundabout.svg'); + marker-placement: interior; + } + + [barrier = 'gate']::barrier { + [zoom >= 16] { + marker-file: url('symbols/gate.svg'); + marker-placement: interior; + } + } + + [barrier = 'lift_gate'][zoom >= 16]::barrier { + marker-file: url('symbols/liftgate.svg'); + marker-fill: #3f3f3f; + marker-placement: interior + } + + [barrier = 'bollard'], + [barrier = 'block'] { + [zoom >= 16] { + marker-width: 3; + marker-line-width: 0; + marker-fill: #7d7c7c; + marker-placement: interior; + + [zoom >= 18] { + marker-width: 4; + } + } + } +} + +.text-low-zoom[zoom < 10], +.text[zoom >= 10] { + [feature = 'place_island'][zoom >= 7][way_pixels > 3000], + [feature = 'place_island'][zoom >= 16], + [feature = 'place_islet'][zoom >= 14][way_pixels > 3000], + [feature = 'place_islet'][zoom >= 17] { + text-name: "[name]"; + text-fill: #000; + text-size: 10; + [way_pixels > 12000] { text-size: 12; } + [way_pixels > 48000] { text-size: 15; } + text-face-name: @oblique-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + + [feature = 'amenity_pub'], + [feature = 'amenity_restaurant'], + [feature = 'amenity_cafe'], + [feature = 'amenity_fast_food'], + [feature = 'amenity_biergarten'], + [feature = 'amenity_bar'] { + [zoom >= 17] { + text-name: "[name]"; + text-fill: #734a08; + text-size: 10; + text-dy: 11; + text-face-name: @bold-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + [feature = 'amenity_bar']{ + text-dy: 13; + } + } + } + + [feature = 'amenity_library'], + [feature = 'amenity_theatre'], + [feature = 'amenity_courthouse'], + [feature = 'amenity_cinema'] { + [zoom >= 17] { + text-name: "[name]"; + text-size: 10; + text-fill: #734a08; + text-dy: 13; + text-face-name: @bold-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + [feature = 'amenity_cinema'] { + text-dy: 15; + } + } + } + + [feature = 'amenity_parking'][zoom >= 17] { + text-name: "[name]"; + text-size: 9; + text-fill: @transportation-text; + text-dy: 9; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + [access != ''][access != 'public'][access != 'yes'] { + text-fill: #66ccaf; + } + } + + [feature = 'amenity_police'][zoom >= 17] { + text-name: "[name]"; + text-size: 10; + text-fill: #734a08; + text-dy: 11; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + + [feature = 'amenity_fire_station'][zoom >= 17] { + text-name: "[name]"; + text-size: 10; + text-fill: #734a08; + text-dy: 11; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + + [feature = 'amenity_place_of_worship'][zoom >= 17] { + text-name: "[name]"; + text-size: 10; + text-fill: #000033; + text-dy: 12; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + + [feature = 'natural_wood'][is_building = 'no'] { + [zoom >= 8][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@wood, 40%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'natural_peak'], + [feature = 'natural_volcano'] { + [zoom >= 13] { + text-name: "[name]"; + text-size: 10; + text-fill: brown; + text-dy: 7; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + ele/text-name: "[ele]"; + ele/text-size: 9; + ele/text-fill: brown; + ele/text-dy: 6; + ele/text-face-name: @oblique-fonts; + ele/text-halo-radius: 1; + ele/text-placement: interior; + [name != ''] { + ele/text-dy: 19; + } + } + } + + [feature = 'natural_saddle'] { + [zoom >= 15] { + text-name: "[name]"; + text-size: 10; + text-fill: brown; + text-dy: 7; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + ele/text-name: "[ele]"; + ele/text-size: 9; + ele/text-fill: brown; + ele/text-dy: 6; + ele/text-face-name: @oblique-fonts; + ele/text-halo-radius: 1; + ele/text-placement: interior; + [name != ''] { + ele/text-dy: 19; + } + } + } + + [feature = 'natural_cave_entrance'][zoom >= 15] { + text-name: "[name]"; + text-size: 10; + text-fill: brown; + text-dy: 11; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + + [feature = 'historic_memorial'][zoom >= 17] { + text-name: "[name]"; + text-size: 9; + text-fill: brown; + text-dy: 13; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + + [feature = 'historic_archaeological_site'][zoom >= 17] { + text-name: "[name]"; + text-size: 9; + text-fill: brown; + text-dy: 15; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + + [feature = 'natural_water'], + [feature = 'natural_lake'], + [feature = 'landuse_reservoir'], + [feature = 'landuse_basin'] { + [way_area >= 40000000][zoom >= 10], + [way_area >= 10000000][zoom >= 11], + [way_area >= 2400000][zoom >= 12], + [way_area >= 600000][zoom >= 13], + [way_area >= 150000][zoom >= 14], + [way_area >= 80000][zoom >= 15], + [way_area >= 20000][zoom >= 16], + [zoom >= 17] { + text-name: "[name]"; + text-size: 12; + text-fill: @water-text; + text-face-name: @oblique-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + } + + [feature = 'natural_mud'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: @mud-text; + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'natural_wetland'][is_building = 'no'], + [feature = 'natural_marsh'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: @wetland-text; + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'leisure_swimming_pool'][is_building = 'no'] { + [zoom >= 14][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: @marina-text; + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'leisure_sports_centre'][is_building = 'no'], + [feature = 'leisure_stadium'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@stadium, 30%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'leisure_track'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@track, 40%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'leisure_pitch'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@pitch, 40%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'leisure_playground'] { + [way_area >= 150000][zoom >= 14], + [way_area >= 80000][zoom >= 15], + [way_area >= 20000][zoom >= 16], + [zoom >= 17] { + text-name: "[name]"; + text-size: 11; + text-dy: 13; + text-fill: darken(@park, 60%); + text-face-name: @book-fonts; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + } + + [feature = 'leisure_park'][is_building = 'no'], + [feature = 'leisure_recreation_ground'][is_building = 'no'], + [feature = 'landuse_recreation_ground'][is_building = 'no'], + [feature = 'landuse_conservation'][is_building = 'no'], + [feature = 'landuse_village_green'][is_building = 'no'], + [feature = 'leisure_common'][is_building = 'no'], + [feature = 'leisure_garden'][is_building = 'no'], + [feature = 'leisure_golf_course'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@park, 60%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'boundary_national_park'][is_building = 'no'], + [feature = 'leisure_nature_reserve'][is_building = 'no'] { + [zoom >= 8][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@park, 70%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'landuse_quarry'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@quarry, 60%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'landuse_vineyard'][is_building = 'no'], + [feature = 'landuse_orchard'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@vineyard, 50%); + text-face-name: @landcover-face-name; + text-halo-radius: 1.5; /* extra halo needed to overpower the vineyard polygon pattern */ + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'landuse_cemetery'][is_building = 'no'], + [feature = 'amenity_grave_yard'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@cemetery, 50%); + text-face-name: @landcover-face-name; + text-halo-radius: 1.5; /* extra halo needed to overpower the cemetery polygon pattern */ + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'landuse_residential'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@residential, 50%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'landuse_garages'][is_building = 'no'] { + [zoom >= 13][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@garages, 50%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'landuse_field'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@field, 50%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'landuse_meadow'][is_building = 'no'], + [feature = 'landuse_grass'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@grass, 50%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'landuse_allotments'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@allotments, 50%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'landuse_forest'][is_building = 'no'] { + [zoom >= 8][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@forest, 30%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'landuse_farmyard'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@farmyard, 50%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + [feature = 'landuse_farm'][is_building = 'no'], + [feature = 'landuse_farmland'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@farmland, 50%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'shop_mall'], + [feature = 'landuse_retail'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@retail, 50%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'landuse_industrial'][is_building = 'no'], + [feature = 'landuse_railway'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@industrial, 60%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'landuse_commercial'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@commercial, 60%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'landuse_brownfield'][is_building = 'no'], + [feature = 'landuse_landfill'][is_building = 'no'], + [feature = 'landuse_construction'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@construction, 50%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'natural_bay'][zoom >= 14] { + text-name: "[name]"; + text-size: 10; + text-fill: #6699cc; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + + [feature = 'natural_spring'][zoom >= 16] { + text-name: "[name]"; + text-size: 10; + text-fill: #6699cc; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + text-dy: 6; + } + + [feature = 'tourism_alpine_hut'][zoom >= 15] { + text-name: "[name]"; + text-size: 9; + text-fill: #6699cc; + text-dy: 11; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + [zoom >= 16] { + ele/text-name: "[ele]"; + ele/text-size: 8; + ele/text-fill: #6699cc; + ele/text-dy: 23; + ele/text-face-name: @oblique-fonts; + ele/text-halo-radius: 1; + ele/text-placement: interior; + } + } + + [feature = 'amenity_shelter'][zoom >= 17] { + text-name: "[name]"; + text-size: 9; + text-fill: #6699cc; + text-dy: 11; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + ele/text-name: "[ele]"; + ele/text-size: 8; + ele/text-fill: #6699cc; + ele/text-dy: 23; + ele/text-face-name: @oblique-fonts; + ele/text-halo-radius: 1; + ele/text-placement: interior; + } + + [feature = 'amenity_bank'][zoom >= 17] { + text-name: "[name]"; + text-size: 9; + text-fill: black; + text-dy: 12; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + text-face-name: @book-fonts; + } + + [feature = 'tourism_hotel'], + [feature = 'tourism_motel'], + [feature = 'tourism_hostel'], + [feature = 'tourism_chalet'] { + [zoom >= 17] { + text-name: "[name]"; + text-size: 10; + text-fill: #0066ff; + text-dy: 13; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + [feature = 'tourism_chalet'] { + text-dy: 11; + } + } + } + + [feature = 'amenity_embassy'][zoom >= 17] { + text-name: "[name]"; + text-size: 9; + text-fill: #0066ff; + text-dy: 9; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + + [feature = 'tourism_guest_house'][zoom >= 17] { + text-name: "[name]"; + text-size: 8; + text-fill: #0066ff; + text-dy: 10; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + + [feature = 'highway_bus_stop'], + [feature = 'amenity_fuel'], + [feature = 'amenity_bus_station'] { + [zoom >= 17] { + text-name: "[name]"; + text-size: 9; + text-fill: @transportation-text; + text-dy: 11; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + [feature = 'highway_bus_stop'] { + text-dy: 9; + } + } + } + + [feature = 'tourism_camp_site'][zoom >= 17] { + text-name: "[name]"; + text-size: 10; + text-fill: #0066ff; + text-dy: 15; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + + [feature = 'tourism_caravan_site'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@campsite, 50%); + text-dy: 15; + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'waterway_lock'][zoom >= 15] { + text-name: "[name]"; + text-size: 9; + text-dy: 10; + text-fill: #0066ff; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + + [feature = 'leisure_marina'][zoom >= 15] { + text-name: "[name]"; + text-size: 8; + text-fill: @marina-text; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + [zoom >= 17] { + text-size: 10; + } + } + + [feature = 'tourism_theme_park'][is_building = 'no'] { + [zoom >= 13][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: @theme_park; + text-face-name: @bold-fonts; /*rendered bold to improve visibility since theme parks tend to have crowded backgrounds*/ + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'tourism_museum'][zoom >= 17] { + text-name: "[name]"; + text-size: 10; + text-dy: 11; + text-fill: #734a08; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + + [feature = 'amenity_prison'][zoom >= 17] { + text-name: "[name]"; + text-size: 10; + text-fill: #734a08; + text-dy: 16; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + + [feature = 'tourism_attraction'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: #660033; + text-face-name: @book-fonts; + text-halo-radius: 2; + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'amenity_university'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@school, 70%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'amenity_school'][is_building = 'no'], + [feature = 'amenity_college'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@school, 70%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'amenity_kindergarten'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@school, 65%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'man_made_lighthouse'][zoom >= 15] { + text-name: "[name]"; + text-size: 9; + text-fill: #000033; + text-dy: 16; + text-face-name: @book-fonts; + text-halo-radius: 2; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + + [feature = 'man_made_windmill'][zoom >= 17] { + text-name: "[name]"; + text-size: 9; + text-fill: #734a08; + text-dy: 12; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + + [feature = 'amenity_hospital'][zoom >= 16] { + text-name: "[name]"; + text-fill: #da0092; + text-size: 8; + text-dy: 10; + text-face-name: @book-fonts; + text-halo-radius: 2; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + + [feature = 'amenity_pharmacy'][zoom >= 17] { + text-name: "[name]"; + text-size: 8; + text-dy: 10; + text-fill: #da0092; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + + [feature = 'shop_bakery'], + [feature = 'shop_clothes'], + [feature = 'shop_fashion'], + [feature = 'shop_convenience'], + [feature = 'shop_doityourself'], + [feature = 'shop_hairdresser'], + [feature = 'shop_butcher'], + [feature = 'shop_car'], + [feature = 'shop_car_repair'], + [feature = 'shop_bicycle'], + [feature = 'shop_florist'], + [feature = 'shop_other']{ + [zoom >= 17] { + text-name: "[name]"; + text-size: 10; + text-dy: 12; + text-fill: #939; + text-face-name: @book-fonts; + text-halo-radius: 1.5; + text-halo-fill: rgba(255, 255, 255, 0.8); + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + } + + [feature = 'shop_supermarket'], + [feature = 'shop_department_store'] { + [zoom >= 16] { + text-name: "[name]"; + text-size: 10; + text-dy: 12; + text-fill: #939; + text-face-name: @book-fonts; + text-halo-radius: 1.5; + text-halo-fill: rgba(255, 255, 255, 0.8); + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + } + + [feature = 'military_danger_area'][is_building = 'no'] { + [zoom >= 9][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@danger_area, 40%); + text-face-name: @bold-fonts; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'landuse_military'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@military, 40%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'aeroway_gate'][zoom >= 17] { + text-name: "[ref]"; + text-size: 10; + text-fill: #aa66cc; + text-face-name: @book-fonts; + text-halo-radius: 1; + text-wrap-width: @standard-wrap-width; + text-placement: interior; + } + + [feature = 'military_barracks'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@barracks, 40%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'tourism_zoo'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@zoo, 40%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'power_station'][is_building = 'no'][zoom >= 10], + [feature = 'power_generator'][is_building = 'no'][zoom >= 10], + [feature = 'power_sub_station'][is_building = 'no'][zoom >= 13], + [feature = 'power_substation'][is_building = 'no'][zoom >= 13]{ + [way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@power, 40%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'natural_desert'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@desert, 40%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'natural_sand'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@sand, 50%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'natural_heath'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@heath, 40%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + + [feature = 'natural_grassland'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@grassland, 60%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'natural_scrub'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@scrub, 60%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'aeroway_apron'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@apron, 60%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'natural_beach'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@beach, 60%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + text-placement: interior; + } + } + + [feature = 'highway_services'][is_building = 'no'], + [feature = 'highway_rest_area'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@rest_area, 40%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + } + } + + [feature = 'natural_glacier'][is_building = 'no'] { + [zoom >= 10][way_pixels > 3000], + [zoom >= 17] { + text-name: "[name]"; + text-size: @landcover-font-size; + [way_pixels > 12000] { text-size: @landcover-font-size-big; } + [way_pixels > 48000] { text-size: @landcover-font-size-bigger; } + text-fill: darken(@glacier, 40%); + text-face-name: @landcover-face-name; + text-halo-radius: 1; + text-halo-fill: rgba(255,255,255,0.6); + text-wrap-width: @landcover-wrap-width-size; + [way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; } + [way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; } + } + } + + [feature = 'aeroway_helipad'][zoom >= 16]::aeroway { + text-name: "[name]"; + text-size: 8; + text-fill: @airtransport; + text-dy: -10; + text-face-name: @bold-fonts; + text-halo-radius: 1; + text-placement: interior; + text-wrap-width: 30; + } + + [feature = 'aeroway_aerodrome'][zoom >= 10][zoom < 14]::aeroway { + text-name: "[name]"; + text-size: 8; + text-fill: darken(@airtransport, 15%); + text-dy: -10; + text-face-name: @oblique-fonts; + text-halo-radius: 1; + text-placement: interior; + text-wrap-width: 30; + } +} diff --git a/samples/GAP/bugfix.tst b/samples/GAP/bugfix.tst new file mode 100644 index 00000000..be4bd975 --- /dev/null +++ b/samples/GAP/bugfix.tst @@ -0,0 +1,161 @@ +gap> START_TEST("Test for various former bugs"); + + +gap> # The following used to trigger an error starting with: +gap> # "SolutionMat: matrix and vector incompatible called from" +gap> K:=AbelianPcpGroup([3,3,3]);; +gap> A:=Subgroup(K,[K.1]);; +gap> cr:=CRRecordBySubgroup(K,A);; +gap> ExtensionsCR(cr);; + + +# Comparing homomorphisms used to be broken +gap> K:=AbelianPcpGroup(1,[3]);; +gap> hom1:=GroupHomomorphismByImages(K,K,[K.1],[K.1]);; +gap> hom2:=GroupHomomorphismByImages(K,K,[K.1^2],[K.1^2]);; +gap> hom1=hom2; +true +gap> hom1=IdentityMapping(K); +true +gap> hom2=IdentityMapping(K); +true + + +gap> # The following incorrectly triggered an error at some point +gap> IsTorsionFree(ExamplesOfSomePcpGroups(5)); +true + + +gap> # Verify IsGeneratorsOfMagmaWithInverses warnings are silenced +gap> IsGeneratorsOfMagmaWithInverses(GeneratorsOfGroup(ExamplesOfSomePcpGroups(5))); +true + + +gap> # Check for a bug reported 2012-01-19 by Robert Morse +gap> g := PcGroupToPcpGroup(SmallGroup(48,1)); +Pcp-group with orders [ 2, 2, 2, 2, 3 ] +gap> # The next two commands used to trigger errors +gap> NonAbelianTensorSquare(Centre(g)); +Pcp-group with orders [ 8 ] +gap> NonAbelianExteriorSquare(Centre(g)); +Pcp-group with orders [ ] + + +gap> # Check for a bug reported 2012-01-19 by Robert Morse +gap> F := FreeGroup("x","y"); + +gap> x := F.1;; y := F.2;; +gap> G := F/[x^2/y^24, y^24, y^x/y^23]; + +gap> iso := IsomorphismPcGroup(G); +[ x, y ] -> [ f1, f2*f5 ] +gap> iso1 := IsomorphismPcpGroup(Image(iso)); +[ f1, f2, f3, f4, f5 ] -> [ g1, g2, g3, g4, g5 ] +gap> G := Image(iso*iso1); +Pcp-group with orders [ 2, 2, 2, 2, 3 ] +gap> # The next command used to trigger an error +gap> NonAbelianTensorSquare(Image(iso*iso1)); +Pcp-group with orders [ 2, 2, 3, 2, 2, 2, 2 ] + + +gap> # The problem with the previous example is/was that Igs(G) +gap> # is set to a non-standard value: +gap> Igs(G); +[ g1, g2*g5, g3*g4*g5^2, g4*g5, g5 ] +gap> # Unfortunately, it seems that a lot of code that +gap> # really should be using Ngs or Cgs is using Igs incorrectly. +gap> # For example, direct products could return *invalid* embeddings: +gap> D := DirectProduct(G, G); +Pcp-group with orders [ 2, 2, 2, 2, 3, 2, 2, 2, 2, 3 ] +gap> hom:=Embedding(D,1);; +gap> mapi:=MappingGeneratorsImages(hom);; +gap> GroupHomomorphismByImages(Source(hom),Range(hom),mapi[1],mapi[2]) <> fail; +true +gap> hom:=Projection(D,1);; +gap> mapi:=MappingGeneratorsImages(hom);; +gap> GroupHomomorphismByImages(Source(hom),Range(hom),mapi[1],mapi[2]) <> fail; +true + + +gap> # Check for bug computing Schur extension of infinite cyclic groups, +gap> # found by Max Horn 2012-05-25 +gap> G:=AbelianPcpGroup(1,[0]); +Pcp-group with orders [ 0 ] +gap> # The next command used to trigger an error +gap> SchurExtension(G); +Pcp-group with orders [ 0 ] + + +gap> # Check for bug computing Schur extensions of subgroups, found by MH 2012-05-25. +gap> G:=HeisenbergPcpGroup(2); +Pcp-group with orders [ 0, 0, 0, 0, 0 ] +gap> H:=Subgroup(G,[G.2^3*G.3^2, G.1^9]); +Pcp-group with orders [ 0, 0, 0 ] +gap> # The next command used to trigger an error +gap> SchurExtension(H); +Pcp-group with orders [ 0, 0, 0, 0, 0, 0 ] + + +gap> # Check for bug computing Schur extensions of subgroups, found by MH 2012-05-25. +gap> G:=HeisenbergPcpGroup(2); +Pcp-group with orders [ 0, 0, 0, 0, 0 ] +gap> H:=Subgroup(G,[G.1, G.2]); +Pcp-group with orders [ 0, 0 ] +gap> # The next command used to trigger an error +gap> SchurExtension(H); +Pcp-group with orders [ 0, 0, 0 ] + + +gap> # Check for bug computing normalizer of two subgroups, found by MH 2012-05-30. +gap> # The problem was caused by incorrect resp. overly restrictive use of Parent(). +gap> G:=HeisenbergPcpGroup(2); +Pcp-group with orders [ 0, 0, 0, 0, 0 ] +gap> A:=Subgroup(Subgroup(G,[G.2,G.3,G.4,G.5]), [G.3]); +Pcp-group with orders [ 0 ] +gap> B:=Subgroup(Subgroup(G,[G.1,G.4,G.5]), [G.4]); +Pcp-group with orders [ 0 ] +gap> Normalizer(A,B); +Pcp-group with orders [ 0 ] +gap> # The following used to trigger the error "arguments must have a common parent group" +gap> Normalizer(B,A); +Pcp-group with orders [ 0 ] + + +gap> # In polycyclic 2.9 and 2.10, the code for 2-cohomology computations was broken. +gap> G := UnitriangularPcpGroup(3,0); +Pcp-group with orders [ 0, 0, 0 ] +gap> mats := G!.mats; +[ [ [ 1, 1, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ], + [ [ 1, 0, 0 ], [ 0, 1, 1 ], [ 0, 0, 1 ] ], + [ [ 1, 0, 1 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] ] +gap> C := CRRecordByMats(G,mats);; +gap> cc := TwoCohomologyCR(C);; +gap> cc.factor.rels; +[ 2, 0, 0 ] +gap> c := cc.factor.prei[2]; +[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, -1, 1 ] +gap> cc.gcb; +[ [ 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0 ], + [ 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, -1 ], + [ -1, 0, 1, 1, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ], + [ 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1 ] ] +gap> cc.gcc; +[ [ 1, 0, 0, 0, 0, -2, -1, 0, 1, 1, -1, -1, 0, 0, 0, 0, 0, 0 ], + [ 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, 1, 0, 0, -2, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, 0, 1, 0, 0, -1, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, -1, 1 ], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, -1 ] ] + + +gap> # LowerCentralSeriesOfGroup for non-nilpotent pcp-groups used to trigger +gap> # an infinite recursion +gap> G := PcGroupToPcpGroup(SmallGroup(6,1)); +Pcp-group with orders [ 2, 3 ] +gap> LowerCentralSeriesOfGroup(G); +[ Pcp-group with orders [ 2, 3 ], Pcp-group with orders [ 3 ] ] + + +gap> STOP_TEST( "bugfix.tst", 10000000); diff --git a/samples/GAP/factor.tst b/samples/GAP/factor.tst new file mode 100644 index 00000000..115fe921 --- /dev/null +++ b/samples/GAP/factor.tst @@ -0,0 +1,21 @@ +gap> START_TEST("Test of factor groups and natural homomorphisms"); + +gap> G:=HeisenbergPcpGroup(2); +Pcp-group with orders [ 0, 0, 0, 0, 0 ] + +gap> H:=Subgroup(G,[G.2,G.3,G.4,G.5]); +gap> K:=G/H; +gap> NaturalHomomorphism(K); + +gap> A:=Subgroup(H, [G.3]); +Pcp-group with orders [ 0 ] +gap> B:=Subgroup(Subgroup(G,[G.1,G.4,G.5]), [G.4]); +Pcp-group with orders [ 0 ] +gap> Normalizer(A,B); +Pcp-group with orders [ 0 ] +gap> # The following used to trigger the error "arguments must have a common parent group" +gap> Normalizer(B,A); +Pcp-group with orders [ 0 ] + + +gap> STOP_TEST( "factor.tst", 10000000); diff --git a/samples/HTML/index.html.hl b/samples/HTML/index.html.hl new file mode 100644 index 00000000..65491957 --- /dev/null +++ b/samples/HTML/index.html.hl @@ -0,0 +1,328 @@ + + + + + + + + +
+

Example 1

+ + + + + +
+ + +
+ +

~{x}

+
+
+
+
+ + +
+

Example 2

+ + + + + +
+ + +
+ +

~{x}

+
+
+
+
+ + +
+

Example 3

+ + + + + +
+ + + +
+ +

~{x}

+
+
+
+
+ + +
+

Example 4

+ + + + + +
+ + +
+
+
+ + +
+

Example 5

+ + + + + +
+ + +
+
+
+ + +
+

Example 6

+ + + + + +
+ + +
+
+ +

~{x}

+
+
+
+
+
+ + +
+

Example 7

+ + + + + +
+ + +
+
+ +

~{x}

+
+
+
+
+
+ + +
+

Example 8

+ + + + + +
+ + +
+
+ +

~{x}

+
+
+
+
+
+ + +
+

Example 9

+ + + + + +
+ + +
+
+ + +
+

Example 10

+ + + + + +
+ + + +
+
+ + diff --git a/samples/Jasmin/if1.j b/samples/Jasmin/if1.j new file mode 100644 index 00000000..dc46a541 --- /dev/null +++ b/samples/Jasmin/if1.j @@ -0,0 +1,56 @@ +.class public if1 +.super java/lang/Object +; +; standard initializer (calls java.lang.Object's initializer) +; +.method public ()V +aload_0 +invokenonvirtual java/lang/Object/()V +return +.end method + +.method public static main([Ljava/lang/String;)V + +.limit locals 1 +.limit stack 5 +BeginGlobal: + .line 2 + ldc 0x1 + ldc 0x1 + if_icmpeq If556261059 + goto IfElse556261059 + If556261059: + .line 3 + .line 3 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x1 + invokevirtual java/io/PrintStream/print(I)V + goto IfDone556261059 + IfElse556261059: + .line 5 + .line 5 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x2 + invokevirtual java/io/PrintStream/print(I)V + IfDone556261059: + + .line 6 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x3 + invokevirtual java/io/PrintStream/print(I)V + + .line 7 + ldc 0x1 + ldc 0x1 + if_icmpne IfNot-920218690 + .line 8 + .line 8 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x4 + invokevirtual java/io/PrintStream/print(I)V + IfNot-920218690: + +EndGlobal: +return +.end method + diff --git a/samples/Jasmin/if2.j b/samples/Jasmin/if2.j new file mode 100644 index 00000000..e6121c18 --- /dev/null +++ b/samples/Jasmin/if2.j @@ -0,0 +1,167 @@ +.class public if2 +.super java/lang/Object +; +; standard initializer (calls java.lang.Object's initializer) +; +.method public ()V +aload_0 +invokenonvirtual java/lang/Object/()V +return +.end method + +.method public static main([Ljava/lang/String;)V + +.limit locals 1 +.limit stack 5 +BeginGlobal: + .line 2 + ldc 0x1 + ldc 0x1 + if_icmpeq Cmp1893841232 + ldc 0x0 + goto CmpDone1893841232 + Cmp1893841232: + ldc 0x1 + CmpDone1893841232: + ldc 0x1 + if_icmpeq If-1736765035 + goto IfElse-1736765035 + If-1736765035: + .line 2 + .line 3 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x1 + invokevirtual java/io/PrintStream/print(I)V + goto IfDone-1736765035 + IfElse-1736765035: + .line 4 + .line 4 + ldc 0x2 + ldc 0x1 + if_icmpeq Cmp-1460884369 + ldc 0x0 + goto CmpDone-1460884369 + Cmp-1460884369: + ldc 0x1 + CmpDone-1460884369: + ldc 0x1 + if_icmpeq If-247349760 + goto IfElse-247349760 + If-247349760: + .line 4 + .line 5 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x2 + invokevirtual java/io/PrintStream/print(I)V + goto IfDone-247349760 + IfElse-247349760: + .line 6 + .line 7 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x3 + invokevirtual java/io/PrintStream/print(I)V + IfDone-247349760: + IfDone-1736765035: + + .line 10 + ldc 0x1 + ldc 0x2 + if_icmpeq Cmp933554851 + ldc 0x0 + goto CmpDone933554851 + Cmp933554851: + ldc 0x1 + CmpDone933554851: + ldc 0x1 + if_icmpeq If1623625546 + goto IfElse1623625546 + If1623625546: + .line 10 + .line 11 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x1 + invokevirtual java/io/PrintStream/print(I)V + goto IfDone1623625546 + IfElse1623625546: + .line 12 + .line 12 + ldc 0x2 + ldc 0x2 + if_icmpeq Cmp1572138409 + ldc 0x0 + goto CmpDone1572138409 + Cmp1572138409: + ldc 0x1 + CmpDone1572138409: + ldc 0x1 + if_icmpeq If126354425 + goto IfElse126354425 + If126354425: + .line 12 + .line 13 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x2 + invokevirtual java/io/PrintStream/print(I)V + goto IfDone126354425 + IfElse126354425: + .line 14 + .line 15 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x3 + invokevirtual java/io/PrintStream/print(I)V + IfDone126354425: + IfDone1623625546: + + .line 18 + ldc 0x1 + ldc 0x2 + if_icmpeq Cmp126493150 + ldc 0x0 + goto CmpDone126493150 + Cmp126493150: + ldc 0x1 + CmpDone126493150: + ldc 0x1 + if_icmpeq If1522284422 + goto IfElse1522284422 + If1522284422: + .line 18 + .line 19 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x1 + invokevirtual java/io/PrintStream/print(I)V + goto IfDone1522284422 + IfElse1522284422: + .line 20 + .line 20 + ldc 0x2 + ldc 0x1 + if_icmpeq Cmp-906666545 + ldc 0x0 + goto CmpDone-906666545 + Cmp-906666545: + ldc 0x1 + CmpDone-906666545: + ldc 0x1 + if_icmpeq If1083939031 + goto IfElse1083939031 + If1083939031: + .line 20 + .line 21 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x2 + invokevirtual java/io/PrintStream/print(I)V + goto IfDone1083939031 + IfElse1083939031: + .line 22 + .line 23 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x3 + invokevirtual java/io/PrintStream/print(I)V + IfDone1083939031: + IfDone1522284422: + +EndGlobal: +return +.end method + diff --git a/samples/Jasmin/if3.j b/samples/Jasmin/if3.j new file mode 100644 index 00000000..3d687392 --- /dev/null +++ b/samples/Jasmin/if3.j @@ -0,0 +1,55 @@ +.class public if3 +.super java/lang/Object +; +; standard initializer (calls java.lang.Object's initializer) +; +.method public ()V +aload_0 +invokenonvirtual java/lang/Object/()V +return +.end method + +.method public static main([Ljava/lang/String;)V + +.limit locals 1 +.limit stack 5 +BeginGlobal: + .line 2 + ldc 0x1 + ldc 0x1 + if_icmpeq If-811796083 + goto IfElse-811796083 + If-811796083: + .line 3 + .line 3 + ldc 0x0 + ldc 0x1 + if_icmpeq If-1001319390 + goto IfElse-1001319390 + If-1001319390: + .line 4 + .line 4 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x1 + invokevirtual java/io/PrintStream/print(I)V + goto IfDone-1001319390 + IfElse-1001319390: + .line 6 + .line 6 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x2 + invokevirtual java/io/PrintStream/print(I)V + IfDone-1001319390: + goto IfDone-811796083 + IfElse-811796083: + .line 8 + .line 8 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x3 + invokevirtual java/io/PrintStream/print(I)V + IfDone-811796083: + +EndGlobal: +return +.end method + diff --git a/samples/Jasmin/if4.j b/samples/Jasmin/if4.j new file mode 100644 index 00000000..f79a090b --- /dev/null +++ b/samples/Jasmin/if4.j @@ -0,0 +1,37 @@ +.class public if4 +.super java/lang/Object +; +; standard initializer (calls java.lang.Object's initializer) +; +.method public ()V +aload_0 +invokenonvirtual java/lang/Object/()V +return +.end method + +.method public static main([Ljava/lang/String;)V + +.limit locals 1 +.limit stack 5 +BeginGlobal: + .line 2 + ldc 0x1 + ldc 0x1 + if_icmpne IfNot1919266740 + .line 2 + .line 2 + ldc 0x1 + ldc 0x1 + if_icmpne IfNot613368541 + .line 2 + .line 2 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x1 + invokevirtual java/io/PrintStream/print(I)V + IfNot613368541: + IfNot1919266740: + +EndGlobal: +return +.end method + diff --git a/samples/Jasmin/op1.j b/samples/Jasmin/op1.j new file mode 100644 index 00000000..d8344913 --- /dev/null +++ b/samples/Jasmin/op1.j @@ -0,0 +1,54 @@ +.class public op1 +.super java/lang/Object +; +; standard initializer (calls java.lang.Object's initializer) +; +.method public ()V +aload_0 +invokenonvirtual java/lang/Object/()V +return +.end method + +.method public static main([Ljava/lang/String;)V + +.limit locals 1 +.limit stack 5 +BeginGlobal: + .line 2 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x1 + ldc 0x1 + iadd + invokevirtual java/io/PrintStream/println(I)V + + .line 3 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0xa + ldc 0x5 + isub + invokevirtual java/io/PrintStream/println(I)V + + .line 4 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x15 + ldc 0x3 + idiv + invokevirtual java/io/PrintStream/println(I)V + + .line 5 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x159 + ldc 0x38 + imul + invokevirtual java/io/PrintStream/println(I)V + + .line 6 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x52 + ldc 0x9 + irem + invokevirtual java/io/PrintStream/println(I)V + +EndGlobal: +return +.end method \ No newline at end of file diff --git a/samples/Jasmin/op2.j b/samples/Jasmin/op2.j new file mode 100644 index 00000000..4463a5ca --- /dev/null +++ b/samples/Jasmin/op2.j @@ -0,0 +1,34 @@ +.class public op2 +.super java/lang/Object +; +; standard initializer (calls java.lang.Object's initializer) +; +.method public ()V +aload_0 +invokenonvirtual java/lang/Object/()V +return +.end method + +.method public static main([Ljava/lang/String;)V + +.limit locals 1 +.limit stack 5 +BeginGlobal: + .line 2 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x1 + ldc 0x0 + iand + invokevirtual java/io/PrintStream/println(Z)V + + .line 3 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x1 + ldc 0x0 + ior + invokevirtual java/io/PrintStream/println(Z)V + +EndGlobal: +return +.end method + diff --git a/samples/Jasmin/op3.j b/samples/Jasmin/op3.j new file mode 100644 index 00000000..10dd6897 --- /dev/null +++ b/samples/Jasmin/op3.j @@ -0,0 +1,68 @@ +.class public op3 +.super java/lang/Object +; +; standard initializer (calls java.lang.Object's initializer) +; +.method public ()V +aload_0 +invokenonvirtual java/lang/Object/()V +return +.end method + +.method public static main([Ljava/lang/String;)V + +.limit locals 1 +.limit stack 5 +BeginGlobal: + .line 2 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x0 + ldc 0x1 + if_icmpeq Cmp-1307183590 + ldc 0x0 + goto CmpDone-1307183590 + Cmp-1307183590: + ldc 0x1 + CmpDone-1307183590: + invokevirtual java/io/PrintStream/println(Z)V + + .line 3 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x0 + ldc 0x0 + if_icmpeq Cmp-1443270821 + ldc 0x0 + goto CmpDone-1443270821 + Cmp-1443270821: + ldc 0x1 + CmpDone-1443270821: + invokevirtual java/io/PrintStream/println(Z)V + + .line 4 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x1 + ldc 0x1 + if_icmpeq Cmp1759327329 + ldc 0x0 + goto CmpDone1759327329 + Cmp1759327329: + ldc 0x1 + CmpDone1759327329: + invokevirtual java/io/PrintStream/println(Z)V + + .line 5 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x1 + ldc 0x0 + if_icmpeq Cmp-678570146 + ldc 0x0 + goto CmpDone-678570146 + Cmp-678570146: + ldc 0x1 + CmpDone-678570146: + invokevirtual java/io/PrintStream/println(Z)V + +EndGlobal: +return +.end method + diff --git a/samples/Jasmin/op4.j b/samples/Jasmin/op4.j new file mode 100644 index 00000000..47644392 --- /dev/null +++ b/samples/Jasmin/op4.j @@ -0,0 +1,68 @@ +.class public op4 +.super java/lang/Object +; +; standard initializer (calls java.lang.Object's initializer) +; +.method public ()V +aload_0 +invokenonvirtual java/lang/Object/()V +return +.end method + +.method public static main([Ljava/lang/String;)V + +.limit locals 1 +.limit stack 5 +BeginGlobal: + .line 2 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x0 + ldc 0x1 + if_icmpne Cmp-191731100 + ldc 0x0 + goto CmpDone-191731100 + Cmp-191731100: + ldc 0x1 + CmpDone-191731100: + invokevirtual java/io/PrintStream/println(Z)V + + .line 3 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x0 + ldc 0x0 + if_icmpne Cmp-901585603 + ldc 0x0 + goto CmpDone-901585603 + Cmp-901585603: + ldc 0x1 + CmpDone-901585603: + invokevirtual java/io/PrintStream/println(Z)V + + .line 4 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x1 + ldc 0x1 + if_icmpne Cmp1522577937 + ldc 0x0 + goto CmpDone1522577937 + Cmp1522577937: + ldc 0x1 + CmpDone1522577937: + invokevirtual java/io/PrintStream/println(Z)V + + .line 5 + getstatic java/lang/System/out Ljava/io/PrintStream; + ldc 0x1 + ldc 0x0 + if_icmpne Cmp-1653028684 + ldc 0x0 + goto CmpDone-1653028684 + Cmp-1653028684: + ldc 0x1 + CmpDone-1653028684: + invokevirtual java/io/PrintStream/println(Z)V + +EndGlobal: +return +.end method + diff --git a/samples/Nit/file.nit b/samples/Nit/file.nit new file mode 100644 index 00000000..889526fc --- /dev/null +++ b/samples/Nit/file.nit @@ -0,0 +1,798 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2004-2008 Jean Privat +# Copyright 2008 Floréal Morandat +# Copyright 2008 Jean-Sébastien Gélinas +# +# This file is free software, which comes along with NIT. This software is +# distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. You can modify it is you want, provided this header +# is kept unaltered, and a notification of the changes is added. +# You are allowed to redistribute it and sell it, alone or is a part of +# another product. + +# File manipulations (create, read, write, etc.) +module file + +intrude import stream +intrude import ropes +import string_search +import time + +in "C Header" `{ + #include + #include + #include + #include + #include + #include + #include + #include +`} + +# File Abstract Stream +abstract class FStream + super IOS + # The path of the file. + var path: nullable String = null + + # The FILE *. + private var file: nullable NativeFile = null + + fun file_stat: FileStat do return _file.file_stat + + # File descriptor of this file + fun fd: Int do return _file.fileno +end + +# File input stream +class IFStream + super FStream + super BufferedIStream + super PollableIStream + # Misc + + # Open the same file again. + # The original path is reused, therefore the reopened file can be a different file. + fun reopen + do + if not eof and not _file.address_is_null then close + _file = new NativeFile.io_open_read(path.to_cstring) + if _file.address_is_null then + last_error = new IOError("Error: Opening file at '{path.as(not null)}' failed with '{sys.errno.strerror}'") + end_reached = true + return + end + end_reached = false + _buffer_pos = 0 + _buffer.clear + end + + redef fun close + do + if _file.address_is_null then return + var i = _file.io_close + _buffer.clear + end_reached = true + end + + redef fun fill_buffer + do + var nb = _file.io_read(_buffer.items, _buffer.capacity) + if nb <= 0 then + end_reached = true + nb = 0 + end + _buffer.length = nb + _buffer_pos = 0 + end + # End of file? + redef var end_reached: Bool = false + + # Open the file at `path` for reading. + init open(path: String) + do + self.path = path + prepare_buffer(10) + _file = new NativeFile.io_open_read(path.to_cstring) + if _file.address_is_null then + last_error = new IOError("Error: Opening file at '{path}' failed with '{sys.errno.strerror}'") + end_reached = true + end + end + + init from_fd(fd: Int) do + self.path = "" + prepare_buffer(10) + _file = fd_to_stream(fd, read_only) + if _file.address_is_null then + last_error = new IOError("Error: Converting fd {fd} to stream failed with '{sys.errno.strerror}'") + end_reached = true + end + end +end + +# File output stream +class OFStream + super FStream + super OStream + + redef fun write(s) + do + if last_error != null then return + if not _is_writable then + last_error = new IOError("Cannot write to non-writable stream") + return + end + if s isa FlatText then + write_native(s.to_cstring, s.length) + else + for i in s.substrings do write_native(i.to_cstring, i.length) + end + end + + redef fun close + do + if _file.address_is_null then + last_error = new IOError("Cannot close non-existing write stream") + _is_writable = false + return + end + var i = _file.io_close + _is_writable = false + end + redef var is_writable = false + + # Write `len` bytes from `native`. + private fun write_native(native: NativeString, len: Int) + do + if last_error != null then return + if not _is_writable then + last_error = new IOError("Cannot write to non-writable stream") + return + end + if _file.address_is_null then + last_error = new IOError("Writing on a null stream") + _is_writable = false + return + end + var err = _file.io_write(native, len) + if err != len then + # Big problem + last_error = new IOError("Problem in writing : {err} {len} \n") + end + end + + # Open the file at `path` for writing. + init open(path: String) + do + _file = new NativeFile.io_open_write(path.to_cstring) + if _file.address_is_null then + last_error = new IOError("Error: Opening file at '{path}' failed with '{sys.errno.strerror}'") + self.path = path + is_writable = false + end + self.path = path + _is_writable = true + end + + # Creates a new File stream from a file descriptor + init from_fd(fd: Int) do + self.path = "" + _file = fd_to_stream(fd, wipe_write) + _is_writable = true + if _file.address_is_null then + last_error = new IOError("Error: Opening stream from file descriptor {fd} failed with '{sys.errno.strerror}'") + _is_writable = false + end + end +end + +redef interface Object + + private fun read_only: NativeString do return "r".to_cstring + + private fun wipe_write: NativeString do return "w".to_cstring + + private fun fd_to_stream(fd: Int, mode: NativeString): NativeFile `{ + return fdopen(fd, mode); + `} + + # returns first available stream to read or write to + # return null on interruption (possibly a signal) + protected fun poll( streams : Sequence[FStream] ) : nullable FStream + do + var in_fds = new Array[Int] + var out_fds = new Array[Int] + var fd_to_stream = new HashMap[Int,FStream] + for s in streams do + var fd = s.fd + if s isa IFStream then in_fds.add( fd ) + if s isa OFStream then out_fds.add( fd ) + + fd_to_stream[fd] = s + end + + var polled_fd = intern_poll( in_fds, out_fds ) + + if polled_fd == null then + return null + else + return fd_to_stream[polled_fd] + end + end + + private fun intern_poll(in_fds: Array[Int], out_fds: Array[Int]) : nullable Int is extern import Array[Int].length, Array[Int].[], Int.as(nullable Int) `{ + int in_len, out_len, total_len; + struct pollfd *c_fds; + sigset_t sigmask; + int i; + int first_polled_fd = -1; + int result; + + in_len = Array_of_Int_length( in_fds ); + out_len = Array_of_Int_length( out_fds ); + total_len = in_len + out_len; + c_fds = malloc( sizeof(struct pollfd) * total_len ); + + /* input streams */ + for ( i=0; i 0 ) { + /* analyse results */ + for ( i=0; i 0 and self.chars[l] == '/' do l -= 1 # remove all trailing `/` + if l == 0 then return "/" + var pos = chars.last_index_of_from('/', l) + var n = self + if pos >= 0 then + n = substring(pos+1, l-pos) + end + return n.strip_extension(ext) + end + + # Extract the dirname of a path + # + # assert "/path/to/a_file.ext".dirname == "/path/to" + # assert "path/to/a_file.ext".dirname == "path/to" + # assert "path/to".dirname == "path" + # assert "path/to/".dirname == "path" + # assert "path".dirname == "." + # assert "/path".dirname == "/" + # assert "/".dirname == "/" + # assert "".dirname == "." + fun dirname: String + do + var l = length - 1 # Index of the last char + while l > 0 and self.chars[l] == '/' do l -= 1 # remove all trailing `/` + var pos = chars.last_index_of_from('/', l) + if pos > 0 then + return substring(0, pos) + else if pos == 0 then + return "/" + else + return "." + end + end + + # Return the canonicalized absolute pathname (see POSIX function `realpath`) + fun realpath: String do + var cs = to_cstring.file_realpath + var res = cs.to_s_with_copy + # cs.free_malloc # FIXME memory leak + return res + end + + # Simplify a file path by remove useless ".", removing "//", and resolving ".." + # ".." are not resolved if they start the path + # starting "/" is not removed + # trainling "/" is removed + # + # Note that the method only wonrk on the string: + # * no I/O access is performed + # * the validity of the path is not checked + # + # assert "some/./complex/../../path/from/../to/a////file//".simplify_path == "path/to/a/file" + # assert "../dir/file".simplify_path == "../dir/file" + # assert "dir/../../".simplify_path == ".." + # assert "dir/..".simplify_path == "." + # assert "//absolute//path/".simplify_path == "/absolute/path" + # assert "//absolute//../".simplify_path == "/" + fun simplify_path: String + do + var a = self.split_with("/") + var a2 = new Array[String] + for x in a do + if x == "." then continue + if x == "" and not a2.is_empty then continue + if x == ".." and not a2.is_empty and a2.last != ".." then + a2.pop + continue + end + a2.push(x) + end + if a2.is_empty then return "." + if a2.length == 1 and a2.first == "" then return "/" + return a2.join("/") + end + + # Correctly join two path using the directory separator. + # + # Using a standard "{self}/{path}" does not work in the following cases: + # + # * `self` is empty. + # * `path` ends with `'/'`. + # * `path` starts with `'/'`. + # + # This method ensures that the join is valid. + # + # assert "hello".join_path("world") == "hello/world" + # assert "hel/lo".join_path("wor/ld") == "hel/lo/wor/ld" + # assert "".join_path("world") == "world" + # assert "hello".join_path("/world") == "/world" + # assert "hello/".join_path("world") == "hello/world" + # assert "hello/".join_path("/world") == "/world" + # + # Note: You may want to use `simplify_path` on the result. + # + # Note: This method works only with POSIX paths. + fun join_path(path: String): String + do + if path.is_empty then return self + if self.is_empty then return path + if path.chars[0] == '/' then return path + if self.last == '/' then return "{self}{path}" + return "{self}/{path}" + end + + # Convert the path (`self`) to a program name. + # + # Ensure the path (`self`) will be treated as-is by POSIX shells when it is + # used as a program name. In order to do that, prepend `./` if needed. + # + # assert "foo".to_program_name == "./foo" + # assert "/foo".to_program_name == "/foo" + # assert "".to_program_name == "./" # At least, your shell will detect the error. + fun to_program_name: String do + if self.has_prefix("/") then + return self + else + return "./{self}" + end + end + + # Alias for `join_path` + # + # assert "hello" / "world" == "hello/world" + # assert "hel/lo" / "wor/ld" == "hel/lo/wor/ld" + # assert "" / "world" == "world" + # assert "/hello" / "/world" == "/world" + # + # This operator is quite useful for chaining changes of path. + # The next one being relative to the previous one. + # + # var a = "foo" + # var b = "/bar" + # var c = "baz/foobar" + # assert a/b/c == "/bar/baz/foobar" + fun /(path: String): String do return join_path(path) + + # Returns the relative path needed to go from `self` to `dest`. + # + # assert "/foo/bar".relpath("/foo/baz") == "../baz" + # assert "/foo/bar".relpath("/baz/bar") == "../../baz/bar" + # + # If `self` or `dest` is relative, they are considered relatively to `getcwd`. + # + # In some cases, the result is still independent of the current directory: + # + # assert "foo/bar".relpath("..") == "../../.." + # + # In other cases, parts of the current directory may be exhibited: + # + # var p = "../foo/bar".relpath("baz") + # var c = getcwd.basename("") + # assert p == "../../{c}/baz" + # + # For path resolution independent of the current directory (eg. for paths in URL), + # or to use an other starting directory than the current directory, + # just force absolute paths: + # + # var start = "/a/b/c/d" + # var p2 = (start/"../foo/bar").relpath(start/"baz") + # assert p2 == "../../d/baz" + # + # + # Neither `self` or `dest` has to be real paths or to exist in directories since + # the resolution is only done with string manipulations and without any access to + # the underlying file system. + # + # If `self` and `dest` are the same directory, the empty string is returned: + # + # assert "foo".relpath("foo") == "" + # assert "foo/../bar".relpath("bar") == "" + # + # The empty string and "." designate both the current directory: + # + # assert "".relpath("foo/bar") == "foo/bar" + # assert ".".relpath("foo/bar") == "foo/bar" + # assert "foo/bar".relpath("") == "../.." + # assert "/" + "/".relpath(".") == getcwd + fun relpath(dest: String): String + do + var cwd = getcwd + var from = (cwd/self).simplify_path.split("/") + if from.last.is_empty then from.pop # case for the root directory + var to = (cwd/dest).simplify_path.split("/") + if to.last.is_empty then to.pop # case for the root directory + + # Remove common prefixes + while not from.is_empty and not to.is_empty and from.first == to.first do + from.shift + to.shift + end + + # Result is going up in `from` with ".." then going down following `to` + var from_len = from.length + if from_len == 0 then return to.join("/") + var up = "../"*(from_len-1) + ".." + if to.is_empty then return up + var res = up + "/" + to.join("/") + return res + end + + # Create a directory (and all intermediate directories if needed) + fun mkdir + do + var dirs = self.split_with("/") + var path = new FlatBuffer + if dirs.is_empty then return + if dirs[0].is_empty then + # it was a starting / + path.add('/') + end + for d in dirs do + if d.is_empty then continue + path.append(d) + path.add('/') + path.to_s.to_cstring.file_mkdir + end + end + + # Delete a directory and all of its content, return `true` on success + # + # Does not go through symbolic links and may get stuck in a cycle if there + # is a cycle in the filesystem. + fun rmdir: Bool + do + var ok = true + for file in self.files do + var file_path = self.join_path(file) + var stat = file_path.file_lstat + if stat.is_dir then + ok = file_path.rmdir and ok + else + ok = file_path.file_delete and ok + end + stat.free + end + + # Delete the directory itself + if ok then to_cstring.rmdir + + return ok + end + + # Change the current working directory + # + # "/etc".chdir + # assert getcwd == "/etc" + # "..".chdir + # assert getcwd == "/" + # + # TODO: errno + fun chdir do to_cstring.file_chdir + + # Return right-most extension (without the dot) + # + # Only the last extension is returned. + # There is no special case for combined extensions. + # + # assert "file.txt".file_extension == "txt" + # assert "file.tar.gz".file_extension == "gz" + # + # For file without extension, `null` is returned. + # Hoever, for trailing dot, `""` is returned. + # + # assert "file".file_extension == null + # assert "file.".file_extension == "" + # + # The starting dot of hidden files is never considered. + # + # assert ".file.txt".file_extension == "txt" + # assert ".file".file_extension == null + fun file_extension: nullable String + do + var last_slash = chars.last_index_of('.') + if last_slash > 0 then + return substring( last_slash+1, length ) + else + return null + end + end + + # returns files contained within the directory represented by self + fun files : Set[ String ] is extern import HashSet[String], HashSet[String].add, NativeString.to_s, String.to_cstring, HashSet[String].as(Set[String]) `{ + char *dir_path; + DIR *dir; + + dir_path = String_to_cstring( recv ); + if ((dir = opendir(dir_path)) == NULL) + { + perror( dir_path ); + exit( 1 ); + } + else + { + HashSet_of_String results; + String file_name; + struct dirent *de; + + results = new_HashSet_of_String(); + + while ( ( de = readdir( dir ) ) != NULL ) + if ( strcmp( de->d_name, ".." ) != 0 && + strcmp( de->d_name, "." ) != 0 ) + { + file_name = NativeString_to_s( strdup( de->d_name ) ); + HashSet_of_String_add( results, file_name ); + } + + closedir( dir ); + return HashSet_of_String_as_Set_of_String( results ); + } + `} +end + +redef class NativeString + private fun file_exists: Bool is extern "string_NativeString_NativeString_file_exists_0" + private fun file_stat: FileStat is extern "string_NativeString_NativeString_file_stat_0" + private fun file_lstat: FileStat `{ + struct stat* stat_element; + int res; + stat_element = malloc(sizeof(struct stat)); + res = lstat(recv, stat_element); + if (res == -1) return NULL; + return stat_element; + `} + private fun file_mkdir: Bool is extern "string_NativeString_NativeString_file_mkdir_0" + private fun rmdir: Bool `{ return rmdir(recv); `} + private fun file_delete: Bool is extern "string_NativeString_NativeString_file_delete_0" + private fun file_chdir is extern "string_NativeString_NativeString_file_chdir_0" + private fun file_realpath: NativeString is extern "file_NativeString_realpath" +end + +# This class is system dependent ... must reify the vfs +extern class FileStat `{ struct stat * `} + # Returns the permission bits of file + fun mode: Int is extern "file_FileStat_FileStat_mode_0" + # Returns the last access time + fun atime: Int is extern "file_FileStat_FileStat_atime_0" + # Returns the last status change time + fun ctime: Int is extern "file_FileStat_FileStat_ctime_0" + # Returns the last modification time + fun mtime: Int is extern "file_FileStat_FileStat_mtime_0" + # Returns the size + fun size: Int is extern "file_FileStat_FileStat_size_0" + + # Returns true if it is a regular file (not a device file, pipe, sockect, ...) + fun is_reg: Bool `{ return S_ISREG(recv->st_mode); `} + # Returns true if it is a directory + fun is_dir: Bool `{ return S_ISDIR(recv->st_mode); `} + # Returns true if it is a character device + fun is_chr: Bool `{ return S_ISCHR(recv->st_mode); `} + # Returns true if it is a block device + fun is_blk: Bool `{ return S_ISBLK(recv->st_mode); `} + # Returns true if the type is fifo + fun is_fifo: Bool `{ return S_ISFIFO(recv->st_mode); `} + # Returns true if the type is a link + fun is_lnk: Bool `{ return S_ISLNK(recv->st_mode); `} + # Returns true if the type is a socket + fun is_sock: Bool `{ return S_ISSOCK(recv->st_mode); `} +end + +# Instance of this class are standard FILE * pointers +private extern class NativeFile `{ FILE* `} + fun io_read(buf: NativeString, len: Int): Int is extern "file_NativeFile_NativeFile_io_read_2" + fun io_write(buf: NativeString, len: Int): Int is extern "file_NativeFile_NativeFile_io_write_2" + fun io_close: Int is extern "file_NativeFile_NativeFile_io_close_0" + fun file_stat: FileStat is extern "file_NativeFile_NativeFile_file_stat_0" + fun fileno: Int `{ return fileno(recv); `} + + new io_open_read(path: NativeString) is extern "file_NativeFileCapable_NativeFileCapable_io_open_read_1" + new io_open_write(path: NativeString) is extern "file_NativeFileCapable_NativeFileCapable_io_open_write_1" + new native_stdin is extern "file_NativeFileCapable_NativeFileCapable_native_stdin_0" + new native_stdout is extern "file_NativeFileCapable_NativeFileCapable_native_stdout_0" + new native_stderr is extern "file_NativeFileCapable_NativeFileCapable_native_stderr_0" +end + +redef class Sys + + # Standard input + var stdin: PollableIStream = new Stdin is protected writable + + # Standard output + var stdout: OStream = new Stdout is protected writable + + # Standard output for errors + var stderr: OStream = new Stderr is protected writable + +end + +# Print `objects` on the standard output (`stdout`). +protected fun printn(objects: Object...) +do + sys.stdout.write(objects.to_s) +end + +# Print an `object` on the standard output (`stdout`) and add a newline. +protected fun print(object: Object) +do + sys.stdout.write(object.to_s) + sys.stdout.write("\n") +end + +# Read a character from the standard input (`stdin`). +protected fun getc: Char +do + return sys.stdin.read_char.ascii +end + +# Read a line from the standard input (`stdin`). +protected fun gets: String +do + return sys.stdin.read_line +end + +# Return the working (current) directory +protected fun getcwd: String do return file_getcwd.to_s +private fun file_getcwd: NativeString is extern "string_NativeString_NativeString_file_getcwd_0" diff --git a/samples/Nit/meetup.nit b/samples/Nit/meetup.nit new file mode 100644 index 00000000..e5d1f561 --- /dev/null +++ b/samples/Nit/meetup.nit @@ -0,0 +1,376 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License + +# Shows a meetup and allows to modify its participants +module meetup + +import opportunity_model +import boilerplate +import welcome +import template + +# Shows a meetup and allows to modify its participants +class OpportunityMeetupPage + super OpportunityPage + + # Meetup the page is supposed to show + var meetup: nullable Meetup = null + # Answer mode for the meetup + var mode = 0 + + init from_id(id: String) do + var db = new OpportunityDB.open("opportunity") + meetup = db.find_meetup_by_id(id) + db.close + if meetup != null then mode = meetup.answer_mode + init + end + + init do + header.page_js = "mode = {mode};\n" + header.page_js += """ + function update_scores(){ + var anss = $('.answer'); + var count = {}; + var scores = {}; + var answers = []; + var maxscore = 0; + for(i=0; i < anss.length; i++){ + var incscore = 0; + var inccount = 0; + var idparts = anss[i].id.split("_"); + var ansid = idparts[1]; + var html = anss[i].innerHTML; + if(html === "
"){ + inccount = 1; + incscore = 2; + }else if(html === "
"){ + incscore = 1; + } + var intansid = parseInt(ansid) + if(answers.indexOf(intansid) == -1){ + answers.push(intansid); + } + if(ansid in count){ + count[ansid] += inccount; + }else{ + count[ansid] = inccount; + } + if(ansid in scores){ + scores[ansid] += incscore; + }else{ + scores[ansid] = incscore; + } + if(scores[ansid] > maxscore){ + maxscore = scores[ansid]; + } + } + for(i=0; i < answers.length; i++){ + var ansid = answers[i].toString(); + var el = $('#total'+ansid)[0]; + var ins = "
"+count[ansid]; + if(scores[ansid] >= maxscore){ + ins += "
"; + } + ins += "
"; + el.innerHTML = ins; + } + } + function change_answer(ele, id){ + // modify only the currently selected entry + if (in_modification_id != id) return; + + var e = document.getElementById(ele.id); + var i = e.innerHTML; + var ans = true;""" + if mode == 0 then + header.page_js += """ + if(i === "
"){ + ans = 0; + e.innerHTML = "
" + e.style.color = "red"; + }else{ + ans = 1; + e.innerHTML = "
"; + e.style.color = "green"; + }""" + + else + header.page_js += """ + if(i === "
"){ + ans = 1; + e.innerHTML = "
" + e.style.color = "#B8860B"; + }else if(i === "
"){ + ans = 0; + e.innerHTML = "
" + e.style.color = "red"; + }else{ + ans = 2; + e.innerHTML = "
"; + e.style.color = "green"; + }""" + end + header.page_js += """ + var a = ele.id.split('_') + var pid = a[1] + var aid = a[2] + update_scores(); + $.ajax({ + type: "POST", + url: "./rest/answer", + data: { + answer_id: aid, + pers_id: pid, + answer: ans + } + }); + } + function change_temp_answer(ele){ + var e = document.getElementById(ele.id); + var i = e.innerHTML;""" + if mode == 0 then + header.page_js += """ + if(i === "
"){ + e.innerHTML = "
" + e.style.color = "red"; + }else{ + e.innerHTML = "
"; + e.style.color = "green"; + } + """ + else + header.page_js += """ + if(i === "
"){ + e.innerHTML = "
"; + e.style.color = "#B8860B"; + }else if(i === "
"){ + e.innerHTML = "
" + e.style.color = "red"; + }else{ + e.innerHTML = "
"; + e.style.color = "green"; + } + """ + end + header.page_js += """ + update_scores(); + } + function add_part(ele){ + var e = document.getElementById(ele.id); + var pname = document.getElementById("new_name").value; + var arr = e.id.split("_"); + var mid = arr[1]; + var ans = $('#' + ele.id).parent().parent().parent().children(".answer"); + ansmap = {}; + for(i=0;i✔"){ + ansmap[curr.attr('id')] = 1 + }else{ + ansmap[curr.attr('id')] = 0 + }""" + else + header.page_js += """ + if(curr[0].innerHTML === "
"){ + ansmap[curr.attr('id')] = 2 + }else if(curr[0].innerHTML === "
"){ + ansmap[curr.attr('id')] = 1 + }else{ + ansmap[curr.attr('id')] = 0 + }""" + end + header.page_js += """ + } + $.ajax({ + type: "POST", + url: "./rest/meetup/new_pers", + data: { + meetup_id: mid, + persname: pname, + answers: $.param(ansmap) + } + }) + .done(function(data){ + location.reload(); + }) + .fail(function(data){ + //TODO: Notify of failure + }); + } + function remove_people(ele){ + var arr = ele.id.split("_") + var pid = arr[1] + $('#' + ele.id).parent().parent().parent().remove(); + update_scores(); + $.ajax({ + type: "POST", + url: "./rest/people", + data: { + method: "DELETE", + p_id: pid + } + }); + } + // ID of line currently open for modification + var in_modification_id = null; + function modify_people(ele, id){ + if (in_modification_id != null) { + // reset to normal values + $('#modify_'+in_modification_id).text("Modify or delete"); + $('#modify_'+in_modification_id).attr("class", "btn btn-xs btn-warning"); + $('#line_'+in_modification_id).css("background-color", ""); + $('#delete_'+in_modification_id).css("display", "none"); + } + if (in_modification_id != id) { + // activate modifiable mode + $('#modify_'+id).text("Done"); + $('#modify_'+id).attr("class", "btn btn-xs btn-success"); + $('#line_'+id).css("background-color", "LightYellow"); + $('#delete_'+id).show(); + + in_modification_id = id; + } else { + in_modification_id = null; + } + } + """ + end + + redef fun rendering do + if meetup == null then + add((new OpportunityHomePage).write_to_string) + return + end + add header + var db = new OpportunityDB.open("opportunity") + add meetup.to_html(db) + db.close + add footer + end +end + +redef class Meetup + # Build the HTML for `self` + fun to_html(db: OpportunityDB): Streamable do + var t = new Template + t.add """ +
+ + +""" + t.add "" + for i in answers(db) do + t.add "" + end + t.add "" + t.add "" + for i in participants(db) do + i.load_answers(db, self) + t.add "" + t.add "" + for j, k in i.answers do + var color + if answer_mode == 0 then + if k == 1 then + color = "green" + else + color = "red" + end + else + if k == 2 then + color = "green" + else if k == 1 then + color = "#B8860B" + else + color = "red" + end + end + t.add """" + end + t.add """""" + t.add "" + end + t.add """ + + + """ + for i in answers(db) do + t.add "" + end + t.add """ + """ + t.add "" + # Compute score for each answer + var scores = new HashMap[Int, Int] + var maxsc = 0 + for i in answers(db) do + scores[i.id] = i.score(db) + if scores[i.id] > maxsc then maxsc = scores[i.id] + end + t.add """ + + + """ + for i in answers(db) do + t.add """" + end + t.add "" + t.add """ + +""" + t.add "
Participant name" + t.add i.to_s + t.add "
" + t.add i.to_s + t.add """" + t.add "
" + if answer_mode == 0 then + if k == 1 then + t.add "✔" + else + t.add "✘" + end + else + if k == 2 then + t.add "✔" + else if k == 1 then + t.add "❓" + else + t.add "✘" + end + end + t.add "
 """ + t.add """
Total
{{{i.count(db)}}}""" + if scores.has_key(i.id) and scores[i.id] >= maxsc then + t.add """
""" + end + t.add "
" + t.add "
" + return t + end +end diff --git a/samples/Objective-J/AppController.j b/samples/Objective-J/AppController.j new file mode 100644 index 00000000..4870ab75 --- /dev/null +++ b/samples/Objective-J/AppController.j @@ -0,0 +1,434 @@ +// +// AppController.j +// FlickrPhoto +// +// Created by Ross Boucher. +// Copyright 2008 - 2010, 280 North, Inc. All rights reserved. + +@import +@import + +var SliderToolbarItemIdentifier = "SliderToolbarItemIdentifier", + AddToolbarItemIdentifier = "AddToolbarItemIdentifier", + RemoveToolbarItemIdentifier = "RemoveToolbarItemIdentifier"; + +/* + Important note about CPJSONPConnection: CPJSONPConnection is ONLY for JSONP APIs. + If aren't sure you NEED JSONP (see http://ajaxian.com/archives/jsonp-json-with-padding ), + you most likely don't want to use CPJSONPConnection, but rather the more standard + CPURLConnection. CPJSONPConnection is designed for cross-domain + connections, and if you are making requests to the same domain (as most web + applications do), you do not need it. +*/ + +@implementation AppController : CPObject +{ + CPString lastIdentifier; + CPDictionary photosets; + + CPCollectionView listCollectionView; + CPCollectionView photosCollectionView; +} + +- (void)applicationDidFinishLaunching:(CPNotification)aNotification +{ + //the first thing we need to do is create a window to take up the full screen + //we'll also create a toolbar to go with it, and grab its size for future reference + + var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask], + contentView = [theWindow contentView], + toolbar = [[CPToolbar alloc] initWithIdentifier:"Photos"], + bounds = [contentView bounds]; + + //we tell the toolbar that we want to be its delegate and attach it to theWindow + [toolbar setDelegate:self]; + [toolbar setVisible:true]; + [theWindow setToolbar:toolbar]; + + photosets = [CPDictionary dictionary]; //storage for our sets of photos return from Flickr + + //now we create a scroll view to contain the list of collections of photos (photosets) + //inside the scroll view, we'll place our collection view, which manages a collection of "cells" + //each cell will represent one photo collection, and choosing cells will select that collection + + var listScrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(0, 0, 200, CGRectGetHeight(bounds) - 58)]; + [listScrollView setAutohidesScrollers:YES]; + [listScrollView setAutoresizingMask:CPViewHeightSizable]; + [[listScrollView contentView] setBackgroundColor:[CPColor colorWithRed:213.0 / 255.0 green:221.0 / 255.0 blue:230.0 / 255.0 alpha:1.0]]; + + //we create the collection view cells by creating a single prototype (CPCollectionViewItem) and setting its view. + //the CPCollectionView class will then duplicate this item as many times as it needs + + var photosListItem = [[CPCollectionViewItem alloc] init]; + [photosListItem setView:[[PhotosListCell alloc] initWithFrame:CGRectMakeZero()]]; + + listCollectionView = [[CPCollectionView alloc] initWithFrame:CGRectMake(0, 0, 200, 0)]; + + [listCollectionView setDelegate:self]; //we want delegate methods + [listCollectionView setItemPrototype:photosListItem]; //set the item prototype + + [listCollectionView setMinItemSize:CGSizeMake(20.0, 45.0)]; + [listCollectionView setMaxItemSize:CGSizeMake(1000.0, 45.0)]; + [listCollectionView setMaxNumberOfColumns:1]; //setting a single column will make this appear as a vertical list + + [listCollectionView setVerticalMargin:0.0]; + [listCollectionView setAutoresizingMask:CPViewWidthSizable]; + + //finally, we put our collection view inside the scroll view as it's document view, so it can be scrolled + [listScrollView setDocumentView:listCollectionView]; + + //and we add it to the window's content view, so it will show up on the screen + [contentView addSubview:listScrollView]; + + //repeat the process with another collection view for the actual photos + //this time we'll use a different view for the prototype (PhotoCell) + + var photoItem = [[CPCollectionViewItem alloc] init]; + [photoItem setView:[[PhotoCell alloc] initWithFrame:CGRectMake(0, 0, 150, 150)]]; + + var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(200, 0, CGRectGetWidth(bounds) - 200, CGRectGetHeight(bounds) - 58)]; + + photosCollectionView = [[CPCollectionView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(bounds) - 200, 0)]; + + [photosCollectionView setDelegate:self]; + [photosCollectionView setItemPrototype:photoItem]; + + [photosCollectionView setMinItemSize:CGSizeMake(150, 150)]; + [photosCollectionView setMaxItemSize:CGSizeMake(150, 150)]; + [photosCollectionView setAutoresizingMask:CPViewWidthSizable]; + + [scrollView setAutoresizingMask:CPViewHeightSizable | CPViewWidthSizable]; + [scrollView setDocumentView:photosCollectionView]; + [scrollView setAutohidesScrollers:YES]; + + [[scrollView contentView] setBackgroundColor:[CPColor colorWithCalibratedWhite:0.25 alpha:1.0]]; + + [contentView addSubview:scrollView]; + + //bring forward the window to display it + [theWindow orderFront:self]; + + //get the most interesting photos on flickr + var request = [CPURLRequest requestWithURL:"http://www.flickr.com/services/rest/?method=flickr.interestingness.getList&per_page=20&format=json&api_key=ca4dd89d3dfaeaf075144c3fdec76756"]; + + // see important note about CPJSONPConnection above + var connection = [CPJSONPConnection sendRequest:request callback:"jsoncallback" delegate:self]; + + lastIdentifier = "Interesting Photos"; +} + +- (void)add:(id)sender +{ + var string = prompt("Enter a tag to search Flickr for photos."); + + if (string) + { + //create a new request for the photos with the tag returned from the javascript prompt + var request = [CPURLRequest requestWithURL:"http://www.flickr.com/services/rest/?"+ + "method=flickr.photos.search&tags="+encodeURIComponent(string)+ + "&media=photos&machine_tag_mode=any&per_page=20&format=json&api_key=ca4dd89d3dfaeaf075144c3fdec76756"]; + + // see important note about CPJSONPConnection above + [CPJSONPConnection sendRequest:request callback:"jsoncallback" delegate:self]; + + lastIdentifier = string; + } +} + +- (void)remove:(id)sender +{ + //remove this photo + [self removeImageListWithIdentifier:[[photosets allKeys] objectAtIndex:[[listCollectionView selectionIndexes] firstIndex]]]; +} + +- (void)addImageList:(CPArray)images withIdentifier:(CPString)aString +{ + [photosets setObject:images forKey:aString]; + + [listCollectionView setContent:[[photosets allKeys] copy]]; + [listCollectionView setSelectionIndexes:[CPIndexSet indexSetWithIndex:[[photosets allKeys] indexOfObject:aString]]]; +} + +- (void)removeImageListWithIdentifier:(CPString)aString +{ + var nextIndex = MAX([[listCollectionView content] indexOfObject:aString] - 1, 0); + + [photosets removeObjectForKey:aString]; + + [listCollectionView setContent:[[photosets allKeys] copy]]; + [listCollectionView setSelectionIndexes:[CPIndexSet indexSetWithIndex:nextIndex]]; +} + +- (void)adjustImageSize:(id)sender +{ + var newSize = [sender value]; + + [photosCollectionView setMinItemSize:CGSizeMake(newSize, newSize)]; + [photosCollectionView setMaxItemSize:CGSizeMake(newSize, newSize)]; +} + +- (void)collectionViewDidChangeSelection:(CPCollectionView)aCollectionView +{ + if (aCollectionView == listCollectionView) + { + var listIndex = [[listCollectionView selectionIndexes] firstIndex]; + + if (listIndex === CPNotFound) + return; + + var key = [listCollectionView content][listIndex]; + + [photosCollectionView setContent:[photosets objectForKey:key]]; + [photosCollectionView setSelectionIndexes:[CPIndexSet indexSet]]; + } +} + +- (void)connection:(CPJSONPConnection)aConnection didReceiveData:(CPString)data +{ + //this method is called when the network request returns. the data is the returned + //information from flickr. we set the array of photo urls as the data to our collection view + + [self addImageList:data.photos.photo withIdentifier:lastIdentifier]; +} + +- (void)connection:(CPJSONPConnection)aConnection didFailWithError:(CPString)error +{ + alert(error); //a network error occurred +} + +//these two methods are the toolbar delegate methods, and tell the toolbar what it should display to the user + +- (CPArray)toolbarAllowedItemIdentifiers:(CPToolbar)aToolbar +{ + return [self toolbarDefaultItemIdentifiers:aToolbar]; +} + +- (CPArray)toolbarDefaultItemIdentifiers:(CPToolbar)aToolbar +{ + return [AddToolbarItemIdentifier, RemoveToolbarItemIdentifier, CPToolbarFlexibleSpaceItemIdentifier, SliderToolbarItemIdentifier]; +} + +//this delegate method returns the actual toolbar item for the given identifier + +- (CPToolbarItem)toolbar:(CPToolbar)aToolbar itemForItemIdentifier:(CPString)anItemIdentifier willBeInsertedIntoToolbar:(BOOL)aFlag +{ + var toolbarItem = [[CPToolbarItem alloc] initWithItemIdentifier:anItemIdentifier]; + + if (anItemIdentifier == SliderToolbarItemIdentifier) + { + [toolbarItem setView:[[PhotoResizeView alloc] initWithFrame:CGRectMake(0, 0, 180, 32)]]; + [toolbarItem setMinSize:CGSizeMake(180, 32)]; + [toolbarItem setMaxSize:CGSizeMake(180, 32)]; + [toolbarItem setLabel:"Scale"]; + } + else if (anItemIdentifier == AddToolbarItemIdentifier) + { + var image = [[CPImage alloc] initWithContentsOfFile:[[CPBundle mainBundle] pathForResource:"add.png"] size:CPSizeMake(30, 25)], + highlighted = [[CPImage alloc] initWithContentsOfFile:[[CPBundle mainBundle] pathForResource:"addHighlighted.png"] size:CPSizeMake(30, 25)]; + + [toolbarItem setImage:image]; + [toolbarItem setAlternateImage:highlighted]; + + [toolbarItem setTarget:self]; + [toolbarItem setAction:@selector(add:)]; + [toolbarItem setLabel:"Add Photo List"]; + + [toolbarItem setMinSize:CGSizeMake(32, 32)]; + [toolbarItem setMaxSize:CGSizeMake(32, 32)]; + } + else if (anItemIdentifier == RemoveToolbarItemIdentifier) + { + var image = [[CPImage alloc] initWithContentsOfFile:[[CPBundle mainBundle] pathForResource:"remove.png"] size:CPSizeMake(30, 25)], + highlighted = [[CPImage alloc] initWithContentsOfFile:[[CPBundle mainBundle] pathForResource:"removeHighlighted.png"] size:CPSizeMake(30, 25)]; + + [toolbarItem setImage:image]; + [toolbarItem setAlternateImage:highlighted]; + + [toolbarItem setTarget:self]; + [toolbarItem setAction:@selector(remove:)]; + [toolbarItem setLabel:"Remove Photo List"]; + + [toolbarItem setMinSize:CGSizeMake(32, 32)]; + [toolbarItem setMaxSize:CGSizeMake(32, 32)]; + } + + return toolbarItem; +} + +@end + +/* + This code demonstrates how to add a category to an existing class. + In this case, we are adding the class method +flickr_labelWithText: to + the CPTextField class. Later on, we can call [CPTextField flickr_labelWithText:"foo"] + to return a new text field with the string foo. + Best practices suggest prefixing category methods with your unique prefix, to prevent collisions. +*/ + +@implementation CPTextField (CreateLabel) + ++ (CPTextField)flickr_labelWithText:(CPString)aString +{ + var label = [[CPTextField alloc] initWithFrame:CGRectMakeZero()]; + + [label setStringValue:aString]; + [label sizeToFit]; + [label setTextShadowColor:[CPColor whiteColor]]; + [label setTextShadowOffset:CGSizeMake(0, 1)]; + + return label; +} + +@end + +// This class wraps our slider + labels combo + +@implementation PhotoResizeView : CPView +{ +} + +- (id)initWithFrame:(CGRect)aFrame +{ + self = [super initWithFrame:aFrame]; + + var slider = [[CPSlider alloc] initWithFrame:CGRectMake(30, CGRectGetHeight(aFrame) / 2.0 - 8, CGRectGetWidth(aFrame) - 65, 24)]; + + [slider setMinValue:50.0]; + [slider setMaxValue:250.0]; + [slider setIntValue:150.0]; + [slider setAction:@selector(adjustImageSize:)]; + + [self addSubview:slider]; + + var label = [CPTextField flickr_labelWithText:"50"]; + [label setFrameOrigin:CGPointMake(0, CGRectGetHeight(aFrame) / 2.0 - 4.0)]; + [self addSubview:label]; + + label = [CPTextField flickr_labelWithText:"250"]; + [label setFrameOrigin:CGPointMake(CGRectGetWidth(aFrame) - CGRectGetWidth([label frame]), CGRectGetHeight(aFrame) / 2.0 - 4.0)]; + [self addSubview:label]; + + return self; +} + +@end + +// This class displays a single photo collection inside our list of photo collecitions + +@implementation PhotosListCell : CPView +{ + CPTextField label; + CPView highlightView; +} + +- (void)setRepresentedObject:(JSObject)anObject +{ + if (!label) + { + label = [[CPTextField alloc] initWithFrame:CGRectInset([self bounds], 4, 4)]; + + [label setFont:[CPFont systemFontOfSize:16.0]]; + [label setTextShadowColor:[CPColor whiteColor]]; + [label setTextShadowOffset:CGSizeMake(0, 1)]; + + [self addSubview:label]; + } + + [label setStringValue:anObject]; + [label sizeToFit]; + + [label setFrameOrigin:CGPointMake(10,CGRectGetHeight([label bounds]) / 2.0)]; +} + +- (void)setSelected:(BOOL)flag +{ + if (!highlightView) + { + highlightView = [[CPView alloc] initWithFrame:CGRectCreateCopy([self bounds])]; + [highlightView setBackgroundColor:[CPColor blueColor]]; + } + + if (flag) + { + [self addSubview:highlightView positioned:CPWindowBelow relativeTo:label]; + [label setTextColor:[CPColor whiteColor]]; + [label setTextShadowColor:[CPColor blackColor]]; + } + else + { + [highlightView removeFromSuperview]; + [label setTextColor:[CPColor blackColor]]; + [label setTextShadowColor:[CPColor whiteColor]]; + } +} + +@end + +// This class displays a single photo from our collection + +@implementation PhotoCell : CPView +{ + CPImage image; + CPImageView imageView; + CPView highlightView; +} + +- (void)setRepresentedObject:(JSObject)anObject +{ + if (!imageView) + { + imageView = [[CPImageView alloc] initWithFrame:CGRectMakeCopy([self bounds])]; + [imageView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; + [imageView setImageScaling:CPScaleProportionally]; + [imageView setHasShadow:YES]; + [self addSubview:imageView]; + } + + [image setDelegate:nil]; + + image = [[CPImage alloc] initWithContentsOfFile:thumbForFlickrPhoto(anObject)]; + + [image setDelegate:self]; + + if ([image loadStatus] == CPImageLoadStatusCompleted) + [imageView setImage:image]; + else + [imageView setImage:nil]; +} + +- (void)imageDidLoad:(CPImage)anImage +{ + [imageView setImage:anImage]; +} + +- (void)setSelected:(BOOL)flag +{ + if (!highlightView) + { + highlightView = [[CPView alloc] initWithFrame:[self bounds]]; + [highlightView setBackgroundColor:[CPColor colorWithCalibratedWhite:0.8 alpha:0.6]]; + [highlightView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; + } + + if (flag) + { + [highlightView setFrame:[self bounds]]; + [self addSubview:highlightView positioned:CPWindowBelow relativeTo:imageView]; + } + else + [highlightView removeFromSuperview]; +} + +@end + +// helper javascript functions for turning a Flickr photo object into a URL for getting the image + +function urlForFlickrPhoto(photo) +{ + return "http://farm" + photo.farm + ".static.flickr.com/" + photo.server + "/" + photo.id+"_" + photo.secret + ".jpg"; +} + +function thumbForFlickrPhoto(photo) +{ + return "http://farm" + photo.farm + ".static.flickr.com/" + photo.server + "/" + photo.id + "_" + photo.secret + "_m.jpg"; +} \ No newline at end of file diff --git a/samples/Objective-J/LightsOff.j b/samples/Objective-J/LightsOff.j new file mode 100644 index 00000000..70959136 --- /dev/null +++ b/samples/Objective-J/LightsOff.j @@ -0,0 +1,88 @@ +@import +@import +@import +@import +@import "LOBoard.j" + +@implementation LOInfoView : CPView +{ +} + +- (void)drawRect:(CGRect)r +{ + [[CPColor whiteColor] setFill] + var path = [CPBezierPath bezierPath]; + [path appendBezierPathWithRoundedRect:CGRectMake(5, 0, CGRectGetWidth([self bounds]) - 10.0, CGRectGetHeight([self bounds])) xRadius:10 yRadius:10]; + [path fill]; +} + +@end + +@implementation AppController : CPObject +{ +} + +- (CPPanel)initInfoWindow +{ + var infoWindow = [[CPPanel alloc] initWithContentRect:CGRectMake(400, 50, 320, 480) styleMask:CPHUDBackgroundWindowMask | CPResizableWindowMask]; + [infoWindow setFloatingPanel:YES]; + + var _infoContent = [infoWindow contentView], + _iconImage = [[CPImage alloc] initWithContentsOfFile:"Resources/icon.png" size:CPSizeMake(59, 60)], + _iconView = [[CPImageView alloc] initWithFrame:CGRectMake(125, 0, 59, 60)]; + + [_iconView setImage:_iconImage]; + [_infoContent addSubview:_iconView]; + + var _infoView = [[LOInfoView alloc] initWithFrame:CGRectMake(0, 65, 320, 395)], + _webView = [[CPWebView alloc] initWithFrame:CGRectMake(20, 0, 270, 370)]; + + [_webView loadHTMLString:@"

Lights Off

Lights Off is a fantastic game exclusively for iPhone and iPod touch and inspired by Tiger Electronic's 'Lights Out'.

The goal of the game is simply to switch all of the lights off, but it's harder than it looks! Give the first few levels a try in the playable demo to the left.

"]; + + [_infoView addSubview:_webView]; + + [_infoContent addSubview:_infoView]; + + return infoWindow; +} + +- (void)applicationDidFinishLaunching:(CPNotification)aNotification +{ + /* Enable Logging (DEBUG) */ + // CPLogRegister(CPLogPopup); + + var rootWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask]; + [rootWindow setBackgroundColor:[CPColor grayColor]]; + [rootWindow orderFront:self]; + + var infoWindow = [self initInfoWindow], + gameWindow = [[CPPanel alloc] initWithContentRect:CGRectMake(50, 50, 324, 482) styleMask:CPHUDBackgroundWindowMask]; + [gameWindow setFloatingPanel:YES]; + [gameWindow setTitle:@"Lights Off"]; + + contentView = [gameWindow contentView]; + + var _board = [[LOBoard alloc] initWithFrame:CGRectMake(2, 0, 320, 480)], + _bgImage = [[CPImage alloc] initWithContentsOfFile:"Resources/lo-background.png" size:CPSizeMake(320, 480)]; + [_board setImage:_bgImage]; + [_board resetBoard]; + + var _buttonImage = [[CPImage alloc] initWithContentsOfFile:"Resources/button-reset.png" size:CPSizeMake(90, 28)], + _buttonPressImage = [[CPImage alloc] initWithContentsOfFile:"Resources/button-reset-press.png" size:CPSizeMake(90, 28)], + _resetButton = [[CPButton alloc] initWithFrame:CGRectMake(195, 422, 90, 28)]; + + [_resetButton setImage:_buttonImage]; + [_resetButton setAlternateImage:_buttonPressImage]; + [_resetButton setBordered:NO]; + + [contentView addSubview:_board]; + [contentView addSubview:_resetButton]; + + [_resetButton setTarget:_board]; + [_resetButton setAction:@selector(resetBoard)]; + + [gameWindow orderFront:self]; + [infoWindow orderFront:self]; +} + +@end \ No newline at end of file diff --git a/samples/Objective-J/iTunesLayout.j b/samples/Objective-J/iTunesLayout.j new file mode 100644 index 00000000..c1ffb2e9 --- /dev/null +++ b/samples/Objective-J/iTunesLayout.j @@ -0,0 +1,47 @@ + +@import + + +@implementation AppController : CPObject +{ +} + +- (void)applicationDidFinishLaunching:(CPNotification)aNotification +{ + // The end result of this layout will be the kind of master/detail/auxilliary view + // found in iTunes, Mail, and many other apps. + + var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask], + contentView = [theWindow contentView]; + + var navigationArea = [[CPView alloc] initWithFrame:CGRectMake(0.0, 0.0, 150.0, CGRectGetHeight([contentView bounds]) - 150.0)]; + + [navigationArea setBackgroundColor:[CPColor redColor]]; + + // This view will grow in height, but stay fixed width attached to the left side of the screen. + [navigationArea setAutoresizingMask:CPViewHeightSizable | CPViewMaxXMargin]; + + [contentView addSubview:navigationArea]; + + var metaDataArea = [[CPView alloc] initWithFrame:CGRectMake(0.0, CGRectGetMaxY([navigationArea frame]), 150.0, 150.0)]; + + [metaDataArea setBackgroundColor:[CPColor greenColor]]; + + // This view will stay the same size in both directions, and fixed to the lower left corner. + [metaDataArea setAutoresizingMask:CPViewMinYMargin | CPViewMaxXMargin]; + + [contentView addSubview:metaDataArea]; + + var contentArea = [[CPView alloc] initWithFrame:CGRectMake(150.0, 0.0, CGRectGetWidth([contentView bounds]) - 150.0, CGRectGetHeight([contentView bounds]))]; + + [contentArea setBackgroundColor:[CPColor blueColor]]; + + // This view will grow in both height an width. + [contentArea setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; + + [contentView addSubview:contentArea]; + + [theWindow orderFront:self]; +} + +@end \ No newline at end of file diff --git a/samples/Zephir/filenames/exception.zep.php b/samples/PHP/exception.zep.php similarity index 100% rename from samples/Zephir/filenames/exception.zep.php rename to samples/PHP/exception.zep.php diff --git a/samples/Pike/shebang.pike b/samples/Pike/shebang.pike new file mode 100644 index 00000000..31bf7e96 --- /dev/null +++ b/samples/Pike/shebang.pike @@ -0,0 +1,6 @@ +#!/usr/bin/env pike + +int main(int argc, array argv) { + return 0; +} + diff --git a/samples/PureBasic/Example_Sine.pb b/samples/PureBasic/Example_Sine.pb new file mode 100644 index 00000000..4170ff6c --- /dev/null +++ b/samples/PureBasic/Example_Sine.pb @@ -0,0 +1,137 @@ +EnableExplicit + +; ##################################################### Includes #################################################### + +XIncludeFile "Includes/AudioOut.pbi" + +; ##################################################### Prototypes ################################################## + +; ##################################################### Structures ################################################## + +; ##################################################### Constants ################################################### + +#Samplerate = 44100 + +; ##################################################### Structures ################################################## + +Structure Main + *AudioOut + + Quit.i +EndStructure +Global Main.Main + +Structure Main_Window + ID.i + + TrackBar.i [10] +EndStructure +Global Main_Window.Main_Window + +; ##################################################### Variables ################################################### + +Global Frequency.d = 1000 +Global Amplitude.d = 0.25 + +; ##################################################### Procedures ################################################## + +Procedure Main_Window_Open() + Main_Window\ID = OpenWindow(#PB_Any, 0, 0, 800, 100, "AudioOut Example", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered) + + If Main_Window\ID + + Main_Window\TrackBar[0] = TrackBarGadget(#PB_Any, 10, 10, 780, 30, 0, 20000) + SetGadgetState(Main_Window\TrackBar[0], Frequency) + + Main_Window\TrackBar[1] = TrackBarGadget(#PB_Any, 10, 40, 780, 30, 0, 1000) + SetGadgetState(Main_Window\TrackBar[1], Amplitude*1000) + + EndIf +EndProcedure + +Procedure Notifier_CallBack(*AudioOut) + Protected *Temp, Temp_Size.i + Static Rotation.d + + While AudioOut::GetQueuedBlocks(*AudioOut) <= 3 + + Temp_Size = AudioOut::GetBufferBlocksize(*AudioOut) + If Temp_Size > 0 + *Temp = AllocateMemory(Temp_Size) + + Define Left.d, Right.d, i + For i = 0 To Temp_Size / 4 - 1 + Left = Sin(Rotation) * Amplitude + Right = Sin(Rotation) * Amplitude + + PokeW(*Temp + i*4 , Left*32767) + PokeW(*Temp + i*4 + 2, Right*32767) + + Rotation + 2.0*#PI / #Samplerate * Frequency + Next + + AudioOut::Write_Data(Main\AudioOut, *Temp, Temp_Size) + + FreeMemory(*Temp) + EndIf + + Wend +EndProcedure + +; ##################################################### Initialisation ############################################## + +Main_Window_Open() + +AudioOut::GetDevices() + +ForEach AudioOut::Device() + Debug PeekS(AudioOut::@Device()\szPname) +Next + +Main\AudioOut = AudioOut::Initialize(#WAVE_MAPPER, #Samplerate, 2, 16, @Notifier_CallBack()) + +If Not Main\AudioOut + Debug AudioOut::GetError() + End +EndIf + +Notifier_CallBack(Main\AudioOut) + +; ##################################################### Main ######################################################## + +Repeat + + Repeat + Select WaitWindowEvent(100) + Case #PB_Event_Gadget + Select EventGadget() + Case Main_Window\TrackBar[0] + Frequency = GetGadgetState(Main_Window\TrackBar[0]) + Debug Frequency + + Case Main_Window\TrackBar[1] + Amplitude = GetGadgetState(Main_Window\TrackBar[1]) / 1000 + + EndSelect + + Case #PB_Event_CloseWindow + Main\Quit = #True + + Case 0 + Break + EndSelect + ForEver + +Until Main\Quit + +; ##################################################### End ######################################################### + +AudioOut::Deinitialize(Main\AudioOut) + +; IDE Options = PureBasic 5.30 Beta 2 (Windows - x64) +; CursorPosition = 109 +; FirstLine = 79 +; Folding = - +; EnableUnicode +; EnableThread +; EnableXP diff --git a/samples/PureBasic/Memory.pbi b/samples/PureBasic/Memory.pbi new file mode 100644 index 00000000..75cc95df --- /dev/null +++ b/samples/PureBasic/Memory.pbi @@ -0,0 +1,203 @@ + +Structure Memory_Operation + Src_Offset.q + Src_Size.q + + Dst_Offset.q + Dst_Size.q + + Copy_Size.q +EndStructure + +; #### Cuts the Offset's / Sizes of the memory operation to prevent memory violations +Procedure Memory_Operation_Check(*Memory_Operation.Memory_Operation) + Protected Temp.q + + If *Memory_Operation\Src_Offset < 0 + *Memory_Operation\Copy_Size + *Memory_Operation\Src_Offset + *Memory_Operation\Dst_Offset - *Memory_Operation\Src_Offset + *Memory_Operation\Src_Offset - *Memory_Operation\Src_Offset + EndIf + + If *Memory_Operation\Dst_Offset < 0 + *Memory_Operation\Copy_Size + *Memory_Operation\Dst_Offset + *Memory_Operation\Src_Offset - *Memory_Operation\Dst_Offset + *Memory_Operation\Dst_Offset - *Memory_Operation\Dst_Offset + EndIf + + Temp = *Memory_Operation\Src_Size - *Memory_Operation\Src_Offset + If *Memory_Operation\Copy_Size > Temp + *Memory_Operation\Copy_Size = Temp + EndIf + + Temp = *Memory_Operation\Dst_Size - *Memory_Operation\Dst_Offset + If *Memory_Operation\Copy_Size > Temp + *Memory_Operation\Copy_Size = Temp + EndIf + + If *Memory_Operation\Copy_Size < 0 + *Memory_Operation\Copy_Size = 0 + EndIf + + ProcedureReturn #True +EndProcedure + +; #### Fills a *Destination with a specified amount of data. +; #### It cuts everything, to prevent memory violations +Procedure Memory_Range_Fill(Ascii.a, Fill_Size.q, *Dst, Dst_Offset.q, Dst_Size.q=-1) + Protected Temp.q + + If Not *Dst + ProcedureReturn #False + EndIf + + If Dst_Size = -1 + Dst_Size.q = MemorySize(*Dst) + EndIf + + If Dst_Offset < 0 + Fill_Size + Dst_Offset + Dst_Offset - Dst_Offset + EndIf + + Temp = Dst_Size - Dst_Offset + If Fill_Size > Temp + Fill_Size = Temp + EndIf + + If Fill_Size > 0 + FillMemory(*Dst+Dst_Offset, Fill_Size, Ascii) + EndIf + + ProcedureReturn #True +EndProcedure + +; #### Copies a specified amount of data (Copy_Size) from the source to the destination. +; #### It cuts everything, to prevent memory violations +Procedure Memory_Range_Copy(*Src, Src_Offset.q, *Dst, Dst_Offset.q, Copy_Size.q, Src_Size.q=-1, Dst_Size.q=-1) + Protected Temp.q + If Not *Src + ProcedureReturn #False + EndIf + + If Not *Dst + ProcedureReturn #False + EndIf + + If Src_Size = -1 + Src_Size.q = MemorySize(*Src) + EndIf + If Dst_Size = -1 + Dst_Size.q = MemorySize(*Dst) + EndIf + + If Src_Offset < 0 + Copy_Size + Src_Offset + Dst_Offset - Src_Offset + Src_Offset - Src_Offset + EndIf + + If Dst_Offset < 0 + Copy_Size + Dst_Offset + Src_Offset - Dst_Offset + Dst_Offset - Dst_Offset + EndIf + + Temp = Src_Size - Src_Offset + If Copy_Size > Temp + Copy_Size = Temp + EndIf + + Temp = Dst_Size - Dst_Offset + If Copy_Size > Temp + Copy_Size = Temp + EndIf + + If Copy_Size > 0 + CopyMemory(*Src+Src_Offset, *Dst+Dst_Offset, Copy_Size) + EndIf + + ProcedureReturn #True +EndProcedure + +; #### Copies (MoveMemory) a specified amount of data (Copy_Size) from the source to the destination. +; #### It cuts everything, to prevent memory violations +Procedure Memory_Range_Move(*Src, Src_Offset.q, *Dst, Dst_Offset.q, Copy_Size.q, Src_Size.q=-1, Dst_Size.q=-1) + Protected Temp.q + If Not *Src + ProcedureReturn #False + EndIf + + If Not *Dst + ProcedureReturn #False + EndIf + + If Src_Size = -1 + Src_Size.q = MemorySize(*Src) + EndIf + If Dst_Size = -1 + Dst_Size.q = MemorySize(*Dst) + EndIf + + If Src_Offset < 0 + Copy_Size + Src_Offset + Dst_Offset - Src_Offset + Src_Offset - Src_Offset + EndIf + + If Dst_Offset < 0 + Copy_Size + Dst_Offset + Src_Offset - Dst_Offset + Dst_Offset - Dst_Offset + EndIf + + Temp = Src_Size - Src_Offset + If Copy_Size > Temp + Copy_Size = Temp + EndIf + + Temp = Dst_Size - Dst_Offset + If Copy_Size > Temp + Copy_Size = Temp + EndIf + + If Copy_Size > 0 + MoveMemory(*Src+Src_Offset, *Dst+Dst_Offset, Copy_Size) + EndIf + + ProcedureReturn #True +EndProcedure + +; #### Mirrors the memory, usable for little/big endian switching +Procedure Memory_Mirror(*Memory, Memory_Size) + Protected Elements, i + Protected Temp.a, *A.Ascii, *B.Ascii + + If Not *Memory + ProcedureReturn #False + EndIf + + If Memory_Size < 1 + ProcedureReturn #True + EndIf + + Elements = Memory_Size/2 + *A = *Memory + *B = *Memory + Memory_Size - 1 + + For i = 0 To Elements - 1 + Temp = *A\a + *A\a = *B\a + *B\a = Temp + *A + 1 + *B - 1 + Next + + ProcedureReturn #True +EndProcedure +; IDE Options = PureBasic 5.31 (Windows - x64) +; CursorPosition = 190 +; FirstLine = 177 +; Folding = - +; EnableXP +; DisableDebugger diff --git a/samples/SAS/detect_phi.sas b/samples/SAS/detect_phi.sas new file mode 100644 index 00000000..5784d74f --- /dev/null +++ b/samples/SAS/detect_phi.sas @@ -0,0 +1,275 @@ +%macro check_dataset(dset =, obs_lim = max, eldest_age = 89) ; + %local i ; + %local inset_name ; + %let inset_name = &dset ; + + %if %lowcase(&obs_lim) = max %then %do ; + %** Nothing ; + %end ; + %else %do ; + proc surveyselect + data = &inset_name + out = __sub_dset + method = srs + sampsize = &obs_lim SELECTALL + seed = 1234567 + noprint + ; + run; + %let dset = __sub_dset ; + %end ; + + %macro check_varname(regx, msg) ; + create table possible_bad_vars as + select name, label + from these_vars + where prxmatch(compress("/(®x)/i"), name) + ; + + %if &sqlobs > 0 %then %do ; + insert into phi_warnings(dset, variable, label, warning) + select "&inset_name" as dset, name, label, "&msg" + from possible_bad_vars + ; + %end ; + + %mend check_varname ; + + %macro check_vars_for_mrn(length_limit = 6, obs_lim = max) ; + %local char ; + %let char = 2 ; + proc sql noprint ; + select name + into :mrn_array separated by ' ' + from these_vars + where type = &char and length ge &length_limit + ; + quit ; + %if &sqlobs > 0 %then %do ; + %put Checking these vars for possible MRN contents: &mrn_array ; + data __gnu ; + retain + mrn_regex_handle + badcount + ; + set &inset_name (obs = &obs_lim keep = &mrn_array) ; + if _n_ = 1 then do ; + mrn_regex_handle = prxparse("/&mrn_regex/") ; + badcount = 0 ; + end ; + array p &mrn_array ; + do i = 1 to dim(p) ; + if prxmatch(mrn_regex_handle, p{i}) then do ; + badvar = vname(p{i}) ; + badvalue = p{i} ; + badcount = _n_ ; + output ; + end ; + keep badvar badvalue badcount ; + end ; + run ; + proc sql noprint ; + select compress(put(max(badcount), best.)) + into :badcount + from __gnu + ; + insert into phi_warnings(dset, variable, warning) + select distinct "&inset_name", badvar, "Could this var hold MRN values? Contents of %trim(&badcount) records match the pattern given for MRN values. MRNs should never move across sites." + from __gnu ; + drop table __gnu ; + quit ; + %end ; + %mend check_vars_for_mrn ; + + %macro check_vars_for_oldsters(eldest_age = 89, obs_lim = max) ; + %local dtfmts ; + %let dtfmts = 'B8601DA','B8601DN','B8601DT','B8601DZ','B8601LZ','B8601TM','B8601TZ','DATE','DATEAMPM','DATETIME','DAY','DDMMYY', + 'DDMMYYB','DDMMYYC','DDMMYYD','DDMMYYN','DDMMYYP','DDMMYYS','DOWNAME','DTDATE','DTMONYY','DTWKDATX','DTYEAR', + 'DTYYQC','E8601DA','E8601DN','E8601DT','E8601DZ','E8601LZ','E8601TM','E8601TZ','HHMM','HOUR','JULDAY','JULIAN', + 'MMDDYY','MMDDYYB','MMDDYYC','MMDDYYD','MMDDYYN','MMDDYYP','MMDDYYS','MMSS','MMYY','MMYY','MONNAME','MONTH','MONYY', + 'PDJULG','PDJULI','QTR','QTRR','WEEKDATE','WEEKDATX','WEEKDAY','WEEKU','WEEKV','WEEKW','WORDDATE','WORDDATX', + 'YEAR','YYMM','YYMMC','YYMMD','YYMMN','YYMMP','YYMMS','YYMMDD','YYMMDDB','YYMMDDC','YYMMDDD','YYMMDDN','YYMMDDP', + 'YYMMDDS','YYMON','YYQ','YYQC','YYQD','YYQN','YYQP','YYQS','YYQR','YYQRC','YYQRD','YYQRN','YYQRP','YYQRS' ; + + %local num ; + %let num = 1 ; + + proc sql noprint ; + select name + into :dat_array separated by ' ' + from these_vars + where type = &num and (format in (&dtfmts) or lowcase(name) like '%date%') + ; + /* added by cb to shorten the process of looking at all dates */ + %if &sqlobs > 0 %then %do ; + %put Checking these vars for possible DOB contents: &dat_array ; + select 'min(' || trim(name) || ') as ' || name into :var_list separated by ',' + from these_vars + where type = &num and (format in (&dtfmts) or lowcase(name) like '%date%') + ; + create table __gnu as + select &var_list from &inset_name + ; + /* end cb additions */ + quit ; + data __gnu ; + set __gnu (obs = &obs_lim keep = &dat_array) ; + array d &dat_array ; + do i = 1 to dim(d) ; + if n(d{i}) then maybe_age = %calcage(bdtvar = d{i}, refdate = "&sysdate9."d) ; + if maybe_age ge &eldest_age then do ; + badvar = vname(d{i}) ; + badvalue = d{i} ; + output ; + end ; + keep badvar badvalue maybe_age ; + end ; + run ; + proc sql outobs = 30 nowarn ; + insert into phi_warnings(dset, variable, warning) + select distinct "&inset_name", badvar, "If this is a date, at least one value is " || compress(put(maybe_age, best.)) || " years ago, which is older than &eldest_age.. " || + "If this date applies to a person, the record is probably PHI." + from __gnu ; + drop table __gnu ; + quit ; + %end ; + %else %do ; + %put No obvious date variables found in &inset_name.--skipping age checks. ; + %end ; + %mend check_vars_for_oldsters ; + + proc contents noprint data = &inset_name out = these_vars ; + run ; + + proc sql noprint ; + create table phi_warnings (dset char(50), variable char(256), label char(256), warning char(200)) ; + + %check_varname(regx = mrn|hrn , msg = %str(Name suggests this var may be an MRN, which should never move across sites.)) ; + %check_varname(regx = birth_date|BirthDate|DOB|BDate , msg = %str(Name suggests this var may be a date of birth.)) ; + %check_varname(regx = SSN|SocialSecurityNumber|social_security_number|socsec, msg = %str(Name suggests this var may be a social security number.)) ; + + %if %symexist(locally_forbidden_varnames) %then %do ; + %check_varname(regx = &locally_forbidden_varnames, msg = %str(May be on the locally defined list of variables not allowed to be sent to other sites.)) ; + %end ; + + quit ; + + %check_vars_for_mrn(obs_lim = &obs_lim) ; + %check_vars_for_oldsters(obs_lim = &obs_lim, eldest_age = &eldest_age) ; + + title3 "WARNINGS for dataset &inset_name:" ; + + proc sql noprint ; + select count(*) as num_warns into :num_warns from phi_warnings ; + + %if &num_warns = 0 %then %do ; + reset print outobs = 5 NOWARN ; + select "No obvious PHI-like data elements in &inset_name--BUT PLEASE INSPECT THE CONTENTS AND PRINTs TO FOLLOW" as x label = "No warnings for &inset_name" + from &inset_name + ; + %do i = 1 %to 5 ; + %put No obvious phi-like data elements in &inset_name. BUT PLEASE INSPECT THE CONTENTS AND PRINTs CAREFULLY TO MAKE SURE OF THIS! ; + %end ; + %end ; + %else %do ; + reset print ; + select variable, warning from phi_warnings + order by variable, warning + ; + quit ; + %end ; + title3 "Dataset &inset_name" ; + proc contents data = &inset_name varnum ; + run ; + /* + proc print data = &inset_name (obs = 20) ; + run ; + */ + ** TODO: make the print print out recs that trip the value warnings. ; + proc sql number ; + select * + from &inset_name (obs = 20) + ; + quit ; + + quit ; + + %RemoveDset(dset = __sub_dset) ; + %RemoveDset(dset = possible_bad_vars) ; + %RemoveDset(dset = phi_warnings) ; + %RemoveDset(dset = these_vars) ; + +%mend check_dataset ; + +%macro detect_phi(transfer_lib, obs_lim = max, eldest_age = 89) ; + + %put ; + %put ; + %put ============================================================== ; + %put ; + %put Macro detect_phi: ; + %put ; + %put Checking all datasets found in %sysfunc(pathname(&transfer_lib)) for the following signs of PHI: ; + %put - Variable names signifying sensitive items like 'MRN', 'birth_date', 'SSN' and so forth. ; + %if %symexist(locally_forbidden_varnames) %then %do ; + %put - Variable names on the list defined in the standard macro variable locally_forbidden_varnames (here those names are: &locally_forbidden_varnames). ; + %end ; + %put - Contents of CHARACTER variables that match the pattern given in the standard macro variable mrn_regex (here that var is &mrn_regex) ; + %put Please note that numeric variables ARE NOT CHECKED FOR MRN-LIKE CONTENT. ; + %put - The contents of date variables (as divined by their formats) for values that, if they were DOBs, would indicate a person older than &eldest_age years. ; + %put ; + %put THIS IS BETA SOFTWARE-PLEASE SCRUTINIZE THE RESULTS AND REPORT PROBLEMS TO pardee.r@ghc.org. ; + %put ; + %put THIS MACRO IS NOT A SUBSTITUTE FOR HUMAN INSPECTION AND THOUGHT--PLEASE CAREFULLY INSPECT ALL VARIABLES--WHETHER ; + %put OR NOT THEY TRIP A WARNING--TO MAKE SURE THE DATA COMPORTS WITH YOUR DATA SHARING AGREEMENT!!! ; + %put THIS MACRO IS NOT A SUBSTITUTE FOR HUMAN INSPECTION AND THOUGHT--PLEASE CAREFULLY INSPECT ALL VARIABLES--WHETHER ; + %put OR NOT THEY TRIP A WARNING--TO MAKE SURE THE DATA COMPORTS WITH YOUR DATA SHARING AGREEMENT!!! ; + %put ; + %put THIS MACRO IS NOT A SUBSTITUTE FOR HUMAN INSPECTION AND THOUGHT--PLEASE CAREFULLY INSPECT ALL VARIABLES--WHETHER ; + %put OR NOT THEY TRIP A WARNING--TO MAKE SURE THE DATA COMPORTS WITH YOUR DATA SHARING AGREEMENT!!! ; + %put THIS MACRO IS NOT A SUBSTITUTE FOR HUMAN INSPECTION AND THOUGHT--PLEASE CAREFULLY INSPECT ALL VARIABLES--WHETHER ; + %put OR NOT THEY TRIP A WARNING--TO MAKE SURE THE DATA COMPORTS WITH YOUR DATA SHARING AGREEMENT!!! ; + %put ; + %put THIS MACRO IS NOT A SUBSTITUTE FOR HUMAN INSPECTION AND THOUGHT--PLEASE CAREFULLY INSPECT ALL VARIABLES--WHETHER ; + %put OR NOT THEY TRIP A WARNING--TO MAKE SURE THE DATA COMPORTS WITH YOUR DATA SHARING AGREEMENT!!! ; + %put THIS MACRO IS NOT A SUBSTITUTE FOR HUMAN INSPECTION AND THOUGHT--PLEASE CAREFULLY INSPECT ALL VARIABLES--WHETHER ; + %put OR NOT THEY TRIP A WARNING--TO MAKE SURE THE DATA COMPORTS WITH YOUR DATA SHARING AGREEMENT!!! ; + %put ; + %put THIS MACRO IS NOT A SUBSTITUTE FOR HUMAN INSPECTION AND THOUGHT--PLEASE CAREFULLY INSPECT ALL VARIABLES--WHETHER ; + %put OR NOT THEY TRIP A WARNING--TO MAKE SURE THE DATA COMPORTS WITH YOUR DATA SHARING AGREEMENT!!! ; + %put THIS MACRO IS NOT A SUBSTITUTE FOR HUMAN INSPECTION AND THOUGHT--PLEASE CAREFULLY INSPECT ALL VARIABLES--WHETHER ; + %put OR NOT THEY TRIP A WARNING--TO MAKE SURE THE DATA COMPORTS WITH YOUR DATA SHARING AGREEMENT!!! ; + %put ; + %put ; + %put ============================================================== ; + %put ; + %put ; + + title1 "PHI-Detection Report for the datasets in %sysfunc(pathname(&transfer_lib))." ; + title2 "please inspect all output carefully to make sure it comports with your data sharing agreement!!!" ; + + proc sql noprint ; + ** describe table dictionary.tables ; + + select trim(libname) || '.' || memname as dset + into :d1-:d999 + from dictionary.tables + where libname = "%upcase(&transfer_lib)" AND + memtype = 'DATA' + ; + %local num_dsets ; + %let num_dsets = &sqlobs ; + quit ; + + %local i ; + + %if &num_dsets = 0 %then %do i = 1 %to 10 ; + %put ERROR: NO DATASETS FOUND IN &transfer_lib!!!! ; + %end ; + + %do i = 1 %to &num_dsets ; + %put about to check &&d&i ; + %check_dataset(dset = &&d&i, obs_lim = &obs_lim, eldest_age = &eldest_age) ; + %end ; + +%mend detect_phi ; diff --git a/samples/SPARQL/foaf.sparql b/samples/SPARQL/foaf.sparql new file mode 100644 index 00000000..699360c7 --- /dev/null +++ b/samples/SPARQL/foaf.sparql @@ -0,0 +1,7 @@ +PREFIX foaf: +SELECT ?name ?email +WHERE { + ?person a foaf:Person. + ?person foaf:name ?name. + ?person foaf:mbox ?email. +} diff --git a/samples/SPARQL/string-matching.sparql b/samples/SPARQL/string-matching.sparql new file mode 100644 index 00000000..424ca987 --- /dev/null +++ b/samples/SPARQL/string-matching.sparql @@ -0,0 +1,40 @@ +PREFIX owl: +PREFIX rdf: +PREFIX skos: + +SELECT DISTINCT ?s ?label +WHERE { + SERVICE + { + SELECT DISTINCT ?s ?label ?plabel ?alabel ?hlabel (GROUP_CONCAT(DISTINCT STR(?type)) as ?types) + WHERE { + GRAPH + { + ?s rdf:type + { + ?s rdf:type ?type . + ?s ?prop ?match . + FILTER ( + strstarts(lcase(str(?match)), "test") && !(?match != ?label && strstarts(lcase(str(?label)), "test")) + ) + OPTIONAL { + ?s skos:prefLabel ?label . + FILTER (langMatches(lang(?label), "en")) + } + OPTIONAL { # in case previous OPTIONAL block gives no labels + ?s ?prop ?match . + ?s skos:prefLabel ?label . + FILTER (langMatches(lang(?label), lang(?match))) } + } + FILTER NOT EXISTS { ?s owl:deprecated true } + } + BIND(IF(?prop = skos:prefLabel && ?match != ?label, ?match, "") as ?plabel) + BIND(IF(?prop = skos:altLabel, ?match, "") as ?alabel) + BIND(IF(?prop = skos:hiddenLabel, ?match, "") as ?hlabel) + VALUES (?prop) { (skos:prefLabel) (skos:altLabel) (skos:hiddenLabel) } + } + GROUP BY ?match ?s ?label ?plabel ?alabel ?hlabel ?prop + ORDER BY lcase(str(?match)) lang(?match) + LIMIT 10 + } +} diff --git a/samples/SQL/videodb.cql b/samples/SQL/videodb.cql new file mode 100644 index 00000000..ffa3170e --- /dev/null +++ b/samples/SQL/videodb.cql @@ -0,0 +1,85 @@ +CREATE KEYSPACE videodb WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }; + +use videodb; + +// Basic entity table +// Object mapping ? +CREATE TABLE users ( + username varchar, + firstname varchar, + lastname varchar, + email varchar, + password varchar, + created_date timestamp, + total_credits int, + credit_change_date timeuuid, + PRIMARY KEY (username) +); + +// One-to-many entity table +CREATE TABLE videos ( + videoid uuid, + videoname varchar, + username varchar, + description varchar, + tags list, + upload_date timestamp, + PRIMARY KEY (videoid) +); + +// One-to-many from the user point of view +// Also know as a lookup table +CREATE TABLE username_video_index ( + username varchar, + videoid uuid, + upload_date timestamp, + videoname varchar, + PRIMARY KEY (username, videoid) +); + +// Counter table +CREATE TABLE video_rating ( + videoid uuid, + rating_counter counter, + rating_total counter, + PRIMARY KEY (videoid) +); + +// Creating index tables for tab keywords +CREATE TABLE tag_index ( + tag varchar, + videoid uuid, + timestamp timestamp, + PRIMARY KEY (tag, videoid) +); + +// Comments as a many-to-many +// Looking from the video side to many users +CREATE TABLE comments_by_video ( + videoid uuid, + username varchar, + comment_ts timestamp, + comment varchar, + PRIMARY KEY (videoid,comment_ts,username) +) WITH CLUSTERING ORDER BY (comment_ts DESC, username ASC); + +// looking from the user side to many videos +CREATE TABLE comments_by_user ( + username varchar, + videoid uuid, + comment_ts timestamp, + comment varchar, + PRIMARY KEY (username,comment_ts,videoid) +) WITH CLUSTERING ORDER BY (comment_ts DESC, videoid ASC); + + +// Time series wide row with reverse comparator +CREATE TABLE video_event ( + videoid uuid, + username varchar, + event varchar, + event_timestamp timeuuid, + video_timestamp bigint, + PRIMARY KEY ((videoid,username), event_timestamp,event) +) WITH CLUSTERING ORDER BY (event_timestamp DESC,event ASC); + diff --git a/samples/SQL/videodb.ddl b/samples/SQL/videodb.ddl new file mode 100644 index 00000000..ffa3170e --- /dev/null +++ b/samples/SQL/videodb.ddl @@ -0,0 +1,85 @@ +CREATE KEYSPACE videodb WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }; + +use videodb; + +// Basic entity table +// Object mapping ? +CREATE TABLE users ( + username varchar, + firstname varchar, + lastname varchar, + email varchar, + password varchar, + created_date timestamp, + total_credits int, + credit_change_date timeuuid, + PRIMARY KEY (username) +); + +// One-to-many entity table +CREATE TABLE videos ( + videoid uuid, + videoname varchar, + username varchar, + description varchar, + tags list, + upload_date timestamp, + PRIMARY KEY (videoid) +); + +// One-to-many from the user point of view +// Also know as a lookup table +CREATE TABLE username_video_index ( + username varchar, + videoid uuid, + upload_date timestamp, + videoname varchar, + PRIMARY KEY (username, videoid) +); + +// Counter table +CREATE TABLE video_rating ( + videoid uuid, + rating_counter counter, + rating_total counter, + PRIMARY KEY (videoid) +); + +// Creating index tables for tab keywords +CREATE TABLE tag_index ( + tag varchar, + videoid uuid, + timestamp timestamp, + PRIMARY KEY (tag, videoid) +); + +// Comments as a many-to-many +// Looking from the video side to many users +CREATE TABLE comments_by_video ( + videoid uuid, + username varchar, + comment_ts timestamp, + comment varchar, + PRIMARY KEY (videoid,comment_ts,username) +) WITH CLUSTERING ORDER BY (comment_ts DESC, username ASC); + +// looking from the user side to many videos +CREATE TABLE comments_by_user ( + username varchar, + videoid uuid, + comment_ts timestamp, + comment varchar, + PRIMARY KEY (username,comment_ts,videoid) +) WITH CLUSTERING ORDER BY (comment_ts DESC, videoid ASC); + + +// Time series wide row with reverse comparator +CREATE TABLE video_event ( + videoid uuid, + username varchar, + event varchar, + event_timestamp timeuuid, + video_timestamp bigint, + PRIMARY KEY ((videoid,username), event_timestamp,event) +) WITH CLUSTERING ORDER BY (event_timestamp DESC,event ASC); + diff --git a/samples/Sage/polinomios.sagews b/samples/Sage/polinomios.sagews new file mode 100644 index 00000000..4edb2234 --- /dev/null +++ b/samples/Sage/polinomios.sagews @@ -0,0 +1,136 @@ +# -*- coding: utf-8 -*- +# +# Funciones en Python/Sage para el trabajo con polinomios con una +# incógnita (x). +# +# Copyright (C) 2014-2015, David Abián +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program. If not, see . + +def pols (grado=-1, K=GF(2), mostrar=False): + """Devuelve la lista de polinomios constantes y no constantes de + coeficientes mónicos y grado igual o menor que el especificado. + Si el grado indicado no es válido, devuelve una lista vacía. + """ + lpols = [] + if not grado.is_integer(): + grado = grado.round() + if grado >= 0: + var('x') + xs = vector([(x^i) for i in range(grado+1)]) + V = VectorSpace(K,grado+1) + lpols = [cs*xs for cs in V] + if mostrar: + for pol in lpols: + print pol + return lpols + +def polsNoCtes (grado=-1, K=GF(2), mostrar=False): + """Devuelve la lista de polinomios no constantes de coeficientes mónicos y + grado igual o menor que el especificado. + Si el grado indicado no es válido, devuelve una lista vacía. + """ + lpols = [] + if not grado.is_integer(): + grado = grado.round() + if grado >= 0: + var('x') + xs = vector([(x^i) for i in range(grado+1)]) + for cs in K^(grado+1): + if cs[:grado] != vector(grado*[0]): # no constantes + lpols += [cs*xs] + if mostrar: + for pol in lpols: + print pol + return lpols + +def polsMismoGrado (grado=-1, K=GF(2), mostrar=False): + """Devuelve la lista de polinomios de coeficientes mónicos del grado + especificado. + Si el grado indicado no es válido, devuelve una lista vacía. + """ + lpols = [] + if not grado.is_integer(): + grado = grado.round() + if grado >= 0: + var('x') + xs = vector([(x^(grado-i)) for i in [0..grado]]) + for cs in K^(grado+1): + if cs[0] != 0: # polinomios del mismo grado + lpols += [cs*xs] + if mostrar: + for pol in lpols: + print pol + return lpols + +def excluirReducibles (lpols=[], mostrar=False): + """Filtra una lista dada de polinomios de coeficientes mónicos y devuelve + aquellos irreducibles. + """ + var('x') + irreds = [] + for p in lpols: + fp = (p.factor_list()) + if len(fp) == 1 and fp[0][1] == 1: + irreds += [p] + if mostrar: + for pol in irreds: + print pol + return irreds + +def vecPol (vec=random_vector(GF(2),0)): + """Transforma los coeficientes dados en forma de vector en el polinomio + que representan. + + Por ejemplo, con vecPol(vector([1,0,3,1])) se obtiene x³ + 3*x + 1. + + Para la función opuesta, véase polVec(). + """ + var('x') + xs = vector([x^(len(vec)-1-i) for i in range(len(vec))]) + return vec*xs + +def polVec (p=None): + """Devuelve el vector de coeficientes del polinomio dado que acompañan a la + incógnita x, de mayor a menor grado. + + Por ejemplo, con polVec(x^3 + 3*x + 1) se obtiene el vector (1, 0, 3, 1). + + Para la función opuesta, véase vecPol(). + """ + cs = [] + if p != None: + var('x') + p(x) = p + for i in [0..p(x).degree(x)]: + cs.append(p(x).coefficient(x,i)) + cs = list(reversed(cs)) + return vector(cs) + +def completar2 (p=0): + """Aplica el método de completar cuadrados en parábolas al polinomio dado de + grado 2 y lo devuelve en su nueva forma. + + Si el polinomio dado no es válido, devuelve 0. + + Por ejemplo, con complCuad(3*x^2 + 12*x + 5) se obtiene 3*(x + 2)^2 - 7. + """ + var('x') + p(x) = p.expand() + if p(x).degree(x) != 2: + p(x) = 0 + else: + cs = polVec(p(x)) + p(x) = cs[0]*(x+(cs[1]/(2*cs[0])))^2+(4*cs[0]*cs[2]-cs[1]^2)/(4*cs[0]) + return p(x) diff --git a/samples/SaltStack/eval.sls b/samples/SaltStack/eval.sls new file mode 100644 index 00000000..f954c8cf --- /dev/null +++ b/samples/SaltStack/eval.sls @@ -0,0 +1,48 @@ +ceph: + pkg.installed: + - refresh: True + service: + - dead + - enable: False + - require: + - file: /etc/eval.conf + {% if grains['os'] == 'Ubuntu'%} + - file: /etc/apt/sources.list.d/ceph.list + {% endif %} + +ceph-mds: + pkg.installed: + - require: + - pkg: ceph + +include: + - ceph.extras + +{% if grains['os'] == 'Ubuntu'%} +/etc/apt/sources.list.d/ceph.list: + file.managed: + - source: salt://ceph/apt.list + - template: jinja + - require: + - cmd: repo-key + +repo-key: + cmd.run: + - name: 'wget -q -O - https://raw.github.com/release.asc | sudo apt-key add -' + - unless: 'apt-key list | grep -q -i ceph' +{% endif %} + +/etc/ceph/ceph.conf: + file.managed: + - source: salt://ceph/eval.conf + - template: jinja + - makedirs: true + +/var/lib/ceph: + file.directory: + - names: + {% for dir in 'mon.a','osd.0','osd.1','mds.a' %} + - /var/lib/ceph/{{ dir.split('.')[0] }}/ceph-{{ dir.split('.')[1] }} + {% endfor %} + - require: + - pkg: ceph diff --git a/samples/SaltStack/top.sls b/samples/SaltStack/top.sls new file mode 100644 index 00000000..12810e8e --- /dev/null +++ b/samples/SaltStack/top.sls @@ -0,0 +1,4 @@ +base: + '*': + - packages + - coffeestats diff --git a/samples/Scheme/lambdastar.sls b/samples/Scheme/lambdastar.sls new file mode 100644 index 00000000..7388b07f --- /dev/null +++ b/samples/Scheme/lambdastar.sls @@ -0,0 +1,46 @@ +(library (lambdastar) + (export (rename (lambda* lambda))) + (import (rnrs)) + +(define-syntax lambda* + (syntax-rules () + ((_ a* e* ...) + ( lambda*-h a* (let () e* ...))))) + +(define-syntax lambda*-h + (syntax-rules () + ((_ () e) + (lambda a* (if (null? a*) e (apply (e) a*)))) + ((_ (a a* ...) e) (posary-h (a a* ...) e)) + ((_ (a a* ... . rest) e) + (polyvariadic-h (a a* ... . rest) e)) + ((_ a* e) (lambda a* e)))) + +(define-syntax posary-h + (syntax-rules () + ((_ (a a* ...) e) + (letrec + ((rec + (case-lambda + (() rec) + ((a a* ...) e) + ((a a* ... . rest) + (apply (rec a a* ...) rest)) + (some (get-more rec some))))) + rec)))) + +(define-syntax polyvariadic-h + (syntax-rules () + ((_ (a a* ... . rest) e) + (letrec + ((rec + (case-lambda + (() rec) + ((a a* ... . rest) e) + (some (get-more rec some))))) + rec)))) + +(define get-more + (lambda (rec some) + (lambda more + (apply rec (append some more)))))) \ No newline at end of file diff --git a/samples/Smalltalk/Booleans.cs b/samples/Smalltalk/Booleans.cs new file mode 100644 index 00000000..551f22a0 --- /dev/null +++ b/samples/Smalltalk/Booleans.cs @@ -0,0 +1 @@ +'From Pharo4.0 of 18 March 2013 [Latest update: #40152] on 6 August 2014 at 10:12:19.27738 pm'! Object subclass: #Boolean instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Kernel-Objects'! Boolean subclass: #False instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Kernel-Objects'! Boolean subclass: #True instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Kernel-Objects'! !Boolean methodsFor: '*monticellofiletree-core' stamp: 'dkh 4/6/2012 15:56:14'! writeCypressJsonOn: aStream forHtml: forHtml indent: startIndent "by default ignore ... is used for Dictionary and Array, i.e., container objects and String which actually encodes itself differently for HTML" aStream nextPutAll: self printString! ! !Boolean methodsFor: 'copying' stamp: 'tk 8/20/1998 16:07'! veryDeepCopyWith: deepCopier "Return self. I can't be copied. Do not record me."! ! !Boolean methodsFor: 'copying'! deepCopy "Receiver has two concrete subclasses, True and False. Only one instance of each should be made, so return self."! ! !Boolean methodsFor: 'copying'! shallowCopy "Receiver has two concrete subclasses, True and False. Only one instance of each should be made, so return self."! ! !Boolean methodsFor: 'logical operations'! not "Negation. Answer true if the receiver is false, answer false if the receiver is true." self subclassResponsibility! ! !Boolean methodsFor: 'logical operations'! & aBoolean "Evaluating conjunction. Evaluate the argument. Then answer true if both the receiver and the argument are true." self subclassResponsibility! ! !Boolean methodsFor: 'logical operations'! | aBoolean "Evaluating disjunction (OR). Evaluate the argument. Then answer true if either the receiver or the argument is true." self subclassResponsibility! ! !Boolean methodsFor: 'logical operations' stamp: 'stephane.ducasse 5/20/2009 21:28'! ==> aBlock "The material conditional, also known as the material implication or truth functional conditional. Correspond to not ... or ... and does not correspond to the English if...then... construction. known as: b if a a implies b if a then b b is a consequence of a a therefore b (but note: 'it is raining therefore it is cloudy' is implication; 'it is autumn therefore the leaves are falling' is equivalence). Here is the truth table for material implication: p | q | p ==> q -------|-------|------------- T | T | T T | F | F F | T | T F | F | T " ^self not or: [aBlock value]! ! !Boolean methodsFor: 'logical operations'! eqv: aBoolean "Answer true if the receiver is equivalent to aBoolean." ^self == aBoolean! ! !Boolean methodsFor: 'controlling'! or: alternativeBlock "Nonevaluating disjunction. If the receiver is false, answer the value of the argument, alternativeBlock; otherwise answer true without evaluating the argument." self subclassResponsibility! ! !Boolean methodsFor: 'controlling'! ifFalse: alternativeBlock "If the receiver is true (i.e., the condition is true), then the value is the true alternative, which is nil. Otherwise answer the result of evaluating the argument, alternativeBlock. Create an error notification if the receiver is nonBoolean. Execution does not actually reach here because the expression is compiled in-line." self subclassResponsibility! ! !Boolean methodsFor: 'controlling'! ifTrue: trueAlternativeBlock ifFalse: falseAlternativeBlock "If the receiver is true (i.e., the condition is true), then answer the value of the argument trueAlternativeBlock. If the receiver is false, answer the result of evaluating the argument falseAlternativeBlock. If the receiver is a nonBoolean then create an error notification. Execution does not actually reach here because the expression is compiled in-line." self subclassResponsibility! ! !Boolean methodsFor: 'controlling'! ifFalse: falseAlternativeBlock ifTrue: trueAlternativeBlock "Same as ifTrue:ifFalse:." self subclassResponsibility! ! !Boolean methodsFor: 'controlling'! ifTrue: alternativeBlock "If the receiver is false (i.e., the condition is false), then the value is the false alternative, which is nil. Otherwise answer the result of evaluating the argument, alternativeBlock. Create an error notification if the receiver is nonBoolean. Execution does not actually reach here because the expression is compiled in-line." self subclassResponsibility! ! !Boolean methodsFor: 'controlling'! and: alternativeBlock "Nonevaluating conjunction. If the receiver is true, answer the value of the argument, alternativeBlock; otherwise answer false without evaluating the argument." self subclassResponsibility! ! !Boolean methodsFor: '*Fuel' stamp: 'MartinDias 2/21/2013 12:49'! fuelAccept: aGeneralMapper ^aGeneralMapper visitHookPrimitive: self! ! !Boolean methodsFor: '*Fuel' stamp: 'MartinDias 2/21/2013 12:49'! serializeOn: anEncoder "Do nothing"! ! !Boolean methodsFor: '*NativeBoost-Core' stamp: 'cb 4/22/2013 14:15'! asNBExternalType: gen "boolean value in argument description array defines a simple 0 or 1 constant #( true false ) - turned into a 1 and 0 " ^ NBFFIConst value: self asBit! ! !Boolean methodsFor: 'printing'! storeOn: aStream "Refer to the comment in Object|storeOn:." self printOn: aStream! ! !Boolean methodsFor: 'printing' stamp: 'apb 4/21/2006 09:22'! isLiteral ^ true! ! !Boolean methodsFor: 'self evaluating' stamp: 'sd 7/31/2005 21:45'! isSelfEvaluating ^ true! ! !Boolean methodsFor: 'converting' stamp: 'CamilloBruni 3/27/2012 17:20'! asBit "convert myself to an Integer representing 1 for true and 0 for false" self subclassResponsibility! ! !Boolean class methodsFor: '*System-Settings-Browser' stamp: 'alain.plantec 3/18/2009 14:48'! settingInputWidgetForNode: aSettingNode ^ aSettingNode inputWidgetForBoolean! ! !Boolean class methodsFor: '*NativeBoost-Core' stamp: 'IgorStasenko 8/13/2013 16:47'! asNBExternalType: gen ^ NBBool asNBExternalType: gen! ! !Boolean class methodsFor: 'instance creation'! new self error: 'You may not create any more Booleans - this is two-valued logic'! ! !False methodsFor: 'printing'! printOn: aStream aStream nextPutAll: 'false'! ! !False methodsFor: 'logical operations'! not "Negation -- answer true since the receiver is false." ^true! ! !False methodsFor: 'logical operations' stamp: 'md 7/30/2005 18:05'! & aBoolean "Evaluating conjunction -- answer false since receiver is false." ^self! ! !False methodsFor: 'logical operations'! | aBoolean "Evaluating disjunction (OR) -- answer with the argument, aBoolean." ^aBoolean! ! !False methodsFor: 'logical operations' stamp: 'CamilloBruni 8/1/2012 16:25'! xor: aBoolean ^aBoolean value! ! !False methodsFor: 'controlling'! or: alternativeBlock "Nonevaluating disjunction -- answer value of alternativeBlock." ^alternativeBlock value! ! !False methodsFor: 'controlling'! ifFalse: alternativeBlock "Answer the value of alternativeBlock. Execution does not actually reach here because the expression is compiled in-line." ^alternativeBlock value! ! !False methodsFor: 'controlling'! ifTrue: trueAlternativeBlock ifFalse: falseAlternativeBlock "Answer the value of falseAlternativeBlock. Execution does not actually reach here because the expression is compiled in-line." ^falseAlternativeBlock value! ! !False methodsFor: 'controlling'! ifFalse: falseAlternativeBlock ifTrue: trueAlternativeBlock "Answer the value of falseAlternativeBlock. Execution does not actually reach here because the expression is compiled in-line." ^falseAlternativeBlock value! ! !False methodsFor: 'controlling'! ifTrue: alternativeBlock "Since the condition is false, answer the value of the false alternative, which is nil. Execution does not actually reach here because the expression is compiled in-line." ^nil! ! !False methodsFor: 'controlling'! and: alternativeBlock "Nonevaluating conjunction -- answer with false since the receiver is false." ^self! ! !False methodsFor: 'converting' stamp: 'IgorStasenko 12/28/2012 15:09'! asBit ^ 0! ! !True methodsFor: 'controlling'! or: alternativeBlock "Nonevaluating disjunction -- answer true since the receiver is true." ^self! ! !True methodsFor: 'controlling'! ifFalse: alternativeBlock "Since the condition is true, the value is the true alternative, which is nil. Execution does not actually reach here because the expression is compiled in-line." ^nil! ! !True methodsFor: 'controlling'! ifTrue: trueAlternativeBlock ifFalse: falseAlternativeBlock "Answer with the value of trueAlternativeBlock. Execution does not actually reach here because the expression is compiled in-line." ^trueAlternativeBlock value! ! !True methodsFor: 'controlling'! ifFalse: falseAlternativeBlock ifTrue: trueAlternativeBlock "Answer the value of trueAlternativeBlock. Execution does not actually reach here because the expression is compiled in-line." ^trueAlternativeBlock value! ! !True methodsFor: 'controlling'! ifTrue: alternativeBlock "Answer the value of alternativeBlock. Execution does not actually reach here because the expression is compiled in-line." ^alternativeBlock value! ! !True methodsFor: 'controlling'! and: alternativeBlock "Nonevaluating conjunction -- answer the value of alternativeBlock since the receiver is true." ^alternativeBlock value! ! !True methodsFor: 'converting' stamp: 'IgorStasenko 12/28/2012 15:09'! asBit ^ 1! ! !True methodsFor: 'printing'! printOn: aStream aStream nextPutAll: 'true'! ! !True methodsFor: 'logical operations'! not "Negation--answer false since the receiver is true." ^false! ! !True methodsFor: 'logical operations' stamp: 'md 7/30/2005 18:04'! & aBoolean "Evaluating conjunction -- answer aBoolean since receiver is true." ^aBoolean! ! !True methodsFor: 'logical operations'! | aBoolean "Evaluating disjunction (OR) -- answer true since the receiver is true." ^self! ! !True methodsFor: 'logical operations' stamp: 'CamilloBruni 8/1/2012 16:25'! xor: aBoolean ^aBoolean value not! ! !True class methodsFor: '*Fuel' stamp: 'MartinDias 2/21/2013 12:51'! materializeFrom: aDecoder "Answer my unique instance" ^ true! ! !False class methodsFor: '*Fuel' stamp: 'MartinDias 2/21/2013 12:51'! materializeFrom: aDecoder "Answer my unique instance" ^ false! ! \ No newline at end of file diff --git a/samples/Smalltalk/Collections.cs b/samples/Smalltalk/Collections.cs new file mode 100644 index 00000000..e0a79e72 --- /dev/null +++ b/samples/Smalltalk/Collections.cs @@ -0,0 +1 @@ +'From Pharo4.0 of 18 March 2013 [Latest update: #40152] on 7 August 2014 at 2:21:37.309017 pm'! Object subclass: #Collection instanceVariableNames: '' classVariableNames: 'MutexForPicking RandomForPicking' poolDictionaries: '' category: 'Collections-Abstract'! HashedCollection subclass: #Dictionary instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Collections-Unordered'! Collection class instanceVariableNames: ''! Dictionary class instanceVariableNames: ''! String subclass: #Symbol instanceVariableNames: '' classVariableNames: 'NewSymbols OneCharacterSymbols SymbolTable' poolDictionaries: '' category: 'Collections-Strings'! Symbol class instanceVariableNames: ''! SequenceableCollection subclass: #OrderedCollection instanceVariableNames: 'array firstIndex lastIndex' classVariableNames: '' poolDictionaries: '' category: 'Collections-Sequenceable'! OrderedCollection class uses: TSortable classTrait instanceVariableNames: ''! Object subclass: #Stream instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Collections-Streams'! Stream class instanceVariableNames: ''! !Collection methodsFor: '*metacello-core-scripting' stamp: 'dkh 9/5/2012 06:26:03.064'! execute: projectSpecBlock against: aScriptExecutor aScriptExecutor executeCollection: self do: projectSpecBlock! ! !Collection methodsFor: 'testing' stamp: 'EstebanLorenzano 8/17/2012 16:40'! includesSubstringAnywhere: testString "Answer whether the receiver includes, anywhere in its nested structure, a string that has testString as a substring" self do: [:element | (element isString) ifTrue: [(element includesSubstring: testString) ifTrue: [^ true]]. (element isCollection) ifTrue: [(element includesSubstringAnywhere: testString) ifTrue: [^ true]]]. ^ false "#(first (second third) ((allSentMessages ('Elvis' includes:)))) includesSubstringAnywhere: 'lvi'"! ! !Collection methodsFor: 'testing'! contains: aBlock "VW compatibility" ^self anySatisfy: aBlock! ! !Collection methodsFor: 'testing' stamp: 'ClementBera 12/2/2013 12:41'! includesAllOf: aCollection self flag: 'use includesAll: instead'. ^ self includesAll: aCollection.! ! !Collection methodsFor: 'testing' stamp: 'CamilloBruni 9/8/2011 14:18'! includesAny: aCollection "Answer whether any element of aCollection is one of the receiver's elements." aCollection do: [:elem | (self includes: elem) ifTrue: [^ true]]. ^ false! ! !Collection methodsFor: 'testing' stamp: 'ls 3/27/2000 17:25'! identityIncludes: anObject "Answer whether anObject is one of the receiver's elements." self do: [:each | anObject == each ifTrue: [^true]]. ^false! ! !Collection methodsFor: 'testing' stamp: 'StephaneDucasse 7/3/2010 22:15'! ifEmpty: aBlock "Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver." "Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: self classifyMethodAs: (myProtocol ifEmpty: ['As yet unclassified'])" ^ self isEmpty ifTrue: [ ^aBlock value ] ifFalse: [ self ]! ! !Collection methodsFor: 'testing' stamp: 'HenrikSperreJohansen 6/28/2010 12:13'! ifEmpty: emptyBlock ifNotEmpty: notEmptyBlock "Evaluate emptyBlock if I'm empty, notEmptyBlock otherwise" " If the notEmptyBlock has an argument, eval with the receiver as its argument" self isEmpty ifTrue: [ ^emptyBlock value ]. ^notEmptyBlock cull: self! ! !Collection methodsFor: 'testing' stamp: 'StephaneDucasse 7/3/2010 22:10'! ifNotEmpty: aBlock "Evaluate the given block with the receiver as argument, answering its value unless the receiver is empty, in which case answer the receiver If the block has an argument, eval with the receiver as its argument, but it might be better to use ifNotEmptyDo: to make the code easier to understand" "Note that the fact that this method returns its argument in case the receiver is empty allows one to write expressions like the following ones: self classifyMethodAs: (myProtocol ifEmpty: ['As yet unclassified']" ^self isEmpty ifTrue: [self] ifFalse: [aBlock cull: self] ! ! !Collection methodsFor: 'testing' stamp: 'ar 11/21/2009 00:36'! ifNotEmptyDo: aBlock "Evaluate the given block with the receiver as its argument." self isEmpty ifFalse: [^ aBlock value: self]. ! ! !Collection methodsFor: 'testing' stamp: 'sma 5/12/2000 14:07'! includes: anObject "Answer whether anObject is one of the receiver's elements." ^ self anySatisfy: [:each | each = anObject]! ! !Collection methodsFor: 'testing' stamp: 'ul 11/11/2009 16:24'! ifEmpty: emptyBlock ifNotEmptyDo: notEmptyBlock "Evaluate emptyBlock if I'm empty, notEmptyBlock otherwise" "Evaluate the notEmptyBlock with the receiver as its argument" self isEmpty ifTrue: [ ^emptyBlock value ]. ^notEmptyBlock value: self! ! !Collection methodsFor: 'testing'! isEmpty "Answer whether the receiver contains any elements." ^self size = 0! ! !Collection methodsFor: 'testing' stamp: 'bf 3/10/2000 09:29'! isEmptyOrNil "Answer whether the receiver contains any elements, or is nil. Useful in numerous situations where one wishes the same reaction to an empty collection or to nil" ^ self isEmpty! ! !Collection methodsFor: 'testing'! occurrencesOf: anObject "Answer how many of the receiver's elements are equal to anObject." | tally | tally := 0. self do: [:each | anObject = each ifTrue: [tally := tally + 1]]. ^tally! ! !Collection methodsFor: 'testing' stamp: 'di 11/6/1998 09:16'! isSequenceable ^ false! ! !Collection methodsFor: 'testing' stamp: 'ul 11/11/2009 16:25'! ifNotEmptyDo: notEmptyBlock ifEmpty: emptyBlock "Evaluate emptyBlock if I'm empty, notEmptyBlock otherwise Evaluate the notEmptyBlock with the receiver as its argument" self isEmpty ifFalse: [ ^notEmptyBlock value: self ]. ^emptyBlock value! ! !Collection methodsFor: 'testing' stamp: 'CamilloBruni 9/8/2011 14:20'! includesAnyOf: aCollection self flag: 'use includesAny: instead'. ^ self includesAny: aCollection. ! ! !Collection methodsFor: 'testing' stamp: 'MarcusDenker 7/17/2013 13:15'! isNotEmpty "Answer whether the receiver contains any elements." ^ self isEmpty not! ! !Collection methodsFor: 'testing' stamp: 'CamilloBruni 9/8/2011 14:18'! includesAll: aCollection "Answer whether all the elements of aCollection are in the receiver." aCollection do: [:elem | (self includes: elem) ifFalse: [^ false]]. ^ true! ! !Collection methodsFor: 'testing' stamp: 'ar 8/17/1999 19:43'! isCollection "Return true if the receiver is some sort of Collection and responds to basic collection messages such as #size and #do:" ^true! ! !Collection methodsFor: 'testing' stamp: 'MarcusDenker 7/17/2013 13:16'! notEmpty "Answer whether the receiver contains any elements." "use isNotEmpty for consistency with isEmpty" ^ self isEmpty not! ! !Collection methodsFor: 'testing' stamp: 'HenrikSperreJohansen 6/28/2010 12:14'! ifNotEmpty: notEmptyBlock ifEmpty: emptyBlock "Evaluate emptyBlock if I'm empty, notEmptyBlock otherwise If the notEmptyBlock has an argument, eval with the receiver as its argument" self isEmpty ifFalse: [ ^notEmptyBlock cull: self ]. ^emptyBlock value! ! !Collection methodsFor: '*Morphic-Base-Basic' stamp: 'CamilloBruni 10/21/2012 23:39'! asDraggableMorph ^ (String streamContents: [ :s| self do: [ :each | s print: each ] separatedBy: [ s space ]]) asStringMorph! ! !Collection methodsFor: 'comparing' stamp: 'SqR 8/3/2000 13:36'! hash "Answer an integer hash value for the receiver such that, -- the hash value of an unchanged object is constant over time, and -- two equal objects have equal hash values" | hash | hash := self species hash. self size <= 10 ifTrue: [self do: [:elem | hash := hash bitXor: elem hash]]. ^hash bitXor: self size hash! ! !Collection methodsFor: 'enumerating' stamp: 'CamilloBruni 3/23/2013 10:46'! reject: rejectBlock thenDo: doBlock "Utility method to improve readability." (self reject: rejectBlock) do: doBlock! ! !Collection methodsFor: 'enumerating' stamp: 'SebastianTleye 6/25/2013 18:41'! flattened "Flattens a collection of collections (no matter how many levels of collections exist). Strings are considered atoms and, as such, won't be flattened Examples: #(1 #(2 3) #(4 (#5))) flattened returns #(1 2 3 4 5) #('string1' #('string2' 'string3')) flattened returns #('string1' 'string2' 'string3')" ^ Array streamContents: [ :stream | self flattenOn: stream].! ! !Collection methodsFor: 'enumerating' stamp: 'nice 1/5/2010 15:59'! detectMin: aBlock "Evaluate aBlock with each of the receiver's elements as the argument. Answer the element for which aBlock evaluates to the lowest number. If collection empty, return nil." | minElement minValue | self do: [:each | | val | minValue == nil ifFalse: [ (val := aBlock value: each) < minValue ifTrue: [ minElement := each. minValue := val]] ifTrue: ["first element" minElement := each. minValue := aBlock value: each]. "Note that there is no way to get the first element that works for all kinds of Collections. Must test every one."]. ^ minElement! ! !Collection methodsFor: 'enumerating' stamp: 'GabrielOmarCotelli 11/26/2013 17:15'! detect: aBlock ifNone: exceptionBlock "Evaluate aBlock with each of the receiver's elements as the argument. Answer the first element for which aBlock evaluates to true. If none evaluate to true, then evaluate the argument, exceptionBlock." ^ self detect: aBlock ifFound: [ :element | element ] ifNone: exceptionBlock! ! !Collection methodsFor: 'enumerating' stamp: 'sma 5/12/2000 11:57'! do: elementBlock separatedBy: separatorBlock "Evaluate the elementBlock for all elements in the receiver, and evaluate the separatorBlock between." | beforeFirst | beforeFirst := true. self do: [:each | beforeFirst ifTrue: [beforeFirst := false] ifFalse: [separatorBlock value]. elementBlock value: each]! ! !Collection methodsFor: 'enumerating' stamp: 'sma 4/30/2000 11:17'! anySatisfy: aBlock "Evaluate aBlock with the elements of the receiver. If aBlock returns true for any element return true. Otherwise return false." self do: [:each | (aBlock value: each) ifTrue: [^ true]]. ^ false! ! !Collection methodsFor: 'enumerating' stamp: 'TudorGirba 3/20/2012 09:07'! intersection: aCollection "Answer the set theoretic intersection of two collections." | set outputSet | set := self asSet. outputSet := Set new. aCollection do: [ :each| ((set includes: each) and: [(outputSet includes: each) not]) ifTrue: [ outputSet add: each]]. ^ self species withAll: outputSet asArray! ! !Collection methodsFor: 'enumerating' stamp: 'nice 12/9/2009 15:37'! findFirstInByteString: aByteString startingAt: start "Find the index of first character starting at start in aByteString that is included in the receiver. Default is to use a naive algorithm. Subclasses might want to implement a more efficient scheme" start to: aByteString size do: [:index | (self includes: (aByteString at: index)) ifTrue: [^ index]]. ^ 0! ! !Collection methodsFor: 'enumerating' stamp: 'CamilloBruni 3/22/2013 22:09'! reject: rejectBlock thenCollect: collectBlock "Utility method to improve readability." ^ (self reject: rejectBlock) collect: collectBlock! ! !Collection methodsFor: 'enumerating' stamp: 'sma 4/30/2000 11:17'! allSatisfy: aBlock "Evaluate aBlock with the elements of the receiver. If aBlock returns false for any element return false. Otherwise return true." self do: [:each | (aBlock value: each) ifFalse: [^ false]]. ^ true! ! !Collection methodsFor: 'enumerating' stamp: 'CamilloBruni 3/22/2013 22:30'! collect: collectBlock thenReject: selectBlock "Utility method to improve readability." ^ (self collect: collectBlock) reject: selectBlock! ! !Collection methodsFor: 'enumerating' stamp: 'StephaneDucasse 1/3/2010 20:15'! groupBy: keyBlock having: selectBlock "This message is deprecated. Please use groupedBy:having:. But we let it right now without warning because we are not sure to remove in the next iteration." ^ self groupedBy: keyBlock having: selectBlock ! ! !Collection methodsFor: 'enumerating' stamp: 'StephaneDucasse 1/2/2012 21:08'! reduce: aBlock "Fold the result of the receiver into aBlock. The argument aBlock must take two or more arguments. It applies the argument, binaryBlock cumulatively to the elements of the receiver. For sequenceable collections the elements will be used in order, for unordered collections the order is unspecified." "#(1 2 3) asSet reduce: [ :a :b | a + b ] --> 1 + 2 + 3 = 6 #(1 2 3 4 5) asSet reduce: [ :a :b :c | a + b + c ] --> 1 + 2 + 3 + 4 + 5 = 15" ^self asOrderedCollection reduce: aBlock! ! !Collection methodsFor: 'enumerating' stamp: 'CamilloBruni 3/22/2013 22:32'! reject: aBlock "Evaluate aBlock with each of the receiver's elements as the argument. Collect into a new collection like the receiver only those elements for which aBlock evaluates to false. Answer the new collection." ^self select: [ :element | (aBlock value: element) == false ]! ! !Collection methodsFor: 'enumerating' stamp: 'jannik.laval 8/27/2010 15:54'! flatCollect: aBlock as: aCollectionClass "Evaluate aBlock for each of the receiver's elements and answer the list of all resulting values flatten one level. Assumes that aBlock returns some kind of collection for each element. Equivalent to the lisp's mapcan" | col | self isEmpty ifTrue: [^self copy ]. col := aCollectionClass new: self size. self do: [ :each | col addAll: (aBlock value: each) ]. ^col! ! !Collection methodsFor: 'enumerating' stamp: 'ST 6/23/2013 11:33'! gather: aBlock "This method is kept for compatibility reasons, use flatCollect instead." ^ self flatCollect: aBlock.! ! !Collection methodsFor: 'enumerating' stamp: 'TudorGirba 11/3/2013 12:12'! flatCollect: aBlock "Evaluate aBlock for each of the receiver's elements and answer the list of all resulting values flatten one level. Assumes that aBlock returns some kind of collection for each element. Equivalent to the lisp's mapcan" | stream | self isEmpty ifTrue: [ ^ self copy ]. stream := (self species new: 0) writeStream. self do: [ :each | stream nextPutAll: (aBlock value: each) ]. ^ stream contents! ! !Collection methodsFor: 'enumerating'! detectSum: aBlock "Evaluate aBlock with each of the receiver's elements as the argument. Return the sum of the answers." | sum | sum := 0. self do: [:each | sum := (aBlock value: each) + sum]. ^ sum! ! !Collection methodsFor: 'enumerating' stamp: 'AdrianKuhn 12/30/2009 09:37'! groupedBy: aBlock having: aSelectionBlock "Like in SQL operation - Split the recievers contents into collections of elements for which keyBlock returns the same results, and return those collections allowed by selectBlock." ^ (self groupedBy: aBlock) select: aSelectionBlock ! ! !Collection methodsFor: 'enumerating' stamp: 'CamilloBruni 9/7/2011 19:24'! \ aCollection ^ self difference: aCollection! ! !Collection methodsFor: 'enumerating' stamp: 'BenComan 3/20/2014 00:00'! do: aBlock displayingProgress: aStringOrBlock every: msecs "Enumerate aBlock displaying progress information. If the argument is a string, use a static label for the process. If the argument is a block, evaluate it with the element to retrieve the label. The msecs argument ensures that updates happen at most every msecs. Example: Smalltalk allClasses do:[:aClass| (Delay forMilliseconds: 1) wait] displayingProgress:[:aClass| 'Processing ', aClass name] every: 0." | size labelBlock count oldLabel lastUpdate | self isEmpty ifTrue: [ ^ self ]. oldLabel := nil. count := lastUpdate := 0. size := self size. '' displayProgressFrom: 0 to: size during: [:bar | labelBlock := aStringOrBlock isString ifTrue: [ bar label: aStringOrBlock. [ :dummyItem | aStringOrBlock]] ifFalse: [aStringOrBlock]. self do: [:each| | newLabel | "Special handling for first and last element" (count = 0 or: [count+1 = size or: [(Time millisecondsSince: lastUpdate) >= msecs]]) ifTrue: [ bar current: count. oldLabel = (newLabel := (labelBlock cull: each) ifNil: [oldLabel]) ifFalse: [ bar label: newLabel. ProgressNotification signal: '' extra: (oldLabel := newLabel) ]. lastUpdate := Time millisecondClockValue ]. aBlock value: each. count := count + 1]]! ! !Collection methodsFor: 'enumerating'! associationsDo: aBlock "Evaluate aBlock for each of the receiver's elements (key/value associations). If any non-association is within, the error is not caught now, but later, when a key or value message is sent to it." self do: aBlock! ! !Collection methodsFor: 'enumerating' stamp: 'AdrianKuhn 12/30/2009 09:36'! groupedBy: aBlock "Answer a dictionary whose keys are the result of evaluating aBlock for all my elements, and the value for each key is the selection of my elements that evaluated to that key. Uses species." | groups | groups := PluggableDictionary integerDictionary. self do: [ :each | (groups at: (aBlock value: each) ifAbsentPut: [ OrderedCollection new ]) add: each ]. self species ~~ OrderedCollection ifTrue: [ groups associationsDo: [ :association | association value: (self species withAll: association value) ]]. ^ groups ! ! !Collection methodsFor: 'enumerating' stamp: 'ST 6/19/2013 18:29'! flattenOn: aStream self do: [ :each | (each isCollection and: [each isString not]) ifTrue: [each flattenOn: aStream] ifFalse: [aStream nextPut: each]].! ! !Collection methodsFor: 'enumerating'! do: aBlock "Evaluate aBlock with each of the receiver's elements as the argument." self subclassResponsibility! ! !Collection methodsFor: 'enumerating' stamp: 'GabrielOmarCotelli 11/26/2013 16:53'! detect: aBlock ifFound: foundBlock "Evaluate aBlock with each of the receiver's elements as the argument. If some element evaluates aBlock to true, then cull this element into foundBlock. If no element matches the criteria then do nothing. Always returns self to avoid misuse and a potential isNil check on the sender." self detect: aBlock ifFound: foundBlock ifNone: [ "Do nothing on purpose" ]! ! !Collection methodsFor: 'enumerating' stamp: 'StephaneDucasse 2/4/2010 15:34'! do: aBlock displayingProgress: aStringOrBlock "Enumerate aBlock displaying progress information. If the argument is a string, use a static label for the process. If the argument is a block, evaluate it with the element to retrieve the label. Smalltalk allClasses do:[:aClass| (Delay forMilliseconds: 1) wait] displayingProgress: 'Processing...'. Smalltalk allClasses do:[:aClass| (Delay forMilliseconds: 1) wait] displayingProgress:[:aClass| 'Processing ', aClass name]. " ^self do: aBlock displayingProgress: aStringOrBlock every: 20! ! !Collection methodsFor: 'enumerating' stamp: 'sma 5/12/2000 11:45'! collect: aBlock "Evaluate aBlock with each of the receiver's elements as the argument. Collect the resulting values into a collection like the receiver. Answer the new collection." | newCollection | newCollection := self species new. self do: [:each | newCollection add: (aBlock value: each)]. ^ newCollection! ! !Collection methodsFor: 'enumerating' stamp: 'nice 1/5/2010 15:59'! detectMax: aBlock "Evaluate aBlock with each of the receiver's elements as the argument. Answer the element for which aBlock evaluates to the highest magnitude. If collection empty, return nil. This method might also be called elect:." | maxElement maxValue | self do: [:each | | val | maxValue == nil ifFalse: [ (val := aBlock value: each) > maxValue ifTrue: [ maxElement := each. maxValue := val]] ifTrue: ["first element" maxElement := each. maxValue := aBlock value: each]. "Note that there is no way to get the first element that works for all kinds of Collections. Must test every one."]. ^ maxElement! ! !Collection methodsFor: 'enumerating' stamp: 'sma 5/12/2000 11:51'! collect: collectBlock thenSelect: selectBlock "Utility method to improve readability." ^ (self collect: collectBlock) select: selectBlock! ! !Collection methodsFor: 'enumerating' stamp: 'CamilloBruni 9/7/2011 19:23'! & aCollection ^ self intersection: aCollection! ! !Collection methodsFor: 'enumerating' stamp: 'CamilloBruni 3/22/2013 22:18'! collect: collectBlock thenDo: doBlock "Utility method to improve readability." ^ self do: [ :each| doBlock value: (collectBlock value: each)]! ! !Collection methodsFor: 'enumerating' stamp: 'gh 9/18/2001 15:59'! noneSatisfy: aBlock "Evaluate aBlock with the elements of the receiver. If aBlock returns false for all elements return true. Otherwise return false" self do: [:item | (aBlock value: item) ifTrue: [^ false]]. ^ true! ! !Collection methodsFor: 'enumerating' stamp: 'sma 5/12/2000 11:59'! select: selectBlock thenCollect: collectBlock "Utility method to improve readability." ^ (self select: selectBlock) collect: collectBlock! ! !Collection methodsFor: 'enumerating' stamp: 'ul 11/21/2009 01:16'! collect: aBlock as: aClass "Evaluate aBlock with each of the receiver's elements as the argument. Collect the resulting values into an instance of aClass. Answer the resulting collection." ^(aClass new: self size) fillFrom: self with: aBlock! ! !Collection methodsFor: 'enumerating' stamp: 'sma 5/12/2000 11:20'! detect: aBlock "Evaluate aBlock with each of the receiver's elements as the argument. Answer the first element for which aBlock evaluates to true." ^ self detect: aBlock ifNone: [self errorNotFound: aBlock]! ! !Collection methodsFor: 'enumerating' stamp: 'GabrielOmarCotelli 11/26/2013 16:53'! detect: aBlock ifFound: foundBlock ifNone: exceptionBlock "Evaluate aBlock with each of the receiver's elements as the argument. If some element evaluates aBlock to true, then cull this element into foundBlock and answer the result of this evaluation. If none evaluate to true, then evaluate exceptionBlock." self do: [ :each | (aBlock value: each) ifTrue: [ ^ foundBlock cull: each ] ]. ^ exceptionBlock value ! ! !Collection methodsFor: 'enumerating' stamp: 'StephaneDucasse 2/1/2011 07:34'! fold: binaryBlock "Evaluate the block with the first two elements of the receiver, then with the result of the first evaluation and the next element, and so on. Answer the result of the final evaluation. If the receiver is empty, raise an error. If the receiver has a single element, answer that element." "#('if' 'it' 'is' 'to' 'be' 'it' 'is' 'up' 'to' 'me') fold: [:a :b | a, ' ', b]" ^self reduce: binaryBlock! ! !Collection methodsFor: 'enumerating' stamp: 'sma 5/12/2000 11:52'! count: aBlock "Evaluate aBlock with each of the receiver's elements as the argument. Answer the number of elements that answered true." | sum | sum := 0. self do: [:each | (aBlock value: each) ifTrue: [sum := sum + 1]]. ^ sum! ! !Collection methodsFor: 'enumerating' stamp: 'sma 5/12/2000 11:59'! do: aBlock without: anItem "Enumerate all elements in the receiver. Execute aBlock for those elements that are not equal to the given item" ^ self do: [:each | anItem = each ifFalse: [aBlock value: each]]! ! !Collection methodsFor: 'enumerating' stamp: 'CamilloBruni 9/7/2011 19:24'! | aCollection ^ self union: aCollection! ! !Collection methodsFor: 'enumerating' stamp: 'StephaneDucasse 5/20/2012 18:50'! piecesCutWhere: binaryBlock do: pieceBlock "Evaluate pieceBlock with substrings of the receiver derived from cutting the receiver at points where binaryBlock answers true for adjacent elements." | size lastCut this next | (size := self size) <= 1 ifTrue: [size = 1 ifTrue: [pieceBlock value: self]. ^self]. lastCut := 1. this := self at: 1. 2 to: size do: [:i| next := self at: i. (binaryBlock value: this value: next) ifTrue: [pieceBlock value: (self copyFrom: lastCut to: i - 1). lastCut := i]. this := next]. pieceBlock value: (self copyFrom: lastCut to: size)! ! !Collection methodsFor: 'enumerating' stamp: 'TudorGirba 3/20/2012 09:06'! union: aCollection "Answer the set theoretic union of two collections." | set | set := self asSet addAll: aCollection; yourself. ^ self species withAll: set asArray! ! !Collection methodsFor: 'enumerating' stamp: 'TudorGirba 11/3/2013 12:12'! flatCollectAsSet: aBlock "Evaluate aBlock for each of the receiver's elements and answer the list of all resulting values flatten one level. Assumes that aBlock returns some kind of collection for each element. Equivalent to the lisp's mapcan" ^ self flatCollect: aBlock as: Set! ! !Collection methodsFor: 'enumerating' stamp: 'CamilloBruni 3/22/2013 22:20'! piecesCutWhere: binaryBlock "Answer substrings of the receiver derived from cutting the receiver at points where binaryBlock answers true for adjacent elements." | pieces | pieces := OrderedCollection new. self piecesCutWhere: binaryBlock do: [ :piece | pieces add: piece ]. ^pieces "'Now is the time for all good people to come to the aid of the cause of world peace. It is just fine, even desirable, to love your country, if that means wanting it to play a beneficial role in the course of world events and be the best possible example of a good society. But if it means wanting dominion over the rest of the world, it is not love but defensiveness or self-glorification, and will lead only to oblivion.' piecesCutWhere: [:a :b| a = $. and: [b isSeparator]]"! ! !Collection methodsFor: 'enumerating' stamp: 'hfm 2/12/2009 13:38'! select: selectBlock thenDo: doBlock "Utility method to improve readability. Do not create the intermediate collection." self do: [: each | ( selectBlock value: each ) ifTrue: [ doBlock value: each ] ].! ! !Collection methodsFor: 'enumerating' stamp: 'ul 11/21/2009 01:16'! collect: aBlock into: aCollection "Evaluate aBlock with each of the receiver's elements as the argument. Collect the resulting values into aCollection. Answer aCollection." ^aCollection fillFrom: self with: aBlock! ! !Collection methodsFor: 'enumerating' stamp: 'CamilloBruni 10/20/2012 21:50'! select: aBlock "Evaluate aBlock with each of the receiver's elements as the argument. Collect into a new collection like the receiver, only those elements for which aBlock evaluates to true. Answer the new collection." | newCollection | newCollection := self copyEmpty. self do: [ :each | (aBlock value: each) ifTrue: [ newCollection add: each ]]. ^newCollection! ! !Collection methodsFor: 'enumerating'! inject: thisValue into: binaryBlock "Accumulate a running value associated with evaluating the argument, binaryBlock, with the current value of the argument, thisValue, and the receiver as block arguments. For instance, to sum the numeric elements of a collection, aCollection inject: 0 into: [:subTotal :next | subTotal + next]." | nextValue | nextValue := thisValue. self do: [:each | nextValue := binaryBlock value: nextValue value: each]. ^nextValue! ! !Collection methodsFor: 'enumerating' stamp: 'StephaneDucasse 3/14/2014 20:54'! difference: aCollection "Answer the set theoretic difference of two collections." "#(a b c d e f) difference: #(a b z k) => #(#f #d #e #c) #(a b z k) difference: #(a b c d e f) => #(#k #z) " | set | set := self asSet. aCollection do: [ :each | set remove: each ifAbsent: [ ] ]. ^ self species withAll: set asArray! ! !Collection methodsFor: '*metacello-mc' stamp: 'dkh 6/8/2012 14:04:22'! mergeIntoMetacelloRepositories: aMetacelloRepositoriesSpec self do: [:each | each mergeIntoMetacelloRepositories: aMetacelloRepositoriesSpec ] ! ! !Collection methodsFor: '*metacello-mc' stamp: 'dkh 6/8/2012 14:04:22'! removeFromMetacelloRepositories: aMetacelloRepositoriesSpec self do: [:each | each removeFromMetacelloRepositories: aMetacelloRepositoriesSpec ] ! ! !Collection methodsFor: '*metacello-mc' stamp: 'dkh 6/8/2012 14:04:22'! loadRequiredForMetacelloMCVersion: aMetacelloMCVersion ^aMetacelloMCVersion doLoadRequiredFromArray: self.! ! !Collection methodsFor: '*metacello-mc' stamp: 'dkh 6/8/2012 14:04:22'! resolvePackageSpecsNamedForMetacelloMCVersion: aMetacelloMCVersion visited: visited ifAbsent: aBlock ^ aMetacelloMCVersion allPackagesForSpecs: (self collect: [ :ea | aMetacelloMCVersion packageNamed: ea ifAbsent: aBlock ]) visited: visited! ! !Collection methodsFor: '*metacello-mc' stamp: 'dkh 6/8/2012 14:04:22'! recordRequiredForMetacelloMCVersion: aMetacelloMCVersion ^aMetacelloMCVersion doRecordRequiredFromArray: self.! ! !Collection methodsFor: '*metacello-mc' stamp: 'dkh 6/8/2012 14:04:22'! fetchRequiredForMetacelloMCVersion: aMetacelloMCVersion ^aMetacelloMCVersion doFetchRequiredFromArray: self.! ! !Collection methodsFor: '*metacello-mc' stamp: 'dkh 6/8/2012 14:04:22'! addToMetacelloRepositories: aMetacelloRepositoriesSpec self do: [:each | each addToMetacelloRepositories: aMetacelloRepositoriesSpec ] ! ! !Collection methodsFor: 'adding' stamp: 'sma 5/12/2000 17:23'! addIfNotPresent: anObject "Include anObject as one of the receiver's elements, but only if there is no such element already. Anwser anObject." (self includes: anObject) ifFalse: [self add: anObject]. ^ anObject! ! !Collection methodsFor: 'adding' stamp: 'sma 5/12/2000 17:21'! add: newObject withOccurrences: anInteger "Add newObject anInteger times to the receiver. Answer newObject." anInteger timesRepeat: [self add: newObject]. ^ newObject! ! !Collection methodsFor: 'adding'! add: newObject "Include newObject as one of the receiver's elements. Answer newObject. ArrayedCollections cannot respond to this message." self subclassResponsibility! ! !Collection methodsFor: 'adding' stamp: 'sma 5/12/2000 17:26'! addAll: aCollection "Include all the elements of aCollection as the receiver's elements. Answer aCollection. Actually, any object responding to #do: can be used as argument." aCollection do: [:each | self add: each]. ^ aCollection! ! !Collection methodsFor: 'adapting' stamp: 'di 11/6/1998 13:37'! adaptToString: rcvr andSend: selector "If I am involved in arithmetic with a String, convert it to a Number." ^ rcvr asNumber perform: selector with: self! ! !Collection methodsFor: 'adapting' stamp: 'di 11/6/1998 13:37'! adaptToPoint: rcvr andSend: selector "If I am involved in arithmetic with a scalar, return a Collection of the results of each element combined with the scalar in that expression." ^ self collect: [:element | rcvr perform: selector with: element]! ! !Collection methodsFor: 'adapting' stamp: 'di 11/9/1998 12:16'! adaptToNumber: rcvr andSend: selector "If I am involved in arithmetic with a scalar, return a Collection of the results of each element combined with the scalar in that expression." ^ self collect: [:element | rcvr perform: selector with: element]! ! !Collection methodsFor: 'adapting' stamp: 'ClementBera 9/30/2013 10:59'! adaptToCollection: rcvr andSend: selector "If I am involved in arithmetic with another Collection, return a Collection of the results of each element combined with the scalar in that expression." (rcvr isSequenceable and: [ self isSequenceable ]) ifFalse: [self error: 'Only sequenceable collections may be combined arithmetically']. ^ rcvr with: self collect: [:rcvrElement :myElement | rcvrElement perform: selector with: myElement]! ! !Collection methodsFor: 'printing' stamp: 'gk 1/14/2005 08:27'! asStringOn: aStream delimiter: delimString "Print elements on a stream separated with a delimiter String like: 'a, b, c' Uses #asString instead of #print:." self do: [:elem | aStream nextPutAll: elem asString] separatedBy: [aStream nextPutAll: delimString]! ! !Collection methodsFor: 'printing' stamp: 'gk 1/14/2005 08:20'! asCommaStringAnd "Return collection printed as 'a, b and c' " ^String streamContents: [:s | self asStringOn: s delimiter: ', ' last: ' and '] ! ! !Collection methodsFor: 'printing' stamp: 'gk 1/14/2005 08:27'! asStringOn: aStream delimiter: delimString last: lastDelimString "Print elements on a stream separated with a delimiter between all the elements and with a special one before the last like: 'a, b and c'. Uses #asString instead of #print: Note: Feel free to improve the code to detect the last element." | n sz | n := 1. sz := self size. self do: [:elem | n := n + 1. aStream nextPutAll: elem asString] separatedBy: [ aStream nextPutAll: (n = sz ifTrue: [lastDelimString] ifFalse: [delimString])]! ! !Collection methodsFor: 'printing' stamp: 'sma 6/1/2000 09:41'! printNameOn: aStream super printOn: aStream! ! !Collection methodsFor: 'printing' stamp: 'fbs 1/14/2005 10:54'! printOn: aStream delimiter: delimString last: lastDelimString "Print elements on a stream separated with a delimiter between all the elements and with a special one before the last like: 'a, b and c' Note: Feel free to improve the code to detect the last element." | n sz | n := 1. sz := self size. self do: [:elem | n := n + 1. aStream print: elem] separatedBy: [ n = sz ifTrue: [aStream print: lastDelimString] ifFalse: [aStream print: delimString]]! ! !Collection methodsFor: 'printing'! storeOn: aStream "Refer to the comment in Object|storeOn:." | noneYet | aStream nextPutAll: '(('. aStream nextPutAll: self class name. aStream nextPutAll: ' new)'. noneYet := true. self do: [:each | noneYet ifTrue: [noneYet := false] ifFalse: [aStream nextPut: $;]. aStream nextPutAll: ' add: '. aStream store: each]. noneYet ifFalse: [aStream nextPutAll: '; yourself']. aStream nextPut: $)! ! !Collection methodsFor: 'printing' stamp: 'apb 4/21/2006 09:37'! printElementsOn: aStream "The original code used #skip:, but some streams do not support that, and we don't really need it." aStream nextPut: $(. self do: [:element | aStream print: element] separatedBy: [aStream space]. aStream nextPut: $)! ! !Collection methodsFor: 'printing' stamp: 'gk 1/14/2005 08:19'! asCommaString "Return collection printed as 'a, b, c' " ^String streamContents: [:s | self asStringOn: s delimiter: ', '] ! ! !Collection methodsFor: 'printing' stamp: 'gk 1/14/2005 08:01'! printOn: aStream delimiter: delimString "Print elements on a stream separated with a delimiter String like: 'a, b, c' " self do: [:elem | aStream print: elem] separatedBy: [aStream print: delimString] ! ! !Collection methodsFor: 'printing' stamp: 'sma 6/1/2000 09:41'! printOn: aStream "Append a sequence of characters that identify the receiver to aStream." self printNameOn: aStream. self printElementsOn: aStream! ! !Collection methodsFor: '*zinc-resource-meta-core' stamp: 'SvenVanCaekenberghe 3/16/2013 20:24'! addedToZnUrl: url ^ url withPathSegments: self! ! !Collection methodsFor: 'accessing' stamp: 'nice 4/19/2011 00:26'! atRandom: aGenerator "Answer a random element of the receiver. Uses aGenerator which     should be kept by the user in a variable and used every time. Use     this instead of #atRandom for better uniformity of random numbers because only you use the generator. Causes an error if self has no elements." | rand index | self emptyCheck. rand := aGenerator nextInt: self size. index := 1. self do: [:each | index = rand ifTrue: [^each]. index := index + 1]. ^ self errorEmptyCollection ! ! !Collection methodsFor: 'accessing' stamp: 'sma 5/12/2000 11:34'! size "Answer how many elements the receiver contains." | tally | tally := 0. self do: [:each | tally := tally + 1]. ^ tally! ! !Collection methodsFor: 'accessing' stamp: 'sd 11/4/2003 22:05'! atRandom "Answer a random element of the receiver. Uses a shared random number generator owned by class Collection. If you use this a lot, define your own instance of Random and use #atRandom:. Causes an error if self has no elements." ^ self class mutexForPicking critical: [ self atRandom: self class randomForPicking ] "Examples: #('one' 'or' 'the' 'other') atRandom (1 to: 10) atRandom 'Just pick one of these letters at random' atRandom #(3 7 4 9 21) asSet atRandom (just to show it also works for Sets) "! ! !Collection methodsFor: 'accessing' stamp: 'sma 5/12/2000 11:41'! capacity "Answer the current capacity of the receiver." ^ self size! ! !Collection methodsFor: 'accessing' stamp: 'sma 5/12/2000 11:33'! anyOne "Answer a representative sample of the receiver. This method can be helpful when needing to preinfer the nature of the contents of semi-homogeneous collections." self emptyCheck. self do: [:each | ^ each]! ! !Collection methodsFor: '*Fuel' stamp: 'MartinDias 5/19/2011 23:41'! addIfNotPresent: anObject ifPresentDo: aBlock "Include anObject as one of the receiver's elements and then value aBlock, but only if there is no such element already. Anwser anObject." (self includes: anObject) ifFalse: [ self add: anObject ] ifTrue: [ aBlock value ]. ^ anObject! ! !Collection methodsFor: '*Keymapping-KeyCombinations' stamp: 'GuillermoPolito 6/28/2013 13:02'! asShortcut ^ self asKeyCombination! ! !Collection methodsFor: '*Keymapping-KeyCombinations' stamp: 'GuillermoPolito 3/19/2013 19:12'! asKeyCombination | shortcut | self size = 1 ifTrue: [ ^self first asKeyCombination ]. shortcut := KMKeyCombinationSequence new. self do: [ :each | shortcut addShortcut: each asKeyCombination ]. ^shortcut.! ! !Collection methodsFor: 'filter streaming' stamp: 'sma 5/12/2000 12:07'! contents ^ self! ! !Collection methodsFor: 'filter streaming' stamp: 'sma 5/12/2000 12:07'! write: anObject ^ self add: anObject! ! !Collection methodsFor: 'copying' stamp: 'ar 2/11/2001 01:55'! copyWithDependent: newElement "Answer a new collection with newElement added (as last element if sequenceable)." ^self copyWith: newElement! ! !Collection methodsFor: 'copying' stamp: 'sma 5/12/2000 18:08'! copyWithoutAll: aCollection "Answer a copy of the receiver that does not contain any elements equal to those in aCollection." ^ self reject: [:each | aCollection includes: each]! ! !Collection methodsFor: 'copying' stamp: 'CamilloBruni 10/20/2012 21:49'! copyEmpty ^ self species new! ! !Collection methodsFor: 'copying' stamp: 'sma 5/12/2000 14:43'! copyWithout: oldElement "Answer a copy of the receiver that does not contain any elements equal to oldElement." ^ self reject: [:each | each = oldElement] "Examples: 'fred the bear' copyWithout: $e #(2 3 4 5 5 6) copyWithout: 5 "! ! !Collection methodsFor: 'copying' stamp: 'al 12/12/2003 14:31'! , aCollection ^self copy addAll: aCollection; yourself! ! !Collection methodsFor: 'copying' stamp: 'sma 5/12/2000 14:41'! copyWith: newElement "Answer a new collection with newElement added (as last element if sequenceable)." ^ self copy add: newElement; yourself! ! !Collection methodsFor: 'math functions' stamp: 'TAG 11/6/1998 16:00'! median ^ self asSortedCollection median! ! !Collection methodsFor: 'math functions' stamp: 'TudorGirba 11/19/2013 21:37'! sumNumbers: aBlock "This is implemented using a variant of the normal inject:into: pattern that is specific to handling numbers. aBlock is expected to return a number for every element in the collection. Different from the sum: implementation, the default value is zero. While sum: is more general, sumNumbers: is meant to support the most often encountered use case of dealing with numbers." ^ self inject: 0 into: [ :sum :each | sum + (aBlock value: each) ]! ! !Collection methodsFor: 'math functions' stamp: 'MarcusDenker 8/15/2010 11:01'! stdev | avg sample sum | avg := self average. "see comment in self sum" sample := self anyOne. sum := self inject: sample into: [:accum :each | accum + (each - avg) squared]. sum := sum - sample. ^ (sum / (self size - 1)) sqrt! ! !Collection methodsFor: 'math functions' stamp: 'JuanVuletich 10/11/2010 20:15'! sum: aBlock "This is implemented using a variant of the normal inject:into: pattern. The reason for this is that it is not known whether we're in the normal number line, i.e. whether 0 is a good initial value for the sum. Consider a collection of measurement objects, 0 would be the unitless value and would not be appropriate to add with the unit-ed objects." | sum sample | sample := aBlock value: self anyOne. sum := self inject: sample into: [ :previousValue :each | previousValue + (aBlock value: each) ]. ^ sum - sample! ! !Collection methodsFor: '*Tool-Explorer' stamp: 'yo 8/27/2008 23:29'! explorerContentsWithIndexCollect: twoArgBlock ^ self asOrderedCollection withIndexCollect: twoArgBlock ! ! !Collection methodsFor: '*Tool-Explorer' stamp: 'yo 8/27/2008 23:45'! explorerContents ^self explorerContentsWithIndexCollect: [:value :index | ObjectExplorerWrapper with: value name: index printString model: self]! ! !Collection methodsFor: 'removing' stamp: 'nice 9/14/2009 20:30'! removeAll "Remove each element from the receiver and leave it empty. ArrayedCollections cannot respond to this message. There are two good reasons why a subclass should override this message: 1) the subclass does not support being modified while being iterated 2) the subclass provides a much faster way than iterating through each element" self do: [:each | self remove: each].! ! !Collection methodsFor: 'removing' stamp: 'sma 5/12/2000 11:19'! removeAllSuchThat: aBlock "Evaluate aBlock for each element and remove all that elements from the receiver for that aBlock evaluates to true. Use a copy to enumerate collections whose order changes when an element is removed (i.e. Sets)." self copy do: [:each | (aBlock value: each) ifTrue: [self remove: each]]! ! !Collection methodsFor: 'removing' stamp: 'nice 1/10/2009 00:01'! removeAll: aCollection "Remove each element of aCollection from the receiver. If successful for each, answer aCollection. Otherwise create an error notification. ArrayedCollections cannot respond to this message." aCollection == self ifTrue: [^self removeAll]. aCollection do: [:each | self remove: each]. ^ aCollection! ! !Collection methodsFor: 'removing' stamp: 'sma 5/12/2000 11:22'! remove: oldObject "Remove oldObject from the receiver's elements. Answer oldObject unless no element is equal to oldObject, in which case, raise an error. ArrayedCollections cannot respond to this message." ^ self remove: oldObject ifAbsent: [self errorNotFound: oldObject]! ! !Collection methodsFor: 'removing' stamp: 'sma 5/12/2000 11:14'! remove: oldObject ifAbsent: anExceptionBlock "Remove oldObject from the receiver's elements. If several of the elements are equal to oldObject, only one is removed. If no element is equal to oldObject, answer the result of evaluating anExceptionBlock. Otherwise, answer the argument, oldObject. ArrayedCollections cannot respond to this message." self subclassResponsibility! ! !Collection methodsFor: 'removing' stamp: 'sma 5/12/2000 11:16'! removeAllFoundIn: aCollection "Remove each element of aCollection which is present in the receiver from the receiver. Answer aCollection. No error is raised if an element isn't found. ArrayedCollections cannot respond to this message." aCollection do: [:each | self remove: each ifAbsent: []]. ^ aCollection! ! !Collection methodsFor: 'private' stamp: 'ul 11/21/2009 01:14'! fillFrom: aCollection with: aBlock "Evaluate aBlock with each of aCollections's elements as the argument. Collect the resulting values into self. Answer self." aCollection do: [ :each | self add: (aBlock value: each) ]! ! !Collection methodsFor: 'private' stamp: 'SvenVanCaekenberghe 4/18/2011 14:37'! errorNotFound: anObject "Raise a NotFound exception." NotFound signalFor: anObject! ! !Collection methodsFor: 'private' stamp: 'SvenVanCaekenberghe 4/18/2011 14:58'! errorNoMatch "Signal a SizeMismatch exception" SizeMismatch signal! ! !Collection methodsFor: 'private'! toBraceStack: itsSize "Push receiver's elements onto the stack of thisContext sender. Error if receiver does not have itsSize elements or if receiver is unordered. Do not call directly: this is called by {a. b} := ... constructs." self size ~= itsSize ifTrue: [self error: 'Trying to store ', self size printString, ' values into ', itsSize printString, ' variables.']. thisContext sender push: itsSize fromIndexable: self! ! !Collection methodsFor: 'private' stamp: 'SvenVanCaekenberghe 4/18/2011 14:59'! errorEmptyCollection "Signal a CollectionIsEmpty exception" CollectionIsEmpty signalWith: self! ! !Collection methodsFor: 'private' stamp: 'yo 6/29/2004 13:14'! errorNotKeyed self error: ('Instances of {1} do not respond to keyed accessing messages.' translated format: {self class name}) ! ! !Collection methodsFor: 'private'! emptyCheck self isEmpty ifTrue: [self errorEmptyCollection]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'raok 10/22/2002 00:20'! arcTan ^self collect: [:each | each arcTan]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'raok 10/22/2002 00:22'! tan ^self collect: [:each | each tan]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'TAG 11/6/1998 15:53'! reciprocal "Return the reciever full of reciprocated elements" ^ self collect: [:a | a reciprocal]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'TAG 11/6/1998 15:51'! ceiling ^ self collect: [:a | a ceiling]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'raok 10/22/2002 00:21'! ln ^self collect: [:each | each ln]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'TAG 11/6/1998 15:54'! truncated ^ self collect: [:a | a truncated]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'raok 10/22/2002 00:20'! arcCos ^self collect: [:each | each arcCos]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'raok 10/22/2002 00:20'! cos ^self collect: [:each | each cos]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'raok 10/22/2002 00:22'! sin ^self collect: [:each | each sin]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'raok 10/22/2002 00:21'! exp ^self collect: [:each | each exp]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'TAG 11/6/1998 15:53'! rounded ^ self collect: [:a | a rounded]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'TAG 11/6/1998 15:52'! log ^ self collect: [:each | each log]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'TAG 11/6/1998 15:53'! sqrt ^ self collect: [:each | each sqrt]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'TAG 11/6/1998 15:51'! abs "Absolute value of all elements in the collection" ^ self collect: [:a | a abs]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'raok 10/22/2002 00:20'! arcSin ^self collect: [:each | each arcSin]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'nk 12/30/2003 15:47'! roundTo: quantum ^self collect: [ :ea | ea roundTo: quantum ]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'TAG 11/6/1998 15:52'! negated "Negated value of all elements in the collection" ^ self collect: [:a | a negated]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'TAG 11/6/1998 15:53'! squared ^ self collect: [:each | each * each]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'raok 10/22/2002 00:23'! sign ^self collect: [:each | each sign]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'raok 10/22/2002 00:20'! degreeCos ^self collect: [:each | each degreeCos]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'TAG 11/6/1998 15:51'! floor ^ self collect: [:a | a floor]! ! !Collection methodsFor: '*Collections-arithmetic-collectors' stamp: 'raok 10/22/2002 00:21'! degreeSin ^self collect: [:each | each degreeSin]! ! !Collection methodsFor: '*metacello-core' stamp: 'dkh 6/6/2009 11:42'! removeFromMetacelloPackages: aMetacelloPackagesSpec self do: [:each | each removeFromMetacelloPackages: aMetacelloPackagesSpec ] ! ! !Collection methodsFor: '*metacello-core' stamp: 'dkh 9/8/2012 05:30'! asMetacelloAttributePath ^ MetacelloMethodSectionPath withAll: self! ! !Collection methodsFor: '*metacello-core' stamp: 'dkh 6/6/2009 10:08'! setRequiresInMetacelloPackage: aMetacelloPackageSpec aMetacelloPackageSpec setRequires: self asArray.! ! !Collection methodsFor: '*metacello-core' stamp: 'dkh 9/7/2012 13:10'! asMetacelloAttributeList ^ self! ! !Collection methodsFor: '*metacello-core' stamp: 'dkh 9/5/2012 06:26:03.064'! setForVersion: aString withInMetacelloConfig: aMetacelloConstructore aMetacelloConstructore setFor: self version: aString! ! !Collection methodsFor: '*metacello-core' stamp: 'dkh 6/6/2009 11:45'! addToMetacelloPackages: aMetacelloPackagesSpec self do: [:each | each addToMetacelloPackages: aMetacelloPackagesSpec ] ! ! !Collection methodsFor: '*metacello-core' stamp: 'dkh 6/8/2009 19:02'! setLoadsInMetacelloProject: aMetacelloPackageSpec aMetacelloPackageSpec setLoads: self asArray.! ! !Collection methodsFor: '*metacello-core' stamp: 'dkh 6/6/2009 11:46'! mergeIntoMetacelloPackages: aMetacelloPackagesSpec self do: [:each | each mergeIntoMetacelloPackages: aMetacelloPackagesSpec ] ! ! !Collection methodsFor: '*metacello-core' stamp: 'dkh 9/5/2012 06:26:03.064'! setForDo: aBlock withInMetacelloConfig: aMetacelloConstructore aMetacelloConstructore setFor: self do: aBlock! ! !Collection methodsFor: '*metacello-core' stamp: 'dkh 9/23/2009 08:46'! setIncludesInMetacelloPackage: aMetacelloPackageSpec aMetacelloPackageSpec setIncludes: self asArray.! ! !Collection methodsFor: '*Collections-arithmetic' stamp: 'TAG 11/6/1998 15:57'! average ^ self sum / self size! ! !Collection methodsFor: '*Collections-arithmetic' stamp: 'di 11/6/1998 13:53'! / arg ^ arg adaptToCollection: self andSend: #/! ! !Collection methodsFor: '*Collections-arithmetic' stamp: 'raok 10/22/2002 00:17'! raisedTo: arg ^ arg adaptToCollection: self andSend: #raisedTo:! ! !Collection methodsFor: '*Collections-arithmetic' stamp: 'di 11/6/1998 13:54'! \\ arg ^ arg adaptToCollection: self andSend: #\\! ! !Collection methodsFor: '*Collections-arithmetic' stamp: 'di 11/6/1998 13:53'! - arg ^ arg adaptToCollection: self andSend: #-! ! !Collection methodsFor: '*Collections-arithmetic' stamp: 'di 11/6/1998 13:53'! + arg ^ arg adaptToCollection: self andSend: #+! ! !Collection methodsFor: '*Collections-arithmetic' stamp: 'G.C 10/23/2008 10:12'! * arg ^ arg adaptToCollection: self andSend: #*! ! !Collection methodsFor: '*Collections-arithmetic' stamp: 'di 11/6/1998 13:54'! // arg ^ arg adaptToCollection: self andSend: #//! ! !Collection methodsFor: '*Collections-arithmetic' stamp: 'TAG 11/6/1998 15:58'! max ^ self inject: self anyOne into: [:max :each | max max: each]! ! !Collection methodsFor: '*Collections-arithmetic' stamp: 'TAG 11/6/1998 16:02'! sum "This is implemented using a variant of the normal inject:into: pattern. The reason for this is that it is not known whether we're in the normal number line, i.e. whether 0 is a good initial value for the sum. Consider a collection of measurement objects, 0 would be the unitless value and would not be appropriate to add with the unit-ed objects." | sum sample | sample := self anyOne. sum := self inject: sample into: [:accum :each | accum + each]. ^ sum - sample! ! !Collection methodsFor: '*Collections-arithmetic' stamp: 'TAG 11/6/1998 16:00'! min ^ self inject: self anyOne into: [:min :each | min min: each]! ! !Collection methodsFor: '*Collections-arithmetic' stamp: 'TAG 11/6/1998 16:00'! range ^ self max - self min! ! !Collection methodsFor: 'sorting' stamp: 'LucFabresse 6/28/2013 12:58'! sorted "Return a new sequenceable collection which contains the same elements as self but its elements are sorted" ^self asArray sorted! ! !Collection methodsFor: 'sorting' stamp: 'StephaneDucasse 3/28/2010 22:42'! sorted: aSortBlockOrNil "Return a new sequenceable collection which contains the same elements as self but its elements are sorted by aSortBlockOrNil. The block should take two arguments and return true if the first element should preceed the second one. If aSortBlock is nil then <= is used for comparison." ^self asArray sort: aSortBlockOrNil! ! !Collection methodsFor: 'converting' stamp: 'sma 5/6/2000 20:22'! asArray "Answer an Array whose elements are the elements of the receiver. Implementation note: Cannot use ''Array withAll: self'' as that only works for SequenceableCollections which support the replacement primitive." | array index | array := Array new: self size. index := 0. self do: [:each | array at: (index := index + 1) put: each]. ^ array! ! !Collection methodsFor: 'converting' stamp: 'StephaneDucasse 3/28/2010 22:39'! asSortedCollection "Answer a SortedCollection whose elements are the elements of the receiver. The sort order is the default less than or equal. Note that you should use #sorted: if you don't really need a SortedCollection, but a sorted collection." ^ self as: SortedCollection! ! !Collection methodsFor: 'converting' stamp: 'sma 5/6/2000 20:29'! asSet "Answer a Set whose elements are the unique elements of the receiver." ^ Set withAll: self! ! !Collection methodsFor: 'converting' stamp: 'sma 5/6/2000 20:26'! asCharacterSet "Answer a CharacterSet whose elements are the unique elements of the receiver. The reciever should only contain characters." ^ CharacterSet newFrom: self! ! !Collection methodsFor: 'converting' stamp: 'StephaneDucasse 3/28/2010 22:41'! asSortedCollection: aSortBlock "Answer a SortedCollection whose elements are the elements of the receiver. The sort order is defined by the argument, aSortBlock. Note that this is better to use #sorted: if you don't really need a SortedCollection, but a sorted collection!!!!" | aSortedCollection | aSortedCollection := SortedCollection new: self size. aSortedCollection sortBlock: aSortBlock. aSortedCollection addAll: self. ^ aSortedCollection! ! !Collection methodsFor: 'converting' stamp: 'sma 5/12/2000 17:43'! asOrderedCollection "Answer an OrderedCollection whose elements are the elements of the receiver. The order in which elements are added depends on the order in which the receiver enumerates its elements. In the case of unordered collections, the ordering is not necessarily the same for multiple requests for the conversion." ^ self as: OrderedCollection! ! !Collection methodsFor: 'converting' stamp: 'sma 5/6/2000 20:22'! asByteArray "Answer a ByteArray whose elements are the elements of the receiver. Implementation note: Cannot use ''ByteArray withAll: self'' as that only works for SequenceableCollections which support the replacement primitive." | array index | array := ByteArray new: self size. index := 0. self do: [:each | array at: (index := index + 1) put: each]. ^ array! ! !Collection methodsFor: 'converting' stamp: 'MarcusDenker 11/28/2009 11:40'! asDictionary ^ self as: Dictionary! ! !Collection methodsFor: 'converting' stamp: 'ar 9/22/2000 10:12'! asIdentitySet ^(IdentitySet new: self size) addAll: self; yourself! ! !Collection methodsFor: 'converting' stamp: 'sma 5/6/2000 20:10'! asBag "Answer a Bag whose elements are the elements of the receiver." ^ Bag withAll: self! ! !Dictionary methodsFor: '*Fuel' stamp: 'MartinDias 2/25/2013 14:33'! fuelAfterMaterialization | class | "Since for Set and IdentitySet we are recreating the collection with #add: we do not need to rehash." class := self class. ^ (((class == Dictionary) or: [ class == IdentityDictionary ]) ) ifFalse: [ self rehash ] ifTrue: [ self ]! ! !Dictionary methodsFor: '*Fuel' stamp: 'MarianoMartinezPeck 7/30/2012 23:16'! fuelAccept: aGeneralMapper | class | "Since we have subclasses of Dictionary that behave differently, we cannot use the visitDictionary: for all of them. We could also use MethodDictionary for this case, but its materialization is much slower with this cluster than with the default action." class := self class. ^ (((class == Dictionary) or: [class == IdentityDictionary ])) ifTrue: [ aGeneralMapper visitDictionary: self ] ifFalse: [ super fuelAccept: aGeneralMapper ] ! ! !Dictionary methodsFor: 'adding'! add: anAssociation | index element | index := self findElementOrNil: anAssociation key. element := array at: index. element == nil ifTrue: [self atNewIndex: index put: anAssociation] ifFalse: [element value: anAssociation value]. ^ anAssociation! ! !Dictionary methodsFor: 'adding' stamp: 'raok 12/17/2003 16:01'! addAll: aKeyedCollection aKeyedCollection == self ifFalse: [ aKeyedCollection keysAndValuesDo: [:key :value | self at: key put: value]]. ^aKeyedCollection! ! !Dictionary methodsFor: 'private' stamp: 'nice 11/14/2009 16:33'! fixCollisionsFrom: start "The element at start has been removed and replaced by nil. This method moves forward from there, relocating any entries that had been placed below due to collisions with this one." | element index | index := start. [ (element := array at: (index := index \\ array size + 1)) == nil ] whileFalse: [ | newIndex | (newIndex := self findElementOrNil: element key) = index ifFalse: [ array swap: index with: newIndex ] ]! ! !Dictionary methodsFor: 'private' stamp: 'CamilloBruni 8/1/2012 16:12'! noCheckAdd: anObject "Must be defined separately for Dictionary because (self findElementOrNil:) expects a key, not an association." array at: (self findElementOrNil: anObject key) put: anObject. tally := tally + 1! ! !Dictionary methodsFor: 'private' stamp: 'SvenVanCaekenberghe 4/19/2011 19:41'! errorKeyNotFound: aKey KeyNotFound signalFor: aKey! ! !Dictionary methodsFor: 'private' stamp: 'md 10/5/2005 15:42'! scanFor: anObject "Scan the key array for the first slot containing either a nil (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or zero if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements." | element start finish | finish := array size. start := (anObject hash \\ finish) + 1. "Search from (hash mod size) to the end." start to: finish do: [:index | ((element := array at: index) == nil or: [element key = anObject]) ifTrue: [^ index ]]. "Search from 1 to where we started." 1 to: start-1 do: [:index | ((element := array at: index) == nil or: [element key = anObject]) ifTrue: [^ index ]]. ^ 0 "No match AND no empty slot"! ! !Dictionary methodsFor: 'private'! valueAtNewKey: aKey put: anObject atIndex: index declareFrom: aDictionary "Support for coordinating class variable and global declarations with variables that have been put in Undeclared so as to redirect all references to the undeclared variable." (aDictionary includesKey: aKey) ifTrue: [self atNewIndex: index put: ((aDictionary associationAt: aKey) value: anObject). aDictionary removeKey: aKey] ifFalse: [self atNewIndex: index put: (Association key: aKey value: anObject)]! ! !Dictionary methodsFor: 'private' stamp: 'ul 11/21/2009 01:15'! fillFrom: aCollection with: aBlock "Evaluate aBlock with each of aCollections's elements as the argument. Collect the resulting values into self. Answer self." aCollection keysAndValuesDo: [ :key :value | self at: key put: (aBlock value: value) ]! ! !Dictionary methodsFor: 'private' stamp: 'SvenVanCaekenberghe 4/19/2011 20:30'! errorValueNotFound: value ValueNotFound signalFor: value! ! !Dictionary methodsFor: 'private'! rehash "Smalltalk rehash." | newSelf | newSelf := self species new: self size. self associationsDo: [:each | newSelf noCheckAdd: each]. array := newSelf array! ! !Dictionary methodsFor: 'private' stamp: 'HenrikSperreJohansen 9/1/2010 23:17'! noCheckNoGrowFillFrom: anArray "Add the elements of anArray except nils to me assuming that I don't contain any of them, they are unique and I have more free space than they require." 1 to: anArray size do: [ :index | (anArray at: index) ifNotNil: [ :association | array at: (self scanForEmptySlotFor: association key) put: association ] ]! ! !Dictionary methodsFor: 'enumerating' stamp: 'nice 10/5/2009 10:16'! select: aBlock "Evaluate aBlock with each of my values as the argument. Collect into a new dictionary, only those associations for which aBlock evaluates to true." | newCollection | newCollection := self copyEmpty. self associationsDo: [ :each | (aBlock value: each value) ifTrue: [ newCollection add: each copy ] ]. ^newCollection! ! !Dictionary methodsFor: 'enumerating' stamp: 'MarianoMartinezPeck 8/24/2012 15:26'! keysAndValuesDo: aBlock ^self associationsDo:[:assoc| aBlock value: assoc key value: assoc value].! ! !Dictionary methodsFor: 'enumerating' stamp: 'dtl 2/17/2003 09:40'! associationsSelect: aBlock "Evaluate aBlock with each of my associations as the argument. Collect into a new dictionary, only those associations for which aBlock evaluates to true." | newCollection | newCollection := self species new. self associationsDo: [:each | (aBlock value: each) ifTrue: [newCollection add: each]]. ^newCollection! ! !Dictionary methodsFor: 'enumerating'! keysDo: aBlock "Evaluate aBlock for each of the receiver's keys." self associationsDo: [:association | aBlock value: association key]! ! !Dictionary methodsFor: 'enumerating' stamp: 'ar 6/13/2008 00:16'! collect: aBlock "Evaluate aBlock with each of my values as the argument. Collect the resulting values into a collection that is like me. Answer with the new collection." | newCollection | newCollection := self species new. self associationsDo:[:each | newCollection at: each key put: (aBlock value: each value). ]. ^newCollection! ! !Dictionary methodsFor: 'enumerating' stamp: 'CamilloBruni 9/9/2011 16:50'! difference: aCollection "Answer the set theoretic difference of two collections. This is a specialized version for Dictionaries keeping the keys of the objects. At a slightly higher price of an additional Set to track duplicates." | other result duplicates | other := aCollection asSet. duplicates := Set new. result := self class new: self size. self keysAndValuesDo: [ :key :value| ((other includes: value) not and: [ (duplicates includes: value) not ]) ifTrue: [ duplicates add: value. result at: key put: value]]. ^ result! ! !Dictionary methodsFor: 'enumerating' stamp: 'TristanBourgois 5/10/2010 10:41'! associationsDo: aBlock "Evaluate aBlock for each of the receiver's elements (key/value associations)." tally = 0 ifTrue: [^ self]. array do: [:each | each ifNotNil: [aBlock value: each]]! ! !Dictionary methodsFor: 'enumerating' stamp: 'MarcusDenker 7/2/2010 13:02'! do: aBlock ^self valuesDo: aBlock! ! !Dictionary methodsFor: 'enumerating' stamp: 'SqR 11/7/2013 12:12'! valuesDo: aBlock "Evaluate aBlock for each of the receiver's values. Implemented with == checks merely for the sake of maximum efficiency" tally = 0 ifTrue: [ ^self ]. 1 to: array size do: [ :eachIndex | | eachAssociation | eachAssociation := array at: eachIndex. nil == eachAssociation ifFalse: [ aBlock value: eachAssociation value ] ]! ! !Dictionary methodsFor: 'enumerating' stamp: 'ar 5/18/2003 20:33'! bindingsDo: aBlock ^self associationsDo: aBlock! ! !Dictionary methodsFor: 'removing'! removeKey: key ifAbsent: aBlock "Remove key (and its associated value) from the receiver. If key is not in the receiver, answer the result of evaluating aBlock. Otherwise, answer the value externally named by key." | index assoc | index := self findElementOrNil: key. assoc := array at: index. assoc == nil ifTrue: [ ^ aBlock value ]. array at: index put: nil. tally := tally - 1. self fixCollisionsFrom: index. ^ assoc value! ! !Dictionary methodsFor: 'removing'! removeUnreferencedKeys "Undeclared removeUnreferencedKeys" ^ self unreferencedKeys do: [:key | self removeKey: key].! ! !Dictionary methodsFor: 'removing' stamp: 'MarcusDenker 10/9/2013 11:29'! unreferencedKeys "| uk | (Time millisecondsToRun: [uk := TextConstants unreferencedKeys]) -> uk" ^'Scanning for references . . .' displayProgressFrom: 0 to: Smalltalk globals classNames size * 2 during: [:bar | | currentClass n associations referencedAssociations | currentClass := nil. n := 0. associations := self associations asIdentitySet. referencedAssociations := IdentitySet new: associations size. self systemNavigation allMethodsSelect: [:m| m methodClass ~~ currentClass ifTrue: [currentClass := m methodClass. bar current: (n := n + 1)]. m literalsDo: [:l| (l isVariableBinding and: [associations includes: l]) ifTrue: [referencedAssociations add: l]]. false]. ((associations reject: [:assoc | referencedAssociations includes: assoc]) collect: [:assoc| assoc key]) asSet]! ! !Dictionary methodsFor: 'removing' stamp: 'di 4/4/2000 11:47'! keysAndValuesRemove: keyValueBlock "Removes all entries for which keyValueBlock returns true." "When removing many items, you must not do it while iterating over the dictionary, since it may be changing. This method takes care of tallying the removals in a first pass, and then performing all the deletions afterward. Many places in the sytem could be simplified by using this method." | removals | removals := OrderedCollection new. self associationsDo: [:assoc | (keyValueBlock value: assoc key value: assoc value) ifTrue: [removals add: assoc key]]. removals do: [:aKey | self removeKey: aKey]! ! !Dictionary methodsFor: 'removing' stamp: 'CamilloBruni 4/11/2011 13:30'! removeKey: key "Remove key from the receiver. If key is not in the receiver, notify an error." ^ self removeKey: key ifAbsent: [self errorKeyNotFound: key]! ! !Dictionary methodsFor: 'removing'! remove: anObject self shouldNotImplement! ! !Dictionary methodsFor: 'removing'! remove: anObject ifAbsent: exceptionBlock self shouldNotImplement! ! !Dictionary methodsFor: 'copying' stamp: 'ul 9/22/2009 04:51'! postCopy "Must copy the associations, or later store will affect both the original and the copy" array := array collect: [ :association | association ifNotNil: [ association copy ] ]! ! !Dictionary methodsFor: 'printing'! storeOn: aStream | noneYet | aStream nextPutAll: '(('. aStream nextPutAll: self class name. aStream nextPutAll: ' new)'. noneYet := true. self associationsDo: [:each | noneYet ifTrue: [noneYet := false] ifFalse: [aStream nextPut: $;]. aStream nextPutAll: ' add: '. aStream store: each]. noneYet ifFalse: [aStream nextPutAll: '; yourself']. aStream nextPut: $)! ! !Dictionary methodsFor: 'printing' stamp: 'apb 7/14/2004 12:48'! printElementsOn: aStream aStream nextPut: $(. self size > 100 ifTrue: [aStream nextPutAll: 'size '. self size printOn: aStream] ifFalse: [self keysSortedSafely do: [:key | aStream print: key; nextPutAll: '->'; print: (self at: key); space]]. aStream nextPut: $)! ! !Dictionary methodsFor: 'comparing' stamp: 'cyrille.delaunay 7/17/2009 15:45'! = aDictionary "Two dictionaries are equal if (a) they are the same 'kind' of thing. (b) they have the same set of keys. (c) for each (common) key, they have the same value" self == aDictionary ifTrue: [ ^ true ]. (aDictionary isDictionary) ifFalse: [^false]. self size = aDictionary size ifFalse: [^false]. self associationsDo: [:assoc| (aDictionary at: assoc key ifAbsent: [^false]) = assoc value ifFalse: [^false]]. ^true ! ! !Dictionary methodsFor: '*monticellofiletree-core' stamp: 'dkh 4/6/2012 15:56:14'! writeCypressJsonForHtmlOn: aStream self writeCypressJsonOn: aStream forHtml: true indent: 0! ! !Dictionary methodsFor: '*monticellofiletree-core' stamp: 'dkh 4/6/2012 15:56:14'! writeCypressJsonOn: aStream self writeCypressJsonOn: aStream forHtml: false indent: 0. aStream lf! ! !Dictionary methodsFor: '*monticellofiletree-core' stamp: 'dkh 4/6/2012 15:56:14'! writeCypressJsonOn: aStream forHtml: forHtml indent: startIndent "by default ignore ... is used for Dictionary and Array, i.e., container objects and String which actually encodes itself differently for HTML" | indent keys | indent := startIndent. aStream nextPutAll: '{'; lf. indent := indent + 1. keys := self keys sort: [ :a :b | a <= b ]. 1 to: keys size do: [ :index | | key value | key := keys at: index. value := self at: key. aStream tab: indent. key writeCypressJsonOn: aStream forHtml: forHtml indent: indent. aStream nextPutAll: ' : '. value writeCypressJsonOn: aStream forHtml: forHtml indent: indent. index < self size ifTrue: [ aStream nextPutAll: ','; lf ] ]. self size = 0 ifTrue: [ aStream tab: indent ]. aStream nextPutAll: ' }'! ! !Dictionary methodsFor: '*Tool-Explorer' stamp: 'yo 8/27/2008 23:16'! customizeExplorerContents ^ true. ! ! !Dictionary methodsFor: '*Tool-Explorer' stamp: 'yo 8/27/2008 23:44'! explorerContentsWithIndexCollect: twoArgBlock | sortedKeys | sortedKeys := self keys asSortedCollection: [:x :y | ((x isString and: [y isString]) or: [x isNumber and: [y isNumber]]) ifTrue: [x < y] ifFalse: [x class == y class ifTrue: [x printString < y printString] ifFalse: [x class name < y class name]]]. ^ sortedKeys collect: [:k | twoArgBlock value: (self at: k) value: k]. ! ! !Dictionary methodsFor: 'kernel'! declare: key from: aDictionary "Add key to the receiver. If key already exists, do nothing. If aDictionary includes key, then remove it from aDictionary and use its association as the element of the receiver." (self includesKey: key) ifTrue: [^ self]. (aDictionary includesKey: key) ifTrue: [self add: (aDictionary associationAt: key). aDictionary removeKey: key] ifFalse: [self add: key -> nil]! ! !Dictionary methodsFor: 'kernel' stamp: 'MarcusDenker 7/29/2014 16:08'! declareVariable: newGlobal from: aDictionary "Add aGlobal to the receiver. If key already exists, do nothing. If aDictionary includes key, then remove it from aDictionary and use its association as the element of the receiver." | globalName | globalName := newGlobal key. self associationAt: globalName ifPresent: [:existingGlobal | "need to take care to migrate existing variables to new global if class if different" (existingGlobal class == newGlobal class) ifTrue: [^self]. newGlobal value: existingGlobal value. self removeKey: globalName. self add: newGlobal. ]. (aDictionary includesKey: globalName) ifTrue: [ self add: ((aDictionary associationAt: globalName) primitiveChangeClassTo: ClassVariable new). aDictionary removeKey: globalName] ifFalse: [ self add: newGlobal]! ! !Dictionary methodsFor: 'testing'! includes: anObject self do: [:each | anObject = each ifTrue: [^true]]. ^false! ! !Dictionary methodsFor: 'testing' stamp: 'SvenVanCaekenberghe 10/26/2013 12:24'! includesKey: key "Answer whether the receiver has a key equal to the argument, key." ^ (array at: (self scanFor: key)) ~~ nil "We could use #notNil here, but ProtoObject doesn't understand it."! ! !Dictionary methodsFor: 'testing' stamp: 'tween 9/13/2004 10:11'! hasBindingThatBeginsWith: aString "Answer true if the receiver has a key that begins with aString, false otherwise" self keysDo:[:each | (each beginsWith: aString) ifTrue:[^true]]. ^false! ! !Dictionary methodsFor: 'testing' stamp: 'sw 3/23/2000 01:12'! keyForIdentity: anObject "If anObject is one of the values of the receive, return its key, else return nil. Contrast #keyAtValue: in which there is only an equality check, here there is an identity check" self associationsDo: [:assoc | assoc value == anObject ifTrue: [^ assoc key]]. ^ nil! ! !Dictionary methodsFor: 'testing' stamp: 'StephaneDucasse 5/28/2011 14:01'! isHealthy "Test that object hashes match their positions stored in set's array, answer true if everything ok, false otherwise Dictionary allInstances select: [:dict | dict isHealthy not ] Dictionary allSubInstances select: [:dict | dict isHealthy not ] " array withIndexDo: [:elem :i | elem ifNotNil: [ (self scanFor: elem key) == i ifFalse: [ ^ false ] ] ]. ^ true! ! !Dictionary methodsFor: 'testing' stamp: 'md 8/11/2005 16:49'! isDictionary ^true! ! !Dictionary methodsFor: 'testing' stamp: 'sw 2/14/2000 14:34'! includesIdentity: anObject "Answer whether anObject is one of the values of the receiver. Contrast #includes: in which there is only an equality check, here there is an identity check" self do: [:each | anObject == each ifTrue: [^ true]]. ^ false! ! !Dictionary methodsFor: 'testing' stamp: 'ab 9/17/2004 00:39'! includesAssociation: anAssociation ^ (self associationAt: anAssociation key ifAbsent: [ ^ false ]) value = anAssociation value ! ! !Dictionary methodsFor: 'accessing' stamp: 'MarcusDenker 8/18/2010 19:17'! at: key ifAbsent: aBlock "Answer the value associated with the key or, if key isn't found, answer the result of evaluating aBlock." ^((array at: (self findElementOrNil: key)) ifNil: [aBlock] ifNotNil: [:assoc | assoc]) value.! ! !Dictionary methodsFor: 'accessing' stamp: 'SvenVanCaekenberghe 4/19/2011 20:31'! keyAtValue: value "Answer the key that is the external name for the argument, value. If there is none, signal an error." ^self keyAtValue: value ifAbsent: [self errorValueNotFound: value]! ! !Dictionary methodsFor: 'accessing' stamp: 'CamilloBruni 4/11/2011 13:30'! at: key "Answer the value associated with the key." ^ self at: key ifAbsent: [self errorKeyNotFound: key]! ! !Dictionary methodsFor: 'accessing' stamp: 'StephaneDucasse 5/13/2010 11:37'! at: key ifPresent: oneArgBlock ifAbsent: absentBlock "Lookup the given key in the receiver. If it is present, answer the value of evaluating the oneArgBlock with the value associated with the key, otherwise answer the value of absentBlock." self at: key ifPresent: [ :v | ^oneArgBlock value: v ]. ^absentBlock value! ! !Dictionary methodsFor: 'accessing' stamp: 'StephaneDucasse 12/25/2009 12:12'! associations "Answer a Collection containing the receiver's associations." "Suggested by l. Uzonyi" ^Array new: self size streamContents: [ :stream | self associationsDo: [ :each | stream nextPut: each ] ]! ! !Dictionary methodsFor: 'accessing' stamp: 'tk 2/18/97'! keyAtValue: value ifAbsent: exceptionBlock "Answer the key that is the external name for the argument, value. If there is none, answer the result of evaluating exceptionBlock. : Use =, not ==, so stings like 'this' can be found. Note that MethodDictionary continues to use == so it will be fast." self associationsDo: [:association | value = association value ifTrue: [^association key]]. ^exceptionBlock value! ! !Dictionary methodsFor: 'accessing' stamp: 'nice 10/20/2009 23:20'! keys "Answer an Array containing the receiver's keys." ^Array new: self size streamContents: [:s| self keysDo: [:key| s nextPut: key]]! ! !Dictionary methodsFor: 'accessing' stamp: 'SvenVanCaekenberghe 4/19/2011 20:31'! keyAtIdentityValue: value "Answer the key that is the external name for the argument, value. If there is none, answer nil. Note: There can be multiple keys with the same value. Only one is returned." ^self keyAtIdentityValue: value ifAbsent: [self errorValueNotFound: value]! ! !Dictionary methodsFor: 'accessing' stamp: 'StephaneDucasse 12/25/2009 12:15'! keysSortedSafely "Answer an Array containing the receiver's keys." "Suggested by l. Uzonyi" | sortedKeys | sortedKeys := Array new: self size streamContents: [ :stream | self keysDo: [ :each | stream nextPut: each ] ]. sortedKeys sort: [ :x :y | "Should really be use compareSafely..." ((x isString and: [ y isString ]) or: [ x isNumber and: [ y isNumber ] ]) ifTrue: [ x < y ] ifFalse: [ x class == y class ifTrue: [ x printString < y printString ] ifFalse: [ x class name < y class name ] ] ]. ^sortedKeys! ! !Dictionary methodsFor: 'accessing'! associationAt: key ifAbsent: aBlock "Answer the association with the given key. If key is not found, return the result of evaluating aBlock." | index assoc | index := self findElementOrNil: key. assoc := array at: index. nil == assoc ifTrue: [ ^ aBlock value ]. ^ assoc! ! !Dictionary methodsFor: 'accessing' stamp: 'PeterHugossonMiller 9/3/2009 01:13'! values "Answer a Collection containing the receiver's values." | out | out := (Array new: self size) writeStream. self valuesDo: [:value | out nextPut: value]. ^ out contents! ! !Dictionary methodsFor: 'accessing' stamp: 'ar 2/13/1999 21:16'! keyAtIdentityValue: value ifAbsent: exceptionBlock "Answer the key that is the external name for the argument, value. If there is none, answer the result of evaluating exceptionBlock. Note: There can be multiple keys with the same value. Only one is returned." self associationsDo: [:association | value == association value ifTrue: [^association key]]. ^exceptionBlock value! ! !Dictionary methodsFor: 'accessing' stamp: 'CamilloBruni 4/11/2011 13:30'! associationAt: key ^ self associationAt: key ifAbsent: [self errorKeyNotFound: key]! ! !Dictionary methodsFor: 'accessing' stamp: 'ar 5/17/2003 14:07'! bindingOf: varName ^self associationAt: varName ifAbsent:[nil]! ! !Dictionary methodsFor: 'accessing' stamp: 'sma 5/12/2000 15:00'! at: key put: anObject "Set the value at key to be anObject. If key is not found, create a new entry for key and set is value to anObject. Answer anObject." | index assoc | index := self findElementOrNil: key. assoc := array at: index. assoc ifNil: [self atNewIndex: index put: (Association key: key value: anObject)] ifNotNil: [assoc value: anObject]. ^ anObject! ! !Dictionary methodsFor: 'accessing' stamp: 'MarcusDenker 7/11/2014 18:34'! associationAt: key ifPresent: aBlock "Answer the association with the given key. If key is not found, return the result of evaluating aBlock." ^(array at: (self findElementOrNil: key)) ifNotNil: [:assoc | aBlock cull: assoc]! ! !Dictionary methodsFor: 'accessing' stamp: 'sma 5/12/2000 15:01'! at: key ifAbsentPut: aBlock "Return the value at the given key. If key is not included in the receiver store the result of evaluating aBlock as new value." ^ self at: key ifAbsent: [self at: key put: aBlock value]! ! !Dictionary methodsFor: 'accessing' stamp: 'nice 5/1/2011 18:29'! at: key ifPresent: aBlock "Lookup the given key in the receiver. If it is present, answer the value of evaluating the given block with the value associated with the key. Otherwise, answer nil." ^(array at: (self findElementOrNil: key)) ifNotNil: [:assoc | aBlock cull: assoc value]! ! !Dictionary methodsFor: '*NewValueHolder' stamp: 'BenjaminVanRyseghem 1/24/2014 16:07'! asValueHolder ^ DictionaryValueHolder value: self! ! !Collection class methodsFor: 'instance creation' stamp: 'sma 5/6/2000 20:07'! withAll: aCollection "Create a new collection containing all the elements from aCollection." ^ (self new: aCollection size) addAll: aCollection; yourself! ! !Collection class methodsFor: 'instance creation' stamp: 'sma 5/6/2000 20:06'! with: firstObject with: secondObject with: thirdObject with: fourthObject with: fifthObject with: sixthObject "Answer an instance of me, containing the six arguments as the elements." ^ self new add: firstObject; add: secondObject; add: thirdObject; add: fourthObject; add: fifthObject; add: sixthObject; yourself! ! !Collection class methodsFor: 'instance creation' stamp: 'sma 5/6/2000 20:06'! with: firstObject with: secondObject with: thirdObject with: fourthObject with: fifthObject "Answer an instance of me, containing the five arguments as the elements." ^ self new add: firstObject; add: secondObject; add: thirdObject; add: fourthObject; add: fifthObject; yourself! ! !Collection class methodsFor: 'instance creation' stamp: 'sma 5/6/2000 20:01'! with: firstObject with: secondObject "Answer an instance of me containing the two arguments as elements." ^ self new add: firstObject; add: secondObject; yourself! ! !Collection class methodsFor: 'instance creation' stamp: 'sma 5/6/2000 20:03'! with: firstObject with: secondObject with: thirdObject "Answer an instance of me containing the three arguments as elements." ^ self new add: firstObject; add: secondObject; add: thirdObject; yourself! ! !Collection class methodsFor: 'instance creation' stamp: 'sma 5/6/2000 20:06'! with: firstObject with: secondObject with: thirdObject with: fourthObject "Answer an instance of me, containing the four arguments as the elements." ^ self new add: firstObject; add: secondObject; add: thirdObject; add: fourthObject; yourself! ! !Collection class methodsFor: 'instance creation' stamp: 'sma 5/6/2000 19:58'! with: anObject "Answer an instance of me containing anObject." ^ self new add: anObject; yourself! ! !Collection class methodsFor: '*Tools-Debugger' stamp: 'SeanDeNigris 5/28/2013 17:47'! canonicalArgumentName ^ 'aCollection'.! ! !Collection class methodsFor: 'private' stamp: 'lr 11/4/2003 12:07'! initialize "Set up a Random number generator to be used by atRandom when the user does not feel like creating his own Random generator." RandomForPicking := Random new. MutexForPicking := Semaphore forMutualExclusion! ! !Collection class methodsFor: 'private' stamp: 'lr 11/4/2003 12:08'! mutexForPicking ^ MutexForPicking! ! !Collection class methodsFor: 'private' stamp: 'sma 5/12/2000 12:31'! randomForPicking ^ RandomForPicking! ! !Collection class methodsFor: '*Polymorph-Widgets-Themes' stamp: 'YuriyTymchuk 12/20/2013 11:17'! systemIcon ^ Smalltalk ui icons iconNamed: #collectionIcon! ! !Dictionary class methodsFor: '*Spec-Inspector' stamp: 'cb 6/25/2013 13:43'! inspectorClass ^ EyeDictionaryInspector! ! !Dictionary class methodsFor: 'instance creation'! newFrom: aDict "Answer an instance of me containing the same associations as aDict. Error if any key appears twice." | newDictionary | newDictionary := self new: aDict size. aDict associationsDo: [:x | (newDictionary includesKey: x key) ifTrue: [self error: 'Duplicate key: ', x key printString] ifFalse: [newDictionary add: x]]. ^ newDictionary " NewDictionary newFrom: {1->#a. 2->#b. 3->#c} {1->#a. 2->#b. 3->#c} as: NewDictionary NewDictionary newFrom: {1->#a. 2->#b. 1->#c} {1->#a. 2->#b. 1->#c} as: NewDictionary "! ! !Dictionary class methodsFor: 'instance creation' stamp: 'bgf 10/25/2006 17:08'! newFromPairs: anArray "Answer an instance of me associating (anArray at:i) to (anArray at: i+i) for each odd i. anArray must have an even number of entries." | newDictionary | newDictionary := self new: (anArray size/2). 1 to: (anArray size-1) by: 2 do: [ :i| newDictionary at: (anArray at: i) put: (anArray at: i+1). ]. ^ newDictionary " Dictionary newFromPairs: {'Red' . Color red . 'Blue' . Color blue . 'Green' . Color green}. "! ! !Symbol methodsFor: 'printing' stamp: 'BenjaminVanRyseghem 11/24/2010 14:43'! storeOn: aStream aStream nextPut: $#. (self isLiteralSymbol) ifTrue: [aStream nextPutAll: self] ifFalse: [super storeOn: aStream]! ! !Symbol methodsFor: 'printing' stamp: 'sw 8/19/1999 11:30'! isOrientedFill "Needs to be implemented here because symbols can occupy 'color' slots of morphs." ^ false! ! !Symbol methodsFor: '*metacello-core' stamp: 'DaleHenrichs 12/21/2010 13:55'! setPreLoadDoItInMetacelloSpec: aMetacelloSpec self precedence == 0 ifTrue: [ self error: 'Invalid selector' ]. aMetacelloSpec setPreLoadDoIt: (aMetacelloSpec project valueHolderSpec value: self; yourself)! ! !Symbol methodsFor: '*metacello-core' stamp: 'dkh 9/5/2012 06:26:03.064'! setForVersion: aString withInMetacelloConfig: aMetacelloConstructore aMetacelloConstructore setFor: {self} version: aString! ! !Symbol methodsFor: '*metacello-core' stamp: 'dkh 9/7/2012 13:44'! asMetacelloAttributePath ^ MetacelloMethodSectionPath with: {self}! ! !Symbol methodsFor: '*metacello-core' stamp: 'dkh 9/5/2012 06:26:03.064'! setForDo: aBlock withInMetacelloConfig: aMetacelloConstructore aMetacelloConstructore setFor: {self} do: aBlock! ! !Symbol methodsFor: '*metacello-core' stamp: 'dkh 9/7/2012 13:11'! asMetacelloAttributeList ^ {self}! ! !Symbol methodsFor: '*metacello-core' stamp: 'DaleHenrichs 12/21/2010 13:54'! setPostLoadDoItInMetacelloSpec: aMetacelloSpec self precedence == 0 ifTrue: [ self error: 'Invalid selector' ]. aMetacelloSpec setPostLoadDoIt: (aMetacelloSpec project valueHolderSpec value: self; yourself)! ! !Symbol methodsFor: '*Slot' stamp: 'MarcusDenker 6/26/2014 13:37'! asSlot ^ InstanceVariableSlot named: self.! ! !Symbol methodsFor: '*Slot' stamp: 'MarcusDenker 7/13/2014 11:56'! => aVariable aVariable isBehavior ifTrue: [ ^ aVariable named: self]. ^ aVariable name: self; yourself! ! !Symbol methodsFor: '*Slot' stamp: 'MartinDias 8/7/2012 01:31'! isPseudovariableName "Answer true if I am a pseudo-variable name. #self isPseudovariableName -> true " ^ self class pseudovariablesNames includes: self! ! !Symbol methodsFor: '*opalcompiler-core' stamp: 'MarcusDenker 6/21/2012 11:18'! asOneArgSelector ^ String streamContents: [:str| | parts | parts := (self findTokens: ':)'). str nextPutAll: parts first. parts allButFirst do: [:each | str nextPutAll: each capitalized] . str nextPutAll: ':']! ! !Symbol methodsFor: '*opalcompiler-core' stamp: 'MarcusDenker 10/11/2013 10:21'! asMethodPreamble self numArgs = 0 ifTrue: [ ^self asString]. ^ String streamContents: [ :str | self keywords doWithIndex: [ :each :index | str nextPutAll: each; nextPutAll: ' var' , index asString ] ]! ! !Symbol methodsFor: 'evaluating' stamp: 'HenrikSperreJohansen 2/18/2010 14:58'! cull: anObject ^anObject perform: self.! ! !Symbol methodsFor: 'evaluating' stamp: 'md 3/24/2006 12:09'! value: anObject ^anObject perform: self.! ! !Symbol methodsFor: 'copying' stamp: 'tk 8/19/1998 16:05'! veryDeepCopyWith: deepCopier "Return self. I am immutable in the Morphic world. Do not record me."! ! !Symbol methodsFor: 'copying'! copy "Answer with the receiver, because Symbols are unique."! ! !Symbol methodsFor: 'copying'! shallowCopy "Answer with the receiver, because Symbols are unique."! ! !Symbol methodsFor: 'sorting' stamp: 'DamienCassou 8/27/2013 21:06'! sorted: aSortBlockOrNil "Return a new sequenceable collection which contains the same elements as self but its elements are sorted by aSortBlockOrNil. The block should take two arguments and return true if the first element should preceed the second one. If aSortBlock is nil then <= is used for comparison. We convert the symbol to an array because symbols can't be changed." ^self asArray sort: aSortBlockOrNil! ! !Symbol methodsFor: 'system primitives' stamp: 'CamilloBruni 9/7/2011 16:21'! numArgs: n "Answer a string that can be used as a selector with n arguments. TODO: need to be extended to support shrinking and for selectors like #+ " | selector numArgs offs | selector := self. (numArgs := selector numArgs) >= n ifTrue: [ ^ self ]. ^ self class new: 16 streamContents: [ :stream| stream nextPutAll: self. (numArgs = 0) ifTrue: [ stream nextPut: $:. offs := 0] ifFalse: [ offs := 1 ]. 2 to: n - numArgs + offs do: [:i | stream nextPutAll: 'with:' ]]. ! ! !Symbol methodsFor: 'system primitives' stamp: 'MarcusDenker 2/29/2012 11:18'! flushCache "Tell the interpreter to remove all entries with this symbol as a selector from its method lookup cache, if it has one. This primitive must be called whenever a method is redefined or removed. NOTE: Only one of the two selective flush methods (Symbol or CompiledMethod) needs to be used." ! ! !Symbol methodsFor: 'announcements' stamp: 'StephaneDucasse 2/22/2013 18:21'! handlesAnnouncement: anAnnouncement "Anything else than the announcement identifier (in the case of symbol i.e. #foo for ... on: #foo send: #bar to: nil) will not be handled." "Announcer new on: #FOO send: #bar to: nil; announce: #FOO should raise DNU bar" ^ anAnnouncement == self! ! !Symbol methodsFor: 'testing' stamp: 'StephaneDucasse 5/28/2011 13:42'! isUnary "Answer whether the receiver is an unary message selector." ^ self precedence = 1! ! !Symbol methodsFor: 'testing' stamp: 'md 1/20/2006 16:16'! includesKey: sym ^self == sym.! ! !Symbol methodsFor: 'testing' stamp: 'md 8/27/2005 16:33'! isDoIt ^ (self == #DoIt) or: [self == #DoItIn:].! ! !Symbol methodsFor: 'testing' stamp: 'StephaneDucasse 5/28/2011 13:45'! isInfix "Answer whether the receiver is an infix message selector." ^ self precedence = 2! ! !Symbol methodsFor: 'testing' stamp: 'md 4/30/2003 15:31'! isSymbol ^ true ! ! !Symbol methodsFor: 'testing' stamp: 'StephaneDucasse 5/28/2011 13:45'! isBinary "Answer whether the receiver is a binary message selector." ^ self precedence = 2! ! !Symbol methodsFor: 'testing' stamp: 'StephaneDucasse 5/28/2011 13:47'! isKeyword "Answer whether the receiver is a message keyword." ^ self precedence = 3! ! !Symbol methodsFor: 'converting' stamp: 'st 11/22/2004 17:26'! asMutator "Return a setter message from a getter message. For example, #name asMutator returns #name:" ^ (self copyWith: $:) asSymbol! ! !Symbol methodsFor: 'converting'! asSymbol "Refer to the comment in String|asSymbol."! ! !Symbol methodsFor: 'converting' stamp: 'ar 4/10/2005 22:42'! asString "Refer to the comment in String|asString." | newString | newString := self species new: self size. newString replaceFrom: 1 to: newString size with: self startingAt: 1. ^newString! ! !Symbol methodsFor: 'converting' stamp: 'MarcusDenker 10/11/2013 10:07'! separateKeywords "#'foo:zork:' separateKeywords -> 'foo: zork:'" self isKeyword ifFalse: [ ^ self ]. ^ String streamContents: [ :stream | (self findTokens: $:) do: [ :each | stream nextPutAll: each; nextPut: $: ] separatedBy: [ stream nextPutAll: ' ' ] ]! ! !Symbol methodsFor: 'converting' stamp: 'md 8/10/2004 10:54'! withFirstCharacterDownshifted "Answer an object like the receiver but with first character downshifted if necesary" ^self asString withFirstCharacterDownshifted asSymbol.! ! !Symbol methodsFor: 'converting' stamp: 'StephaneDucasse 2/22/2013 18:18'! asAnnouncement ^ self! ! !Symbol methodsFor: 'converting' stamp: 'sw 1/28/98 18:18'! capitalized ^ self asString capitalized asSymbol! ! !Symbol methodsFor: '*System-Support' stamp: 'MarcusDenker 7/17/2014 19:07'! implementors ^SystemNavigation new allImplementorsOf: self! ! !Symbol methodsFor: '*System-Support' stamp: 'MarcusDenker 7/17/2014 19:11'! senders ^SystemNavigation new allSendersOf: self! ! !Symbol methodsFor: 'accessing'! replaceFrom: start to: stop with: replacement startingAt: repStart self errorNoModification! ! !Symbol methodsFor: 'accessing'! at: anInteger put: anObject "You cannot modify the receiver." self errorNoModification! ! !Symbol methodsFor: 'accessing' stamp: 'sma 2/5/2000 12:32'! precedence "Answer the receiver's precedence, assuming it is a valid Smalltalk message selector or 0 otherwise. The numbers are 1 for unary, 2 for binary and 3 for keyword selectors." self size = 0 ifTrue: [^ 0]. self first isLetter ifFalse: [^ 2]. self last = $: ifTrue: [^ 3]. ^ 1! ! !Symbol methodsFor: 'comparing' stamp: 'ar 4/10/2005 23:45'! = aSymbol "Compare the receiver and aSymbol." self == aSymbol ifTrue: [^ true]. self class == aSymbol class ifTrue: [^ false]. "Use String comparison otherwise" ^ super = aSymbol! ! !Symbol methodsFor: 'private'! string: aString 1 to: aString size do: [:j | super at: j put: (aString at: j)]. ^self ! ! !Symbol methodsFor: 'private'! errorNoModification self error: 'symbols can not be modified.'! ! !Symbol class methodsFor: 'initialization' stamp: 'RAA 5/29/2001 14:35'! allSymbolTablesDo: aBlock after: aSymbol NewSymbols do: aBlock after: aSymbol. SymbolTable do: aBlock after: aSymbol.! ! !Symbol class methodsFor: 'initialization' stamp: 'RAA 5/29/2001 09:04'! initialize "Symbol initialize" Symbol rehash. OneCharacterSymbols := nil. OneCharacterSymbols := (1 to: 256) collect: [ :i | (i - 1) asCharacter asSymbol]. Smalltalk addToShutDownList: self. ! ! !Symbol class methodsFor: 'initialization' stamp: 'RAA 5/29/2001 08:21'! allSymbolTablesDo: aBlock NewSymbols do: aBlock. SymbolTable do: aBlock.! ! !Symbol class methodsFor: 'initialization' stamp: 'RAA 12/17/2000 18:05'! compactSymbolTable "Reduce the size of the symbol table so that it holds all existing symbols + 25% (changed from 1000 since sets like to have 25% free and the extra space would grow back in a hurry)" | oldSize | Smalltalk garbageCollect. oldSize := SymbolTable array size. SymbolTable growTo: SymbolTable size * 4 // 3 + 100. ^oldSize printString,' ',(oldSize - SymbolTable array size) printString, ' slot(s) reclaimed'! ! !Symbol class methodsFor: 'accessing' stamp: 'CamilloBruni 9/5/2011 15:22'! streamSpecies ^ String! ! !Symbol class methodsFor: 'instance creation' stamp: 'MarcusDenker 7/23/2014 13:17'! findInterned: aString self hasInterned:aString ifTrue:[:symbol| ^symbol]. ^nil.! ! !Symbol class methodsFor: 'instance creation' stamp: 'BenjaminVanRyseghem 11/24/2010 14:44'! with: aCharacter ^self newFrom: aCharacter asOrderedCollection! ! !Symbol class methodsFor: 'instance creation' stamp: 'CamilloBruni 9/9/2011 12:57'! withAll: aCollection ^ self newFrom: aCollection! ! !Symbol class methodsFor: 'instance creation' stamp: 'ar 4/10/2005 23:04'! internCharacter: aCharacter aCharacter asciiValue > 256 ifTrue:[^self intern: aCharacter asString]. OneCharacterSymbols ifNil: [^self intern: aCharacter asString]. ^OneCharacterSymbols at: aCharacter asciiValue + 1 ! ! !Symbol class methodsFor: 'instance creation'! newFrom: aCollection "Answer an instance of me containing the same elements as aCollection." ^ (aCollection as: String) asSymbol " Symbol newFrom: {$P. $e. $n} {$P. $e. $n} as: Symbol "! ! !Symbol class methodsFor: 'instance creation' stamp: 'RAA 5/29/2001 08:09'! lookup: aStringOrSymbol ^(SymbolTable like: aStringOrSymbol) ifNil: [ NewSymbols like: aStringOrSymbol ]! ! !Symbol class methodsFor: 'instance creation' stamp: 'SheridanMahoney 11/12/2009 22:04'! new: aSize self shouldNotImplement .! ! !Symbol class methodsFor: 'instance creation' stamp: 'MarcusDenker 5/18/2013 15:44'! readFrom: strm "Symbol readFromString: '#abc'" strm peek = $# ifFalse: [self error: 'Symbols must be introduced by #']. ^ strm contents parseLiterals first. ! ! !Symbol class methodsFor: 'instance creation' stamp: 'SheridanMahoney 11/17/2009 13:23'! intern: aStringOrSymbol ^(self lookup: aStringOrSymbol) ifNil:[ | aClass aSymbol | aStringOrSymbol isSymbol ifTrue:[ aSymbol := aStringOrSymbol. ] ifFalse:[ aClass := aStringOrSymbol isOctetString ifTrue:[ByteSymbol] ifFalse:[WideSymbol]. aSymbol := aClass basicNew: aStringOrSymbol size. aSymbol string: aStringOrSymbol. ]. NewSymbols add: aSymbol. aSymbol].! ! !Symbol class methodsFor: 'private' stamp: 'RAA 5/29/2001 09:04'! shutDown: aboutToQuit SymbolTable addAll: NewSymbols. NewSymbols := WeakSet new.! ! !Symbol class methodsFor: 'private' stamp: 'MarcusDenker 10/9/2013 10:42'! hasInterned: aString ifTrue: symBlock "Answer with false if aString hasnt been interned (into a Symbol), otherwise supply the symbol to symBlock and return true." ^ (self lookup: aString) ifNil: [ false ] ifNotNil: [ :symbol | symBlock value: symbol. true ]! ! !Symbol class methodsFor: 'private' stamp: 'ar 9/27/2005 20:01'! rehash "Symbol rehash" "Rebuild the hash table, reclaiming unreferenced Symbols." SymbolTable := WeakSet withAll: self allSubInstances. NewSymbols := WeakSet new.! ! !Symbol class methodsFor: 'private' stamp: 'nice 1/5/2010 15:59'! possibleSelectorsFor: misspelled "Answer an ordered collection of possible corrections for the misspelled selector in order of likelyhood" | numArgs candidates lookupString best binary short long first | lookupString := misspelled asLowercase. "correct uppercase selectors to lowercase" numArgs := lookupString numArgs. (numArgs < 0 or: [lookupString size < 2]) ifTrue: [^ OrderedCollection new: 0]. first := lookupString first. short := lookupString size - (lookupString size // 4 max: 3) max: 2. long := lookupString size + (lookupString size // 4 max: 3). "First assemble candidates for detailed scoring" candidates := OrderedCollection new. self allSymbolTablesDo: [:s | | ss | (((ss := s size) >= short "not too short" and: [ss <= long "not too long" or: [(s at: 1) = first]]) "well, any length OK if starts w/same letter" and: [s numArgs = numArgs]) "and numArgs is the same" ifTrue: [candidates add: s]]. "Then further prune these by correctAgainst:" best := lookupString correctAgainst: candidates. ((misspelled last ~~ $:) and: [misspelled size > 1]) ifTrue: [ binary := misspelled, ':'. "try for missing colon" Symbol hasInterned: binary ifTrue: [:him | best addFirst: him]]. ^ best! ! !Symbol class methodsFor: 'cleanup' stamp: 'StephaneDucasse 3/9/2010 22:17'! cleanUp "Flush caches" self compactSymbolTable.! ! !Symbol class methodsFor: 'stream creation' stamp: 'CamilloBruni 9/5/2011 15:35'! new: size streamContents: aBlock ^ (super new: size streamContents: aBlock) asSymbol! ! !Symbol class methodsFor: 'access' stamp: 'tween 9/13/2004 10:09'! thatStartsCaseSensitive: leadingCharacters skipping: skipSym "Same as thatStarts:skipping: but caseSensitive" | size firstMatch key | size := leadingCharacters size. size = 0 ifTrue: [^skipSym ifNil: [#''] ifNotNil: [nil]]. firstMatch := leadingCharacters at: 1. size > 1 ifTrue: [key := leadingCharacters copyFrom: 2 to: size]. self allSymbolTablesDo: [:each | each size >= size ifTrue: [ ((each at: 1) == firstMatch and: [key == nil or: [(each findString: key startingAt: 2 caseSensitive: true) = 2]]) ifTrue: [^each] ] ] after: skipSym. ^nil ! ! !Symbol class methodsFor: 'access' stamp: 'StephaneDucasse 5/28/2011 13:45'! selectorsContaining: aString "Answer a list of selectors that contain aString within them. Case-insensitive. Does return symbols that begin with a capital letter." | size selectorList ascii | selectorList := OrderedCollection new. (size := aString size) = 0 ifTrue: [^selectorList]. aString size = 1 ifTrue: [ ascii := aString first asciiValue. ascii < 128 ifTrue: [selectorList add: (OneCharacterSymbols at: ascii+1)] ]. (aString first isAlphaNumeric) ifFalse: [ aString size = 2 ifTrue: [Symbol hasInterned: aString ifTrue: [:s | selectorList add: s]]. ^selectorList ]. selectorList := selectorList copyFrom: 2 to: selectorList size. self allSymbolTablesDo: [:each | each size >= size ifTrue: [(each findSubstring: aString in: each startingAt: 1 matchTable: CaseInsensitiveOrder) > 0 ifTrue: [selectorList add: each]]]. ^selectorList reject: [:each | "reject non-selectors, but keep ones that begin with an uppercase" each numArgs < 0 and: [each asString withFirstCharacterDownshifted numArgs < 0]]. "Symbol selectorsContaining: 'scon'"! ! !Symbol class methodsFor: 'access' stamp: 'ar 4/10/2005 22:49'! allSymbols "Answer all interned symbols" ^Array streamContents:[:s| s nextPutAll: NewSymbols. s nextPutAll: OneCharacterSymbols. s nextPutAll: SymbolTable. ]. ! ! !Symbol class methodsFor: 'access' stamp: 'RAA 5/29/2001 14:35'! thatStarts: leadingCharacters skipping: skipSym "Answer a selector symbol that starts with leadingCharacters. Symbols beginning with a lower-case letter handled directly here. Ignore case after first char. If skipSym is not nil, it is a previous answer; start searching after it. If no symbols are found, answer nil. Used by Alt-q (Command-q) routines" | size firstMatch key | size := leadingCharacters size. size = 0 ifTrue: [^skipSym ifNil: [#''] ifNotNil: [nil]]. firstMatch := leadingCharacters at: 1. size > 1 ifTrue: [key := leadingCharacters copyFrom: 2 to: size]. self allSymbolTablesDo: [:each | each size >= size ifTrue: [ ((each at: 1) == firstMatch and: [key == nil or: [(each findString: key startingAt: 2 caseSensitive: false) = 2]]) ifTrue: [^each] ] ] after: skipSym. ^nil "Symbol thatStarts: 'sf' skipping: nil" "Symbol thatStarts: 'sf' skipping: #sfpGetFile:with:with:with:with:with:with:with:with:" "Symbol thatStarts: 'candidate' skipping: nil" ! ! !Symbol class methodsFor: '*Slot' stamp: 'MartinDias 8/7/2012 01:18'! pseudovariablesNames ^#('self' 'true' 'false' 'nil' 'thisContext' 'super')! ! !OrderedCollection methodsFor: '*GroupManager' stamp: 'BenjaminVanRyseghem 4/14/2012 12:08'! removeDuplicates | iterator | "Remove the copies of elements, but keep the same order" self ifEmpty: [ ^ self ]. iterator := 1. [ iterator <= self size ] whileTrue: [ | each newIndex | each := self at: iterator. [ newIndex := (self indexOf: each startingAt: iterator+1). newIndex > 0 ] whileTrue: [ self removeAt: newIndex ]. iterator := iterator + 1. ]! ! !OrderedCollection methodsFor: '*Fuel' stamp: 'MarianoMartinezPeck 7/26/2012 17:42'! fuelAccept: aGeneralMapper "Since we have subclasses of OrderedCollection that behave differently, we cannot use the visitSimpleCollection: for all of them." ^ (self class == OrderedCollection ) ifTrue: [ aGeneralMapper visitSimpleCollection: self ] ifFalse: [ super fuelAccept: aGeneralMapper ] ! ! !OrderedCollection methodsFor: 'adding'! add: newObject after: oldObject "Add the argument, newObject, as an element of the receiver. Put it in the sequence just succeeding oldObject. Answer newObject." | index | index := self find: oldObject. self insert: newObject before: index + 1. ^newObject! ! !OrderedCollection methodsFor: 'adding' stamp: 'ar 7/15/2008 23:05'! add: newObject beforeIndex: index "Add the argument, newObject, as an element of the receiver. Put it in the sequence just before index. Answer newObject." (index between: 1 and: self size+1) ifFalse:[^self errorSubscriptBounds: index]. self insert: newObject before: firstIndex + index - 1. ^ newObject! ! !OrderedCollection methodsFor: 'adding'! add: newObject ^self addLast: newObject! ! !OrderedCollection methodsFor: 'adding' stamp: 'CamilloBruni 4/12/2011 13:52'! add: newObject afterIndex: index "Add the argument, newObject, as an element of the receiver. Put it in the sequence just after index. Answer newObject." (index between: 0 and: self size) ifFalse:[^self errorSubscriptBounds: index]. self insert: newObject before: firstIndex + index. ^ newObject! ! !OrderedCollection methodsFor: 'adding' stamp: 'sma 5/12/2000 11:26'! addAll: aCollection "Add each element of aCollection at my end. Answer aCollection." ^ self addAllLast: aCollection! ! !OrderedCollection methodsFor: 'adding'! addAllFirst: anOrderedCollection "Add each element of anOrderedCollection at the beginning of the receiver. Answer anOrderedCollection." anOrderedCollection reverseDo: [:each | self addFirst: each]. ^anOrderedCollection! ! !OrderedCollection methodsFor: 'adding' stamp: 'StephaneDucasse 12/25/2009 12:13'! addAllLast: aCollection "Add each element of aCollection at the end of the receiver. Answer aCollection." aCollection do: [:each | self addLast: each]. ^aCollection! ! !OrderedCollection methodsFor: 'adding' stamp: 'sw 3/1/2001 11:03'! addAllFirstUnlessAlreadyPresent: anOrderedCollection "Add each element of anOrderedCollection at the beginning of the receiver, preserving the order, but do not add any items that are already in the receiver. Answer anOrderedCollection." anOrderedCollection reverseDo: [:each | (self includes: each) ifFalse: [self addFirst: each]]. ^ anOrderedCollection! ! !OrderedCollection methodsFor: 'adding'! addFirst: newObject "Add newObject to the beginning of the receiver. Answer newObject." firstIndex = 1 ifTrue: [self makeRoomAtFirst]. firstIndex := firstIndex - 1. array at: firstIndex put: newObject. ^ newObject! ! !OrderedCollection methodsFor: 'adding'! add: newObject before: oldObject "Add the argument, newObject, as an element of the receiver. Put it in the sequence just preceding oldObject. Answer newObject." | index | index := self find: oldObject. self insert: newObject before: index. ^newObject! ! !OrderedCollection methodsFor: 'adding' stamp: 'ajh 5/22/2003 12:03'! at: index ifAbsentPut: block "Return value at index, however, if value does not exist (nil or out of bounds) then add block's value at index (growing self if necessary)" | v | index <= self size ifTrue: [ ^ (v := self at: index) ifNotNil: [v] ifNil: [self at: index put: block value] ]. [self size < index] whileTrue: [self add: nil]. ^ self at: index put: block value! ! !OrderedCollection methodsFor: 'adding'! addLast: newObject "Add newObject to the end of the receiver. Answer newObject." lastIndex = array size ifTrue: [self makeRoomAtLast]. lastIndex := lastIndex + 1. array at: lastIndex put: newObject. ^ newObject! ! !OrderedCollection methodsFor: 'accessing' stamp: 'sma 5/12/2000 11:39'! size "Answer how many elements the receiver contains." ^ lastIndex - firstIndex + 1! ! !OrderedCollection methodsFor: 'accessing' stamp: 'sma 5/12/2000 11:42'! capacity "Answer the current capacity of the receiver." ^ array size! ! !OrderedCollection methodsFor: 'accessing' stamp: 'CamilloBruni 4/11/2011 15:39'! at: anInteger put: anObject "Put anObject at element index anInteger. at:put: cannot be used to append, front or back, to an ordered collection; it is used by a knowledgeable client to replace an element." self ensureBoundsFrom: anInteger to: anInteger. ^array at: anInteger + firstIndex - 1 put: anObject! ! !OrderedCollection methodsFor: 'accessing' stamp: 'CamilloBruni 4/11/2011 15:36'! at: anInteger "Answer my element at index anInteger. at: is used by a knowledgeable client to access an existing element" self ensureBoundsFrom: anInteger to: anInteger. ^ array at: anInteger + firstIndex - 1! ! !OrderedCollection methodsFor: 'removing'! remove: oldObject ifAbsent: absentBlock | index | index := firstIndex. [index <= lastIndex] whileTrue: [oldObject = (array at: index) ifTrue: [self removeIndex: index. ^ oldObject] ifFalse: [index := index + 1]]. ^ absentBlock value! ! !OrderedCollection methodsFor: 'removing'! removeFirst "Remove the first element of the receiver and answer it. If the receiver is empty, create an error notification." | firstObject | self emptyCheck. firstObject := array at: firstIndex. array at: firstIndex put: nil. firstIndex := firstIndex + 1. ^ firstObject! ! !OrderedCollection methodsFor: 'removing' stamp: 'ar 5/22/2000 12:19'! removeAt: index | removed | removed := self at: index. self removeIndex: index + firstIndex - 1. ^removed! ! !OrderedCollection methodsFor: 'removing' stamp: 'cmm 10/25/2010 22:26'! removeAll "remove all the elements from this collection. Keep same amount of storage" self setCollection: (self class arrayType new: array size)! ! !OrderedCollection methodsFor: 'removing'! removeLast "Remove the last element of the receiver and answer it. If the receiver is empty, create an error notification." | lastObject | self emptyCheck. lastObject := array at: lastIndex. array at: lastIndex put: nil. lastIndex := lastIndex - 1. ^ lastObject! ! !OrderedCollection methodsFor: 'removing' stamp: 'StephaneDucasse 10/18/2010 14:51'! removeAllSuchThat: aBlock "Remove each element of the receiver for which aBlock evaluates to true. The method in Collection is O(N^2), this is O(N)." | n | n := firstIndex. firstIndex to: lastIndex do: [:index | (aBlock value: (array at: index)) ifFalse: [ array at: n put: (array at: index). n := n + 1]]. array from: n to: lastIndex put: nil. lastIndex := n - 1! ! !OrderedCollection methodsFor: 'removing' stamp: 'cmm 10/25/2010 22:26'! removeFirst: n "Remove first n object into an array" | list | list := self class arrayType new: n. 1 to: n do: [ : i | list at: i put: self removeFirst ]. ^ list! ! !OrderedCollection methodsFor: 'removing' stamp: 'ul 2/24/2011 14:33'! reset "Quickly remove all elements. The objects will be still referenced, but will not be accessible." self resetTo: 1! ! !OrderedCollection methodsFor: 'removing' stamp: 'cmm 10/25/2010 22:26'! removeLast: n "Remove last n object into an array with last in last position" | list | list := self class arrayType new: n. n to: 1 by: -1 do: [ : i | list at: i put: self removeLast ]. ^ list! ! !OrderedCollection methodsFor: 'enumerating' stamp: 'CamilloBruni 3/22/2013 23:51'! reject: rejectBlock thenCollect: collectBlock " Optimized version of Collection>>#reject:thenCollect: " | newCollection | newCollection := self copyEmpty. firstIndex to: lastIndex do: [ :index | | element | element := array at: index. (rejectBlock value: element) ifFalse: [ newCollection addLast: (collectBlock value: element) ]]. ^ newCollection! ! !OrderedCollection methodsFor: 'enumerating' stamp: 'CamilloBruni 3/22/2013 23:51'! select: selectBlock "Optimized version of Collection>>#select: " | newCollection element | newCollection := self copyEmpty. firstIndex to: lastIndex do: [ :index | (selectBlock value: (element := array at: index)) ifTrue: [ newCollection addLast: element ]]. ^ newCollection! ! !OrderedCollection methodsFor: 'enumerating'! reverseDo: aBlock "Override the superclass for performance reasons." | index | index := lastIndex. [index >= firstIndex] whileTrue: [aBlock value: (array at: index). index := index - 1]! ! !OrderedCollection methodsFor: 'enumerating' stamp: 'di 8/31/1999 13:13'! with: otherCollection collect: twoArgBlock "Collect and return the result of evaluating twoArgBlock with corresponding elements from this collection and otherCollection." | result | otherCollection size = self size ifFalse: [self error: 'otherCollection must be the same size']. result := self species new: self size. 1 to: self size do: [:index | result addLast: (twoArgBlock value: (self at: index) value: (otherCollection at: index))]. ^ result! ! !OrderedCollection methodsFor: 'enumerating' stamp: 'CamilloBruni 3/22/2013 23:52'! reject: rejectBlock "Optimized version of Collection>>#reject:" | newCollection element | newCollection := self copyEmpty. firstIndex to: lastIndex do: [ :index | (rejectBlock value: (element := array at: index)) ifFalse: [ newCollection addLast: element ]]. ^ newCollection! ! !OrderedCollection methodsFor: 'enumerating' stamp: 'CamilloBruni 3/22/2013 23:52'! collect: collectBlock thenSelect: selectBlock "Optimized version Collection>>#collect:thenSelect:" | newCollection newElement | newCollection := self copyEmpty. firstIndex to: lastIndex do: [ :index | newElement := collectBlock value: (array at: index). (selectBlock value: newElement) ifTrue: [ newCollection addLast: newElement ]]. ^ newCollection! ! !OrderedCollection methodsFor: 'enumerating' stamp: 'bf 5/16/2000 16:30'! withIndexCollect: elementAndIndexBlock "Just like with:collect: except that the iteration index supplies the second argument to the block. Override superclass in order to use addLast:, not at:put:." | newCollection | newCollection := self species new: self size. firstIndex to: lastIndex do: [:index | newCollection addLast: (elementAndIndexBlock value: (array at: index) value: index - firstIndex + 1)]. ^ newCollection! ! !OrderedCollection methodsFor: 'enumerating' stamp: 'sma 2/5/2000 15:22'! collect: aBlock "Evaluate aBlock with each of my elements as the argument. Collect the resulting values into a collection that is like me. Answer the new collection. Override superclass in order to use addLast:, not at:put:." | newCollection | newCollection := self species new: self size. firstIndex to: lastIndex do: [:index | newCollection addLast: (aBlock value: (array at: index))]. ^ newCollection! ! !OrderedCollection methodsFor: 'enumerating'! do: aBlock "Override the superclass for performance reasons." | index | index := firstIndex. [index <= lastIndex] whileTrue: [aBlock value: (array at: index). index := index + 1]! ! !OrderedCollection methodsFor: 'enumerating' stamp: 'CamilloBruni 3/22/2013 23:52'! select: selectBlock thenCollect: collectBlock " Optimized version Collection>>#select:thenCollect: " | newCollection element | newCollection := self copyEmpty. firstIndex to: lastIndex do: [ :index | element := array at: index. (selectBlock value: element) ifTrue: [ newCollection addLast: (collectBlock value: element) ]]. ^ newCollection! ! !OrderedCollection methodsFor: 'enumerating' stamp: 'CamilloBruni 4/11/2011 15:34'! collect: aBlock from: fromIndex to: toIndex "Override superclass in order to use addLast:, not at:put:." | result | self ensureBoundsFrom: fromIndex to: toIndex. result := self species new: toIndex - fromIndex + 1. firstIndex + fromIndex - 1 to: firstIndex + toIndex - 1 do: [:index | result addLast: (aBlock value: (array at: index))]. ^ result ! ! !OrderedCollection methodsFor: 'enumerating' stamp: 'pmm 3/13/2010 11:33'! sort: aSortBlock "Sort this array using aSortBlock. The block should take two arguments and return true if the first element should preceed the second one." self size <= 1 ifTrue: [^ self]. "nothing to do" array mergeSortFrom: firstIndex to: lastIndex src: array shallowCopy dst: array by: aSortBlock! ! !OrderedCollection methodsFor: 'testing' stamp: 'md 8/13/2008 21:40'! hasContentsInExplorer ^self notEmpty! ! !OrderedCollection methodsFor: 'converting' stamp: 'stephane.ducasse 8/8/2009 10:48'! asArray ^ (Array new: self size) replaceFrom: 1 to: self size with: array startingAt: firstIndex.! ! !OrderedCollection methodsFor: 'splitjoin' stamp: 'onierstrasz 4/12/2009 19:44'! join: aCollection | result | result := self class new. aCollection do: [:each | each appendTo: result] separatedBy: [self appendTo: result]. ^ result! ! !OrderedCollection methodsFor: 'private'! collector "Private" ^ array! ! !OrderedCollection methodsFor: 'private'! errorConditionNotSatisfied self error: 'no element satisfies condition'! ! !OrderedCollection methodsFor: 'private' stamp: 'MarianoMartinezPeck 8/3/2011 14:37'! makeRoomAtFirst "Make some empty slots at the front of the array. If we have more than 50% free space, then just move the elements, so that the first 50% of the slots are free, otherwise add new free slots to the front by growing. Precondition: firstIndex = 1" | tally newFirstIndex newLastIndex | tally := self size. tally * 2 >= array size ifTrue: [ ^self growAtFirst ]. tally = 0 ifTrue: [ ^self resetTo: array size + 1 ]. newFirstIndex := array size // 2 + 1. newLastIndex := newFirstIndex - firstIndex + lastIndex. 0 to: tally - 1 do: [ :offset | array at: newLastIndex - offset put: (array at: lastIndex - offset) ]. array from: firstIndex to: newFirstIndex - 1 put: nil. firstIndex := newFirstIndex. lastIndex := newLastIndex! ! !OrderedCollection methodsFor: 'private' stamp: 'CamilloBruni 4/11/2011 15:34'! ensureBoundsFrom: fromIndex to: toIndex (fromIndex < 1) ifTrue: [^self errorSubscriptBounds: fromIndex]. (toIndex + firstIndex - 1 > lastIndex) ifTrue: [^self errorSubscriptBounds: toIndex].! ! !OrderedCollection methodsFor: 'private' stamp: 'cmm 10/25/2010 22:27'! growAtFirst "Add new empty slots to the front of array, while keeping the empty slots at the end." | newArray newFirstIndex newLastIndex | newArray := self class arrayType new: (array size * 2 max: 1). newFirstIndex := newArray size - array size + firstIndex. newLastIndex := newFirstIndex + lastIndex - firstIndex. newArray replaceFrom: newFirstIndex to: newLastIndex with: array startingAt: firstIndex. array := newArray. firstIndex := newFirstIndex. lastIndex := newLastIndex! ! !OrderedCollection methodsFor: 'private' stamp: 'BG 1/9/2004 12:28'! removeIndex: removedIndex " removedIndex is an index in the range firstIndex .. lastIndex, such an index is not known from outside the collection. Never use this method in your code, it is meant for private use by OrderedCollection only. The method for public use is: #removeAt: " array replaceFrom: removedIndex to: lastIndex - 1 with: array startingAt: removedIndex+1. array at: lastIndex put: nil. lastIndex := lastIndex - 1.! ! !OrderedCollection methodsFor: 'private' stamp: 'MarianoMartinezPeck 8/3/2011 14:37'! makeRoomAtLast "Make some empty slots at the end of the array. If we have more than 50% free space, then just move the elements, so that the last 50% of the slots are free, otherwise add new free slots to the end by growing. Precondition: lastIndex = array size" | tally newFirstIndex newLastIndex | tally := self size. tally * 2 >= lastIndex ifTrue: [ ^self growAtLast ]. tally = 0 ifTrue: [ ^self resetTo: 1 ]. newLastIndex := lastIndex // 2. newFirstIndex := newLastIndex - lastIndex + firstIndex. array replaceFrom: newFirstIndex to: newLastIndex with: array startingAt: firstIndex. array from: newLastIndex + 1 to: lastIndex put: nil. firstIndex := newFirstIndex. lastIndex := newLastIndex! ! !OrderedCollection methodsFor: 'private' stamp: 'BG 1/9/2004 12:26'! find: oldObject " This method answers an index in the range firstIndex .. lastIndex, which is meant for internal use only. Never use this method in your code, the methods for public use are: #indexOf: #indexOf:ifAbsent: " | index | index := firstIndex. [index <= lastIndex] whileTrue: [(array at: index) = oldObject ifTrue: [^ index]. index := index + 1]. self errorNotFound: oldObject! ! !OrderedCollection methodsFor: 'private' stamp: 'cmm 10/25/2010 22:27'! growAtLast "Add new empty slots to the end of array, while keeping the empty slots at the front." | newArray | newArray := self class arrayType new: (array size * 2 max: 1). newArray replaceFrom: firstIndex to: lastIndex with: array startingAt: firstIndex. array := newArray! ! !OrderedCollection methodsFor: 'private' stamp: 'ar 4/16/1999 07:59'! resetTo: index firstIndex := index. lastIndex := firstIndex - 1! ! !OrderedCollection methodsFor: 'private' stamp: 'BG 1/9/2004 12:29'! insert: anObject before: spot " spot is an index in the range firstIndex .. lastIndex, such an index is not known from outside the collection. Never use this method in your code, it is meant for private use by OrderedCollection only. The methods for use are: #add:before: to insert an object before another object #add:beforeIndex: to insert an object before a given position. " | "index" delta spotIndex| spotIndex := spot. delta := spotIndex - firstIndex. firstIndex = 1 ifTrue: [self makeRoomAtFirst. spotIndex := firstIndex + delta]. firstIndex := firstIndex - 1. array replaceFrom: firstIndex to: spotIndex - 2 with: array startingAt: firstIndex + 1. array at: spotIndex - 1 put: anObject. " index := firstIndex := firstIndex - 1. [index < (spotIndex - 1)] whileTrue: [array at: index put: (array at: index + 1). index := index + 1]. array at: index put: anObject." ^ anObject! ! !OrderedCollection methodsFor: 'private' stamp: 'di 11/14/97 12:54'! setCollection: anArray array := anArray. self reset! ! !OrderedCollection methodsFor: 'private' stamp: 'apb 10/15/2000 18:10'! setContents: anArray array := anArray. firstIndex := 1. lastIndex := array size.! ! !OrderedCollection methodsFor: 'copying'! copyEmpty "Answer a copy of the receiver that contains no elements." ^self species new! ! !OrderedCollection methodsFor: 'copying' stamp: 'sw 1/26/96'! reversed "Answer a copy of the receiver with element order reversed. " | newCol | newCol := self species new. self reverseDo: [:elem | newCol addLast: elem]. ^ newCol "#(2 3 4 'fred') reversed"! ! !OrderedCollection methodsFor: 'copying'! copyReplaceFrom: start to: stop with: replacementCollection "Answer a copy of the receiver with replacementCollection's elements in place of the receiver's start'th to stop'th elements. This does not expect a 1-1 map from replacementCollection to the start to stop elements, so it will do an insert or append." | newOrderedCollection delta startIndex stopIndex | "if start is less than 1, ignore stop and assume this is inserting at the front. if start greater than self size, ignore stop and assume this is appending. otherwise, it is replacing part of me and start and stop have to be within my bounds. " delta := 0. startIndex := start. stopIndex := stop. start < 1 ifTrue: [startIndex := stopIndex := 0] ifFalse: [startIndex > self size ifTrue: [startIndex := stopIndex := self size + 1] ifFalse: [(stopIndex < (startIndex - 1) or: [stopIndex > self size]) ifTrue: [self errorOutOfBounds]. delta := stopIndex - startIndex + 1]]. newOrderedCollection := self species new: self size + replacementCollection size - delta. 1 to: startIndex - 1 do: [:index | newOrderedCollection add: (self at: index)]. 1 to: replacementCollection size do: [:index | newOrderedCollection add: (replacementCollection at: index)]. stopIndex + 1 to: self size do: [:index | newOrderedCollection add: (self at: index)]. ^newOrderedCollection! ! !OrderedCollection methodsFor: 'copying'! copyWith: newElement "Answer a copy of the receiver that is 1 bigger than the receiver and includes the argument, newElement, at the end." | newCollection | newCollection := self copy. newCollection add: newElement. ^newCollection! ! !OrderedCollection methodsFor: 'copying' stamp: 'nice 10/5/2009 08:50'! postCopy array := array copy! ! !OrderedCollection methodsFor: 'copying' stamp: 'nice 10/5/2009 10:18'! copyFrom: startIndex to: endIndex "Answer a copy of the receiver that contains elements from position startIndex to endIndex." ^self shallowCopy postCopyFrom: startIndex to: endIndex! ! !OrderedCollection methodsFor: 'copying' stamp: 'nice 5/28/2008 21:02'! postCopyFrom: startIndex to: endIndex "finish copying the array in a certain range." endIndex < startIndex ifFalse: [ "Because actual size of the array may be greater than used size, postCopyFrom:to: may fail to fail and answer an incorrect result if this sanity check were not applied" (startIndex between: 1 and: self size) ifFalse: [^self error: 'startIndex is out of bounds']. (endIndex between: 1 and: self size) ifFalse: [^self error: 'endIndex is out of bounds']]. "Add a protection that lacks in Array>>postcopy" array := array copyFrom: startIndex + firstIndex - 1 to: (endIndex max: startIndex - 1) + firstIndex - 1. firstIndex := 1. lastIndex := array size! ! !OrderedCollection class methodsFor: 'instance creation' stamp: 'cmm 10/25/2010 22:28'! new: anInteger withAll: anObject ^ self basicNew setContents: (self arrayType new: anInteger withAll: anObject)! ! !OrderedCollection class methodsFor: 'instance creation' stamp: 'cmm 10/25/2010 22:27'! new: anInteger ^ self basicNew setCollection: (self arrayType new: anInteger)! ! !OrderedCollection class methodsFor: 'instance creation' stamp: 'sma 5/12/2000 17:41'! new ^ self new: 10! ! !OrderedCollection class methodsFor: 'instance creation' stamp: 'apb 10/15/2000 22:02'! ofSize: n "Create a new collection of size n with nil as its elements. This method exists because OrderedCollection new: n creates an empty collection, not one of size n." | collection | collection := self new: n. collection setContents: (collection collector). ^ collection ! ! !OrderedCollection class methodsFor: 'instance creation'! newFrom: aCollection "Answer an instance of me containing the same elements as aCollection." | newCollection | newCollection := self new: aCollection size. newCollection addAll: aCollection. ^newCollection " OrderedCollection newFrom: {1. 2. 3} {1. 2. 3} as: OrderedCollection {4. 2. 7} as: SortedCollection "! ! !OrderedCollection class methodsFor: 'private' stamp: 'cmm 10/25/2010 22:26'! arrayType ^ Array! ! !OrderedCollection class methodsFor: 'accessing' stamp: 'CamilloBruni 9/5/2011 15:38'! streamSpecies ^ Array! ! !OrderedCollection class methodsFor: 'stream creation' stamp: 'CamilloBruni 9/5/2011 15:48'! new: size streamContents: aBlock ^ self withAll: (super new: size streamContents: aBlock)! ! !Stream methodsFor: 'accessing' stamp: 'nk 4/29/2004 10:40'! openReadOnly ^self! ! !Stream methodsFor: 'accessing' stamp: 'HenrikSperreJohansen 8/17/2012 11:30'! basicNext: anAmount putAll: aCollection startingAt: startIndex ^ self next: anAmount putAll: aCollection startingAt: startIndex. ! ! !Stream methodsFor: 'accessing' stamp: 'yo 8/30/2002 17:13'! basicNextPutAll: aCollection ^ self nextPutAll: aCollection. ! ! !Stream methodsFor: 'accessing'! nextMatchAll: aColl "Answer true if next N objects are the ones in aColl, else false. Advance stream of true, leave as was if false." | save | save := self position. aColl do: [:each | (self next) = each ifFalse: [ self position: save. ^ false] ]. ^ true! ! !Stream methodsFor: 'accessing' stamp: 'yo 8/30/2002 17:13'! basicNextPut: anObject ^ self nextPut: anObject! ! !Stream methodsFor: 'accessing' stamp: 'HenrikSperreJohansen 8/17/2012 11:30'! next: anInteger putAll: aCollection startingAt: startIndex "Store the next anInteger elements from the given collection." (startIndex = 1 and:[anInteger = aCollection size]) ifTrue:[^self nextPutAll: aCollection]. ^self nextPutAll: (aCollection copyFrom: startIndex to: startIndex+anInteger-1)! ! !Stream methodsFor: 'accessing' stamp: 'MarianoMartinezPeck 8/24/2012 15:30'! upToEnd "answer the remaining elements in the string" | elements | elements := OrderedCollection new. [ self atEnd ] whileFalse: [ elements add: self next ]. ^elements! ! !Stream methodsFor: 'accessing'! next: anInteger put: anObject "Make anObject be the next anInteger number of objects accessible by the receiver. Answer anObject." anInteger timesRepeat: [self nextPut: anObject]. ^anObject! ! !Stream methodsFor: 'accessing' stamp: 'MarianoMartinezPeck 8/24/2012 15:59'! next "Answer the next object accessible by the receiver." self subclassResponsibility ! ! !Stream methodsFor: 'accessing' stamp: 'MarianoMartinezPeck 8/24/2012 15:30'! next: anInteger "Answer the next anInteger number of objects accessible by the receiver." | aCollection | aCollection := OrderedCollection new. anInteger timesRepeat: [aCollection addLast: self next]. ^aCollection! ! !Stream methodsFor: 'accessing' stamp: 'MarianoMartinezPeck 8/24/2012 15:59'! flush "Do nothing by default" ! ! !Stream methodsFor: 'accessing' stamp: 'MarianoMartinezPeck 8/24/2012 15:59'! nextPut: anObject "Insert the argument, anObject, as the next object accessible by the receiver. Answer anObject." self subclassResponsibility ! ! !Stream methodsFor: 'accessing' stamp: 'MarianoMartinezPeck 8/24/2012 15:59'! binary "do nothing" ^self ! ! !Stream methodsFor: 'accessing' stamp: 'yo 8/30/2002 17:13'! basicNext ^ self next. ! ! !Stream methodsFor: 'accessing'! contents "Answer all of the contents of the receiver." self subclassResponsibility! ! !Stream methodsFor: 'accessing' stamp: 'MarianoMartinezPeck 8/24/2012 15:29'! nextPutAll: aCollection "Append the elements of aCollection to the sequence of objects accessible by the receiver. Answer aCollection." aCollection do: [:v | self nextPut: v]. ^aCollection! ! !Stream methodsFor: 'accessing' stamp: 'nk 4/29/2004 10:41'! readOnly ^self! ! !Stream methodsFor: 'accessing' stamp: 'nk 4/29/2004 10:38'! localName ^'a stream'! ! !Stream methodsFor: 'accessing'! nextMatchFor: anObject "Gobble the next object and answer whether it is equal to the argument, anObject." ^anObject = self next! ! !Stream methodsFor: 'filter streaming' stamp: 'MPW 1/1/1901 00:48'! write:encodedObject ^encodedObject putOn:self. ! ! !Stream methodsFor: '*Monticello' stamp: 'cwp 8/9/2003 12:02'! isMessageStream ^ false! ! !Stream methodsFor: 'printing' stamp: 'sma 6/1/2000 09:56'! print: anObject "Have anObject print itself on the receiver." anObject printOn: self! ! !Stream methodsFor: 'enumerating'! do: aBlock "Evaluate aBlock for each of the objects accessible by receiver." [self atEnd] whileFalse: [aBlock value: self next]! ! !Stream methodsFor: 'file open/close' stamp: 'MarianoMartinezPeck 8/24/2012 15:59'! close "Presumably sets the status of the receiver to be closed. This message does nothing at this level, but is included for FileStream compatibility." ^self ! ! !Stream methodsFor: 'readability' stamp: 'kph 9/27/2007 21:53'! << items items putOn: self. ^ self! ! !Stream methodsFor: 'testing' stamp: 'MarcusDenker 7/15/2012 15:43'! isBinary ^false! ! !Stream methodsFor: 'testing' stamp: 'ar 12/23/1999 15:43'! isStream "Return true if the receiver responds to the stream protocol" ^true! ! !Stream methodsFor: 'testing' stamp: 'MarianoMartinezPeck 8/24/2012 15:59'! atEnd "Answer whether the receiver can access any more objects." self subclassResponsibility ! ! !Stream methodsFor: 'testing' stamp: 'ab 8/28/2003 18:30'! closed ^ false! ! !Stream methodsFor: 'testing' stamp: 'ClementBera 9/30/2013 10:56'! nextWordsPutAll: aCollection "Write the argument a word-like object in big endian format on the receiver. May be used to write other than plain word-like objects (such as ColorArray)." (aCollection class isPointers or: [ aCollection class isWords not ]) ifTrue: [ ^ self error: aCollection class name,' is not word-like']. 1 to: aCollection basicSize do: [ :i | self nextNumber: 4 put: (aCollection basicAt: i) ]. ^ aCollection! ! !Stream methodsFor: '*Fuel' stamp: 'MartinDias 8/13/2011 14:29'! nextBytesPutAll: aCollection "Append the bytes of aCollection to the sequence of bytes accessible by the receiver. Answer aCollection." ^self nextPutAll: aCollection! ! !Stream class methodsFor: 'instance creation' stamp: 'MarianoMartinezPeck 8/24/2012 15:59'! new self error: 'Streams are created with on: and with:'! ! Symbol initialize! Collection initialize! \ No newline at end of file diff --git a/samples/Text/messages.fr b/samples/Text/messages.fr index da0269bb..c8108873 100644 --- a/samples/Text/messages.fr +++ b/samples/Text/messages.fr @@ -1 +1,2 @@ the green potato=la pomme de terre verte +le nouveau type de musique=the new type of music diff --git a/samples/Turtle/gnd-record.ttl b/samples/Turtle/gnd-record.ttl new file mode 100644 index 00000000..ef1d2c35 --- /dev/null +++ b/samples/Turtle/gnd-record.ttl @@ -0,0 +1,183 @@ +@prefix foaf: . +@prefix owl: . +@prefix gndo: . +@prefix xsd: . + + + a ; + foaf:page ; + owl:sameAs , , ; + gndo:gndIdentifier "118514768" ; + gndo:oldAuthorityNumber "(DE-588)1022091077", "(DE-588a)118514768", "(DE-588a)141399074", "(DE-588a)139089691", "(DE-588a)141300248", "(DE-588a)136949541", "(DE-588a)134336232", "(DE-588a)12794544X", "(DE-588a)12736630X", "(DE-588a)12722811X", "(DE-588a)127228098", "(DE-588a)127228101" ; + gndo:variantNameForThePerson "Brêcht, Becton", "Brecht, Bert", "Brecht, Bertolʹ", "Brecht, Berthold", "Brecht, Bertholt", "Brecht, Bertold", "Brecht, B.", "Brecht, Eugen Berthold Friedrich", "Brecht, ...", "Brecht-Eisler, ...", "Becht, Bertolt", "Beituo'erte-Bulaixite", "Berchito, B.", "Brechtas, B.", "Brechts, Bertolts", "Brehd, Berd", "Breht, Bertolt", "Brehts, Bertolts", "Breḳhṭ, Bārṭolṭ", "Brekt, Berṭolṭ", "Brekṭ, Berṭōlṭ", "Breḳṭ, Berṭôlṭ", "Breśṭ, Berṭalṭa", "Breṣṭa, Barṭolṭa", "Brišt, Bartūlt", "Brišt, Birtūld", "Brišt, Birtult", "Buchito, Berutorutu", "Bulaixite, Beituo'erte", "Bulaixite, ...", "Burehito, Berutoruto", "Burehito, ...", "B. B.", "Larsen, Berthold", "Mprecht, Mpertolt", "Mprecht, ...", "Pulaihsit'ê, Peit'oĉrht'ê", "Pulaihsit'ê, ...", "Pŭrehit'ŭ, Peŏt'olt'ŭ", "Bŭrehit'ŭ, Beŏt'olt'ŭ", "برشت، برتولد", "브레히트, 베르톨트", "ברכט, ברטולט", "贝·布莱希特", "布莱希特, 贝", "ブレヒト, ベルトルト" ; + gndo:variantNameEntityForThePerson [ + gndo:forename "Becton" ; + gndo:surname "Brêcht" + ], [ + gndo:forename "Bert" ; + gndo:surname "Brecht" + ], [ + gndo:forename "Bertolʹ" ; + gndo:surname "Brecht" + ], [ + gndo:forename "Berthold" ; + gndo:surname "Brecht" + ], [ + gndo:forename "Bertholt" ; + gndo:surname "Brecht" + ], [ + gndo:forename "Bertold" ; + gndo:surname "Brecht" + ], [ + gndo:forename "B." ; + gndo:surname "Brecht" + ], [ + gndo:forename "Eugen Berthold Friedrich" ; + gndo:surname "Brecht" + ], [ + gndo:forename "..." ; + gndo:surname "Brecht" + ], [ + gndo:forename "..." ; + gndo:surname "Brecht-Eisler" + ], [ + gndo:forename "Bertolt" ; + gndo:surname "Becht" + ], [ gndo:personalName "Beituo'erte-Bulaixite" ], [ + gndo:forename "B." ; + gndo:surname "Berchito" + ], [ + gndo:forename "B." ; + gndo:surname "Brechtas" + ], [ + gndo:forename "Bertolts" ; + gndo:surname "Brechts" + ], [ + gndo:forename "Berd" ; + gndo:surname "Brehd" + ], [ + gndo:forename "Bertolt" ; + gndo:surname "Breht" + ], [ + gndo:forename "Bertolts" ; + gndo:surname "Brehts" + ], [ + gndo:forename "Bārṭolṭ" ; + gndo:surname "Breḳhṭ" + ], [ + gndo:forename "Berṭolṭ" ; + gndo:surname "Brekt" + ], [ + gndo:forename "Berṭōlṭ" ; + gndo:surname "Brekṭ" + ], [ + gndo:forename "Berṭôlṭ" ; + gndo:surname "Breḳṭ" + ], [ + gndo:forename "Berṭalṭa" ; + gndo:surname "Breśṭ" + ], [ + gndo:forename "Barṭolṭa" ; + gndo:surname "Breṣṭa" + ], [ + gndo:forename "Bartūlt" ; + gndo:surname "Brišt" + ], [ + gndo:forename "Birtūld" ; + gndo:surname "Brišt" + ], [ + gndo:forename "Birtult" ; + gndo:surname "Brišt" + ], [ + gndo:forename "Berutorutu" ; + gndo:surname "Buchito" + ], [ + gndo:forename "Beituo'erte" ; + gndo:surname "Bulaixite" + ], [ + gndo:forename "..." ; + gndo:surname "Bulaixite" + ], [ + gndo:forename "Berutoruto" ; + gndo:surname "Burehito" + ], [ + gndo:forename "..." ; + gndo:surname "Burehito" + ], [ gndo:personalName "B. B." ], [ + gndo:forename "Berthold" ; + gndo:surname "Larsen" + ], [ + gndo:forename "Mpertolt" ; + gndo:surname "Mprecht" + ], [ + gndo:forename "..." ; + gndo:surname "Mprecht" + ], [ + gndo:forename "Peit'oĉrht'ê" ; + gndo:surname "Pulaihsit'ê" + ], [ + gndo:forename "..." ; + gndo:surname "Pulaihsit'ê" + ], [ + gndo:forename "Peŏt'olt'ŭ" ; + gndo:surname "Pŭrehit'ŭ" + ], [ + gndo:forename "Beŏt'olt'ŭ" ; + gndo:surname "Bŭrehit'ŭ" + ], [ gndo:personalName "برشت، برتولد" ], [ + gndo:forename "베르톨트" ; + gndo:surname "브레히트" + ], [ + gndo:forename "ברטולט" ; + gndo:surname "ברכט" + ], [ gndo:personalName "贝·布莱希特" ], [ + gndo:forename "贝" ; + gndo:surname "布莱希特" + ], [ + gndo:forename "ベルトルト" ; + gndo:surname "ブレヒト" + ] ; + gndo:preferredNameForThePerson "Brecht, Bertolt" ; + gndo:preferredNameEntityForThePerson [ + gndo:forename "Bertolt" ; + gndo:surname "Brecht" + ] ; + gndo:familialRelationship , , , , , , , , , , , , , , ; + gndo:professionOrOccupation , , , , , , ; + gndo:playedInstrument ; + gndo:gndSubjectCategory , , ; + gndo:geographicAreaCode ; + gndo:languageCode ; + gndo:placeOfBirth ; + gndo:placeOfDeath ; + gndo:placeOfExile , ; + gndo:gender ; + gndo:dateOfBirth "1898-02-10"^^xsd:date ; + gndo:dateOfDeath "1956-08-14"^^xsd:date . + + gndo:preferredNameForThePerson "Brecht, Berthold Friedrich" . + gndo:preferredNameForThePerson "Banholzer, Paula" . + gndo:preferredNameForThePerson "Neher, Carola" . + gndo:preferredNameForThePerson "Banholzer, Frank" . + gndo:preferredNameForThePerson "Berlau, Ruth" . + gndo:preferredNameForThePerson "Steffin, Margarete" . + gndo:preferredNameForThePerson "Zoff, Marianne" . + gndo:preferredNameForThePerson "Weigel, Helene" . + gndo:preferredNameForThePerson "Reichel, Käthe" . + gndo:preferredNameForThePerson "Hiob, Hanne" . + gndo:preferredNameForThePerson "Brecht, Stefan" . + gndo:preferredNameForThePerson "Brecht-Schall, Barbara" . + gndo:preferredNameForThePerson "Schall, Ekkehard" . + gndo:preferredNameForThePerson "Brezing, Joseph Friedrich" . + gndo:preferredNameForThePerson "Brezing, Friederike" . + gndo:preferredNameForTheSubjectHeading "Theaterregisseur" . + gndo:preferredNameForTheSubjectHeading "Dramatiker" . + gndo:preferredNameForTheSubjectHeading "Schauspieler" . + gndo:preferredNameForTheSubjectHeading "Lyriker" . + gndo:preferredNameForTheSubjectHeading "Schriftsteller" . + gndo:preferredNameForTheSubjectHeading "Regisseur" . + gndo:preferredNameForTheSubjectHeading "Drehbuchautor" . + gndo:preferredNameForThePlaceOrGeographicName "Augsburg" . + gndo:preferredNameForThePlaceOrGeographicName "Berlin" . + gndo:preferredNameForThePlaceOrGeographicName "Dänemark" . + gndo:preferredNameForThePlaceOrGeographicName "Schweden" . \ No newline at end of file diff --git a/samples/Turtle/rdf-syntax-grammar.ttl b/samples/Turtle/rdf-syntax-grammar.ttl new file mode 100644 index 00000000..edcd4db2 --- /dev/null +++ b/samples/Turtle/rdf-syntax-grammar.ttl @@ -0,0 +1,10 @@ +@prefix rdf: . +@prefix dc: . +@prefix ex: . + + + dc:title "RDF/XML Syntax Specification (Revised)" ; + ex:editor [ + ex:fullname "Dave Beckett"; + ex:homePage + ] . \ No newline at end of file diff --git a/samples/Web Ontology Language/sample.owl b/samples/Web Ontology Language/sample.owl new file mode 100644 index 00000000..612186db --- /dev/null +++ b/samples/Web Ontology Language/sample.owl @@ -0,0 +1,6858 @@ + + + + + + + +]> + + + + + v.1.4. Added Food class (used in domain/range of hasIngredient), Added several hasCountryOfOrigin restrictions on pizzas, Made hasTopping invers functional + version 1.5 + v.1.5. Removed protege.owl import and references. Made ontology URI date-independent + An example ontology that contains all constructs required for the various versions of the Pizza Tutorial run by Manchester University (see http://www.co-ode.org/resources/tutorials/) + + + + + + + + + + + + + Americana + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AmericanaPicante + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CoberturaDeAnchovies + + + + + + + + + + + CoberturaDeArtichoke + + + + + + + + + + + + + + + + + CoberturaDeAspargos + + + + + + + + + + + + + + + + + Cajun + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CoberturaDeCajun + + + + + + + + + + + + + + + + + CoberturaDeCaper + + + + + + + + + + + + + + + + + Capricciosa + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Caprina + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CoberturaDeQueijo + + + + + + + + + + + Any pizza that has at least 1 cheese topping. + PizzaComQueijo + + + + + + + + + + + + + + + + + + + CoberturaDeQueijoComVegetais + This class will be inconsistent. This is because we have given it 2 disjoint parents, which means it could never have any members (as nothing can simultaneously be a CheeseTopping and a VegetableTopping). NB Called ProbeInconsistentTopping in the ProtegeOWL Tutorial. + + + + + + + + + + + + + + CoberturaDeFrango + + + + + + + + + + + + + + + + + Pais + A class that is equivalent to the set of individuals that are described in the enumeration - ie Countries can only be either America, England, France, Germany or Italy and nothing else. Note that these individuals have been asserted to be allDifferent from each other. + + + + + + + + + + + + + + + + + + + + + + + + BaseEspessa + + + + + + + + + + + + + + + + + Fiorentina + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CoberturaDePeixe + + + + + + + + + + + + + + + + + + + + + + + + + + + CoberturaQuatroQueijos + + + + + + + + + + + + + + + + + QuatroQueijos + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CoberturaDeFrutas + + + + + + + + + + + FrutosDoMar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CoberturaDeAlho + + + + + + + + + + + + + + + + + Giardiniera + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CoberturaDeQueijoDeCabra + + + + + + + + + + + + + + + + + CoberturaDeGorgonzola + + + + + + + + + + + + + + + + + CoberturaDePimentaoVerde + + + + + + + + + + + CoberturaDePresunto + + + + + + + + + + + CoberturaDeErvas + + + + + + + + + + + Picante + + + + + + + + + + + CoberturaDePimentaoVerdePicante + + + + + + + + + + + + + + + + + CoberturaDeBifePicante + + + + + + + + + + + + + + + + + A class to demonstrate mistakes made with setting a property domain. The property hasTopping has a domain of Pizza. This means that the reasoner can infer that all individuals using the hasTopping property must be of type Pizza. Because of the restriction on this class, all members of IceCream must use the hasTopping property, and therefore must also be members of Pizza. However, Pizza and IceCream are disjoint, so this causes an inconsistency. If they were not disjoint, IceCream would be inferred to be a subclass of Pizza. + Sorvete + + + + + + + + + + + + + + + + + PizzaInteressante + Any pizza that has at least 3 toppings. Note that this is a cardinality constraint on the hasTopping property and NOT a qualified cardinality constraint (QCR). A QCR would specify from which class the members in this relationship must be. eg has at least 3 toppings from PizzaTopping. This is currently not supported in OWL. + + + + + + 3 + + + + + + + + + + + + + CoberturaDeJalapeno + + + + + + + + + + + + + + + + + LaReine + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CoberturaDeLeek + + + + + + + + + + + + + + + + + Margherita + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CoberturaDeCarne + + + + + + + + + + + Any pizza that has at least one meat topping + PizzaDeCarne + + + + + + + + + + + + + + + + + + + Media + + + + + + + + + + + NaoPicante + + + + + + + + + + + CoberturaDeFrutosDoMarMistos + + + + + + + + + + + CoberturaDeMozzarella + + + + + + + + + + + + + + + + + + + + + + + Cogumelo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CoberturaDeCogumelo + + + + + + + + + + + + + + + + + A pizza that can be found on a pizza menu + PizzaComUmNome + + + + + + + + + + + Napoletana + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Any Pizza that is not a VegetarianPizza + PizzaNaoVegetariana + + + + + + + + + + + + + + + + + + + + CoberturaDeCastanha + + + + + + + + + + + + + + + + + CoberturaDeAzeitona + + + + + + + + + + + + + + + + + CoberturaDeCebola + + + + + + + + + + + + + + + + + CoberturaDePrezuntoParma + + + + + + + + + + + + + + + + + Parmense + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CoberturaDeParmesao + + + + + + + + + + + + + + + + + CoberturaPeperonata + + + + + + + + + + + + + + + + + CoberturaDeCalabreza + + + + + + + + + + + + + + + + + CoberturaDePimentao + + + + + + + + + + + CoberturaPetitPois + + + + + + + + + + + + + + + + + CoberturaPineKernels + + + + + + + + + + + Pizza + + + + + + + + + + + + + + + + + BaseDaPizza + + + + + + + + + + + CoberturaDaPizza + + + + + + + + + + + PolloAdAstra + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CoberturaDeCamarao + + + + + + + + + + + CoberturaPrinceCarlo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + QuatroQueijos + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This defined class has conditions that are part of the definition: ie any Pizza that has the country of origin, Italy is a RealItalianPizza. It also has conditions that merely describe the members - that all RealItalianPizzas must only have ThinAndCrispy bases. In essence, all pizzas from Italy must have ThinAndCrispy bases. + PizzaItalianaReal + + + + + + + + + + + + + + + + + + + + + + + + + CoberturaDeCebolaVermelha + + + + + + + + + + + CoberturaRocket + + + + + + + + + + + + + + + + + Rosa + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CoberturaRosemary + + + + + + + + + + + + + + + + + CoberturaEmMolho + + + + + + + + + + + Siciliana + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CoberturaDeTomateFatiado + + + + + + + + + + + + + + + + + SloppyGiuseppe + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Soho + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A ValuePartition that describes only values from Hot, Medium or Mild. NB Subclasses can themselves be divided up into further partitions. + Tempero + + + + + + + + + + + + + + + + + + + + Any pizza that has a spicy topping is a SpicyPizza + PizzaTemperada + + + + + + + + + + + + + + + + + + + An alternative definition for the SpicyPizza which does away with needing a definition of SpicyTopping and uses a slightly more complicated restriction: Pizzas that have at least one topping that is both a PizzaTopping and has spiciness hot are members of this class. + PizzaTemperadaEquivalente + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Any pizza topping that has spiciness Hot + CoberturaTemperada + + + + + + + + + + + + + + + + + + + CoberturaDeEspinafre + + + + + + + + + + + + + + + + + CoberturaSultana + + + + + + + + + + + + + + + + + CoberturaDeTomateRessecadoAoSol + + + + + + + + + + + + + + + + + CoberturaDePimentaoDoce + + + + + + + + + + + + + + + + + BaseFinaEQuebradica + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MolhoTobascoPepper + + + + + + + + + + + + + + + + + CoberturaDeTomate + + + + + + + + + + + + + + + + + PizzaAberta + An unclosed Pizza cannot be inferred to be either a VegetarianPizza or a NonVegetarianPizza, because it might have other toppings. + + + + + + + + + + + + + + + + + ValorDaParticao + A ValuePartition is a pattern that describes a restricted set of classes from which a property can be associated. The parent class is used in restrictions, and the covering axiom means that only members of the subclasses may be used as values. The possible subclasses cannot be extended without updating the ValuePartition class. + + + + + + + + CoberturaDeVegetais + + + + + + + + + + + PizzaVegetariana + Any pizza that does not have fish topping and does not have meat topping is a VegetarianPizza. Members of this class do not need to have any toppings at all. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Any pizza that only has vegetarian toppings or no toppings is a VegetarianPizzaEquiv1. Should be inferred to be equivalent to VegetarianPizzaEquiv2. Not equivalent to VegetarianPizza because PizzaTopping is not covering + PizzaVegetarianaEquivalente1 + + + + + + + + + + + + + + + + + + + An alternative to VegetarianPizzaEquiv1 that does not require a definition of VegetarianTopping. Perhaps more difficult to maintain. Not equivalent to VegetarianPizza + PizzaVegetarianaEquivalente2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + An example of a covering axiom. VegetarianTopping is equivalent to the union of all toppings in the given axiom. VegetarianToppings can only be Cheese or Vegetable or....etc. + CoberturaVegetariana + + + + + + + + + + + + + + + + + + + + + + + + + Veneziana + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NB Transitive - the ingredients of ingredients are ingredients of the whole + + + + + + + + + + + + + + + + + + A property created to be used with the ValuePartition - Spiciness. + + + + + + + + + + + + Note that hasTopping is inverse functional because isToppingOf is functional + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The inverse property tree to hasIngredient - all subproperties and attributes of the properties should reflect those under hasIngredient. + + + + + + + + + + + + + + + + + + Any given instance of topping should only be added to a single pizza (no cheap half-measures on our pizzas) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/XML/FXMLSample.fxml b/samples/XML/FXMLSample.fxml new file mode 100644 index 00000000..30b56b04 --- /dev/null +++ b/samples/XML/FXMLSample.fxml @@ -0,0 +1,30 @@ + + + + + + + + + +
+ + + + + + + +
+ + + + + + + +
diff --git a/samples/XML/libsomething.dll.config b/samples/XML/libsomething.dll.config new file mode 100644 index 00000000..3d54afea --- /dev/null +++ b/samples/XML/libsomething.dll.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/samples/XML/phpunit.xml.dist b/samples/XML/phpunit.xml.dist new file mode 100644 index 00000000..1d192902 --- /dev/null +++ b/samples/XML/phpunit.xml.dist @@ -0,0 +1,14 @@ + + + + + tests + + + + + src + + + diff --git a/script/bootstrap b/script/bootstrap new file mode 100755 index 00000000..e86baee4 --- /dev/null +++ b/script/bootstrap @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +cd "$(dirname "$0")/.." + +bundle config --local path vendor/gems + +bundle check > /dev/null 2>&1 || bundle install + +git submodule init +git submodule sync --quiet +script/fast-submodule-update diff --git a/script/cibuild b/script/cibuild index 4dbcf970..62cd4242 100755 --- a/script/cibuild +++ b/script/cibuild @@ -1,4 +1,7 @@ #!/bin/sh + +set -e + if [ -d /usr/share/rbenv/shims ]; then export PATH=/usr/share/rbenv/shims:$PATH export RBENV_VERSION=2.1.2-github @@ -11,11 +14,9 @@ ruby -v bundle -v set +x -mkdir -p ./vendor/gems - # Clean out any unversioned files git clean -fd -bundle install --local --path ./vendor/gems +script/bootstrap bundle exec rake samples bundle exec rake diff --git a/script/download-grammars b/script/convert-grammars similarity index 63% rename from script/download-grammars rename to script/convert-grammars index e0dfe10c..7c45a7c8 100755 --- a/script/download-grammars +++ b/script/convert-grammars @@ -2,19 +2,72 @@ require 'json' require 'net/http' +require 'optparse' require 'plist' require 'set' +require 'thread' require 'tmpdir' require 'uri' require 'yaml' -GRAMMARS_PATH = File.expand_path("../../grammars", __FILE__) -SOURCES_FILE = File.expand_path("../../grammars.yml", __FILE__) -CSONC = File.expand_path("../../node_modules/.bin/csonc", __FILE__) +ROOT = File.expand_path("../..", __FILE__) +GRAMMARS_PATH = File.join(ROOT, "grammars") +SOURCES_FILE = File.join(ROOT, "grammars.yml") +CSONC = File.join(ROOT, "node_modules", ".bin", "csonc") + +$options = { + :add => false, + :install => true, + :output => SOURCES_FILE, + :remote => true, +} + +class SingleFile + def initialize(path) + @path = path + end + + def url + @path + end + + def fetch(tmp_dir) + [@path] + end +end + +class DirectoryPackage + def self.fetch(dir) + Dir["#{dir}/**/*"].select do |path| + case File.extname(path.downcase) + when '.plist' + path.split('/')[-2] == 'Syntaxes' + when '.tmlanguage' + true + when '.cson', '.json' + path.split('/')[-2] == 'grammars' + else + false + end + end + end + + def initialize(directory) + @directory = directory + end + + def url + @directory + end + + def fetch(tmp_dir) + self.class.fetch(File.join(ROOT, @directory)) + end +end class TarballPackage def self.fetch(tmp_dir, url) - `curl --silent --location --max-time 10 --output "#{tmp_dir}/archive" "#{url}"` + `curl --silent --location --max-time 30 --output "#{tmp_dir}/archive" "#{url}"` raise "Failed to fetch GH package: #{url} #{$?.to_s}" unless $?.success? output = File.join(tmp_dir, 'extracted') @@ -22,18 +75,7 @@ class TarballPackage `tar -C "#{output}" -xf "#{tmp_dir}/archive"` raise "Failed to uncompress tarball: #{tmp_dir}/archive (from #{url}) #{$?.to_s}" unless $?.success? - Dir["#{output}/**/*"].select do |path| - case File.extname(path.downcase) - when '.plist' - path.split('/')[-2] == 'Syntaxes' - when '.tmlanguage' - true - when '.cson' - path.split('/')[-2] == 'grammars' - else - false - end - end + DirectoryPackage.fetch(output) end attr_reader :url @@ -110,13 +152,24 @@ def load_grammar(path) cson = `"#{CSONC}" "#{path}"` raise "Failed to convert CSON grammar '#{path}': #{$?.to_s}" unless $?.success? JSON.parse(cson) + when '.json' + JSON.parse(File.read(path)) else raise "Invalid document type #{path}" end end -def install_grammar(tmp_dir, source, all_scopes) - p = if source.end_with?('.tmLanguage', '.plist') +def load_grammars(tmp_dir, source, all_scopes) + is_url = source.start_with?("http:", "https:") + return [] if is_url && !$options[:remote] + + p = if !is_url + if File.directory?(source) + DirectoryPackage.new(source) + else + SingleFile.new(source) + end + elsif source.end_with?('.tmLanguage', '.plist') SingleGrammar.new(source) elsif source.start_with?('https://github.com') GitHubPackage.new(source) @@ -130,9 +183,7 @@ def install_grammar(tmp_dir, source, all_scopes) raise "Unsupported source: #{source}" unless p - installed = [] - - p.fetch(tmp_dir).each do |path| + p.fetch(tmp_dir).map do |path| grammar = load_grammar(path) scope = grammar['scopeName'] @@ -142,13 +193,21 @@ def install_grammar(tmp_dir, source, all_scopes) " Previous package: #{all_scopes[scope]}" next end - - File.write(File.join(GRAMMARS_PATH, "#{scope}.json"), JSON.pretty_generate(grammar)) all_scopes[scope] = p.url + grammar + end +end + +def install_grammars(grammars, path) + installed = [] + + grammars.each do |grammar| + scope = grammar['scopeName'] + File.write(File.join(GRAMMARS_PATH, "#{scope}.json"), JSON.pretty_generate(grammar)) installed << scope end - $stderr.puts("OK #{p.url} (#{installed.join(', ')})") + $stderr.puts("OK #{path} (#{installed.join(', ')})") end def run_thread(queue, all_scopes) @@ -164,7 +223,8 @@ def run_thread(queue, all_scopes) dir = "#{tmpdir}/#{index}" Dir.mkdir(dir) - install_grammar(dir, source, all_scopes) + grammars = load_grammars(dir, source, all_scopes) + install_grammars(grammars, source) if $options[:install] end end end @@ -175,7 +235,7 @@ def generate_yaml(all_scopes, base) out[value] << key end - yaml = yaml.sort.to_h + yaml = Hash[yaml.sort] yaml.each { |k, v| v.sort! } yaml end @@ -190,9 +250,10 @@ def main(sources) all_scopes = {} - if ARGV[0] == '--add' + if source = $options[:add] Dir.mktmpdir do |tmpdir| - install_grammar(tmpdir, ARGV[1], all_scopes) + grammars = load_grammars(tmpdir, source, all_scopes) + install_grammars(grammars, source) if $options[:install] end generate_yaml(all_scopes, sources) else @@ -210,12 +271,34 @@ def main(sources) end end +OptionParser.new do |opts| + opts.banner = "Usage: #{$0} [options]" + + opts.on("--add GRAMMAR", "Add a new grammar. GRAMMAR may be a file path or URL.") do |a| + $options[:add] = a + end + + opts.on("--[no-]install", "Install grammars into grammars/ directory.") do |i| + $options[:install] = i + end + + opts.on("--output FILE", "Write output to FILE. Use - for stdout.") do |o| + $options[:output] = o == "-" ? $stdout : o + end + + opts.on("--[no-]remote", "Download remote grammars.") do |r| + $options[:remote] = r + end +end.parse! + sources = File.open(SOURCES_FILE) do |file| YAML.load(file) end yaml = main(sources) -File.write(SOURCES_FILE, YAML.dump(yaml)) - -$stderr.puts("Done") +if $options[:output].is_a?(IO) + $options[:output].write(YAML.dump(yaml)) +else + File.write($options[:output], YAML.dump(yaml)) +end diff --git a/script/fast-submodule-update b/script/fast-submodule-update new file mode 100755 index 00000000..dff1be7d --- /dev/null +++ b/script/fast-submodule-update @@ -0,0 +1,67 @@ +#!/usr/bin/env ruby + +require "thread" + +ROOT = File.expand_path("../..", __FILE__).freeze +Dir.chdir(ROOT) + +SUBMODULES = `git config --list --file .gitmodules`.lines.grep(/\.path=/).map { |line| line.chomp.split("=", 2).last }.freeze +SLOW_SUBMODULES = %w[ + vendor/grammars/factor + vendor/grammars/fsharpbinding + vendor/grammars/ioke-outdated +] + +class TaskResult < Struct.new(:submodule, :output, :status); end + +def run_process(*args) + read, write = IO.pipe + pid = Process.spawn(*args, in: :close, out: write, err: [:child, :out]) + write.close + output = read.read + read.close + Process.wait(pid) + [output, $?] +end + +def update_submodule(submodule) + output, status = run_process("git", "submodule", "update", "--", submodule) + TaskResult.new(submodule, output, status) +end + +def run_thread(submodules, results) + loop do + begin + submodule = submodules.pop(true) + rescue ThreadError + # The queue is empty. + break + end + + results.push(update_submodule(submodule)) + end +end + +submodules = Queue.new +results = Queue.new + +# Update the slow submodules first so they can update in the background while +# the fast ones run. +SUBMODULES.partition { |submodule| SLOW_SUBMODULES.include?(submodule) }.flatten.each do |submodule| + submodules.push(submodule) +end + +8.times do + Thread.new { run_thread(submodules, results) } +end + +success = true +SUBMODULES.each do + result = results.pop + unless result.status.success? + success = false + puts "Error updating #{result.submodule}" + end + puts result.output if result.output =~ /\S/ +end +exit success ? 0 : 1 diff --git a/script/travis/before_install b/script/travis/before_install new file mode 100755 index 00000000..442f6718 --- /dev/null +++ b/script/travis/before_install @@ -0,0 +1,20 @@ +#!/bin/sh + +set -ex + +# Fetch all commits/refs needed to run our tests. +git fetch origin master:master v2.0.0:v2.0.0 test/attributes:test/attributes test/master:test/master + +script/vendor-deb libicu48 libicu-dev +if ruby -e 'exit RUBY_VERSION >= "2.0" && RUBY_VERSION < "2.1"'; then + # Workaround for https://bugs.ruby-lang.org/issues/8074. We can't use this + # solution on all versions of Ruby due to + # https://github.com/bundler/bundler/pull/3338. + bundle config build.charlock_holmes --with-icu-include=$(pwd)/vendor/debs/include --with-icu-lib=$(pwd)/vendor/debs/lib +else + bundle config build.charlock_holmes --with-icu-dir=$(pwd)/vendor/debs +fi + +git submodule init +git submodule sync --quiet +script/fast-submodule-update diff --git a/script/vendor-deb b/script/vendor-deb new file mode 100755 index 00000000..ebad3e76 --- /dev/null +++ b/script/vendor-deb @@ -0,0 +1,13 @@ +#!/bin/sh + +set -ex + +cd "$(dirname "$0")/.." + +mkdir -p vendor/apt vendor/debs + +(cd vendor/apt && apt-get --assume-yes download "$@") + +for deb in vendor/apt/*.deb; do + ar p $deb data.tar.gz | tar -vzxC vendor/debs --strip-components=2 +done diff --git a/test/helper.rb b/test/helper.rb index 780819dc..ebfeefc7 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -1,4 +1,4 @@ require "bundler/setup" -require "test/unit" +require "minitest/autorun" require "mocha/setup" require "linguist" diff --git a/test/test_blob.rb b/test/test_blob.rb index 6e588442..372ff13f 100644 --- a/test/test_blob.rb +++ b/test/test_blob.rb @@ -1,6 +1,6 @@ require_relative "./helper" -class TestBlob < Test::Unit::TestCase +class TestBlob < Minitest::Test include Linguist def setup diff --git a/test/test_classifier.rb b/test/test_classifier.rb index 8e1d8355..1d10d512 100644 --- a/test/test_classifier.rb +++ b/test/test_classifier.rb @@ -1,6 +1,6 @@ require_relative "./helper" -class TestClassifier < Test::Unit::TestCase +class TestClassifier < Minitest::Test include Linguist def samples_path diff --git a/test/test_file_blob.rb b/test/test_file_blob.rb index 9371dce7..30d483fe 100644 --- a/test/test_file_blob.rb +++ b/test/test_file_blob.rb @@ -1,7 +1,6 @@ -require 'linguist/file_blob' -require 'test/unit' +require_relative "./helper" -class TestFileBlob < Test::Unit::TestCase +class TestFileBlob < Minitest::Test def test_extensions assert_equal [".gitignore"], Linguist::FileBlob.new(".gitignore").extensions assert_equal [".xml"], Linguist::FileBlob.new("build.xml").extensions diff --git a/test/test_generated.rb b/test/test_generated.rb new file mode 100644 index 00000000..1c3f8d90 --- /dev/null +++ b/test/test_generated.rb @@ -0,0 +1,55 @@ +require_relative "./helper" + +class TestGenerated < Minitest::Test + include Linguist + + def samples_path + File.expand_path("../../samples", __FILE__) + end + + class DataLoadedError < StandardError; end + + def generated_without_loading_data(name) + blob = File.join(samples_path, name) + begin + assert Generated.generated?(blob, lambda { raise DataLoadedError.new }), "#{name} was not recognized as a generated file" + rescue DataLoadedError + assert false, "Data was loaded when calling generated? on #{name}" + end + end + + def generated_loading_data(name) + blob = File.join(samples_path, name) + assert_raises(DataLoadedError, "Data wasn't loaded when calling generated? on #{name}") do + Generated.generated?(blob, lambda { raise DataLoadedError.new }) + end + end + + def test_check_generated_without_loading_data + # Xcode project files + generated_without_loading_data("Binary/MainMenu.nib") + generated_without_loading_data("Dummy/foo.xcworkspacedata") + generated_without_loading_data("Dummy/foo.xcuserstate") + + # .NET designer file + generated_without_loading_data("Dummu/foo.designer.cs") + + # Composer generated composer.lock file + generated_without_loading_data("JSON/composer.lock") + + # Node modules + generated_without_loading_data("Dummy/node_modules/foo.js") + + # Godep saved dependencies + generated_without_loading_data("Godeps/Godeps.json") + generated_without_loading_data("Godeps/_workspace/src/github.com/kr/s3/sign.go") + + # Generated by Zephir + generated_without_loading_data("C/exception.zep.c") + generated_without_loading_data("C/exception.zep.h") + generated_without_loading_data("PHP/exception.zep.php") + + # Minified files + generated_loading_data("JavaScript/jquery-1.6.1.min.js") + end +end diff --git a/test/test_grammars.rb b/test/test_grammars.rb new file mode 100644 index 00000000..188bc187 --- /dev/null +++ b/test/test_grammars.rb @@ -0,0 +1,136 @@ +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 + ].freeze + + def setup + @grammars = YAML.load(File.read(File.join(ROOT, "grammars.yml"))) + end + + def test_no_duplicate_scopes + scopes = @grammars.values.flatten + duplicates = scopes.group_by { |s| s }.select { |k, v| v.length > 1 }.map(&:first) + assert duplicates.empty?, "The following scopes appear in grammars.yml more than once:\n#{duplicates.sort.join("\n")}" + end + + def test_submodules_are_in_sync + # Strip off paths inside the submodule so that just the submodule path remains. + listed_submodules = @grammars.keys.grep(/vendor\/grammars/).map { |source| source[%r{vendor/grammars/[^/]+}] } + + nonexistent_submodules = listed_submodules - submodule_paths + unlisted_submodules = submodule_paths - listed_submodules + + message = "" + unless nonexistent_submodules.empty? + message << "The following submodules are listed in grammars.yml but don't seem to exist in the repository.\n" + message << "Either add them using `git submodule add` or remove them from grammars.yml.\n" + message << nonexistent_submodules.sort.join("\n") + end + unless unlisted_submodules.empty? + message << "\n" unless message.empty? + message << "The following submodules exist in the repository but aren't listed in grammars.yml.\n" + message << "Either add them to grammars.yml or remove them from the repository using `git rm`.\n" + message << unlisted_submodules.sort.join("\n") + end + + assert nonexistent_submodules.empty? && unlisted_submodules.empty?, message + end + + def test_local_scopes_are_in_sync + actual = YAML.load(`"#{File.join(ROOT, "script", "convert-grammars")}" --output - --no-install --no-remote`) + assert $?.success?, "script/convert-grammars failed" + + # We're not checking remote grammars. That can take a long time and make CI + # flaky if network conditions are poor. + @grammars.delete_if { |k, v| k.start_with?("http:", "https:") } + + @grammars.each do |k, v| + assert_equal v, actual[k], "The scopes listed for #{k} in grammars.yml don't match the scopes found in that repository" + end + end + + def test_submodules_have_licenses + categories = submodule_paths.group_by do |submodule| + files = Dir[File.join(ROOT, submodule, "*")] + license = files.find { |path| File.basename(path) =~ /\b(un)?licen[cs]e\b/i } || files.find { |path| File.basename(path) =~ /\bcopying\b/i } + if license.nil? + if readme = files.find { |path| File.basename(path) =~ /\Areadme\b/i } + license = readme if File.read(readme) =~ /\blicen[cs]e\b/i + end + end + if license.nil? + :unlicensed + elsif classify_license(license) + :licensed + else + :unrecognized + end + end + + 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) + + message = "" + if disallowed_unlicensed.any? + message << "The following grammar submodules don't seem to have a license. All grammars must have a license that permits redistribution.\n" + message << disallowed_unlicensed.sort.join("\n") + end + if disallowed_unrecognized.any? + message << "\n\n" unless message.empty? + message << "The following grammar submodules have an unrecognized license. Please update #{__FILE__} to recognize the license.\n" + message << disallowed_unrecognized.sort.join("\n") + 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 << "or have been removed from the repository. Please remove them from the whitelist.\n" + message << extra_whitelist_entries.sort.join("\n") + end + + assert disallowed_unlicensed.empty? && disallowed_unrecognized.empty? && extra_whitelist_entries.empty?, message + end + + private + + def submodule_paths + @submodule_paths ||= `git config --list --file "#{File.join(ROOT, ".gitmodules")}"`.lines.grep(/\.path=/).map { |line| line.chomp.split("=", 2).last } + end + + def classify_license(path) + content = File.read(path) + if content.include?("Apache License") && content.include?("2.0") + "Apache 2.0" + elsif content.include?("GNU") && content =~ /general/i && content =~ /public/i + if content =~ /version 2/i + "GPLv2" + elsif content =~ /version 3/i + "GPLv3" + end + elsif content.include?("GPL") && content.include?("http://www.gnu.org/licenses/gpl.html") + "GPLv3" + elsif content.include?("Creative Commons") + "CC" + elsif content.include?("tidy-license.txt") || content.include?("If not otherwise specified (see below)") + "textmate" + elsif content =~ /^\s*[*-]\s+Redistribution/ || content.include?("Redistributions of source code") + "BSD" + elsif content.include?("Permission is hereby granted") || content =~ /\bMIT\b/ + "MIT" + elsif content.include?("unlicense.org") + "unlicense" + elsif content.include?("http://www.wtfpl.net/txt/copying/") + "WTFPL" + end + end +end diff --git a/test/test_heuristics.rb b/test/test_heuristics.rb index 73454806..b88d0fda 100644 --- a/test/test_heuristics.rb +++ b/test/test_heuristics.rb @@ -1,6 +1,6 @@ require_relative "./helper" -class TestHeuristcs < Test::Unit::TestCase +class TestHeuristcs < Minitest::Test include Linguist def samples_path @@ -140,6 +140,13 @@ class TestHeuristcs < Test::Unit::TestCase }) end + def test_cs_by_heuristics + assert_heuristics({ + "C#" => all_fixtures("C#", "*.cs"), + "Smalltalk" => all_fixtures("Smalltalk", "*.cs") + }) + end + def assert_heuristics(hash) candidates = hash.keys.map { |l| Language[l] } diff --git a/test/test_language.rb b/test/test_language.rb index fb6e102b..1a39744e 100644 --- a/test/test_language.rb +++ b/test/test_language.rb @@ -1,6 +1,6 @@ require_relative "./helper" -class TestLanguage < Test::Unit::TestCase +class TestLanguage < Minitest::Test include Linguist def test_find_by_alias @@ -198,7 +198,7 @@ class TestLanguage < Test::Unit::TestCase def test_find_all_by_extension Language.all.each do |language| language.extensions.each do |extension| - assert_include Language.find_by_extension(extension), language + assert_includes Language.find_by_extension(extension), language end end end @@ -283,7 +283,7 @@ class TestLanguage < Test::Unit::TestCase end def test_error_without_name - assert_raise ArgumentError do + assert_raises ArgumentError do Language.new :name => nil end end diff --git a/test/test_md5.rb b/test/test_md5.rb index 17006e2e..16b1c15b 100644 --- a/test/test_md5.rb +++ b/test/test_md5.rb @@ -1,6 +1,6 @@ require_relative "./helper" -class TestMD5 < Test::Unit::TestCase +class TestMD5 < Minitest::Test include Linguist def test_hexdigest_string @@ -12,28 +12,28 @@ class TestMD5 < Test::Unit::TestCase assert_equal "450c1ae043459546517b3dd2f98250f0", MD5.hexdigest(:foo) assert_equal "f06967526af9d7a512594b0a81b31ede", MD5.hexdigest(:bar) - assert_not_equal MD5.hexdigest("foo"), MD5.hexdigest(:foo) + refute_equal MD5.hexdigest("foo"), MD5.hexdigest(:foo) end def test_hexdigest_integer assert_equal "7605ec17fd7fd213fdcd23cac302cbb4", MD5.hexdigest(1) assert_equal "097c311a46d330e4e119ba2b1dc0f9a5", MD5.hexdigest(2) - assert_not_equal MD5.hexdigest("1"), MD5.hexdigest(1) + refute_equal MD5.hexdigest("1"), MD5.hexdigest(1) end def test_hexdigest_boolean assert_equal "a690a0615820e2e5c53901d8b8958509", MD5.hexdigest(true) assert_equal "fca6a9b459e702fa93513c6a8b8c5dfe", MD5.hexdigest(false) - assert_not_equal MD5.hexdigest("true"), MD5.hexdigest(true) - assert_not_equal MD5.hexdigest("false"), MD5.hexdigest(false) + refute_equal MD5.hexdigest("true"), MD5.hexdigest(true) + refute_equal MD5.hexdigest("false"), MD5.hexdigest(false) end def test_hexdigest_nil assert_equal "35589a1cc0b3ca90fc52d0e711c0c434", MD5.hexdigest(nil) - assert_not_equal MD5.hexdigest("nil"), MD5.hexdigest(nil) + refute_equal MD5.hexdigest("nil"), MD5.hexdigest(nil) end def test_hexdigest_array @@ -49,7 +49,7 @@ class TestMD5 < Test::Unit::TestCase assert_equal "868ee214faf277829a85667cf332749f", MD5.hexdigest({:a => 1}) assert_equal "fa9df957c2b26de6fcca9d062ea8701e", MD5.hexdigest({:b => 2}) - assert_not_equal MD5.hexdigest([:b, 2]), MD5.hexdigest({:b => 2}) + refute_equal MD5.hexdigest([:b, 2]), MD5.hexdigest({:b => 2}) assert_equal MD5.hexdigest({:b => 2, :a => 1}), MD5.hexdigest({:a => 1, :b => 2}) assert_equal MD5.hexdigest({:c => 3, :b => 2, :a => 1}), MD5.hexdigest({:a => 1, :b => 2, :c => 3}) diff --git a/test/test_pedantic.rb b/test/test_pedantic.rb index be8ce063..0861b8d8 100644 --- a/test/test_pedantic.rb +++ b/test/test_pedantic.rb @@ -1,8 +1,9 @@ require_relative "./helper" -class TestPedantic < Test::Unit::TestCase +class TestPedantic < Minitest::Test filename = File.expand_path("../../lib/linguist/languages.yml", __FILE__) LANGUAGES = YAML.load(File.read(filename)) + GRAMMARS = YAML.load(File.read(File.expand_path("../../grammars.yml", __FILE__))) def test_language_names_are_sorted assert_sorted LANGUAGES.keys @@ -21,6 +22,16 @@ class TestPedantic < Test::Unit::TestCase end end + def test_grammars_are_sorted + assert_sorted GRAMMARS.keys + end + + def test_scopes_are_sorted + GRAMMARS.values.each do |scopes| + assert_sorted scopes + end + end + def assert_sorted(list) list.each_cons(2) do |previous, item| flunk "#{previous} should come after #{item}" if previous > item diff --git a/test/test_repository.rb b/test/test_repository.rb index d07d86da..b661668d 100644 --- a/test/test_repository.rb +++ b/test/test_repository.rb @@ -1,6 +1,6 @@ require_relative "./helper" -class TestRepository < Test::Unit::TestCase +class TestRepository < Minitest::Test def rugged_repository @rugged ||= Rugged::Repository.new(File.expand_path("../../.git", __FILE__)) end diff --git a/test/test_samples.rb b/test/test_samples.rb index f47244ed..0b0722dc 100644 --- a/test/test_samples.rb +++ b/test/test_samples.rb @@ -1,7 +1,7 @@ require_relative "./helper" require "tempfile" -class TestSamples < Test::Unit::TestCase +class TestSamples < Minitest::Test include Linguist def test_up_to_date @@ -43,7 +43,7 @@ class TestSamples < Test::Unit::TestCase if extnames = Samples.cache['extnames'][name] extnames.each do |extname| next if extname == '.script!' - assert options['extensions'].include?(extname), "#{name} has a sample with extension (#{extname}) that isn't explicitly defined in languages.yml" + assert options['extensions'].index { |x| x.end_with? extname }, "#{name} has a sample with extension (#{extname}) that isn't explicitly defined in languages.yml" end end diff --git a/test/test_shebang.rb b/test/test_shebang.rb index 5ead299d..a2d25117 100644 --- a/test/test_shebang.rb +++ b/test/test_shebang.rb @@ -1,6 +1,6 @@ require_relative "./helper" -class TestShebang < Test::Unit::TestCase +class TestShebang < Minitest::Test include Linguist def assert_interpreter(interpreter, body) diff --git a/test/test_tokenizer.rb b/test/test_tokenizer.rb index 5dab023e..24a74105 100644 --- a/test/test_tokenizer.rb +++ b/test/test_tokenizer.rb @@ -1,6 +1,6 @@ require_relative "./helper" -class TestTokenizer < Test::Unit::TestCase +class TestTokenizer < Minitest::Test include Linguist def samples_path diff --git a/vendor/cache/byebug-3.5.1.gem b/vendor/cache/byebug-3.5.1.gem deleted file mode 100644 index 4a2f7840..00000000 Binary files a/vendor/cache/byebug-3.5.1.gem and /dev/null differ diff --git a/vendor/cache/charlock_holmes-0.7.3.gem b/vendor/cache/charlock_holmes-0.7.3.gem deleted file mode 100644 index f07f5cba..00000000 Binary files a/vendor/cache/charlock_holmes-0.7.3.gem and /dev/null differ diff --git a/vendor/cache/coderay-1.1.0.gem b/vendor/cache/coderay-1.1.0.gem deleted file mode 100644 index 20f29116..00000000 Binary files a/vendor/cache/coderay-1.1.0.gem and /dev/null differ diff --git a/vendor/cache/columnize-0.8.9.gem b/vendor/cache/columnize-0.8.9.gem deleted file mode 100644 index bc23af26..00000000 Binary files a/vendor/cache/columnize-0.8.9.gem and /dev/null differ diff --git a/vendor/cache/debugger-linecache-1.2.0.gem b/vendor/cache/debugger-linecache-1.2.0.gem deleted file mode 100644 index 723619d3..00000000 Binary files a/vendor/cache/debugger-linecache-1.2.0.gem and /dev/null differ diff --git a/vendor/cache/escape_utils-1.0.1.gem b/vendor/cache/escape_utils-1.0.1.gem deleted file mode 100644 index 08021101..00000000 Binary files a/vendor/cache/escape_utils-1.0.1.gem and /dev/null differ diff --git a/vendor/cache/metaclass-0.0.4.gem b/vendor/cache/metaclass-0.0.4.gem deleted file mode 100644 index b32424b0..00000000 Binary files a/vendor/cache/metaclass-0.0.4.gem and /dev/null differ diff --git a/vendor/cache/method_source-0.8.2.gem b/vendor/cache/method_source-0.8.2.gem deleted file mode 100644 index 842453a3..00000000 Binary files a/vendor/cache/method_source-0.8.2.gem and /dev/null differ diff --git a/vendor/cache/mime-types-2.4.3.gem b/vendor/cache/mime-types-2.4.3.gem deleted file mode 100644 index 670e7110..00000000 Binary files a/vendor/cache/mime-types-2.4.3.gem and /dev/null differ diff --git a/vendor/cache/mocha-1.1.0.gem b/vendor/cache/mocha-1.1.0.gem deleted file mode 100644 index 39128ca4..00000000 Binary files a/vendor/cache/mocha-1.1.0.gem and /dev/null differ diff --git a/vendor/cache/plist-3.1.0.gem b/vendor/cache/plist-3.1.0.gem deleted file mode 100644 index 2f7934a7..00000000 Binary files a/vendor/cache/plist-3.1.0.gem and /dev/null differ diff --git a/vendor/cache/pry-0.10.1.gem b/vendor/cache/pry-0.10.1.gem deleted file mode 100644 index 25868753..00000000 Binary files a/vendor/cache/pry-0.10.1.gem and /dev/null differ diff --git a/vendor/cache/rake-10.3.2.gem b/vendor/cache/rake-10.3.2.gem deleted file mode 100644 index 59f5fb63..00000000 Binary files a/vendor/cache/rake-10.3.2.gem and /dev/null differ diff --git a/vendor/cache/rugged-0.22.0b4.gem b/vendor/cache/rugged-0.22.0b4.gem deleted file mode 100644 index 5f8a68bc..00000000 Binary files a/vendor/cache/rugged-0.22.0b4.gem and /dev/null differ diff --git a/vendor/cache/slop-3.6.0.gem b/vendor/cache/slop-3.6.0.gem deleted file mode 100644 index 153a673d..00000000 Binary files a/vendor/cache/slop-3.6.0.gem and /dev/null differ diff --git a/vendor/cache/yajl-ruby-1.1.0.gem b/vendor/cache/yajl-ruby-1.1.0.gem deleted file mode 100644 index 3fcb580e..00000000 Binary files a/vendor/cache/yajl-ruby-1.1.0.gem and /dev/null differ diff --git a/vendor/grammars/Agda.tmbundle b/vendor/grammars/Agda.tmbundle new file mode 160000 index 00000000..68a218c4 --- /dev/null +++ b/vendor/grammars/Agda.tmbundle @@ -0,0 +1 @@ +Subproject commit 68a218c489c809655f74164f83b78d359a82989a diff --git a/vendor/grammars/Alloy.tmbundle b/vendor/grammars/Alloy.tmbundle new file mode 160000 index 00000000..dfcc81df --- /dev/null +++ b/vendor/grammars/Alloy.tmbundle @@ -0,0 +1 @@ +Subproject commit dfcc81df4453bf3669862a12073225ca210bc41a diff --git a/vendor/grammars/AutoHotkey b/vendor/grammars/AutoHotkey new file mode 160000 index 00000000..a2207359 --- /dev/null +++ b/vendor/grammars/AutoHotkey @@ -0,0 +1 @@ +Subproject commit a2207359782c564a9a3bfe5142d7b5a250d9b18b diff --git a/vendor/grammars/ColdFusion b/vendor/grammars/ColdFusion new file mode 160000 index 00000000..ee54c805 --- /dev/null +++ b/vendor/grammars/ColdFusion @@ -0,0 +1 @@ +Subproject commit ee54c80589c1618c5a8c55afdc83f770d7bdf44b diff --git a/vendor/grammars/Docker.tmbundle b/vendor/grammars/Docker.tmbundle new file mode 160000 index 00000000..8f28cd87 --- /dev/null +++ b/vendor/grammars/Docker.tmbundle @@ -0,0 +1 @@ +Subproject commit 8f28cd8714072c1a6d3478e700948ee20143c561 diff --git a/vendor/grammars/Elm.tmLanguage b/vendor/grammars/Elm.tmLanguage new file mode 160000 index 00000000..1d2e0963 --- /dev/null +++ b/vendor/grammars/Elm.tmLanguage @@ -0,0 +1 @@ +Subproject commit 1d2e0963012d4959d5517c3dd0dcf486b1ded74b diff --git a/vendor/grammars/Handlebars b/vendor/grammars/Handlebars new file mode 160000 index 00000000..87669eb0 --- /dev/null +++ b/vendor/grammars/Handlebars @@ -0,0 +1 @@ +Subproject commit 87669eb08dc58f6237f0c884774dc387a9e5e9da diff --git a/vendor/grammars/IDL-Syntax b/vendor/grammars/IDL-Syntax new file mode 160000 index 00000000..3baeaeaf --- /dev/null +++ b/vendor/grammars/IDL-Syntax @@ -0,0 +1 @@ +Subproject commit 3baeaeafac9e30e8a4b0789105641e0b59da32a9 diff --git a/vendor/grammars/Isabelle.tmbundle b/vendor/grammars/Isabelle.tmbundle new file mode 160000 index 00000000..b13c44c3 --- /dev/null +++ b/vendor/grammars/Isabelle.tmbundle @@ -0,0 +1 @@ +Subproject commit b13c44c30f4549d31deb293e7e341918bf2c46a7 diff --git a/vendor/grammars/Julia.tmbundle b/vendor/grammars/Julia.tmbundle new file mode 160000 index 00000000..6541d86c --- /dev/null +++ b/vendor/grammars/Julia.tmbundle @@ -0,0 +1 @@ +Subproject commit 6541d86c1f6f19a3a0a26917e9dd81b043b37bc3 diff --git a/vendor/grammars/LiveScript.tmbundle b/vendor/grammars/LiveScript.tmbundle new file mode 160000 index 00000000..801cfac6 --- /dev/null +++ b/vendor/grammars/LiveScript.tmbundle @@ -0,0 +1 @@ +Subproject commit 801cfac6023c43b03354bd6b0fb79aeb02ebd779 diff --git a/vendor/grammars/NSIS b/vendor/grammars/NSIS new file mode 160000 index 00000000..53b64a0a --- /dev/null +++ b/vendor/grammars/NSIS @@ -0,0 +1 @@ +Subproject commit 53b64a0a11a1a505be1aa6b382edef82690bf41e diff --git a/vendor/grammars/NimLime b/vendor/grammars/NimLime new file mode 160000 index 00000000..3aab3b38 --- /dev/null +++ b/vendor/grammars/NimLime @@ -0,0 +1 @@ +Subproject commit 3aab3b3841707e2c1ebac7fad758ec2ca0c7d936 diff --git a/vendor/grammars/PHP-Twig.tmbundle b/vendor/grammars/PHP-Twig.tmbundle new file mode 160000 index 00000000..ad0f5147 --- /dev/null +++ b/vendor/grammars/PHP-Twig.tmbundle @@ -0,0 +1 @@ +Subproject commit ad0f5147e6d7ae70469084659cffcfd22575869e diff --git a/vendor/grammars/RDoc.tmbundle b/vendor/grammars/RDoc.tmbundle new file mode 160000 index 00000000..6a403e7e --- /dev/null +++ b/vendor/grammars/RDoc.tmbundle @@ -0,0 +1 @@ +Subproject commit 6a403e7e2fc8800133075e27fa55f30a7885c41a diff --git a/vendor/grammars/Racket b/vendor/grammars/Racket new file mode 160000 index 00000000..02739c25 --- /dev/null +++ b/vendor/grammars/Racket @@ -0,0 +1 @@ +Subproject commit 02739c25aefb484a031e58ff7a628adf4c97225f diff --git a/vendor/grammars/SCSS.tmbundle b/vendor/grammars/SCSS.tmbundle new file mode 160000 index 00000000..8ef6283d --- /dev/null +++ b/vendor/grammars/SCSS.tmbundle @@ -0,0 +1 @@ +Subproject commit 8ef6283dcbd59795b818b646f20a7ff1cd23985f diff --git a/vendor/grammars/Scalate.tmbundle b/vendor/grammars/Scalate.tmbundle new file mode 160000 index 00000000..0307535a --- /dev/null +++ b/vendor/grammars/Scalate.tmbundle @@ -0,0 +1 @@ +Subproject commit 0307535add076965c8cd438d0f4109bec7d68d2d diff --git a/vendor/grammars/Slash.tmbundle b/vendor/grammars/Slash.tmbundle new file mode 160000 index 00000000..48e678eb --- /dev/null +++ b/vendor/grammars/Slash.tmbundle @@ -0,0 +1 @@ +Subproject commit 48e678eb2797295190f0dfa324167d0006bcc4e3 diff --git a/vendor/grammars/Stata.tmbundle b/vendor/grammars/Stata.tmbundle new file mode 160000 index 00000000..bc1e3634 --- /dev/null +++ b/vendor/grammars/Stata.tmbundle @@ -0,0 +1 @@ +Subproject commit bc1e36344d4d7aa0d9c53757639d3f56511565e7 diff --git a/vendor/grammars/Sublime-Coq b/vendor/grammars/Sublime-Coq new file mode 160000 index 00000000..964eb8f9 --- /dev/null +++ b/vendor/grammars/Sublime-Coq @@ -0,0 +1 @@ +Subproject commit 964eb8f914cd65f107f55eef8e51372fdf77bd53 diff --git a/vendor/grammars/Sublime-HTTP b/vendor/grammars/Sublime-HTTP new file mode 160000 index 00000000..00999986 --- /dev/null +++ b/vendor/grammars/Sublime-HTTP @@ -0,0 +1 @@ +Subproject commit 0099998617eb784fa27d8a47e289058d9a6307ab diff --git a/vendor/grammars/Sublime-Inform b/vendor/grammars/Sublime-Inform new file mode 160000 index 00000000..8db129b8 --- /dev/null +++ b/vendor/grammars/Sublime-Inform @@ -0,0 +1 @@ +Subproject commit 8db129b8389044a6660ca232566651c8fe3ab646 diff --git a/vendor/grammars/Sublime-Lasso b/vendor/grammars/Sublime-Lasso new file mode 160000 index 00000000..c755cf53 --- /dev/null +++ b/vendor/grammars/Sublime-Lasso @@ -0,0 +1 @@ +Subproject commit c755cf53bed8f81dcfbe937f9feaa9e564f1c2a9 diff --git a/vendor/grammars/Sublime-Logos b/vendor/grammars/Sublime-Logos new file mode 160000 index 00000000..9a7aa2fb --- /dev/null +++ b/vendor/grammars/Sublime-Logos @@ -0,0 +1 @@ +Subproject commit 9a7aa2fb92b52f0e422f50b60fd5608d935ef69b diff --git a/vendor/grammars/Sublime-Loom b/vendor/grammars/Sublime-Loom new file mode 160000 index 00000000..72522840 --- /dev/null +++ b/vendor/grammars/Sublime-Loom @@ -0,0 +1 @@ +Subproject commit 725228409c4cfcbf00216d677b85466b2303ef0b diff --git a/vendor/grammars/Sublime-Nit b/vendor/grammars/Sublime-Nit new file mode 160000 index 00000000..7d8b3503 --- /dev/null +++ b/vendor/grammars/Sublime-Nit @@ -0,0 +1 @@ +Subproject commit 7d8b3503923edb3dd0fa0f8e0684dd33e7897446 diff --git a/vendor/grammars/Sublime-QML b/vendor/grammars/Sublime-QML new file mode 160000 index 00000000..e3e058a2 --- /dev/null +++ b/vendor/grammars/Sublime-QML @@ -0,0 +1 @@ +Subproject commit e3e058a21f3c44d64ef5eda93925ee84169b62ec diff --git a/vendor/grammars/Sublime-REBOL b/vendor/grammars/Sublime-REBOL new file mode 160000 index 00000000..977ba9bb --- /dev/null +++ b/vendor/grammars/Sublime-REBOL @@ -0,0 +1 @@ +Subproject commit 977ba9bb5881e4eec0f144f9f8dc23b0137cae00 diff --git a/vendor/grammars/Sublime-SQF-Language b/vendor/grammars/Sublime-SQF-Language new file mode 160000 index 00000000..708c78a0 --- /dev/null +++ b/vendor/grammars/Sublime-SQF-Language @@ -0,0 +1 @@ +Subproject commit 708c78a0ba5e9449c3a913243ce9dfdeb458e68c diff --git a/vendor/grammars/Sublime-Text-2-OpenEdge-ABL b/vendor/grammars/Sublime-Text-2-OpenEdge-ABL new file mode 160000 index 00000000..6e8231cc --- /dev/null +++ b/vendor/grammars/Sublime-Text-2-OpenEdge-ABL @@ -0,0 +1 @@ +Subproject commit 6e8231cca124750b413ee50e8a4ee20e36636a03 diff --git a/vendor/grammars/Sublime-VimL b/vendor/grammars/Sublime-VimL new file mode 160000 index 00000000..366fdc64 --- /dev/null +++ b/vendor/grammars/Sublime-VimL @@ -0,0 +1 @@ +Subproject commit 366fdc64e3655207a0b2672f630d7167e6aac2c3 diff --git a/vendor/grammars/SublimeBrainfuck b/vendor/grammars/SublimeBrainfuck new file mode 160000 index 00000000..571332e4 --- /dev/null +++ b/vendor/grammars/SublimeBrainfuck @@ -0,0 +1 @@ +Subproject commit 571332e4652cb6682dd62517deb2dd80e28a35e3 diff --git a/vendor/grammars/SublimeXtend b/vendor/grammars/SublimeXtend new file mode 160000 index 00000000..61c06e16 --- /dev/null +++ b/vendor/grammars/SublimeXtend @@ -0,0 +1 @@ +Subproject commit 61c06e16645078c3238a23548911c8cd147e4b69 diff --git a/vendor/grammars/Textmate-Gosu-Bundle b/vendor/grammars/Textmate-Gosu-Bundle new file mode 160000 index 00000000..c0e36a01 --- /dev/null +++ b/vendor/grammars/Textmate-Gosu-Bundle @@ -0,0 +1 @@ +Subproject commit c0e36a01ba2c82d87fd6623481fbb57a5055b376 diff --git a/vendor/grammars/VBDotNetSyntax b/vendor/grammars/VBDotNetSyntax new file mode 160000 index 00000000..4c14dda6 --- /dev/null +++ b/vendor/grammars/VBDotNetSyntax @@ -0,0 +1 @@ +Subproject commit 4c14dda6f7e1b61cd1db71b27b3ceee77759ea80 diff --git a/vendor/grammars/Vala-TMBundle b/vendor/grammars/Vala-TMBundle new file mode 160000 index 00000000..bb84dccd --- /dev/null +++ b/vendor/grammars/Vala-TMBundle @@ -0,0 +1 @@ +Subproject commit bb84dccd11ef7edd01882367e241bdcbfcf164bc diff --git a/vendor/grammars/abap.tmbundle b/vendor/grammars/abap.tmbundle new file mode 160000 index 00000000..5d8acce1 --- /dev/null +++ b/vendor/grammars/abap.tmbundle @@ -0,0 +1 @@ +Subproject commit 5d8acce13c54650b62556c0b307d9f30ea7ff538 diff --git a/vendor/grammars/actionscript3-tmbundle b/vendor/grammars/actionscript3-tmbundle new file mode 160000 index 00000000..d69fcc88 --- /dev/null +++ b/vendor/grammars/actionscript3-tmbundle @@ -0,0 +1 @@ +Subproject commit d69fcc8884432874248fe0e05fcc35c46870caa5 diff --git a/vendor/grammars/ada.tmbundle b/vendor/grammars/ada.tmbundle new file mode 160000 index 00000000..c45eed4d --- /dev/null +++ b/vendor/grammars/ada.tmbundle @@ -0,0 +1 @@ +Subproject commit c45eed4d5f98fe3bcbbffbb9e436601ab5bbde4b diff --git a/vendor/grammars/ant.tmbundle b/vendor/grammars/ant.tmbundle new file mode 160000 index 00000000..156b6945 --- /dev/null +++ b/vendor/grammars/ant.tmbundle @@ -0,0 +1 @@ +Subproject commit 156b6945262da1c53c1d83a411dbac126f06195d diff --git a/vendor/grammars/antlr.tmbundle b/vendor/grammars/antlr.tmbundle new file mode 160000 index 00000000..8cb9b531 --- /dev/null +++ b/vendor/grammars/antlr.tmbundle @@ -0,0 +1 @@ +Subproject commit 8cb9b53107f72b7d23cec515d73b3114ae44e6e8 diff --git a/vendor/grammars/apache.tmbundle b/vendor/grammars/apache.tmbundle new file mode 160000 index 00000000..a4a494e8 --- /dev/null +++ b/vendor/grammars/apache.tmbundle @@ -0,0 +1 @@ +Subproject commit a4a494e8455ca98bde8591a7f068c3384babb09a diff --git a/vendor/grammars/applescript.tmbundle b/vendor/grammars/applescript.tmbundle new file mode 160000 index 00000000..bfb42697 --- /dev/null +++ b/vendor/grammars/applescript.tmbundle @@ -0,0 +1 @@ +Subproject commit bfb426974dd4ec9adcee4094f32a14a484b2e1f3 diff --git a/vendor/grammars/asp.tmbundle b/vendor/grammars/asp.tmbundle new file mode 160000 index 00000000..e2c72903 --- /dev/null +++ b/vendor/grammars/asp.tmbundle @@ -0,0 +1 @@ +Subproject commit e2c72903175d4211e4c698a5fa635cc443405892 diff --git a/vendor/grammars/assembly.tmbundle b/vendor/grammars/assembly.tmbundle new file mode 160000 index 00000000..0ef23e86 --- /dev/null +++ b/vendor/grammars/assembly.tmbundle @@ -0,0 +1 @@ +Subproject commit 0ef23e8619103e87a0a90df1b96c2567fbedf7f5 diff --git a/vendor/grammars/atom-salt b/vendor/grammars/atom-salt new file mode 160000 index 00000000..6d6bdc1b --- /dev/null +++ b/vendor/grammars/atom-salt @@ -0,0 +1 @@ +Subproject commit 6d6bdc1be1a43201b5f78a4f89ea9bfc7416df11 diff --git a/vendor/grammars/autoitv3-tmbundle b/vendor/grammars/autoitv3-tmbundle new file mode 160000 index 00000000..9fb17135 --- /dev/null +++ b/vendor/grammars/autoitv3-tmbundle @@ -0,0 +1 @@ +Subproject commit 9fb171353c28313a79aef68571d8f9608a34eeae diff --git a/vendor/grammars/awk-sublime b/vendor/grammars/awk-sublime new file mode 160000 index 00000000..7ec7d154 --- /dev/null +++ b/vendor/grammars/awk-sublime @@ -0,0 +1 @@ +Subproject commit 7ec7d154469c05780cfeecca8fc00fda6f9ac0e7 diff --git a/vendor/grammars/bison.tmbundle b/vendor/grammars/bison.tmbundle new file mode 160000 index 00000000..c6832286 --- /dev/null +++ b/vendor/grammars/bison.tmbundle @@ -0,0 +1 @@ +Subproject commit c6832286bd7792bcad2e66653803217b117373c6 diff --git a/vendor/grammars/boo-sublime b/vendor/grammars/boo-sublime new file mode 160000 index 00000000..2b27a241 --- /dev/null +++ b/vendor/grammars/boo-sublime @@ -0,0 +1 @@ +Subproject commit 2b27a2414542275373dd04f89f88e5233765fc1e diff --git a/vendor/grammars/bro-sublime b/vendor/grammars/bro-sublime new file mode 160000 index 00000000..7a8983d9 --- /dev/null +++ b/vendor/grammars/bro-sublime @@ -0,0 +1 @@ +Subproject commit 7a8983d93ecdb2535b00348b2ed15a964fe6884f diff --git a/vendor/grammars/c.tmbundle b/vendor/grammars/c.tmbundle new file mode 160000 index 00000000..f8254252 --- /dev/null +++ b/vendor/grammars/c.tmbundle @@ -0,0 +1 @@ +Subproject commit f8254252620b24c50d23ec804344915d498ecd7f diff --git a/vendor/grammars/capnproto.tmbundle b/vendor/grammars/capnproto.tmbundle new file mode 160000 index 00000000..2f661649 --- /dev/null +++ b/vendor/grammars/capnproto.tmbundle @@ -0,0 +1 @@ +Subproject commit 2f661649a3ac26918ffc1ce5d17762e24e9965a6 diff --git a/vendor/grammars/carto-atom b/vendor/grammars/carto-atom new file mode 160000 index 00000000..c00fb6c4 --- /dev/null +++ b/vendor/grammars/carto-atom @@ -0,0 +1 @@ +Subproject commit c00fb6c461e17de53e9efaf5b495e5b7d877b9d6 diff --git a/vendor/grammars/ceylon-sublimetext b/vendor/grammars/ceylon-sublimetext new file mode 160000 index 00000000..a81ad702 --- /dev/null +++ b/vendor/grammars/ceylon-sublimetext @@ -0,0 +1 @@ +Subproject commit a81ad702b450a440c9d366fd2e128ea6a895dabd diff --git a/vendor/grammars/chapel-tmbundle b/vendor/grammars/chapel-tmbundle new file mode 160000 index 00000000..d52e9b14 --- /dev/null +++ b/vendor/grammars/chapel-tmbundle @@ -0,0 +1 @@ +Subproject commit d52e9b1417a5aa41e417876e121adb880d6a1ff7 diff --git a/vendor/grammars/cmake.tmbundle b/vendor/grammars/cmake.tmbundle new file mode 160000 index 00000000..926867a4 --- /dev/null +++ b/vendor/grammars/cmake.tmbundle @@ -0,0 +1 @@ +Subproject commit 926867a414c1125abefa38161d82d71756f591a2 diff --git a/vendor/grammars/cool-tmbundle b/vendor/grammars/cool-tmbundle new file mode 160000 index 00000000..ab3a3356 --- /dev/null +++ b/vendor/grammars/cool-tmbundle @@ -0,0 +1 @@ +Subproject commit ab3a3356e2ff4096b23af984da09188e75371759 diff --git a/vendor/grammars/cpp-qt.tmbundle b/vendor/grammars/cpp-qt.tmbundle new file mode 160000 index 00000000..5a2a1073 --- /dev/null +++ b/vendor/grammars/cpp-qt.tmbundle @@ -0,0 +1 @@ +Subproject commit 5a2a10734dad293fc1aee558d7872feb9c8030f3 diff --git a/vendor/grammars/css.tmbundle b/vendor/grammars/css.tmbundle new file mode 160000 index 00000000..bef87ff9 --- /dev/null +++ b/vendor/grammars/css.tmbundle @@ -0,0 +1 @@ +Subproject commit bef87ff98730f62cee3bb470f63bd2eb3fb2e4f9 diff --git a/vendor/grammars/cucumber-tmbundle b/vendor/grammars/cucumber-tmbundle new file mode 160000 index 00000000..d515d5d3 --- /dev/null +++ b/vendor/grammars/cucumber-tmbundle @@ -0,0 +1 @@ +Subproject commit d515d5d302ecb2ba67065bc97eea39616b1e1a9a diff --git a/vendor/grammars/d.tmbundle b/vendor/grammars/d.tmbundle new file mode 160000 index 00000000..a6931961 --- /dev/null +++ b/vendor/grammars/d.tmbundle @@ -0,0 +1 @@ +Subproject commit a6931961dafe68349ca0c388d225987bcf2ce049 diff --git a/vendor/grammars/dart-sublime-bundle b/vendor/grammars/dart-sublime-bundle new file mode 160000 index 00000000..3b97e169 --- /dev/null +++ b/vendor/grammars/dart-sublime-bundle @@ -0,0 +1 @@ +Subproject commit 3b97e1691ed6aaae24fb8396478c697748fae51a diff --git a/vendor/grammars/diff.tmbundle b/vendor/grammars/diff.tmbundle new file mode 160000 index 00000000..62de2cca --- /dev/null +++ b/vendor/grammars/diff.tmbundle @@ -0,0 +1 @@ +Subproject commit 62de2cca5cc5cfb77308fdc94d963f35e2d808d1 diff --git a/vendor/grammars/dylan.tmbundle b/vendor/grammars/dylan.tmbundle new file mode 160000 index 00000000..d1f521cc --- /dev/null +++ b/vendor/grammars/dylan.tmbundle @@ -0,0 +1 @@ +Subproject commit d1f521cc1dc5fba4976388d35d278faa02fabb57 diff --git a/vendor/grammars/ebundles b/vendor/grammars/ebundles new file mode 160000 index 00000000..d9b80213 --- /dev/null +++ b/vendor/grammars/ebundles @@ -0,0 +1 @@ +Subproject commit d9b802135a533abf113c164d25b23143a47283e7 diff --git a/vendor/grammars/eiffel.tmbundle b/vendor/grammars/eiffel.tmbundle new file mode 160000 index 00000000..90662167 --- /dev/null +++ b/vendor/grammars/eiffel.tmbundle @@ -0,0 +1 @@ +Subproject commit 90662167c35bc4dcd1623400c5e9f99136b95992 diff --git a/vendor/grammars/elixir-tmbundle b/vendor/grammars/elixir-tmbundle new file mode 160000 index 00000000..dcf1fc12 --- /dev/null +++ b/vendor/grammars/elixir-tmbundle @@ -0,0 +1 @@ +Subproject commit dcf1fc125c81c904fae8dc91d483905bdb5d5f5d diff --git a/vendor/grammars/erlang.tmbundle b/vendor/grammars/erlang.tmbundle new file mode 160000 index 00000000..39c144dd --- /dev/null +++ b/vendor/grammars/erlang.tmbundle @@ -0,0 +1 @@ +Subproject commit 39c144ddb7a39bdb967c893a33fda27482beb770 diff --git a/vendor/grammars/factor b/vendor/grammars/factor new file mode 160000 index 00000000..208f0141 --- /dev/null +++ b/vendor/grammars/factor @@ -0,0 +1 @@ +Subproject commit 208f01416deb340dbac19013b23d398fe4c8d71b diff --git a/vendor/grammars/fancy-tmbundle b/vendor/grammars/fancy-tmbundle new file mode 160000 index 00000000..d48b6100 --- /dev/null +++ b/vendor/grammars/fancy-tmbundle @@ -0,0 +1 @@ +Subproject commit d48b6100cc64621f68d4d59241e8d442fb9fcdff diff --git a/vendor/grammars/fish-tmbundle b/vendor/grammars/fish-tmbundle new file mode 160000 index 00000000..25e83e24 --- /dev/null +++ b/vendor/grammars/fish-tmbundle @@ -0,0 +1 @@ +Subproject commit 25e83e24225b72c97d173e829734f8bc3dfcafe7 diff --git a/vendor/grammars/fortran.tmbundle b/vendor/grammars/fortran.tmbundle new file mode 160000 index 00000000..1651ca2c --- /dev/null +++ b/vendor/grammars/fortran.tmbundle @@ -0,0 +1 @@ +Subproject commit 1651ca2c7f93e9bcf3cccfa57225b07b74804e13 diff --git a/vendor/grammars/fsharpbinding b/vendor/grammars/fsharpbinding new file mode 160000 index 00000000..9ea14cbe --- /dev/null +++ b/vendor/grammars/fsharpbinding @@ -0,0 +1 @@ +Subproject commit 9ea14cbe3cdcb55215d11863fc4e21fdfa962211 diff --git a/vendor/grammars/gettext.tmbundle b/vendor/grammars/gettext.tmbundle new file mode 160000 index 00000000..08bb6955 --- /dev/null +++ b/vendor/grammars/gettext.tmbundle @@ -0,0 +1 @@ +Subproject commit 08bb69558d82ada8d4f36b8869f871ce69014749 diff --git a/vendor/grammars/gnuplot-tmbundle b/vendor/grammars/gnuplot-tmbundle new file mode 160000 index 00000000..14e0f70c --- /dev/null +++ b/vendor/grammars/gnuplot-tmbundle @@ -0,0 +1 @@ +Subproject commit 14e0f70c7b26c688c904e5d379454df5c34f0a0f diff --git a/vendor/grammars/go-tmbundle b/vendor/grammars/go-tmbundle new file mode 160000 index 00000000..0bdec37e --- /dev/null +++ b/vendor/grammars/go-tmbundle @@ -0,0 +1 @@ +Subproject commit 0bdec37eded22e8416d046fe28e50d2c5c666798 diff --git a/vendor/grammars/gradle.tmbundle b/vendor/grammars/gradle.tmbundle new file mode 160000 index 00000000..772fc9d0 --- /dev/null +++ b/vendor/grammars/gradle.tmbundle @@ -0,0 +1 @@ +Subproject commit 772fc9d008f19b4041a6cee7e7659b18565da0ff diff --git a/vendor/grammars/graphviz.tmbundle b/vendor/grammars/graphviz.tmbundle new file mode 160000 index 00000000..2760230b --- /dev/null +++ b/vendor/grammars/graphviz.tmbundle @@ -0,0 +1 @@ +Subproject commit 2760230b50dbec25906db1504604b37885a53fef diff --git a/vendor/grammars/groovy.tmbundle b/vendor/grammars/groovy.tmbundle new file mode 160000 index 00000000..6f903cac --- /dev/null +++ b/vendor/grammars/groovy.tmbundle @@ -0,0 +1 @@ +Subproject commit 6f903cacfb2d5397a350eeb73bc36b2c40f3da70 diff --git a/vendor/grammars/haskell.tmbundle b/vendor/grammars/haskell.tmbundle new file mode 160000 index 00000000..30fa1e28 --- /dev/null +++ b/vendor/grammars/haskell.tmbundle @@ -0,0 +1 @@ +Subproject commit 30fa1e283244960e520694d8db6189d9b2bde9f5 diff --git a/vendor/grammars/haxe-sublime-bundle b/vendor/grammars/haxe-sublime-bundle new file mode 160000 index 00000000..6359431d --- /dev/null +++ b/vendor/grammars/haxe-sublime-bundle @@ -0,0 +1 @@ +Subproject commit 6359431d8837ea90f245b29def9e2827ff3f040b diff --git a/vendor/grammars/html.tmbundle b/vendor/grammars/html.tmbundle new file mode 160000 index 00000000..4831b07b --- /dev/null +++ b/vendor/grammars/html.tmbundle @@ -0,0 +1 @@ +Subproject commit 4831b07b7211d34ab5570bbf877690cf4fefc9ef diff --git a/vendor/grammars/idl.tmbundle b/vendor/grammars/idl.tmbundle new file mode 160000 index 00000000..95f17ac4 --- /dev/null +++ b/vendor/grammars/idl.tmbundle @@ -0,0 +1 @@ +Subproject commit 95f17ac40b99ace47a26e7751c7b5de45b13b1c0 diff --git a/vendor/grammars/ini.tmbundle b/vendor/grammars/ini.tmbundle new file mode 160000 index 00000000..7d8c7b55 --- /dev/null +++ b/vendor/grammars/ini.tmbundle @@ -0,0 +1 @@ +Subproject commit 7d8c7b5544c48069a246fd2f43e965f06d03d3da diff --git a/vendor/grammars/io.tmbundle b/vendor/grammars/io.tmbundle new file mode 160000 index 00000000..e8f7b377 --- /dev/null +++ b/vendor/grammars/io.tmbundle @@ -0,0 +1 @@ +Subproject commit e8f7b3773544cfc14a7ede7344ed94683f7ed602 diff --git a/vendor/grammars/ioke-outdated b/vendor/grammars/ioke-outdated new file mode 160000 index 00000000..165ade05 --- /dev/null +++ b/vendor/grammars/ioke-outdated @@ -0,0 +1 @@ +Subproject commit 165ade05bce54881ec6408837dad9aed74720a7e diff --git a/vendor/grammars/jade-tmbundle b/vendor/grammars/jade-tmbundle new file mode 160000 index 00000000..b061f52f --- /dev/null +++ b/vendor/grammars/jade-tmbundle @@ -0,0 +1 @@ +Subproject commit b061f52fb369cc0b483cc1ddc4cd0fc088615754 diff --git a/vendor/grammars/jasmin-sublime b/vendor/grammars/jasmin-sublime new file mode 160000 index 00000000..4191e4cf --- /dev/null +++ b/vendor/grammars/jasmin-sublime @@ -0,0 +1 @@ +Subproject commit 4191e4cf68426aa0df125a211e03c1d4105eb819 diff --git a/vendor/grammars/java.tmbundle b/vendor/grammars/java.tmbundle new file mode 160000 index 00000000..a74cb835 --- /dev/null +++ b/vendor/grammars/java.tmbundle @@ -0,0 +1 @@ +Subproject commit a74cb835b821e9a3498d1810d546cb49881df73e diff --git a/vendor/grammars/javadoc.tmbundle b/vendor/grammars/javadoc.tmbundle new file mode 160000 index 00000000..484d468f --- /dev/null +++ b/vendor/grammars/javadoc.tmbundle @@ -0,0 +1 @@ +Subproject commit 484d468f47f6a17c98f73b369fa00a6bbc2a22fd diff --git a/vendor/grammars/javascript-objective-j.tmbundle b/vendor/grammars/javascript-objective-j.tmbundle new file mode 160000 index 00000000..b96701b5 --- /dev/null +++ b/vendor/grammars/javascript-objective-j.tmbundle @@ -0,0 +1 @@ +Subproject commit b96701b5ebea10c6cb363fb2a8fdb32d93093b3b diff --git a/vendor/grammars/jquery-tmbundle b/vendor/grammars/jquery-tmbundle new file mode 160000 index 00000000..ff14cd28 --- /dev/null +++ b/vendor/grammars/jquery-tmbundle @@ -0,0 +1 @@ +Subproject commit ff14cd28e36772d13de16606903b36a091ffeb33 diff --git a/vendor/grammars/json.tmbundle b/vendor/grammars/json.tmbundle new file mode 160000 index 00000000..4100e5b0 --- /dev/null +++ b/vendor/grammars/json.tmbundle @@ -0,0 +1 @@ +Subproject commit 4100e5b0162b3df7984b3b5532529b8ea78cbaa0 diff --git a/vendor/grammars/kotlin-sublime-package b/vendor/grammars/kotlin-sublime-package new file mode 160000 index 00000000..e8e18955 --- /dev/null +++ b/vendor/grammars/kotlin-sublime-package @@ -0,0 +1 @@ +Subproject commit e8e18955d7f18d42574dc55a37e6f31339036800 diff --git a/vendor/grammars/language-clojure b/vendor/grammars/language-clojure new file mode 160000 index 00000000..bae6eee8 --- /dev/null +++ b/vendor/grammars/language-clojure @@ -0,0 +1 @@ +Subproject commit bae6eee8557c2158592ac485a7168ccd10fc6dfb diff --git a/vendor/grammars/language-coffee-script b/vendor/grammars/language-coffee-script new file mode 160000 index 00000000..d86c8963 --- /dev/null +++ b/vendor/grammars/language-coffee-script @@ -0,0 +1 @@ +Subproject commit d86c8963dcee0ab811da05a175b2218045d0c124 diff --git a/vendor/grammars/language-csharp b/vendor/grammars/language-csharp new file mode 160000 index 00000000..fba368a8 --- /dev/null +++ b/vendor/grammars/language-csharp @@ -0,0 +1 @@ +Subproject commit fba368a8397e298fa78679b4ee0a542b2474c150 diff --git a/vendor/grammars/language-gfm b/vendor/grammars/language-gfm new file mode 160000 index 00000000..18400b22 --- /dev/null +++ b/vendor/grammars/language-gfm @@ -0,0 +1 @@ +Subproject commit 18400b22cd7968afee982b4e0aa57ef7813ce991 diff --git a/vendor/grammars/language-hy b/vendor/grammars/language-hy new file mode 160000 index 00000000..f9750744 --- /dev/null +++ b/vendor/grammars/language-hy @@ -0,0 +1 @@ +Subproject commit f9750744ae4b8519314dff7d57abc527b91a0ef2 diff --git a/vendor/grammars/language-javascript b/vendor/grammars/language-javascript new file mode 160000 index 00000000..b47a7fe0 --- /dev/null +++ b/vendor/grammars/language-javascript @@ -0,0 +1 @@ +Subproject commit b47a7fe0cbed2d2553cdb7c6d32e812f9881c21f diff --git a/vendor/grammars/language-python b/vendor/grammars/language-python new file mode 160000 index 00000000..0141d449 --- /dev/null +++ b/vendor/grammars/language-python @@ -0,0 +1 @@ +Subproject commit 0141d44946d55ae06ce4dba90b1b0e08db1e437e diff --git a/vendor/grammars/language-shellscript b/vendor/grammars/language-shellscript new file mode 160000 index 00000000..98397197 --- /dev/null +++ b/vendor/grammars/language-shellscript @@ -0,0 +1 @@ +Subproject commit 9839719721e3fb67c2df8461b2b296e6ff027e7f diff --git a/vendor/grammars/language-yaml b/vendor/grammars/language-yaml new file mode 160000 index 00000000..ce8b4414 --- /dev/null +++ b/vendor/grammars/language-yaml @@ -0,0 +1 @@ +Subproject commit ce8b441467852f766a34d22ba6661099496e22e4 diff --git a/vendor/grammars/latex.tmbundle b/vendor/grammars/latex.tmbundle new file mode 160000 index 00000000..e413297f --- /dev/null +++ b/vendor/grammars/latex.tmbundle @@ -0,0 +1 @@ +Subproject commit e413297f3af499f2c87c5fb92c6d3199f25fa586 diff --git a/vendor/grammars/less.tmbundle b/vendor/grammars/less.tmbundle new file mode 160000 index 00000000..7ef97ad5 --- /dev/null +++ b/vendor/grammars/less.tmbundle @@ -0,0 +1 @@ +Subproject commit 7ef97ad5f15d2a136afe4d5cf568fc8ee79675b7 diff --git a/vendor/grammars/lilypond.tmbundle b/vendor/grammars/lilypond.tmbundle new file mode 160000 index 00000000..b52e8205 --- /dev/null +++ b/vendor/grammars/lilypond.tmbundle @@ -0,0 +1 @@ +Subproject commit b52e8205a8727576df7ae65f2726435eb731d066 diff --git a/vendor/grammars/lisp.tmbundle b/vendor/grammars/lisp.tmbundle new file mode 160000 index 00000000..0c1d1baa --- /dev/null +++ b/vendor/grammars/lisp.tmbundle @@ -0,0 +1 @@ +Subproject commit 0c1d1baa16db1889aa7081bcda8ce9e5b4be85cd diff --git a/vendor/grammars/llvm.tmbundle b/vendor/grammars/llvm.tmbundle new file mode 160000 index 00000000..9f56fc54 --- /dev/null +++ b/vendor/grammars/llvm.tmbundle @@ -0,0 +1 @@ +Subproject commit 9f56fc54d3bc5c5cc8c202d9279e4bc61231086f diff --git a/vendor/grammars/logtalk.tmbundle b/vendor/grammars/logtalk.tmbundle new file mode 160000 index 00000000..6810e9d5 --- /dev/null +++ b/vendor/grammars/logtalk.tmbundle @@ -0,0 +1 @@ +Subproject commit 6810e9d572c6c18264a4f45739a3e83d2ac3853b diff --git a/vendor/grammars/lua.tmbundle b/vendor/grammars/lua.tmbundle new file mode 160000 index 00000000..6cac1887 --- /dev/null +++ b/vendor/grammars/lua.tmbundle @@ -0,0 +1 @@ +Subproject commit 6cac1887dc6955a7601af2efec32f1c5ae2e4f73 diff --git a/vendor/grammars/make.tmbundle b/vendor/grammars/make.tmbundle new file mode 160000 index 00000000..371a9e8a --- /dev/null +++ b/vendor/grammars/make.tmbundle @@ -0,0 +1 @@ +Subproject commit 371a9e8a56ec02289f129bb2172cb0bdc7ee6b44 diff --git a/vendor/grammars/mako-tmbundle b/vendor/grammars/mako-tmbundle new file mode 160000 index 00000000..e039636f --- /dev/null +++ b/vendor/grammars/mako-tmbundle @@ -0,0 +1 @@ +Subproject commit e039636f3d67d96f4b6b763b31153f857e199e5d diff --git a/vendor/grammars/mathematica-tmbundle b/vendor/grammars/mathematica-tmbundle new file mode 160000 index 00000000..3b4b826d --- /dev/null +++ b/vendor/grammars/mathematica-tmbundle @@ -0,0 +1 @@ +Subproject commit 3b4b826dbe60f1dba4484fdeacf0047681b9b82e diff --git a/vendor/grammars/matlab.tmbundle b/vendor/grammars/matlab.tmbundle new file mode 160000 index 00000000..e1460dd9 --- /dev/null +++ b/vendor/grammars/matlab.tmbundle @@ -0,0 +1 @@ +Subproject commit e1460dd9e71a9cb879a438ab31a18f31c2ced107 diff --git a/vendor/grammars/maven.tmbundle b/vendor/grammars/maven.tmbundle new file mode 160000 index 00000000..180999aa --- /dev/null +++ b/vendor/grammars/maven.tmbundle @@ -0,0 +1 @@ +Subproject commit 180999aa43b2dbb3d3953f0196e766420ec34553 diff --git a/vendor/grammars/mercury-tmlanguage b/vendor/grammars/mercury-tmlanguage new file mode 160000 index 00000000..eaef0b06 --- /dev/null +++ b/vendor/grammars/mercury-tmlanguage @@ -0,0 +1 @@ +Subproject commit eaef0b0643b2cea0d7d26056f2dd264c5a652be9 diff --git a/vendor/grammars/monkey.tmbundle b/vendor/grammars/monkey.tmbundle new file mode 160000 index 00000000..4de43baf --- /dev/null +++ b/vendor/grammars/monkey.tmbundle @@ -0,0 +1 @@ +Subproject commit 4de43bafc8c6530a56d225aab50f1690ad928b0f diff --git a/vendor/grammars/moonscript-tmbundle b/vendor/grammars/moonscript-tmbundle new file mode 160000 index 00000000..6f25231c --- /dev/null +++ b/vendor/grammars/moonscript-tmbundle @@ -0,0 +1 @@ +Subproject commit 6f25231cfd1369293ea9c74db21c072bcb8ab2ce diff --git a/vendor/grammars/nemerle.tmbundle b/vendor/grammars/nemerle.tmbundle new file mode 160000 index 00000000..8311f0f0 --- /dev/null +++ b/vendor/grammars/nemerle.tmbundle @@ -0,0 +1 @@ +Subproject commit 8311f0f019a58a2c154a81e2ea9d3f4ddeec1298 diff --git a/vendor/grammars/nesC.tmbundle b/vendor/grammars/nesC.tmbundle new file mode 160000 index 00000000..d0d322ce --- /dev/null +++ b/vendor/grammars/nesC.tmbundle @@ -0,0 +1 @@ +Subproject commit d0d322ceafe3c4d8affc0e8b767fb6ad65c52704 diff --git a/vendor/grammars/ninja.tmbundle b/vendor/grammars/ninja.tmbundle new file mode 160000 index 00000000..89d9cf33 --- /dev/null +++ b/vendor/grammars/ninja.tmbundle @@ -0,0 +1 @@ +Subproject commit 89d9cf333074a6f948053bbcf724281ec4a7adc6 diff --git a/vendor/grammars/objective-c.tmbundle b/vendor/grammars/objective-c.tmbundle new file mode 160000 index 00000000..d66de9b4 --- /dev/null +++ b/vendor/grammars/objective-c.tmbundle @@ -0,0 +1 @@ +Subproject commit d66de9b4fcfcaf53e64cc05fed0cf66c6980c9b2 diff --git a/vendor/grammars/ocaml.tmbundle b/vendor/grammars/ocaml.tmbundle new file mode 160000 index 00000000..903fc455 --- /dev/null +++ b/vendor/grammars/ocaml.tmbundle @@ -0,0 +1 @@ +Subproject commit 903fc455163c90d38db77c47ca636392550967f0 diff --git a/vendor/grammars/ooc.tmbundle b/vendor/grammars/ooc.tmbundle new file mode 160000 index 00000000..ff03f615 --- /dev/null +++ b/vendor/grammars/ooc.tmbundle @@ -0,0 +1 @@ +Subproject commit ff03f615b33e9a6266b43ca2a70dacffe21f0505 diff --git a/vendor/grammars/opa.tmbundle b/vendor/grammars/opa.tmbundle new file mode 160000 index 00000000..4c00f8a6 --- /dev/null +++ b/vendor/grammars/opa.tmbundle @@ -0,0 +1 @@ +Subproject commit 4c00f8a619e4ed6e245610394df1911f0f68d8d0 diff --git a/vendor/grammars/oz-tmbundle b/vendor/grammars/oz-tmbundle new file mode 160000 index 00000000..ae97a56f --- /dev/null +++ b/vendor/grammars/oz-tmbundle @@ -0,0 +1 @@ +Subproject commit ae97a56fadad87b07b5ab8fa869f478844559825 diff --git a/vendor/grammars/pascal.tmbundle b/vendor/grammars/pascal.tmbundle new file mode 160000 index 00000000..a7d124ef --- /dev/null +++ b/vendor/grammars/pascal.tmbundle @@ -0,0 +1 @@ +Subproject commit a7d124ef9bb59d2960979be068c9d8f5184db5c0 diff --git a/vendor/grammars/perl.tmbundle b/vendor/grammars/perl.tmbundle new file mode 160000 index 00000000..8f62f3c4 --- /dev/null +++ b/vendor/grammars/perl.tmbundle @@ -0,0 +1 @@ +Subproject commit 8f62f3c458cacba3152bfedcc971735a0a5d61b1 diff --git a/vendor/grammars/php-smarty.tmbundle b/vendor/grammars/php-smarty.tmbundle new file mode 160000 index 00000000..cbcdb59c --- /dev/null +++ b/vendor/grammars/php-smarty.tmbundle @@ -0,0 +1 @@ +Subproject commit cbcdb59cb3590417d63efd8f30f07ac9eaa8143d diff --git a/vendor/grammars/php.tmbundle b/vendor/grammars/php.tmbundle new file mode 160000 index 00000000..d24593d7 --- /dev/null +++ b/vendor/grammars/php.tmbundle @@ -0,0 +1 @@ +Subproject commit d24593d75c3c5f01b4b0705a9e6db132c0cfd55b diff --git a/vendor/grammars/pike-textmate b/vendor/grammars/pike-textmate new file mode 160000 index 00000000..96870efc --- /dev/null +++ b/vendor/grammars/pike-textmate @@ -0,0 +1 @@ +Subproject commit 96870efc1f1c2f489ec5ac8b73eaf33aa7517ac9 diff --git a/vendor/grammars/postscript.tmbundle b/vendor/grammars/postscript.tmbundle new file mode 160000 index 00000000..d0431d95 --- /dev/null +++ b/vendor/grammars/postscript.tmbundle @@ -0,0 +1 @@ +Subproject commit d0431d9562e295a2ed6e02ed14a60daa1eb8aa07 diff --git a/vendor/grammars/powershell.tmbundle b/vendor/grammars/powershell.tmbundle new file mode 160000 index 00000000..f8716b43 --- /dev/null +++ b/vendor/grammars/powershell.tmbundle @@ -0,0 +1 @@ +Subproject commit f8716b432eb0a1a6cbc93ee42451a443db844c0f diff --git a/vendor/grammars/processing.tmbundle b/vendor/grammars/processing.tmbundle new file mode 160000 index 00000000..4070e43b --- /dev/null +++ b/vendor/grammars/processing.tmbundle @@ -0,0 +1 @@ +Subproject commit 4070e43b094d49eab0e2f1045bd5ac6ad71e870f diff --git a/vendor/grammars/prolog.tmbundle b/vendor/grammars/prolog.tmbundle new file mode 160000 index 00000000..d955aca3 --- /dev/null +++ b/vendor/grammars/prolog.tmbundle @@ -0,0 +1 @@ +Subproject commit d955aca38b7aadce76e6815eb09487a370206742 diff --git a/vendor/grammars/protobuf-tmbundle b/vendor/grammars/protobuf-tmbundle new file mode 160000 index 00000000..7a696473 --- /dev/null +++ b/vendor/grammars/protobuf-tmbundle @@ -0,0 +1 @@ +Subproject commit 7a696473c6bcd28f3d3085a927ec6c39147e87ca diff --git a/vendor/grammars/puppet-textmate-bundle b/vendor/grammars/puppet-textmate-bundle new file mode 160000 index 00000000..708e8d3c --- /dev/null +++ b/vendor/grammars/puppet-textmate-bundle @@ -0,0 +1 @@ +Subproject commit 708e8d3cc19e367bfd6b50ba4bdbbb2b7a22b673 diff --git a/vendor/grammars/python-django.tmbundle b/vendor/grammars/python-django.tmbundle new file mode 160000 index 00000000..81d13959 --- /dev/null +++ b/vendor/grammars/python-django.tmbundle @@ -0,0 +1 @@ +Subproject commit 81d1395950ffb66e689e41863fab9a4f7cc5f30e diff --git a/vendor/grammars/r.tmbundle b/vendor/grammars/r.tmbundle new file mode 160000 index 00000000..d602893b --- /dev/null +++ b/vendor/grammars/r.tmbundle @@ -0,0 +1 @@ +Subproject commit d602893b72cb79611363b10efaeed8480a3e96d6 diff --git a/vendor/grammars/restructuredtext.tmbundle b/vendor/grammars/restructuredtext.tmbundle new file mode 160000 index 00000000..43fc7b1f --- /dev/null +++ b/vendor/grammars/restructuredtext.tmbundle @@ -0,0 +1 @@ +Subproject commit 43fc7b1ff351d6733f7ce136aafe3091e77b4347 diff --git a/vendor/grammars/ruby-haml.tmbundle b/vendor/grammars/ruby-haml.tmbundle new file mode 160000 index 00000000..57b1b352 --- /dev/null +++ b/vendor/grammars/ruby-haml.tmbundle @@ -0,0 +1 @@ +Subproject commit 57b1b3523136e3dce9479d46c1d3c16aaa7f8f70 diff --git a/vendor/grammars/ruby-on-rails-tmbundle b/vendor/grammars/ruby-on-rails-tmbundle new file mode 160000 index 00000000..0981c4c2 --- /dev/null +++ b/vendor/grammars/ruby-on-rails-tmbundle @@ -0,0 +1 @@ +Subproject commit 0981c4c2edac25b4451b396380d6bf48e0ef8bd0 diff --git a/vendor/grammars/ruby-slim.tmbundle b/vendor/grammars/ruby-slim.tmbundle new file mode 160000 index 00000000..07d55270 --- /dev/null +++ b/vendor/grammars/ruby-slim.tmbundle @@ -0,0 +1 @@ +Subproject commit 07d552705b812e6666014c0061bc511736183a86 diff --git a/vendor/grammars/ruby.tmbundle b/vendor/grammars/ruby.tmbundle new file mode 160000 index 00000000..4636a302 --- /dev/null +++ b/vendor/grammars/ruby.tmbundle @@ -0,0 +1 @@ +Subproject commit 4636a3023153c3034eb6ffc613899ba9cf33b41f diff --git a/vendor/grammars/sas.tmbundle b/vendor/grammars/sas.tmbundle new file mode 160000 index 00000000..0d864a6b --- /dev/null +++ b/vendor/grammars/sas.tmbundle @@ -0,0 +1 @@ +Subproject commit 0d864a6bc89ca418e9516249774fc9ab7c792a79 diff --git a/vendor/grammars/sass-textmate-bundle b/vendor/grammars/sass-textmate-bundle new file mode 160000 index 00000000..8444f979 --- /dev/null +++ b/vendor/grammars/sass-textmate-bundle @@ -0,0 +1 @@ +Subproject commit 8444f9796e7610f7f930e9ed7cae3093d5ce7805 diff --git a/vendor/grammars/scala.tmbundle b/vendor/grammars/scala.tmbundle new file mode 160000 index 00000000..b15ed058 --- /dev/null +++ b/vendor/grammars/scala.tmbundle @@ -0,0 +1 @@ +Subproject commit b15ed058e1d48394a3e36987507f5a8409c29684 diff --git a/vendor/grammars/scheme.tmbundle b/vendor/grammars/scheme.tmbundle new file mode 160000 index 00000000..4c21b465 --- /dev/null +++ b/vendor/grammars/scheme.tmbundle @@ -0,0 +1 @@ +Subproject commit 4c21b46583ef6e8adcfd09b417bbdd9579c6a4eb diff --git a/vendor/grammars/scilab.tmbundle b/vendor/grammars/scilab.tmbundle new file mode 160000 index 00000000..629ea8bd --- /dev/null +++ b/vendor/grammars/scilab.tmbundle @@ -0,0 +1 @@ +Subproject commit 629ea8bd1a30890cdfa35f1566137bd773cce948 diff --git a/vendor/grammars/smalltalk-tmbundle b/vendor/grammars/smalltalk-tmbundle new file mode 160000 index 00000000..aea82078 --- /dev/null +++ b/vendor/grammars/smalltalk-tmbundle @@ -0,0 +1 @@ +Subproject commit aea820788aa0d81f74a4e4f9a3492a690d70e542 diff --git a/vendor/grammars/sql.tmbundle b/vendor/grammars/sql.tmbundle new file mode 160000 index 00000000..0e80dd0c --- /dev/null +++ b/vendor/grammars/sql.tmbundle @@ -0,0 +1 @@ +Subproject commit 0e80dd0c7d72e539213703f5e70615e6afa62cff diff --git a/vendor/grammars/standard-ml.tmbundle b/vendor/grammars/standard-ml.tmbundle new file mode 160000 index 00000000..791c8b20 --- /dev/null +++ b/vendor/grammars/standard-ml.tmbundle @@ -0,0 +1 @@ +Subproject commit 791c8b2054b4c12edcee29d73945c0db53e447e9 diff --git a/vendor/grammars/sublime-MuPAD b/vendor/grammars/sublime-MuPAD new file mode 160000 index 00000000..a0efbd59 --- /dev/null +++ b/vendor/grammars/sublime-MuPAD @@ -0,0 +1 @@ +Subproject commit a0efbd596208f270d9ec92765ce07c25c8d5834c diff --git a/vendor/grammars/sublime-befunge b/vendor/grammars/sublime-befunge new file mode 160000 index 00000000..a49a3fb1 --- /dev/null +++ b/vendor/grammars/sublime-befunge @@ -0,0 +1 @@ +Subproject commit a49a3fb1a3afca1dde2a522585841d97999e8ad7 diff --git a/vendor/grammars/sublime-better-typescript b/vendor/grammars/sublime-better-typescript new file mode 160000 index 00000000..b956adec --- /dev/null +++ b/vendor/grammars/sublime-better-typescript @@ -0,0 +1 @@ +Subproject commit b956adec0a0a48c6e637935bbb87fbe6155d46a8 diff --git a/vendor/grammars/sublime-bsv b/vendor/grammars/sublime-bsv new file mode 160000 index 00000000..ca223cdd --- /dev/null +++ b/vendor/grammars/sublime-bsv @@ -0,0 +1 @@ +Subproject commit ca223cdd653e454ed7536f50e68c70bc56d30103 diff --git a/vendor/grammars/sublime-cirru b/vendor/grammars/sublime-cirru new file mode 160000 index 00000000..4f34b670 --- /dev/null +++ b/vendor/grammars/sublime-cirru @@ -0,0 +1 @@ +Subproject commit 4f34b67097262785277887151d04f9d67d3deb07 diff --git a/vendor/grammars/sublime-glsl b/vendor/grammars/sublime-glsl new file mode 160000 index 00000000..31bb50cb --- /dev/null +++ b/vendor/grammars/sublime-glsl @@ -0,0 +1 @@ +Subproject commit 31bb50cbb3501aa94375cc1ded5cc924cfe92f8a diff --git a/vendor/grammars/sublime-idris b/vendor/grammars/sublime-idris new file mode 160000 index 00000000..5e936d1c --- /dev/null +++ b/vendor/grammars/sublime-idris @@ -0,0 +1 @@ +Subproject commit 5e936d1c924c0edaead59a82bd9e9c1456eef61b diff --git a/vendor/grammars/sublime-mask b/vendor/grammars/sublime-mask new file mode 160000 index 00000000..6f12d284 --- /dev/null +++ b/vendor/grammars/sublime-mask @@ -0,0 +1 @@ +Subproject commit 6f12d2841d008fb02eee912485cebcad7151d4f0 diff --git a/vendor/grammars/sublime-nginx b/vendor/grammars/sublime-nginx new file mode 160000 index 00000000..eee371d7 --- /dev/null +++ b/vendor/grammars/sublime-nginx @@ -0,0 +1 @@ +Subproject commit eee371d7f4d688c6ccac0322c63506080e873131 diff --git a/vendor/grammars/sublime-nix b/vendor/grammars/sublime-nix new file mode 160000 index 00000000..412f7e1d --- /dev/null +++ b/vendor/grammars/sublime-nix @@ -0,0 +1 @@ +Subproject commit 412f7e1da57bd1be9ce185f27c0f36a95639ca25 diff --git a/vendor/grammars/sublime-robot-plugin b/vendor/grammars/sublime-robot-plugin new file mode 160000 index 00000000..bf5dc7fa --- /dev/null +++ b/vendor/grammars/sublime-robot-plugin @@ -0,0 +1 @@ +Subproject commit bf5dc7fa9f431f4990a02518f89fe45a2beaa5e8 diff --git a/vendor/grammars/sublime-rust b/vendor/grammars/sublime-rust new file mode 160000 index 00000000..40df3591 --- /dev/null +++ b/vendor/grammars/sublime-rust @@ -0,0 +1 @@ +Subproject commit 40df35916158b680eb3d9acb9080a03f7799144c diff --git a/vendor/grammars/sublime-sourcepawn b/vendor/grammars/sublime-sourcepawn new file mode 160000 index 00000000..350914ff --- /dev/null +++ b/vendor/grammars/sublime-sourcepawn @@ -0,0 +1 @@ +Subproject commit 350914ff0ef8e58b7ae24181728cce3906f344e7 diff --git a/vendor/grammars/sublime-tea b/vendor/grammars/sublime-tea new file mode 160000 index 00000000..b5f1025e --- /dev/null +++ b/vendor/grammars/sublime-tea @@ -0,0 +1 @@ +Subproject commit b5f1025e074a29d3d1e133fc0e1b59b1adec986c diff --git a/vendor/grammars/sublime_cobol b/vendor/grammars/sublime_cobol new file mode 160000 index 00000000..4be198de --- /dev/null +++ b/vendor/grammars/sublime_cobol @@ -0,0 +1 @@ +Subproject commit 4be198de811d856e3f67ea04d7626ce82aff3dcb diff --git a/vendor/grammars/sublime_man_page_support b/vendor/grammars/sublime_man_page_support new file mode 160000 index 00000000..f3568e9e --- /dev/null +++ b/vendor/grammars/sublime_man_page_support @@ -0,0 +1 @@ +Subproject commit f3568e9e61c344cb91e926665ec714adb34ed24c diff --git a/vendor/grammars/sublimetext-cuda-cpp b/vendor/grammars/sublimetext-cuda-cpp new file mode 160000 index 00000000..e51269fc --- /dev/null +++ b/vendor/grammars/sublimetext-cuda-cpp @@ -0,0 +1 @@ +Subproject commit e51269fc22602d3f7aaac0266fc189c4ed4a3901 diff --git a/vendor/grammars/swift.tmbundle b/vendor/grammars/swift.tmbundle new file mode 160000 index 00000000..0cd27c70 --- /dev/null +++ b/vendor/grammars/swift.tmbundle @@ -0,0 +1 @@ +Subproject commit 0cd27c708953230e10571ccb88a4b24eedf762bb diff --git a/vendor/grammars/tcl.tmbundle b/vendor/grammars/tcl.tmbundle new file mode 160000 index 00000000..f06f8014 --- /dev/null +++ b/vendor/grammars/tcl.tmbundle @@ -0,0 +1 @@ +Subproject commit f06f80144c01ff1e3836cef21cbac62f8e1c5df6 diff --git a/vendor/grammars/text.tmbundle b/vendor/grammars/text.tmbundle new file mode 160000 index 00000000..961652ad --- /dev/null +++ b/vendor/grammars/text.tmbundle @@ -0,0 +1 @@ +Subproject commit 961652ad957678e75b533406de1be5bd7f489063 diff --git a/vendor/grammars/textile.tmbundle b/vendor/grammars/textile.tmbundle new file mode 160000 index 00000000..6951fec2 --- /dev/null +++ b/vendor/grammars/textile.tmbundle @@ -0,0 +1 @@ +Subproject commit 6951fec27ccefe4245b76fda33987e746b91758a diff --git a/vendor/grammars/textmate.tmbundle b/vendor/grammars/textmate.tmbundle new file mode 160000 index 00000000..49270318 --- /dev/null +++ b/vendor/grammars/textmate.tmbundle @@ -0,0 +1 @@ +Subproject commit 49270318d53923faba4fa81d56f121b5618239f0 diff --git a/vendor/grammars/thrift.tmbundle b/vendor/grammars/thrift.tmbundle new file mode 160000 index 00000000..eac7c810 --- /dev/null +++ b/vendor/grammars/thrift.tmbundle @@ -0,0 +1 @@ +Subproject commit eac7c8100416015be2bd20562138f43ba3a573b7 diff --git a/vendor/grammars/toml.tmbundle b/vendor/grammars/toml.tmbundle new file mode 160000 index 00000000..cda2b74d --- /dev/null +++ b/vendor/grammars/toml.tmbundle @@ -0,0 +1 @@ +Subproject commit cda2b74d0d40c841c573eae9c5e9edd7621d8d90 diff --git a/vendor/grammars/turtle.tmbundle b/vendor/grammars/turtle.tmbundle new file mode 160000 index 00000000..0782b476 --- /dev/null +++ b/vendor/grammars/turtle.tmbundle @@ -0,0 +1 @@ +Subproject commit 0782b476573a317917fb9b3bbe7e6a68abefa7a5 diff --git a/vendor/grammars/verilog.tmbundle b/vendor/grammars/verilog.tmbundle new file mode 160000 index 00000000..7627ae50 --- /dev/null +++ b/vendor/grammars/verilog.tmbundle @@ -0,0 +1 @@ +Subproject commit 7627ae507278edd9534c3f905d48736875658bf5 diff --git a/vendor/grammars/x86-assembly-textmate-bundle b/vendor/grammars/x86-assembly-textmate-bundle new file mode 160000 index 00000000..f6c4d3ae --- /dev/null +++ b/vendor/grammars/x86-assembly-textmate-bundle @@ -0,0 +1 @@ +Subproject commit f6c4d3ae596cdad8e9f6442b3a8daffd3530ab50 diff --git a/vendor/grammars/xml.tmbundle b/vendor/grammars/xml.tmbundle new file mode 160000 index 00000000..ff0d3e51 --- /dev/null +++ b/vendor/grammars/xml.tmbundle @@ -0,0 +1 @@ +Subproject commit ff0d3e51d42f046f2dc6a1322d21a60eca2038b9 diff --git a/vendor/grammars/zephir-sublime b/vendor/grammars/zephir-sublime new file mode 160000 index 00000000..5b1d75b5 --- /dev/null +++ b/vendor/grammars/zephir-sublime @@ -0,0 +1 @@ +Subproject commit 5b1d75b565894b7d7380e9f994d4a5d8a105867f