From 3c5bcb434c68a2c6c6d3a346b70ec35961627e8e Mon Sep 17 00:00:00 2001 From: Keith Rarick Date: Thu, 3 Sep 2015 10:27:28 -0700 Subject: [PATCH 01/24] Add Go dependencies to generated.rb and test_blob.rb --- lib/linguist/generated.rb | 9 +++++++++ test/test_blob.rb | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/lib/linguist/generated.rb b/lib/linguist/generated.rb index f1fb2d19..cc64c824 100644 --- a/lib/linguist/generated.rb +++ b/lib/linguist/generated.rb @@ -56,6 +56,7 @@ module Linguist generated_net_specflow_feature_file? || composer_lock? || node_modules? || + go_vendor? || godeps? || generated_by_zephir? || minified_files? || @@ -280,6 +281,14 @@ module Linguist !!name.match(/node_modules\//) end + # Internal: Is the blob part of the Go vendor/ tree, + # not meant for humans in pull requests. + # + # Returns true or false. + def go_vendor? + !!name.match(/vendor\//) + end + # Internal: Is the blob part of Godeps/, # which are not meant for humans in pull requests. # diff --git a/test/test_blob.rb b/test/test_blob.rb index 1ba647b0..74cffc2b 100644 --- a/test/test_blob.rb +++ b/test/test_blob.rb @@ -245,6 +245,10 @@ class TestBlob < Minitest::Test assert sample_blob("node_modules/grunt/lib/grunt.js").generated? + # Go vendored dependencies + assert sample_blob("vendor/vendor.json").generated? + assert sample_blob("vendor/github.com/kr/s3/sign.go").generated? + # Godep saved dependencies assert sample_blob("Godeps/Godeps.json").generated? assert sample_blob("Godeps/_workspace/src/github.com/kr/s3/sign.go").generated? From d46530989c93e036721487dbfd16e9a9b8f1082c Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Thu, 18 Feb 2016 19:57:34 -0500 Subject: [PATCH 02/24] Only treat `.go` files in ^vendor/ as generated --- lib/linguist/generated.rb | 4 +++- test/fixtures/go/food_vendor/candy.go | 1 + test/test_blob.rb | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/go/food_vendor/candy.go diff --git a/lib/linguist/generated.rb b/lib/linguist/generated.rb index cc64c824..8c2c1bcd 100644 --- a/lib/linguist/generated.rb +++ b/lib/linguist/generated.rb @@ -286,7 +286,9 @@ module Linguist # # Returns true or false. def go_vendor? - !!name.match(/vendor\//) + return false unless extname == '.go' + + !!name.match(/\Avendor\//) end # Internal: Is the blob part of Godeps/, diff --git a/test/fixtures/go/food_vendor/candy.go b/test/fixtures/go/food_vendor/candy.go new file mode 100644 index 00000000..ce65385b --- /dev/null +++ b/test/fixtures/go/food_vendor/candy.go @@ -0,0 +1 @@ +// empty file for testing that paths with vendor in them don't get ingored diff --git a/test/test_blob.rb b/test/test_blob.rb index 74cffc2b..2e50853d 100644 --- a/test/test_blob.rb +++ b/test/test_blob.rb @@ -246,8 +246,9 @@ class TestBlob < Minitest::Test assert sample_blob("node_modules/grunt/lib/grunt.js").generated? # Go vendored dependencies - assert sample_blob("vendor/vendor.json").generated? + refute sample_blob("vendor/vendor.json").generated? assert sample_blob("vendor/github.com/kr/s3/sign.go").generated? + refute fixture_blob("go/food_vendor/candy.go").generated? # Godep saved dependencies assert sample_blob("Godeps/Godeps.json").generated? From a8719f3e8242d23be06ed1415950db17b9135ded Mon Sep 17 00:00:00 2001 From: Alhadis Date: Tue, 6 Sep 2016 23:05:27 +1000 Subject: [PATCH 03/24] Add script to generate grammars-list in Markdown --- script/list-grammars | 69 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100755 script/list-grammars diff --git a/script/list-grammars b/script/list-grammars new file mode 100755 index 00000000..d58f9ef2 --- /dev/null +++ b/script/list-grammars @@ -0,0 +1,69 @@ +#!/usr/bin/env ruby + +require "linguist" +require "json" +require "yaml" + +root = File.expand_path "../../", __FILE__ + +language_names = Linguist::Language.all.map(&:name).sort { |a, b| a.downcase() <=> b.downcase() } + + +# Shorten a repository URL +def shorten(url) + if url =~ /^https?:\/\/(?:www\.)?github\.com\/([^\/]+\/[^\/]+)/i + $1 + elsif url =~ /^https?:\/\/(?:www\.)?(bitbucket|gitlab)\.(?:com|org)\/([^\/]+\/[^\/]+)/i + "#{$1.downcase()}:#{$2}" + else + url.replace(/^https?:\/\/(?:www\.)?/i, "") + end +end + +# Load .gitmodules +submodules = {} +submodule_file = File.read("#{root}/.gitmodules") +pattern = /^\[submodule\s*"([^"]+)"\]$\n((?:^(?!\[).+(?:\n|$))+)/is +submodule_file.scan(pattern) do |id, attr| + submod = {} + submod[:path] = $1 if attr =~ /^\s*path\s*=\s*(.+)$/ + submod[:url] = $1 if attr =~ /^\s*url\s*=\s*(.+)$/ + submod[:url].gsub!(/\.git$/, "") + submod[:short] = shorten(submod[:url]) + submodules["#{id}"] = submod +end + +# Load grammars.yml +submodules_by_scope = {} +grammars = YAML.load_file("#{root}/grammars.yml") +grammars.each do |path, scopes| + scopes.each { |scope| submodules_by_scope[scope] = path } +end + + +# Markdown: Generate grammar list +markdown = "" +language_names.each do |item| + lang = Linguist::Language["#{item}"] + scope = lang.tm_scope + next if scope == "none" + path = submodules_by_scope[scope] || scope + case path + when "https://bitbucket.org/Clams/sublimesystemverilog/get/default.tar.gz" + short_url = "bitbucket:Clams/sublimesystemverilog" + long_url = "https://bitbucket.org/Clams/sublimesystemverilog" + when "http://svn.edgewall.org/repos/genshi/contrib/textmate/Genshi.tmbundle/Syntaxes/Markup%20Template%20%28XML%29.tmLanguage" + short_url = "genshi.edgewall.org/query" + long_url = "https://genshi.edgewall.org/query" + when "vendor/grammars/oz-tmbundle/Syntaxes/Oz.tmLanguage" + short_url = "eregon/oz-tmbundle" + long_url = "https://github.com/eregon/oz-tmbundle" + else + submodule = submodules[submodules_by_scope[scope]] + short_url = submodule[:short] + long_url = submodule[:url] + end + markdown += "- **#{item}:** [#{short_url}](#{long_url})\n" +end + +puts markdown From 49e9ee48d0f7207587ca23ec37f7e5354015cd3e Mon Sep 17 00:00:00 2001 From: Alhadis Date: Wed, 7 Sep 2016 00:09:24 +1000 Subject: [PATCH 04/24] Make grammar-listing code more modular --- script/list-grammars | 145 ++++++++++++++++++++++++++----------------- 1 file changed, 88 insertions(+), 57 deletions(-) diff --git a/script/list-grammars b/script/list-grammars index d58f9ef2..16a7ef85 100755 --- a/script/list-grammars +++ b/script/list-grammars @@ -4,66 +4,97 @@ require "linguist" require "json" require "yaml" -root = File.expand_path "../../", __FILE__ -language_names = Linguist::Language.all.map(&:name).sort { |a, b| a.downcase() <=> b.downcase() } +class GrammarList + + ROOT = File.expand_path "../../", __FILE__ + + def initialize + @submodules = load_submodules() + @sources = load_sources() + @language_names = load_languages() + end + + + # Load .gitmodules + def load_submodules + submodules = {} + submodule_file = File.read("#{ROOT}/.gitmodules") + pattern = /^\[submodule\s*"([^"]+)"\]$\n((?:^(?!\[).+(?:\n|$))+)/is + submodule_file.scan(pattern) do |id, attr| + submod = {} + submod[:path] = $1 if attr =~ /^\s*path\s*=\s*(.+)$/ + submod[:url] = $1 if attr =~ /^\s*url\s*=\s*(.+)$/ + submod[:url].gsub!(/\.git$/, "") + submod[:short] = shorten(submod[:url]) + submodules["#{id}"] = submod + end + submodules + end + + + # Grab the name of each language, sorted case-insensitively + def load_languages + Linguist::Language.all.map(&:name).sort do |a, b| + a.downcase() <=> b.downcase() + end + end + + + # Load grammars.yml + def load_sources + sources = {} + grammars = YAML.load_file("#{ROOT}/grammars.yml") + grammars.each do |path, scopes| + scopes.each { |scope| sources[scope] = path } + end + sources + end + + + # Shorten a repository URL + def shorten(url) + if url =~ /^https?:\/\/(?:www\.)?github\.com\/([^\/]+\/[^\/]+)/i + $1 + elsif url =~ /^https?:\/\/(?:www\.)?(bitbucket|gitlab)\.(?:com|org)\/([^\/]+\/[^\/]+)/i + "#{$1.downcase()}:#{$2}" + else + url.replace(/^https?:\/\/(?:www\.)?/i, "") + end + end + + + # Markdown: Generate grammar list + def to_markdown + markdown = "" + @language_names.each do |item| + lang = Linguist::Language["#{item}"] + scope = lang.tm_scope + next if scope == "none" + path = @sources[scope] || scope + case path + when "https://bitbucket.org/Clams/sublimesystemverilog/get/default.tar.gz" + short_url = "bitbucket:Clams/sublimesystemverilog" + long_url = "https://bitbucket.org/Clams/sublimesystemverilog" + when "http://svn.edgewall.org/repos/genshi/contrib/textmate/Genshi.tmbundle/Syntaxes/Markup%20Template%20%28XML%29.tmLanguage" + short_url = "genshi.edgewall.org/query" + long_url = "https://genshi.edgewall.org/query" + when "vendor/grammars/oz-tmbundle/Syntaxes/Oz.tmLanguage" + short_url = "eregon/oz-tmbundle" + long_url = "https://github.com/eregon/oz-tmbundle" + else + submodule = @submodules[@sources[scope]] + next unless submodule + short_url = submodule[:short] + long_url = submodule[:url] + end + markdown += "- **#{item}:** [#{short_url}](#{long_url})\n" + end - -# Shorten a repository URL -def shorten(url) - if url =~ /^https?:\/\/(?:www\.)?github\.com\/([^\/]+\/[^\/]+)/i - $1 - elsif url =~ /^https?:\/\/(?:www\.)?(bitbucket|gitlab)\.(?:com|org)\/([^\/]+\/[^\/]+)/i - "#{$1.downcase()}:#{$2}" - else - url.replace(/^https?:\/\/(?:www\.)?/i, "") + markdown end end -# Load .gitmodules -submodules = {} -submodule_file = File.read("#{root}/.gitmodules") -pattern = /^\[submodule\s*"([^"]+)"\]$\n((?:^(?!\[).+(?:\n|$))+)/is -submodule_file.scan(pattern) do |id, attr| - submod = {} - submod[:path] = $1 if attr =~ /^\s*path\s*=\s*(.+)$/ - submod[:url] = $1 if attr =~ /^\s*url\s*=\s*(.+)$/ - submod[:url].gsub!(/\.git$/, "") - submod[:short] = shorten(submod[:url]) - submodules["#{id}"] = submod -end -# Load grammars.yml -submodules_by_scope = {} -grammars = YAML.load_file("#{root}/grammars.yml") -grammars.each do |path, scopes| - scopes.each { |scope| submodules_by_scope[scope] = path } -end - - -# Markdown: Generate grammar list -markdown = "" -language_names.each do |item| - lang = Linguist::Language["#{item}"] - scope = lang.tm_scope - next if scope == "none" - path = submodules_by_scope[scope] || scope - case path - when "https://bitbucket.org/Clams/sublimesystemverilog/get/default.tar.gz" - short_url = "bitbucket:Clams/sublimesystemverilog" - long_url = "https://bitbucket.org/Clams/sublimesystemverilog" - when "http://svn.edgewall.org/repos/genshi/contrib/textmate/Genshi.tmbundle/Syntaxes/Markup%20Template%20%28XML%29.tmLanguage" - short_url = "genshi.edgewall.org/query" - long_url = "https://genshi.edgewall.org/query" - when "vendor/grammars/oz-tmbundle/Syntaxes/Oz.tmLanguage" - short_url = "eregon/oz-tmbundle" - long_url = "https://github.com/eregon/oz-tmbundle" - else - submodule = submodules[submodules_by_scope[scope]] - short_url = submodule[:short] - long_url = submodule[:url] - end - markdown += "- **#{item}:** [#{short_url}](#{long_url})\n" -end - -puts markdown +list = GrammarList.new +puts list.to_markdown() From 09612ae42ec2ea111011324480e3b33476e1b207 Mon Sep 17 00:00:00 2001 From: Alhadis Date: Wed, 7 Sep 2016 00:21:05 +1000 Subject: [PATCH 05/24] Add logic to update Markdown file --- script/list-grammars | 11 +- vendor/README.md | 307 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 317 insertions(+), 1 deletion(-) create mode 100644 vendor/README.md diff --git a/script/list-grammars b/script/list-grammars index 16a7ef85..d9cb0332 100755 --- a/script/list-grammars +++ b/script/list-grammars @@ -93,8 +93,17 @@ class GrammarList markdown end + + + # Update the file displaying the reader-friendly list of grammar repos + def update_readme + readme = "#{ROOT}/vendor/README.md" + preamble = File.read(readme).match(/\A.+?\n/ms) + list = self.to_markdown + File.write(readme, preamble.to_s + list) + end end list = GrammarList.new -puts list.to_markdown() +puts list.update_readme() diff --git a/vendor/README.md b/vendor/README.md new file mode 100644 index 00000000..aa3e492f --- /dev/null +++ b/vendor/README.md @@ -0,0 +1,307 @@ +Grammar index +============= + +This is a list of grammars that Linguist selects to provide syntax highlighting on GitHub. + +If you've encountered an error with highlighting, please report it to the appropriate repository. + + + +- **1C Enterprise:** [xDrivenDevelopment/atom-language-1c-bsl](https://github.com/xDrivenDevelopment/atom-language-1c-bsl) +- **ABAP:** [pvl/abap.tmbundle](https://github.com/pvl/abap.tmbundle) +- **ActionScript:** [honzabrecka/actionscript3-tmbundle](https://github.com/honzabrecka/actionscript3-tmbundle) +- **Ada:** [textmate/ada.tmbundle](https://github.com/textmate/ada.tmbundle) +- **Agda:** [mokus0/Agda.tmbundle](https://github.com/mokus0/Agda.tmbundle) +- **AGS Script:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) +- **Alloy:** [macekond/Alloy.tmbundle](https://github.com/macekond/Alloy.tmbundle) +- **Alpine Abuild:** [atom/language-shellscript](https://github.com/atom/language-shellscript) +- **AMPL:** [ampl/sublime-ampl](https://github.com/ampl/sublime-ampl) +- **Ant Build System:** [textmate/ant.tmbundle](https://github.com/textmate/ant.tmbundle) +- **ANTLR:** [textmate/antlr.tmbundle](https://github.com/textmate/antlr.tmbundle) +- **ApacheConf:** [textmate/apache.tmbundle](https://github.com/textmate/apache.tmbundle) +- **Apex:** [textmate/java.tmbundle](https://github.com/textmate/java.tmbundle) +- **APL:** [Alhadis/language-apl](https://github.com/Alhadis/language-apl) +- **Apollo Guidance Computer:** [Alhadis/language-agc](https://github.com/Alhadis/language-agc) +- **AppleScript:** [textmate/applescript.tmbundle](https://github.com/textmate/applescript.tmbundle) +- **Arduino:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) +- **ASN.1:** [ajLangley12/language-asn1](https://github.com/ajLangley12/language-asn1) +- **ASP:** [textmate/asp.tmbundle](https://github.com/textmate/asp.tmbundle) +- **ATS:** [steinwaywhw/ats-mode-sublimetext](https://github.com/steinwaywhw/ats-mode-sublimetext) +- **Awk:** [JohnNilsson/awk-sublime](https://github.com/JohnNilsson/awk-sublime) +- **Befunge:** [johanasplund/sublime-befunge](https://github.com/johanasplund/sublime-befunge) +- **Bison:** [textmate/bison.tmbundle](https://github.com/textmate/bison.tmbundle) +- **BlitzBasic:** [textmate/blitzmax.tmbundle](https://github.com/textmate/blitzmax.tmbundle) +- **BlitzMax:** [textmate/blitzmax.tmbundle](https://github.com/textmate/blitzmax.tmbundle) +- **Bluespec:** [thotypous/sublime-bsv](https://github.com/thotypous/sublime-bsv) +- **Brainfuck:** [Drako/SublimeBrainfuck](https://github.com/Drako/SublimeBrainfuck) +- **Bro:** [bro/bro-sublime](https://github.com/bro/bro-sublime) +- **C:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) +- **C#:** [atom/language-csharp](https://github.com/atom/language-csharp) +- **C++:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) +- **C2hs Haskell:** [atom-haskell/language-haskell](https://github.com/atom-haskell/language-haskell) +- **Cap'n Proto:** [textmate/capnproto.tmbundle](https://github.com/textmate/capnproto.tmbundle) +- **CartoCSS:** [yohanboniface/carto-atom](https://github.com/yohanboniface/carto-atom) +- **Ceylon:** [jeancharles-roger/ceylon-sublimetext](https://github.com/jeancharles-roger/ceylon-sublimetext) +- **Chapel:** [chapel-lang/chapel-tmbundle](https://github.com/chapel-lang/chapel-tmbundle) +- **ChucK:** [textmate/java.tmbundle](https://github.com/textmate/java.tmbundle) +- **Cirru:** [Cirru/sublime-cirru](https://github.com/Cirru/sublime-cirru) +- **Clean:** [timjs/atom-language-clean](https://github.com/timjs/atom-language-clean) +- **Clojure:** [atom/language-clojure](https://github.com/atom/language-clojure) +- **CMake:** [textmate/cmake.tmbundle](https://github.com/textmate/cmake.tmbundle) +- **COBOL:** [bitbucket:bitlang/sublime_cobol](https://bitbucket.org/bitlang/sublime_cobol) +- **CoffeeScript:** [atom/language-coffee-script](https://github.com/atom/language-coffee-script) +- **ColdFusion:** [SublimeText/ColdFusion](https://github.com/SublimeText/ColdFusion) +- **ColdFusion CFC:** [SublimeText/ColdFusion](https://github.com/SublimeText/ColdFusion) +- **COLLADA:** [textmate/xml.tmbundle](https://github.com/textmate/xml.tmbundle) +- **Common Lisp:** [textmate/lisp.tmbundle](https://github.com/textmate/lisp.tmbundle) +- **Component Pascal:** [textmate/pascal.tmbundle](https://github.com/textmate/pascal.tmbundle) +- **Cool:** [anunayk/cool-tmbundle](https://github.com/anunayk/cool-tmbundle) +- **Coq:** [mkolosick/Sublime-Coq](https://github.com/mkolosick/Sublime-Coq) +- **Crystal:** [atom-crystal/language-crystal](https://github.com/atom-crystal/language-crystal) +- **Csound:** [nwhetsell/language-csound](https://github.com/nwhetsell/language-csound) +- **Csound Document:** [nwhetsell/language-csound](https://github.com/nwhetsell/language-csound) +- **Csound Score:** [nwhetsell/language-csound](https://github.com/nwhetsell/language-csound) +- **CSS:** [textmate/css.tmbundle](https://github.com/textmate/css.tmbundle) +- **Cucumber:** [cucumber/cucumber-tmbundle](https://github.com/cucumber/cucumber-tmbundle) +- **Cuda:** [harrism/sublimetext-cuda-cpp](https://github.com/harrism/sublimetext-cuda-cpp) +- **Cycript:** [atom/language-javascript](https://github.com/atom/language-javascript) +- **Cython:** [textmate/cython.tmbundle](https://github.com/textmate/cython.tmbundle) +- **D:** [textmate/d.tmbundle](https://github.com/textmate/d.tmbundle) +- **Dart:** [guillermooo/dart-sublime-bundle](https://github.com/guillermooo/dart-sublime-bundle) +- **desktop:** [Mailaender/desktop.tmbundle](https://github.com/Mailaender/desktop.tmbundle) +- **Diff:** [textmate/diff.tmbundle](https://github.com/textmate/diff.tmbundle) +- **DNS Zone:** [sixty4k/st2-zonefile](https://github.com/sixty4k/st2-zonefile) +- **Dockerfile:** [asbjornenge/Docker.tmbundle](https://github.com/asbjornenge/Docker.tmbundle) +- **DTrace:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) +- **Dylan:** [textmate/dylan.tmbundle](https://github.com/textmate/dylan.tmbundle) +- **Eagle:** [textmate/xml.tmbundle](https://github.com/textmate/xml.tmbundle) +- **Ecere Projects:** [textmate/json.tmbundle](https://github.com/textmate/json.tmbundle) +- **edn:** [atom/language-clojure](https://github.com/atom/language-clojure) +- **Eiffel:** [textmate/eiffel.tmbundle](https://github.com/textmate/eiffel.tmbundle) +- **EJS:** [gregory-m/ejs-tmbundle](https://github.com/gregory-m/ejs-tmbundle) +- **Elixir:** [elixir-lang/elixir-tmbundle](https://github.com/elixir-lang/elixir-tmbundle) +- **Emacs Lisp:** [Alhadis/language-emacs-lisp](https://github.com/Alhadis/language-emacs-lisp) +- **EmberScript:** [atom/language-coffee-script](https://github.com/atom/language-coffee-script) +- **EQ:** [atom/language-csharp](https://github.com/atom/language-csharp) +- **Erlang:** [textmate/erlang.tmbundle](https://github.com/textmate/erlang.tmbundle) +- **Factor:** [slavapestov/factor](https://github.com/slavapestov/factor) +- **Fancy:** [fancy-lang/fancy-tmbundle](https://github.com/fancy-lang/fancy-tmbundle) +- **fish:** [l15n/fish-tmbundle](https://github.com/l15n/fish-tmbundle) +- **Forth:** [textmate/forth.tmbundle](https://github.com/textmate/forth.tmbundle) +- **FORTRAN:** [textmate/fortran.tmbundle](https://github.com/textmate/fortran.tmbundle) +- **FreeMarker:** [freemarker/FreeMarker.tmbundle](https://github.com/freemarker/FreeMarker.tmbundle) +- **Frege:** [atom-haskell/language-haskell](https://github.com/atom-haskell/language-haskell) +- **Game Maker Language:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) +- **GCC Machine Description:** [textmate/lisp.tmbundle](https://github.com/textmate/lisp.tmbundle) +- **Genshi:** [genshi.edgewall.org/query](https://genshi.edgewall.org/query) +- **Gentoo Ebuild:** [atom/language-shellscript](https://github.com/atom/language-shellscript) +- **Gentoo Eclass:** [atom/language-shellscript](https://github.com/atom/language-shellscript) +- **Gettext Catalog:** [textmate/gettext.tmbundle](https://github.com/textmate/gettext.tmbundle) +- **GLSL:** [euler0/sublime-glsl](https://github.com/euler0/sublime-glsl) +- **Glyph:** [textmate/tcl.tmbundle](https://github.com/textmate/tcl.tmbundle) +- **Gnuplot:** [mattfoster/gnuplot-tmbundle](https://github.com/mattfoster/gnuplot-tmbundle) +- **Go:** [AlanQuatermain/go-tmbundle](https://github.com/AlanQuatermain/go-tmbundle) +- **Gosu:** [jpcamara/Textmate-Gosu-Bundle](https://github.com/jpcamara/Textmate-Gosu-Bundle) +- **Grace:** [zmthy/grace-tmbundle](https://github.com/zmthy/grace-tmbundle) +- **Gradle:** [alkemist/gradle.tmbundle](https://github.com/alkemist/gradle.tmbundle) +- **Grammatical Framework:** [atom-haskell/language-haskell](https://github.com/atom-haskell/language-haskell) +- **GraphQL:** [rmosolgo/language-graphql](https://github.com/rmosolgo/language-graphql) +- **Graphviz (DOT):** [textmate/graphviz.tmbundle](https://github.com/textmate/graphviz.tmbundle) +- **Groff:** [Alhadis/language-roff](https://github.com/Alhadis/language-roff) +- **Groovy:** [textmate/groovy.tmbundle](https://github.com/textmate/groovy.tmbundle) +- **Groovy Server Pages:** [textmate/java.tmbundle](https://github.com/textmate/java.tmbundle) +- **Hack:** [textmate/php.tmbundle](https://github.com/textmate/php.tmbundle) +- **Haml:** [textmate/ruby-haml.tmbundle](https://github.com/textmate/ruby-haml.tmbundle) +- **Handlebars:** [daaain/Handlebars](https://github.com/daaain/Handlebars) +- **Harbour:** [hernad/atom-language-harbour](https://github.com/hernad/atom-language-harbour) +- **Haskell:** [atom-haskell/language-haskell](https://github.com/atom-haskell/language-haskell) +- **Haxe:** [clemos/haxe-sublime-bundle](https://github.com/clemos/haxe-sublime-bundle) +- **HCL:** [aroben/ruby.tmbundle](https://github.com/aroben/ruby.tmbundle) +- **HTML:** [textmate/html.tmbundle](https://github.com/textmate/html.tmbundle) +- **HTML+Django:** [textmate/python-django.tmbundle](https://github.com/textmate/python-django.tmbundle) +- **HTML+ECR:** [atom-crystal/language-crystal](https://github.com/atom-crystal/language-crystal) +- **HTML+EEX:** [elixir-lang/elixir-tmbundle](https://github.com/elixir-lang/elixir-tmbundle) +- **HTML+ERB:** [aroben/ruby.tmbundle](https://github.com/aroben/ruby.tmbundle) +- **HTML+PHP:** [textmate/php.tmbundle](https://github.com/textmate/php.tmbundle) +- **HTTP:** [httpspec/sublime-highlighting](https://github.com/httpspec/sublime-highlighting) +- **Hy:** [rwtolbert/language-hy](https://github.com/rwtolbert/language-hy) +- **IDL:** [mgalloy/idl.tmbundle](https://github.com/mgalloy/idl.tmbundle) +- **Inform 7:** [erkyrath/language-inform7](https://github.com/erkyrath/language-inform7) +- **INI:** [textmate/ini.tmbundle](https://github.com/textmate/ini.tmbundle) +- **Io:** [textmate/io.tmbundle](https://github.com/textmate/io.tmbundle) +- **Ioke:** [vic/ioke-outdated](https://github.com/vic/ioke-outdated) +- **Isabelle:** [lsf37/Isabelle.tmbundle](https://github.com/lsf37/Isabelle.tmbundle) +- **Isabelle ROOT:** [lsf37/Isabelle.tmbundle](https://github.com/lsf37/Isabelle.tmbundle) +- **Jade:** [davidrios/jade-tmbundle](https://github.com/davidrios/jade-tmbundle) +- **Jasmin:** [atmarksharp/jasmin-sublime](https://github.com/atmarksharp/jasmin-sublime) +- **Java:** [textmate/java.tmbundle](https://github.com/textmate/java.tmbundle) +- **Java Server Pages:** [textmate/java.tmbundle](https://github.com/textmate/java.tmbundle) +- **JavaScript:** [atom/language-javascript](https://github.com/atom/language-javascript) +- **JFlex:** [jflex-de/jflex.tmbundle](https://github.com/jflex-de/jflex.tmbundle) +- **JSON:** [textmate/json.tmbundle](https://github.com/textmate/json.tmbundle) +- **JSON5:** [atom/language-javascript](https://github.com/atom/language-javascript) +- **JSONLD:** [atom/language-javascript](https://github.com/atom/language-javascript) +- **Julia:** [nanoant/Julia.tmbundle](https://github.com/nanoant/Julia.tmbundle) +- **Jupyter Notebook:** [textmate/json.tmbundle](https://github.com/textmate/json.tmbundle) +- **Kit:** [textmate/html.tmbundle](https://github.com/textmate/html.tmbundle) +- **Kotlin:** [vkostyukov/kotlin-sublime-package](https://github.com/vkostyukov/kotlin-sublime-package) +- **LabVIEW:** [textmate/xml.tmbundle](https://github.com/textmate/xml.tmbundle) +- **Lasso:** [bfad/Sublime-Lasso](https://github.com/bfad/Sublime-Lasso) +- **Latte:** [textmate/php-smarty.tmbundle](https://github.com/textmate/php-smarty.tmbundle) +- **Lean:** [leanprover/Lean.tmbundle](https://github.com/leanprover/Lean.tmbundle) +- **LFE:** [textmate/lisp.tmbundle](https://github.com/textmate/lisp.tmbundle) +- **LilyPond:** [textmate/lilypond.tmbundle](https://github.com/textmate/lilypond.tmbundle) +- **Liquid:** [bastilian/validcode-textmate-bundles](https://github.com/bastilian/validcode-textmate-bundles) +- **Literate CoffeeScript:** [atom/language-coffee-script](https://github.com/atom/language-coffee-script) +- **Literate Haskell:** [atom-haskell/language-haskell](https://github.com/atom-haskell/language-haskell) +- **LiveScript:** [paulmillr/LiveScript.tmbundle](https://github.com/paulmillr/LiveScript.tmbundle) +- **LLVM:** [whitequark/llvm.tmbundle](https://github.com/whitequark/llvm.tmbundle) +- **Logos:** [Cykey/Sublime-Logos](https://github.com/Cykey/Sublime-Logos) +- **Logtalk:** [textmate/logtalk.tmbundle](https://github.com/textmate/logtalk.tmbundle) +- **LookML:** [atom/language-yaml](https://github.com/atom/language-yaml) +- **LoomScript:** [ambethia/Sublime-Loom](https://github.com/ambethia/Sublime-Loom) +- **LSL:** [textmate/secondlife-lsl.tmbundle](https://github.com/textmate/secondlife-lsl.tmbundle) +- **Lua:** [textmate/lua.tmbundle](https://github.com/textmate/lua.tmbundle) +- **M:** [textmate/lisp.tmbundle](https://github.com/textmate/lisp.tmbundle) +- **Makefile:** [textmate/make.tmbundle](https://github.com/textmate/make.tmbundle) +- **Mako:** [marconi/mako-tmbundle](https://github.com/marconi/mako-tmbundle) +- **Markdown:** [atom/language-gfm](https://github.com/atom/language-gfm) +- **Mask:** [tenbits/sublime-mask](https://github.com/tenbits/sublime-mask) +- **Mathematica:** [shadanan/mathematica-tmbundle](https://github.com/shadanan/mathematica-tmbundle) +- **Matlab:** [textmate/matlab.tmbundle](https://github.com/textmate/matlab.tmbundle) +- **Maven POM:** [textmate/maven.tmbundle](https://github.com/textmate/maven.tmbundle) +- **Max:** [textmate/json.tmbundle](https://github.com/textmate/json.tmbundle) +- **MAXScript:** [Alhadis/language-maxscript](https://github.com/Alhadis/language-maxscript) +- **Mercury:** [sebgod/mercury-tmlanguage](https://github.com/sebgod/mercury-tmlanguage) +- **Metal:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) +- **Mirah:** [aroben/ruby.tmbundle](https://github.com/aroben/ruby.tmbundle) +- **MoonScript:** [leafo/moonscript-tmbundle](https://github.com/leafo/moonscript-tmbundle) +- **MTML:** [textmate/html.tmbundle](https://github.com/textmate/html.tmbundle) +- **mupad:** [ccreutzig/sublime-MuPAD](https://github.com/ccreutzig/sublime-MuPAD) +- **NCL:** [rpavlick/language-ncl](https://github.com/rpavlick/language-ncl) +- **Nemerle:** [textmate/nemerle.tmbundle](https://github.com/textmate/nemerle.tmbundle) +- **nesC:** [cdwilson/nesC.tmbundle](https://github.com/cdwilson/nesC.tmbundle) +- **NetLinx:** [amclain/sublime-netlinx](https://github.com/amclain/sublime-netlinx) +- **NetLinx+ERB:** [amclain/sublime-netlinx](https://github.com/amclain/sublime-netlinx) +- **NetLogo:** [textmate/lisp.tmbundle](https://github.com/textmate/lisp.tmbundle) +- **NewLisp:** [textmate/lisp.tmbundle](https://github.com/textmate/lisp.tmbundle) +- **Nginx:** [brandonwamboldt/sublime-nginx](https://github.com/brandonwamboldt/sublime-nginx) +- **Nimrod:** [Varriount/NimLime](https://github.com/Varriount/NimLime) +- **Ninja:** [textmate/ninja.tmbundle](https://github.com/textmate/ninja.tmbundle) +- **Nit:** [R4PaSs/Sublime-Nit](https://github.com/R4PaSs/Sublime-Nit) +- **Nix:** [wmertens/sublime-nix](https://github.com/wmertens/sublime-nix) +- **NSIS:** [SublimeText/NSIS](https://github.com/SublimeText/NSIS) +- **Nu:** [jsallis/nu.tmbundle](https://github.com/jsallis/nu.tmbundle) +- **Objective-C:** [textmate/objective-c.tmbundle](https://github.com/textmate/objective-c.tmbundle) +- **Objective-C++:** [textmate/objective-c.tmbundle](https://github.com/textmate/objective-c.tmbundle) +- **Objective-J:** [textmate/javascript-objective-j.tmbundle](https://github.com/textmate/javascript-objective-j.tmbundle) +- **OCaml:** [textmate/ocaml.tmbundle](https://github.com/textmate/ocaml.tmbundle) +- **ooc:** [nilium/ooc.tmbundle](https://github.com/nilium/ooc.tmbundle) +- **Opa:** [mads379/opa.tmbundle](https://github.com/mads379/opa.tmbundle) +- **OpenCL:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) +- **OpenEdge ABL:** [jfairbank/Sublime-Text-2-OpenEdge-ABL](https://github.com/jfairbank/Sublime-Text-2-OpenEdge-ABL) +- **OpenRC runscript:** [atom/language-shellscript](https://github.com/atom/language-shellscript) +- **Oz:** [eregon/oz-tmbundle](https://github.com/eregon/oz-tmbundle) +- **Parrot Internal Representation:** [textmate/parrot.tmbundle](https://github.com/textmate/parrot.tmbundle) +- **Pascal:** [textmate/pascal.tmbundle](https://github.com/textmate/pascal.tmbundle) +- **Perl6:** [MadcapJake/language-perl6fe](https://github.com/MadcapJake/language-perl6fe) +- **PHP:** [textmate/php.tmbundle](https://github.com/textmate/php.tmbundle) +- **PicoLisp:** [textmate/lisp.tmbundle](https://github.com/textmate/lisp.tmbundle) +- **Pike:** [hww3/pike-textmate](https://github.com/hww3/pike-textmate) +- **PLpgSQL:** [textmate/sql.tmbundle](https://github.com/textmate/sql.tmbundle) +- **Pony:** [CausalityLtd/sublime-pony](https://github.com/CausalityLtd/sublime-pony) +- **PostScript:** [textmate/postscript.tmbundle](https://github.com/textmate/postscript.tmbundle) +- **POV-Ray SDL:** [c-lipka/language-povray](https://github.com/c-lipka/language-povray) +- **PowerShell:** [SublimeText/PowerShell](https://github.com/SublimeText/PowerShell) +- **Processing:** [textmate/processing.tmbundle](https://github.com/textmate/processing.tmbundle) +- **Protocol Buffer:** [michaeledgar/protobuf-tmbundle](https://github.com/michaeledgar/protobuf-tmbundle) +- **Python:** [MagicStack/MagicPython](https://github.com/MagicStack/MagicPython) +- **Python traceback:** [atom/language-python](https://github.com/atom/language-python) +- **QMake:** [textmate/cpp-qt.tmbundle](https://github.com/textmate/cpp-qt.tmbundle) +- **QML:** [skozlovf/Sublime-QML](https://github.com/skozlovf/Sublime-QML) +- **R:** [textmate/r.tmbundle](https://github.com/textmate/r.tmbundle) +- **Racket:** [soegaard/racket-highlight-for-github](https://github.com/soegaard/racket-highlight-for-github) +- **RAML:** [atom/language-yaml](https://github.com/atom/language-yaml) +- **RDoc:** [joshaven/RDoc.tmbundle](https://github.com/joshaven/RDoc.tmbundle) +- **REALbasic:** [angryant0007/VBDotNetSyntax](https://github.com/angryant0007/VBDotNetSyntax) +- **Rebol:** [Oldes/Sublime-REBOL](https://github.com/Oldes/Sublime-REBOL) +- **Red:** [Oldes/Sublime-Red](https://github.com/Oldes/Sublime-Red) +- **Ren'Py:** [williamd1k0/language-renpy](https://github.com/williamd1k0/language-renpy) +- **reStructuredText:** [Lukasa/language-restructuredtext](https://github.com/Lukasa/language-restructuredtext) +- **RHTML:** [aroben/ruby.tmbundle](https://github.com/aroben/ruby.tmbundle) +- **RMarkdown:** [atom/language-gfm](https://github.com/atom/language-gfm) +- **RobotFramework:** [shellderp/sublime-robot-plugin](https://github.com/shellderp/sublime-robot-plugin) +- **Rouge:** [atom/language-clojure](https://github.com/atom/language-clojure) +- **Ruby:** [aroben/ruby.tmbundle](https://github.com/aroben/ruby.tmbundle) +- **RUNOFF:** [Alhadis/language-roff](https://github.com/Alhadis/language-roff) +- **Rust:** [jhasse/sublime-rust](https://github.com/jhasse/sublime-rust) +- **Sage:** [MagicStack/MagicPython](https://github.com/MagicStack/MagicPython) +- **SaltStack:** [saltstack/atom-salt](https://github.com/saltstack/atom-salt) +- **SAS:** [rpardee/sas.tmbundle](https://github.com/rpardee/sas.tmbundle) +- **Sass:** [nathos/sass-textmate-bundle](https://github.com/nathos/sass-textmate-bundle) +- **Scala:** [mads379/scala.tmbundle](https://github.com/mads379/scala.tmbundle) +- **Scaml:** [scalate/Scalate.tmbundle](https://github.com/scalate/Scalate.tmbundle) +- **Scheme:** [textmate/scheme.tmbundle](https://github.com/textmate/scheme.tmbundle) +- **Scilab:** [textmate/scilab.tmbundle](https://github.com/textmate/scilab.tmbundle) +- **SCSS:** [MarioRicalde/SCSS.tmbundle](https://github.com/MarioRicalde/SCSS.tmbundle) +- **Shell:** [atom/language-shellscript](https://github.com/atom/language-shellscript) +- **ShellSession:** [atom/language-shellscript](https://github.com/atom/language-shellscript) +- **Slash:** [slash-lang/Slash.tmbundle](https://github.com/slash-lang/Slash.tmbundle) +- **Slim:** [slim-template/ruby-slim.tmbundle](https://github.com/slim-template/ruby-slim.tmbundle) +- **Smalltalk:** [tomas-stefano/smalltalk-tmbundle](https://github.com/tomas-stefano/smalltalk-tmbundle) +- **Smarty:** [textmate/php-smarty.tmbundle](https://github.com/textmate/php-smarty.tmbundle) +- **SMT:** [SRI-CSL/SMT.tmbundle](https://github.com/SRI-CSL/SMT.tmbundle) +- **SPARQL:** [peta/turtle.tmbundle](https://github.com/peta/turtle.tmbundle) +- **SQF:** [JonBons/Sublime-SQF-Language](https://github.com/JonBons/Sublime-SQF-Language) +- **SQL:** [textmate/sql.tmbundle](https://github.com/textmate/sql.tmbundle) +- **SQLPL:** [textmate/sql.tmbundle](https://github.com/textmate/sql.tmbundle) +- **Squirrel:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) +- **SRecode Template:** [textmate/lisp.tmbundle](https://github.com/textmate/lisp.tmbundle) +- **Standard ML:** [textmate/standard-ml.tmbundle](https://github.com/textmate/standard-ml.tmbundle) +- **STON:** [tomas-stefano/smalltalk-tmbundle](https://github.com/tomas-stefano/smalltalk-tmbundle) +- **SubRip Text:** [314eter/atom-language-srt](https://github.com/314eter/atom-language-srt) +- **SuperCollider:** [supercollider/language-supercollider](https://github.com/supercollider/language-supercollider) +- **SVG:** [textmate/xml.tmbundle](https://github.com/textmate/xml.tmbundle) +- **Swift:** [textmate/swift.tmbundle](https://github.com/textmate/swift.tmbundle) +- **SystemVerilog:** [bitbucket:Clams/sublimesystemverilog](https://bitbucket.org/Clams/sublimesystemverilog) +- **Tcl:** [textmate/tcl.tmbundle](https://github.com/textmate/tcl.tmbundle) +- **Tcsh:** [atom/language-shellscript](https://github.com/atom/language-shellscript) +- **Tea:** [pferruggiaro/sublime-tea](https://github.com/pferruggiaro/sublime-tea) +- **Terra:** [pyk/sublime-terra](https://github.com/pyk/sublime-terra) +- **TeX:** [textmate/latex.tmbundle](https://github.com/textmate/latex.tmbundle) +- **Thrift:** [textmate/thrift.tmbundle](https://github.com/textmate/thrift.tmbundle) +- **TLA:** [agentultra/TLAGrammar](https://github.com/agentultra/TLAGrammar) +- **TOML:** [textmate/toml.tmbundle](https://github.com/textmate/toml.tmbundle) +- **Turing:** [Alhadis/language-turing](https://github.com/Alhadis/language-turing) +- **Turtle:** [peta/turtle.tmbundle](https://github.com/peta/turtle.tmbundle) +- **Twig:** [Anomareh/PHP-Twig.tmbundle](https://github.com/Anomareh/PHP-Twig.tmbundle) +- **Unified Parallel C:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) +- **Unity3D Asset:** [atom/language-yaml](https://github.com/atom/language-yaml) +- **Uno:** [atom/language-csharp](https://github.com/atom/language-csharp) +- **UnrealScript:** [textmate/java.tmbundle](https://github.com/textmate/java.tmbundle) +- **UrWeb:** [gwalborn/UrWeb-Language-Definition](https://github.com/gwalborn/UrWeb-Language-Definition) +- **Vala:** [technosophos/Vala-TMBundle](https://github.com/technosophos/Vala-TMBundle) +- **VCL:** [brandonwamboldt/sublime-varnish](https://github.com/brandonwamboldt/sublime-varnish) +- **Verilog:** [textmate/verilog.tmbundle](https://github.com/textmate/verilog.tmbundle) +- **VHDL:** [textmate/vhdl.tmbundle](https://github.com/textmate/vhdl.tmbundle) +- **VimL:** [SalGnt/Sublime-VimL](https://github.com/SalGnt/Sublime-VimL) +- **Visual Basic:** [angryant0007/VBDotNetSyntax](https://github.com/angryant0007/VBDotNetSyntax) +- **Volt:** [textmate/d.tmbundle](https://github.com/textmate/d.tmbundle) +- **Vue:** [vuejs/vue-syntax-highlight](https://github.com/vuejs/vue-syntax-highlight) +- **Wavefront Material:** [Alhadis/language-wavefront](https://github.com/Alhadis/language-wavefront) +- **Wavefront Object:** [Alhadis/language-wavefront](https://github.com/Alhadis/language-wavefront) +- **Web Ontology Language:** [textmate/xml.tmbundle](https://github.com/textmate/xml.tmbundle) +- **WebIDL:** [andik/IDL-Syntax](https://github.com/andik/IDL-Syntax) +- **wisp:** [atom/language-clojure](https://github.com/atom/language-clojure) +- **World of Warcraft Addon Data:** [nebularg/language-toc-wow](https://github.com/nebularg/language-toc-wow) +- **X10:** [x10-lang/x10-highlighting](https://github.com/x10-lang/x10-highlighting) +- **xBase:** [hernad/atom-language-harbour](https://github.com/hernad/atom-language-harbour) +- **XML:** [textmate/xml.tmbundle](https://github.com/textmate/xml.tmbundle) +- **Xojo:** [angryant0007/VBDotNetSyntax](https://github.com/angryant0007/VBDotNetSyntax) +- **XProc:** [textmate/xml.tmbundle](https://github.com/textmate/xml.tmbundle) +- **XS:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) +- **XSLT:** [textmate/xml.tmbundle](https://github.com/textmate/xml.tmbundle) +- **Xtend:** [staltz/SublimeXtend](https://github.com/staltz/SublimeXtend) +- **Yacc:** [textmate/bison.tmbundle](https://github.com/textmate/bison.tmbundle) +- **YAML:** [atom/language-yaml](https://github.com/atom/language-yaml) +- **Zephir:** [vmg/zephir-sublime](https://github.com/vmg/zephir-sublime) From 2a4150b104edfec70a0aeb2a0010b90311a5be84 Mon Sep 17 00:00:00 2001 From: Alhadis Date: Wed, 7 Sep 2016 00:23:31 +1000 Subject: [PATCH 06/24] Butcher whitespace to appease tab-hating heretics --- script/list-grammars | 186 +++++++++++++++++++++---------------------- 1 file changed, 89 insertions(+), 97 deletions(-) diff --git a/script/list-grammars b/script/list-grammars index d9cb0332..f0bac8a7 100755 --- a/script/list-grammars +++ b/script/list-grammars @@ -4,106 +4,98 @@ require "linguist" require "json" require "yaml" - class GrammarList - - ROOT = File.expand_path "../../", __FILE__ - - def initialize - @submodules = load_submodules() - @sources = load_sources() - @language_names = load_languages() - end - - - # Load .gitmodules - def load_submodules - submodules = {} - submodule_file = File.read("#{ROOT}/.gitmodules") - pattern = /^\[submodule\s*"([^"]+)"\]$\n((?:^(?!\[).+(?:\n|$))+)/is - submodule_file.scan(pattern) do |id, attr| - submod = {} - submod[:path] = $1 if attr =~ /^\s*path\s*=\s*(.+)$/ - submod[:url] = $1 if attr =~ /^\s*url\s*=\s*(.+)$/ - submod[:url].gsub!(/\.git$/, "") - submod[:short] = shorten(submod[:url]) - submodules["#{id}"] = submod - end - submodules - end - - - # Grab the name of each language, sorted case-insensitively - def load_languages - Linguist::Language.all.map(&:name).sort do |a, b| - a.downcase() <=> b.downcase() - end - end - - - # Load grammars.yml - def load_sources - sources = {} - grammars = YAML.load_file("#{ROOT}/grammars.yml") - grammars.each do |path, scopes| - scopes.each { |scope| sources[scope] = path } - end - sources - end - - - # Shorten a repository URL - def shorten(url) - if url =~ /^https?:\/\/(?:www\.)?github\.com\/([^\/]+\/[^\/]+)/i - $1 - elsif url =~ /^https?:\/\/(?:www\.)?(bitbucket|gitlab)\.(?:com|org)\/([^\/]+\/[^\/]+)/i - "#{$1.downcase()}:#{$2}" - else - url.replace(/^https?:\/\/(?:www\.)?/i, "") - end - end - - - # Markdown: Generate grammar list - def to_markdown - markdown = "" - @language_names.each do |item| - lang = Linguist::Language["#{item}"] - scope = lang.tm_scope - next if scope == "none" - path = @sources[scope] || scope - case path - when "https://bitbucket.org/Clams/sublimesystemverilog/get/default.tar.gz" - short_url = "bitbucket:Clams/sublimesystemverilog" - long_url = "https://bitbucket.org/Clams/sublimesystemverilog" - when "http://svn.edgewall.org/repos/genshi/contrib/textmate/Genshi.tmbundle/Syntaxes/Markup%20Template%20%28XML%29.tmLanguage" - short_url = "genshi.edgewall.org/query" - long_url = "https://genshi.edgewall.org/query" - when "vendor/grammars/oz-tmbundle/Syntaxes/Oz.tmLanguage" - short_url = "eregon/oz-tmbundle" - long_url = "https://github.com/eregon/oz-tmbundle" - else - submodule = @submodules[@sources[scope]] - next unless submodule - short_url = submodule[:short] - long_url = submodule[:url] - end - markdown += "- **#{item}:** [#{short_url}](#{long_url})\n" - end + + ROOT = File.expand_path "../../", __FILE__ + + def initialize + @submodules = load_submodules() + @sources = load_sources() + @language_names = load_languages() + end + + # Load .gitmodules + def load_submodules + submodules = {} + submodule_file = File.read("#{ROOT}/.gitmodules") + pattern = /^\[submodule\s*"([^"]+)"\]$\n((?:^(?!\[).+(?:\n|$))+)/is + submodule_file.scan(pattern) do |id, attr| + submod = {} + submod[:path] = $1 if attr =~ /^\s*path\s*=\s*(.+)$/ + submod[:url] = $1 if attr =~ /^\s*url\s*=\s*(.+)$/ + submod[:url].gsub!(/\.git$/, "") + submod[:short] = shorten(submod[:url]) + submodules["#{id}"] = submod + end + submodules + end + + # Grab the name of each language, sorted case-insensitively + def load_languages + Linguist::Language.all.map(&:name).sort do |a, b| + a.downcase() <=> b.downcase() + end + end + + # Load grammars.yml + def load_sources + sources = {} + grammars = YAML.load_file("#{ROOT}/grammars.yml") + grammars.each do |path, scopes| + scopes.each { |scope| sources[scope] = path } + end + sources + end + + # Shorten a repository URL + def shorten(url) + if url =~ /^https?:\/\/(?:www\.)?github\.com\/([^\/]+\/[^\/]+)/i + $1 + elsif url =~ /^https?:\/\/(?:www\.)?(bitbucket|gitlab)\.(?:com|org)\/([^\/]+\/[^\/]+)/i + "#{$1.downcase()}:#{$2}" + else + url.replace(/^https?:\/\/(?:www\.)?/i, "") + end + end + + # Markdown: Generate grammar list + def to_markdown + markdown = "" + @language_names.each do |item| + lang = Linguist::Language["#{item}"] + scope = lang.tm_scope + next if scope == "none" + path = @sources[scope] || scope + case path + when "https://bitbucket.org/Clams/sublimesystemverilog/get/default.tar.gz" + short_url = "bitbucket:Clams/sublimesystemverilog" + long_url = "https://bitbucket.org/Clams/sublimesystemverilog" + when "http://svn.edgewall.org/repos/genshi/contrib/textmate/Genshi.tmbundle/Syntaxes/Markup%20Template%20%28XML%29.tmLanguage" + short_url = "genshi.edgewall.org/query" + long_url = "https://genshi.edgewall.org/query" + when "vendor/grammars/oz-tmbundle/Syntaxes/Oz.tmLanguage" + short_url = "eregon/oz-tmbundle" + long_url = "https://github.com/eregon/oz-tmbundle" + else + submodule = @submodules[@sources[scope]] + next unless submodule + short_url = submodule[:short] + long_url = submodule[:url] + end + markdown += "- **#{item}:** [#{short_url}](#{long_url})\n" + end - markdown - end - - - # Update the file displaying the reader-friendly list of grammar repos - def update_readme - readme = "#{ROOT}/vendor/README.md" - preamble = File.read(readme).match(/\A.+?\n/ms) - list = self.to_markdown - File.write(readme, preamble.to_s + list) - end + markdown + end + + # Update the file displaying the reader-friendly list of grammar repos + def update_readme + readme = "#{ROOT}/vendor/README.md" + preamble = File.read(readme).match(/\A.+?\n/ms) + list = self.to_markdown + File.write(readme, preamble.to_s + list) + end end - list = GrammarList.new puts list.update_readme() From 9d57e1e1b564a6790311247128c4424f6faf77d1 Mon Sep 17 00:00:00 2001 From: Alhadis Date: Wed, 7 Sep 2016 00:59:13 +1000 Subject: [PATCH 07/24] Remove debugging vestige --- script/list-grammars | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/list-grammars b/script/list-grammars index f0bac8a7..22542745 100755 --- a/script/list-grammars +++ b/script/list-grammars @@ -98,4 +98,4 @@ class GrammarList end list = GrammarList.new -puts list.update_readme() +list.update_readme() From 3247d46e8170a5fb63b6e6690e6b4809c8833738 Mon Sep 17 00:00:00 2001 From: Alhadis Date: Fri, 9 Sep 2016 16:27:57 +1000 Subject: [PATCH 08/24] Chop trailing slashes before looking up language --- script/list-grammars | 2 +- vendor/README.md | 58 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/script/list-grammars b/script/list-grammars index 22542745..96e3a35d 100755 --- a/script/list-grammars +++ b/script/list-grammars @@ -77,7 +77,7 @@ class GrammarList short_url = "eregon/oz-tmbundle" long_url = "https://github.com/eregon/oz-tmbundle" else - submodule = @submodules[@sources[scope]] + submodule = @submodules[@sources[scope].chomp("/")] next unless submodule short_url = submodule[:short] long_url = submodule[:url] diff --git a/vendor/README.md b/vendor/README.md index aa3e492f..f7569ee6 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -20,24 +20,34 @@ If you've encountered an error with highlighting, please report it to the approp - **ANTLR:** [textmate/antlr.tmbundle](https://github.com/textmate/antlr.tmbundle) - **ApacheConf:** [textmate/apache.tmbundle](https://github.com/textmate/apache.tmbundle) - **Apex:** [textmate/java.tmbundle](https://github.com/textmate/java.tmbundle) +- **API Blueprint:** [apiaryio/api-blueprint-sublime-plugin](https://github.com/apiaryio/api-blueprint-sublime-plugin) - **APL:** [Alhadis/language-apl](https://github.com/Alhadis/language-apl) - **Apollo Guidance Computer:** [Alhadis/language-agc](https://github.com/Alhadis/language-agc) - **AppleScript:** [textmate/applescript.tmbundle](https://github.com/textmate/applescript.tmbundle) - **Arduino:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) +- **AsciiDoc:** [zuckschwerdt/asciidoc.tmbundle](https://github.com/zuckschwerdt/asciidoc.tmbundle) - **ASN.1:** [ajLangley12/language-asn1](https://github.com/ajLangley12/language-asn1) - **ASP:** [textmate/asp.tmbundle](https://github.com/textmate/asp.tmbundle) +- **AspectJ:** [pchaigno/sublime-aspectj](https://github.com/pchaigno/sublime-aspectj) +- **Assembly:** [Nessphoro/sublimeassembly](https://github.com/Nessphoro/sublimeassembly) - **ATS:** [steinwaywhw/ats-mode-sublimetext](https://github.com/steinwaywhw/ats-mode-sublimetext) +- **AutoHotkey:** [ahkscript/SublimeAutoHotkey](https://github.com/ahkscript/SublimeAutoHotkey) +- **AutoIt:** [AutoIt/SublimeAutoItScript](https://github.com/AutoIt/SublimeAutoItScript) - **Awk:** [JohnNilsson/awk-sublime](https://github.com/JohnNilsson/awk-sublime) - **Befunge:** [johanasplund/sublime-befunge](https://github.com/johanasplund/sublime-befunge) - **Bison:** [textmate/bison.tmbundle](https://github.com/textmate/bison.tmbundle) +- **Blade:** [jawee/language-blade](https://github.com/jawee/language-blade) - **BlitzBasic:** [textmate/blitzmax.tmbundle](https://github.com/textmate/blitzmax.tmbundle) - **BlitzMax:** [textmate/blitzmax.tmbundle](https://github.com/textmate/blitzmax.tmbundle) - **Bluespec:** [thotypous/sublime-bsv](https://github.com/thotypous/sublime-bsv) +- **Boo:** [Shammah/boo-sublime](https://github.com/Shammah/boo-sublime) - **Brainfuck:** [Drako/SublimeBrainfuck](https://github.com/Drako/SublimeBrainfuck) +- **Brightscript:** [cmink/BrightScript.tmbundle](https://github.com/cmink/BrightScript.tmbundle) - **Bro:** [bro/bro-sublime](https://github.com/bro/bro-sublime) - **C:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) - **C#:** [atom/language-csharp](https://github.com/atom/language-csharp) - **C++:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) +- **C-ObjDump:** [nanoant/assembly.tmbundle](https://github.com/nanoant/assembly.tmbundle) - **C2hs Haskell:** [atom-haskell/language-haskell](https://github.com/atom-haskell/language-haskell) - **Cap'n Proto:** [textmate/capnproto.tmbundle](https://github.com/textmate/capnproto.tmbundle) - **CartoCSS:** [yohanboniface/carto-atom](https://github.com/yohanboniface/carto-atom) @@ -45,7 +55,10 @@ If you've encountered an error with highlighting, please report it to the approp - **Chapel:** [chapel-lang/chapel-tmbundle](https://github.com/chapel-lang/chapel-tmbundle) - **ChucK:** [textmate/java.tmbundle](https://github.com/textmate/java.tmbundle) - **Cirru:** [Cirru/sublime-cirru](https://github.com/Cirru/sublime-cirru) +- **Clarion:** [fushnisoft/SublimeClarion](https://github.com/fushnisoft/SublimeClarion) - **Clean:** [timjs/atom-language-clean](https://github.com/timjs/atom-language-clean) +- **Click:** [stenverbois/language-click](https://github.com/stenverbois/language-click) +- **CLIPS:** [psicomante/CLIPS-sublime](https://github.com/psicomante/CLIPS-sublime) - **Clojure:** [atom/language-clojure](https://github.com/atom/language-clojure) - **CMake:** [textmate/cmake.tmbundle](https://github.com/textmate/cmake.tmbundle) - **COBOL:** [bitbucket:bitlang/sublime_cobol](https://bitbucket.org/bitlang/sublime_cobol) @@ -57,6 +70,8 @@ If you've encountered an error with highlighting, please report it to the approp - **Component Pascal:** [textmate/pascal.tmbundle](https://github.com/textmate/pascal.tmbundle) - **Cool:** [anunayk/cool-tmbundle](https://github.com/anunayk/cool-tmbundle) - **Coq:** [mkolosick/Sublime-Coq](https://github.com/mkolosick/Sublime-Coq) +- **Cpp-ObjDump:** [nanoant/assembly.tmbundle](https://github.com/nanoant/assembly.tmbundle) +- **Creole:** [Siddley/Creole](https://github.com/Siddley/Creole) - **Crystal:** [atom-crystal/language-crystal](https://github.com/atom-crystal/language-crystal) - **Csound:** [nwhetsell/language-csound](https://github.com/nwhetsell/language-csound) - **Csound Document:** [nwhetsell/language-csound](https://github.com/nwhetsell/language-csound) @@ -67,23 +82,29 @@ If you've encountered an error with highlighting, please report it to the approp - **Cycript:** [atom/language-javascript](https://github.com/atom/language-javascript) - **Cython:** [textmate/cython.tmbundle](https://github.com/textmate/cython.tmbundle) - **D:** [textmate/d.tmbundle](https://github.com/textmate/d.tmbundle) +- **D-ObjDump:** [nanoant/assembly.tmbundle](https://github.com/nanoant/assembly.tmbundle) - **Dart:** [guillermooo/dart-sublime-bundle](https://github.com/guillermooo/dart-sublime-bundle) - **desktop:** [Mailaender/desktop.tmbundle](https://github.com/Mailaender/desktop.tmbundle) - **Diff:** [textmate/diff.tmbundle](https://github.com/textmate/diff.tmbundle) +- **DM:** [PJB3005/atomic-dreams](https://github.com/PJB3005/atomic-dreams) - **DNS Zone:** [sixty4k/st2-zonefile](https://github.com/sixty4k/st2-zonefile) - **Dockerfile:** [asbjornenge/Docker.tmbundle](https://github.com/asbjornenge/Docker.tmbundle) - **DTrace:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) - **Dylan:** [textmate/dylan.tmbundle](https://github.com/textmate/dylan.tmbundle) - **Eagle:** [textmate/xml.tmbundle](https://github.com/textmate/xml.tmbundle) +- **eC:** [ecere/ec.tmbundle](https://github.com/ecere/ec.tmbundle) - **Ecere Projects:** [textmate/json.tmbundle](https://github.com/textmate/json.tmbundle) +- **ECLiPSe:** [alnkpa/sublimeprolog](https://github.com/alnkpa/sublimeprolog) - **edn:** [atom/language-clojure](https://github.com/atom/language-clojure) - **Eiffel:** [textmate/eiffel.tmbundle](https://github.com/textmate/eiffel.tmbundle) - **EJS:** [gregory-m/ejs-tmbundle](https://github.com/gregory-m/ejs-tmbundle) - **Elixir:** [elixir-lang/elixir-tmbundle](https://github.com/elixir-lang/elixir-tmbundle) +- **Elm:** [elm-community/Elm.tmLanguage](https://github.com/elm-community/Elm.tmLanguage) - **Emacs Lisp:** [Alhadis/language-emacs-lisp](https://github.com/Alhadis/language-emacs-lisp) - **EmberScript:** [atom/language-coffee-script](https://github.com/atom/language-coffee-script) - **EQ:** [atom/language-csharp](https://github.com/atom/language-csharp) - **Erlang:** [textmate/erlang.tmbundle](https://github.com/textmate/erlang.tmbundle) +- **F#:** [fsprojects/atom-fsharp](https://github.com/fsprojects/atom-fsharp) - **Factor:** [slavapestov/factor](https://github.com/slavapestov/factor) - **Fancy:** [fancy-lang/fancy-tmbundle](https://github.com/fancy-lang/fancy-tmbundle) - **fish:** [l15n/fish-tmbundle](https://github.com/l15n/fish-tmbundle) @@ -91,8 +112,13 @@ If you've encountered an error with highlighting, please report it to the approp - **FORTRAN:** [textmate/fortran.tmbundle](https://github.com/textmate/fortran.tmbundle) - **FreeMarker:** [freemarker/FreeMarker.tmbundle](https://github.com/freemarker/FreeMarker.tmbundle) - **Frege:** [atom-haskell/language-haskell](https://github.com/atom-haskell/language-haskell) +- **G-code:** [robotmaster/sublime-text-syntax-highlighting](https://github.com/robotmaster/sublime-text-syntax-highlighting) - **Game Maker Language:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) +- **GAP:** [dhowden/gap-tmbundle](https://github.com/dhowden/gap-tmbundle) +- **GAS:** [Nessphoro/sublimeassembly](https://github.com/Nessphoro/sublimeassembly) - **GCC Machine Description:** [textmate/lisp.tmbundle](https://github.com/textmate/lisp.tmbundle) +- **GDB:** [quarnster/SublimeGDB](https://github.com/quarnster/SublimeGDB) +- **GDScript:** [beefsack/GDScript-sublime](https://github.com/beefsack/GDScript-sublime) - **Genshi:** [genshi.edgewall.org/query](https://genshi.edgewall.org/query) - **Gentoo Ebuild:** [atom/language-shellscript](https://github.com/atom/language-shellscript) - **Gentoo Eclass:** [atom/language-shellscript](https://github.com/atom/language-shellscript) @@ -101,6 +127,7 @@ If you've encountered an error with highlighting, please report it to the approp - **Glyph:** [textmate/tcl.tmbundle](https://github.com/textmate/tcl.tmbundle) - **Gnuplot:** [mattfoster/gnuplot-tmbundle](https://github.com/mattfoster/gnuplot-tmbundle) - **Go:** [AlanQuatermain/go-tmbundle](https://github.com/AlanQuatermain/go-tmbundle) +- **Golo:** [TypeUnsafe/sublime-golo](https://github.com/TypeUnsafe/sublime-golo) - **Gosu:** [jpcamara/Textmate-Gosu-Bundle](https://github.com/jpcamara/Textmate-Gosu-Bundle) - **Grace:** [zmthy/grace-tmbundle](https://github.com/zmthy/grace-tmbundle) - **Gradle:** [alkemist/gradle.tmbundle](https://github.com/alkemist/gradle.tmbundle) @@ -126,12 +153,14 @@ If you've encountered an error with highlighting, please report it to the approp - **HTTP:** [httpspec/sublime-highlighting](https://github.com/httpspec/sublime-highlighting) - **Hy:** [rwtolbert/language-hy](https://github.com/rwtolbert/language-hy) - **IDL:** [mgalloy/idl.tmbundle](https://github.com/mgalloy/idl.tmbundle) +- **Idris:** [idris-hackers/idris-sublime](https://github.com/idris-hackers/idris-sublime) - **Inform 7:** [erkyrath/language-inform7](https://github.com/erkyrath/language-inform7) - **INI:** [textmate/ini.tmbundle](https://github.com/textmate/ini.tmbundle) - **Io:** [textmate/io.tmbundle](https://github.com/textmate/io.tmbundle) - **Ioke:** [vic/ioke-outdated](https://github.com/vic/ioke-outdated) - **Isabelle:** [lsf37/Isabelle.tmbundle](https://github.com/lsf37/Isabelle.tmbundle) - **Isabelle ROOT:** [lsf37/Isabelle.tmbundle](https://github.com/lsf37/Isabelle.tmbundle) +- **J:** [bcj/JSyntax](https://github.com/bcj/JSyntax) - **Jade:** [davidrios/jade-tmbundle](https://github.com/davidrios/jade-tmbundle) - **Jasmin:** [atmarksharp/jasmin-sublime](https://github.com/atmarksharp/jasmin-sublime) - **Java:** [textmate/java.tmbundle](https://github.com/textmate/java.tmbundle) @@ -140,7 +169,9 @@ If you've encountered an error with highlighting, please report it to the approp - **JFlex:** [jflex-de/jflex.tmbundle](https://github.com/jflex-de/jflex.tmbundle) - **JSON:** [textmate/json.tmbundle](https://github.com/textmate/json.tmbundle) - **JSON5:** [atom/language-javascript](https://github.com/atom/language-javascript) +- **JSONiq:** [wcandillon/language-jsoniq](http://github.com/wcandillon/language-jsoniq) - **JSONLD:** [atom/language-javascript](https://github.com/atom/language-javascript) +- **JSX:** [gandm/language-babel](https://github.com/gandm/language-babel) - **Julia:** [nanoant/Julia.tmbundle](https://github.com/nanoant/Julia.tmbundle) - **Jupyter Notebook:** [textmate/json.tmbundle](https://github.com/textmate/json.tmbundle) - **Kit:** [textmate/html.tmbundle](https://github.com/textmate/html.tmbundle) @@ -149,6 +180,7 @@ If you've encountered an error with highlighting, please report it to the approp - **Lasso:** [bfad/Sublime-Lasso](https://github.com/bfad/Sublime-Lasso) - **Latte:** [textmate/php-smarty.tmbundle](https://github.com/textmate/php-smarty.tmbundle) - **Lean:** [leanprover/Lean.tmbundle](https://github.com/leanprover/Lean.tmbundle) +- **Less:** [atom/language-less](https://github.com/atom/language-less) - **LFE:** [textmate/lisp.tmbundle](https://github.com/textmate/lisp.tmbundle) - **LilyPond:** [textmate/lilypond.tmbundle](https://github.com/textmate/lilypond.tmbundle) - **Liquid:** [bastilian/validcode-textmate-bundles](https://github.com/bastilian/validcode-textmate-bundles) @@ -172,9 +204,13 @@ If you've encountered an error with highlighting, please report it to the approp - **Maven POM:** [textmate/maven.tmbundle](https://github.com/textmate/maven.tmbundle) - **Max:** [textmate/json.tmbundle](https://github.com/textmate/json.tmbundle) - **MAXScript:** [Alhadis/language-maxscript](https://github.com/Alhadis/language-maxscript) +- **MediaWiki:** [textmate/mediawiki.tmbundle](https://github.com/textmate/mediawiki.tmbundle) - **Mercury:** [sebgod/mercury-tmlanguage](https://github.com/sebgod/mercury-tmlanguage) - **Metal:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) - **Mirah:** [aroben/ruby.tmbundle](https://github.com/aroben/ruby.tmbundle) +- **Modelica:** [BorisChumichev/modelicaSublimeTextPackage](https://github.com/BorisChumichev/modelicaSublimeTextPackage) +- **Modula-2:** [harogaston/Sublime-Modula-2](https://github.com/harogaston/Sublime-Modula-2) +- **Monkey:** [gingerbeardman/monkey.tmbundle](https://github.com/gingerbeardman/monkey.tmbundle) - **MoonScript:** [leafo/moonscript-tmbundle](https://github.com/leafo/moonscript-tmbundle) - **MTML:** [textmate/html.tmbundle](https://github.com/textmate/html.tmbundle) - **mupad:** [ccreutzig/sublime-MuPAD](https://github.com/ccreutzig/sublime-MuPAD) @@ -192,29 +228,41 @@ If you've encountered an error with highlighting, please report it to the approp - **Nix:** [wmertens/sublime-nix](https://github.com/wmertens/sublime-nix) - **NSIS:** [SublimeText/NSIS](https://github.com/SublimeText/NSIS) - **Nu:** [jsallis/nu.tmbundle](https://github.com/jsallis/nu.tmbundle) +- **ObjDump:** [nanoant/assembly.tmbundle](https://github.com/nanoant/assembly.tmbundle) - **Objective-C:** [textmate/objective-c.tmbundle](https://github.com/textmate/objective-c.tmbundle) - **Objective-C++:** [textmate/objective-c.tmbundle](https://github.com/textmate/objective-c.tmbundle) - **Objective-J:** [textmate/javascript-objective-j.tmbundle](https://github.com/textmate/javascript-objective-j.tmbundle) - **OCaml:** [textmate/ocaml.tmbundle](https://github.com/textmate/ocaml.tmbundle) - **ooc:** [nilium/ooc.tmbundle](https://github.com/nilium/ooc.tmbundle) - **Opa:** [mads379/opa.tmbundle](https://github.com/mads379/opa.tmbundle) +- **Opal:** [artifactz/sublime-opal](https://github.com/artifactz/sublime-opal) - **OpenCL:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) - **OpenEdge ABL:** [jfairbank/Sublime-Text-2-OpenEdge-ABL](https://github.com/jfairbank/Sublime-Text-2-OpenEdge-ABL) - **OpenRC runscript:** [atom/language-shellscript](https://github.com/atom/language-shellscript) +- **Ox:** [andreashetland/sublime-text-ox](https://github.com/andreashetland/sublime-text-ox) - **Oz:** [eregon/oz-tmbundle](https://github.com/eregon/oz-tmbundle) +- **Papyrus:** [Kapiainen/SublimePapyrus](https://github.com/Kapiainen/SublimePapyrus) - **Parrot Internal Representation:** [textmate/parrot.tmbundle](https://github.com/textmate/parrot.tmbundle) - **Pascal:** [textmate/pascal.tmbundle](https://github.com/textmate/pascal.tmbundle) +- **PAWN:** [Southclaw/pawn-sublime-language](https://github.com/Southclaw/pawn-sublime-language) +- **Perl:** [textmate/perl.tmbundle](https://github.com/textmate/perl.tmbundle) - **Perl6:** [MadcapJake/language-perl6fe](https://github.com/MadcapJake/language-perl6fe) - **PHP:** [textmate/php.tmbundle](https://github.com/textmate/php.tmbundle) - **PicoLisp:** [textmate/lisp.tmbundle](https://github.com/textmate/lisp.tmbundle) +- **PigLatin:** [goblindegook/sublime-text-pig-latin](https://github.com/goblindegook/sublime-text-pig-latin) - **Pike:** [hww3/pike-textmate](https://github.com/hww3/pike-textmate) - **PLpgSQL:** [textmate/sql.tmbundle](https://github.com/textmate/sql.tmbundle) +- **PogoScript:** [featurist/PogoScript.tmbundle](https://github.com/featurist/PogoScript.tmbundle) - **Pony:** [CausalityLtd/sublime-pony](https://github.com/CausalityLtd/sublime-pony) - **PostScript:** [textmate/postscript.tmbundle](https://github.com/textmate/postscript.tmbundle) - **POV-Ray SDL:** [c-lipka/language-povray](https://github.com/c-lipka/language-povray) - **PowerShell:** [SublimeText/PowerShell](https://github.com/SublimeText/PowerShell) - **Processing:** [textmate/processing.tmbundle](https://github.com/textmate/processing.tmbundle) +- **Prolog:** [alnkpa/sublimeprolog](https://github.com/alnkpa/sublimeprolog) +- **Propeller Spin:** [bitbased/sublime-spintools](https://github.com/bitbased/sublime-spintools) - **Protocol Buffer:** [michaeledgar/protobuf-tmbundle](https://github.com/michaeledgar/protobuf-tmbundle) +- **Puppet:** [russCloak/SublimePuppet](https://github.com/russCloak/SublimePuppet) +- **PureScript:** [purescript-contrib/atom-language-purescript](https://github.com/purescript-contrib/atom-language-purescript) - **Python:** [MagicStack/MagicPython](https://github.com/MagicStack/MagicPython) - **Python traceback:** [atom/language-python](https://github.com/atom/language-python) - **QMake:** [textmate/cpp-qt.tmbundle](https://github.com/textmate/cpp-qt.tmbundle) @@ -228,6 +276,7 @@ If you've encountered an error with highlighting, please report it to the approp - **Red:** [Oldes/Sublime-Red](https://github.com/Oldes/Sublime-Red) - **Ren'Py:** [williamd1k0/language-renpy](https://github.com/williamd1k0/language-renpy) - **reStructuredText:** [Lukasa/language-restructuredtext](https://github.com/Lukasa/language-restructuredtext) +- **REXX:** [mblocker/rexx-sublime](https://github.com/mblocker/rexx-sublime) - **RHTML:** [aroben/ruby.tmbundle](https://github.com/aroben/ruby.tmbundle) - **RMarkdown:** [atom/language-gfm](https://github.com/atom/language-gfm) - **RobotFramework:** [shellderp/sublime-robot-plugin](https://github.com/shellderp/sublime-robot-plugin) @@ -251,14 +300,18 @@ If you've encountered an error with highlighting, please report it to the approp - **Smalltalk:** [tomas-stefano/smalltalk-tmbundle](https://github.com/tomas-stefano/smalltalk-tmbundle) - **Smarty:** [textmate/php-smarty.tmbundle](https://github.com/textmate/php-smarty.tmbundle) - **SMT:** [SRI-CSL/SMT.tmbundle](https://github.com/SRI-CSL/SMT.tmbundle) +- **SourcePawn:** [austinwagner/sublime-sourcepawn](https://github.com/austinwagner/sublime-sourcepawn) - **SPARQL:** [peta/turtle.tmbundle](https://github.com/peta/turtle.tmbundle) - **SQF:** [JonBons/Sublime-SQF-Language](https://github.com/JonBons/Sublime-SQF-Language) - **SQL:** [textmate/sql.tmbundle](https://github.com/textmate/sql.tmbundle) - **SQLPL:** [textmate/sql.tmbundle](https://github.com/textmate/sql.tmbundle) - **Squirrel:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) - **SRecode Template:** [textmate/lisp.tmbundle](https://github.com/textmate/lisp.tmbundle) +- **Stan:** [jrnold/atom-language-stan](https://github.com/jrnold/atom-language-stan) - **Standard ML:** [textmate/standard-ml.tmbundle](https://github.com/textmate/standard-ml.tmbundle) +- **Stata:** [pschumm/Stata.tmbundle](https://github.com/pschumm/Stata.tmbundle) - **STON:** [tomas-stefano/smalltalk-tmbundle](https://github.com/tomas-stefano/smalltalk-tmbundle) +- **Stylus:** [billymoon/Stylus](https://github.com/billymoon/Stylus) - **SubRip Text:** [314eter/atom-language-srt](https://github.com/314eter/atom-language-srt) - **SuperCollider:** [supercollider/language-supercollider](https://github.com/supercollider/language-supercollider) - **SVG:** [textmate/xml.tmbundle](https://github.com/textmate/xml.tmbundle) @@ -275,6 +328,8 @@ If you've encountered an error with highlighting, please report it to the approp - **Turing:** [Alhadis/language-turing](https://github.com/Alhadis/language-turing) - **Turtle:** [peta/turtle.tmbundle](https://github.com/peta/turtle.tmbundle) - **Twig:** [Anomareh/PHP-Twig.tmbundle](https://github.com/Anomareh/PHP-Twig.tmbundle) +- **TXL:** [MikeHoffert/Sublime-Text-TXL-syntax](https://github.com/MikeHoffert/Sublime-Text-TXL-syntax) +- **TypeScript:** [Microsoft/TypeScript-Sublime-Plugin](https://github.com/Microsoft/TypeScript-Sublime-Plugin) - **Unified Parallel C:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) - **Unity3D Asset:** [atom/language-yaml](https://github.com/atom/language-yaml) - **Uno:** [atom/language-csharp](https://github.com/atom/language-csharp) @@ -296,12 +351,15 @@ If you've encountered an error with highlighting, please report it to the approp - **World of Warcraft Addon Data:** [nebularg/language-toc-wow](https://github.com/nebularg/language-toc-wow) - **X10:** [x10-lang/x10-highlighting](https://github.com/x10-lang/x10-highlighting) - **xBase:** [hernad/atom-language-harbour](https://github.com/hernad/atom-language-harbour) +- **XC:** [graymalkin/xc.tmbundle](https://github.com/graymalkin/xc.tmbundle) - **XML:** [textmate/xml.tmbundle](https://github.com/textmate/xml.tmbundle) - **Xojo:** [angryant0007/VBDotNetSyntax](https://github.com/angryant0007/VBDotNetSyntax) - **XProc:** [textmate/xml.tmbundle](https://github.com/textmate/xml.tmbundle) +- **XQuery:** [wcandillon/language-jsoniq](http://github.com/wcandillon/language-jsoniq) - **XS:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) - **XSLT:** [textmate/xml.tmbundle](https://github.com/textmate/xml.tmbundle) - **Xtend:** [staltz/SublimeXtend](https://github.com/staltz/SublimeXtend) - **Yacc:** [textmate/bison.tmbundle](https://github.com/textmate/bison.tmbundle) - **YAML:** [atom/language-yaml](https://github.com/atom/language-yaml) +- **YANG:** [DzonyKalafut/language-yang](https://github.com/DzonyKalafut/language-yang) - **Zephir:** [vmg/zephir-sublime](https://github.com/vmg/zephir-sublime) From bed8add2f538d29be58d2ead0ce0581b4b1a5ef2 Mon Sep 17 00:00:00 2001 From: Cyril Ferlicot Date: Sat, 24 Sep 2016 17:32:35 +0200 Subject: [PATCH 09/24] Add smalltalk samples (Issue: https://github.com/github/linguist/issues/3244) --- samples/Smalltalk/baselineDependency.st | 8 ++++++++ samples/Smalltalk/categories.st | 8 ++++++++ samples/Smalltalk/renderSeasideExampleOn..st | 9 +++++++++ samples/Smalltalk/scriptWithPragma.st | 11 +++++++++++ samples/Smalltalk/smallMethod.st | 3 +++ 5 files changed, 39 insertions(+) create mode 100644 samples/Smalltalk/baselineDependency.st create mode 100644 samples/Smalltalk/categories.st create mode 100644 samples/Smalltalk/renderSeasideExampleOn..st create mode 100644 samples/Smalltalk/scriptWithPragma.st create mode 100644 samples/Smalltalk/smallMethod.st diff --git a/samples/Smalltalk/baselineDependency.st b/samples/Smalltalk/baselineDependency.st new file mode 100644 index 00000000..0830bb81 --- /dev/null +++ b/samples/Smalltalk/baselineDependency.st @@ -0,0 +1,8 @@ +dependencies +neoJSON: spec + spec + configuration: 'NeoJSON' + with: [ spec + className: 'ConfigurationOfNeoJSON'; + version: #stable; + repository: 'http://smalltalkhub.com/mc/SvenVanCaekenberghe/Neo/main' ] \ No newline at end of file diff --git a/samples/Smalltalk/categories.st b/samples/Smalltalk/categories.st new file mode 100644 index 00000000..680c6662 --- /dev/null +++ b/samples/Smalltalk/categories.st @@ -0,0 +1,8 @@ +SystemOrganization addCategory: #ChartJs! +SystemOrganization addCategory: 'ChartJs-Component'! +SystemOrganization addCategory: 'ChartJs-Demo'! +SystemOrganization addCategory: 'ChartJs-Exception'! +SystemOrganization addCategory: 'ChartJs-Library'! +SystemOrganization addCategory: 'ChartJs-Model'! +SystemOrganization addCategory: 'ChartJs-Style'! +SystemOrganization addCategory: 'ChartJs-Types'! diff --git a/samples/Smalltalk/renderSeasideExampleOn..st b/samples/Smalltalk/renderSeasideExampleOn..st new file mode 100644 index 00000000..a5427572 --- /dev/null +++ b/samples/Smalltalk/renderSeasideExampleOn..st @@ -0,0 +1,9 @@ +rendering +renderTitleId: divId on: html + ^ html div + id: #title , divId; + class: #aClass; + with: [ + html heading + level3; + with: self data title ] \ No newline at end of file diff --git a/samples/Smalltalk/scriptWithPragma.st b/samples/Smalltalk/scriptWithPragma.st new file mode 100644 index 00000000..3f9dec81 --- /dev/null +++ b/samples/Smalltalk/scriptWithPragma.st @@ -0,0 +1,11 @@ +helpers +installGitFileTree + "GitFileTree is the tool we will use to commit on GitHub." + + + + + + + + +
+ + You signed in with another tab or window. Reload to refresh your session. + You signed out in another tab or window. Reload to refresh your session. +
+ + + + + diff --git a/samples/Coq/JsPrettyInterm.v b/samples/Coq/JsPrettyInterm.v new file mode 100644 index 00000000..71d35969 --- /dev/null +++ b/samples/Coq/JsPrettyInterm.v @@ -0,0 +1,1766 @@ +Set Implicit Arguments. +Require Export JsSyntax JsSyntaxAux JsPreliminary. + +(**************************************************************) +(** ** Implicit Types -- copied from JsPreliminary *) + +Implicit Type b : bool. +Implicit Type n : number. +Implicit Type k : int. +Implicit Type s : string. +Implicit Type i : literal. +Implicit Type l : object_loc. +Implicit Type w : prim. +Implicit Type v : value. +Implicit Type r : ref. +(*Implicit Type B : builtin.*) +Implicit Type ty : type. + +Implicit Type rt : restype. +Implicit Type rv : resvalue. +Implicit Type lab : label. +Implicit Type labs : label_set. +Implicit Type R : res. +Implicit Type o : out. + +Implicit Type x : prop_name. +Implicit Type str : strictness_flag. +Implicit Type m : mutability. +Implicit Type Ad : attributes_data. +Implicit Type Aa : attributes_accessor. +Implicit Type A : attributes. +Implicit Type Desc : descriptor. +Implicit Type D : full_descriptor. + +Implicit Type L : env_loc. +Implicit Type E : env_record. +Implicit Type Ed : decl_env_record. +Implicit Type X : lexical_env. +Implicit Type O : object. +Implicit Type S : state. +Implicit Type C : execution_ctx. +Implicit Type P : object_properties_type. + +Implicit Type e : expr. +Implicit Type p : prog. +Implicit Type t : stat. + + +(****************************************************************) +(** ** Intermediate expression for the Pretty-Big-Step semantic *) + +(** Grammar of extended expressions *) + +Inductive ext_expr := + + (** Extended expressions include expressions *) + + | expr_basic : expr -> ext_expr + + (** Extended expressions associated with primitive expressions *) + + | expr_identifier_1 : specret ref -> ext_expr + + | expr_object_0 : out -> propdefs -> ext_expr + | expr_object_1 : object_loc -> propdefs -> ext_expr + | expr_object_2 : object_loc -> string -> propbody -> propdefs -> ext_expr + | expr_object_3_val : object_loc -> string -> specret value -> propdefs -> ext_expr + | expr_object_3_get : object_loc -> string -> out -> propdefs -> ext_expr + | expr_object_3_set : object_loc -> string -> out -> propdefs -> ext_expr + | expr_object_4 : object_loc -> string -> descriptor -> propdefs -> ext_expr + | expr_object_5 : object_loc -> propdefs -> out -> ext_expr + + + + + + (* _ARRAYS_ : support for array intermediate forms *) + | expr_array_0 : out -> list (option expr) -> ext_expr + | expr_array_1 : object_loc -> list (option expr) -> ext_expr + | expr_array_2 : object_loc -> list (option expr) -> int -> ext_expr + | expr_array_3 : object_loc -> list (option expr) -> int -> ext_expr + | expr_array_3_1 : object_loc -> specret value -> list (option expr) -> int -> ext_expr + | expr_array_3_2 : object_loc -> value -> out -> list (option expr) -> int -> ext_expr + | expr_array_3_3 : object_loc -> value -> specret int -> list (option expr) -> int -> ext_expr + | expr_array_3_4 : object_loc -> value -> out -> list (option expr) -> ext_expr + | expr_array_3_5 : object_loc -> out -> list (option expr) -> ext_expr + + | expr_array_add_length : object_loc -> int -> out -> ext_expr + | expr_array_add_length_0 : object_loc -> int -> ext_expr + | expr_array_add_length_1 : object_loc -> int -> out -> ext_expr + | expr_array_add_length_2 : object_loc -> specret int -> int -> ext_expr + | expr_array_add_length_3 : object_loc -> specret int -> ext_expr + | expr_array_add_length_4 : object_loc -> out -> ext_expr + + + + + + | expr_function_1 : string -> list string -> funcbody -> env_loc -> lexical_env -> out -> ext_expr + | expr_function_2 : string -> env_loc -> out -> ext_expr + | expr_function_3 : object_loc -> out -> ext_expr + + | expr_access_1 : specret value -> expr -> ext_expr (* The left expression has been executed *) + | expr_access_2 : value -> specret value -> ext_expr (* The right expression is executed. *) + | expr_access_3 : value -> out -> value -> ext_expr + | expr_access_4 : value -> out -> ext_expr + + | expr_new_1 : specret value -> list expr -> ext_expr (* The arguments too. *) + | expr_new_2 : value -> specret (list value) -> ext_expr (* The call has been executed. *) + + | expr_call_1 : out -> bool -> list expr -> ext_expr + | expr_call_2 : res -> bool -> list expr -> specret value -> ext_expr (* The function has been evaluated. *) + | expr_call_3 : res -> value -> bool -> specret (list value) -> ext_expr (* The arguments have been executed. *) + | expr_call_4 : res -> object_loc -> bool -> list value -> ext_expr + | expr_call_5 : object_loc -> bool -> list value -> out -> ext_expr (* The call has been executed. *) + + | spec_eval : bool -> value -> list value -> ext_expr + + | expr_unary_op_1 : unary_op -> (specret value) -> ext_expr (* The argument have been executed. *) + | expr_unary_op_2 : unary_op -> value -> ext_expr (* The argument is a value. *) + | expr_delete_1 : out -> ext_expr + | expr_delete_2 : ref -> ext_expr + | expr_delete_3 : ref -> out -> ext_expr + | expr_delete_4 : ref -> env_loc -> ext_expr + | expr_typeof_1 : out -> ext_expr + | expr_typeof_2 : specret value -> ext_expr + | expr_prepost_1 : unary_op -> out -> ext_expr + | expr_prepost_2 : unary_op -> res -> specret value -> ext_expr + | expr_prepost_3 : unary_op -> res -> out -> ext_expr + | expr_prepost_4 : value -> out -> ext_expr + | expr_unary_op_neg_1 : out -> ext_expr + | expr_unary_op_bitwise_not_1 : specret int -> ext_expr + | expr_unary_op_not_1 : out -> ext_expr + | expr_conditional_1 : specret value -> expr -> expr -> ext_expr + | expr_conditional_1': out -> expr -> expr -> ext_expr + | expr_conditional_2 : specret value -> ext_expr + + | expr_binary_op_1 : binary_op -> (specret value) -> expr -> ext_expr + | expr_binary_op_2 : binary_op -> value -> (specret value) -> ext_expr + | expr_binary_op_3 : binary_op -> value -> value -> ext_expr + | expr_binary_op_add_1 : specret (value*value) -> ext_expr + | expr_binary_op_add_string_1 : specret (value*value) -> ext_expr + | expr_puremath_op_1 : (number -> number -> number) -> specret (value*value) -> ext_expr + | expr_shift_op_1 : (int -> int -> int) -> specret int -> value -> ext_expr + | expr_shift_op_2 : (int -> int -> int) -> int -> specret int -> ext_expr + | expr_inequality_op_1 : bool -> bool -> value -> value -> ext_expr + | expr_inequality_op_2 : bool -> bool -> specret (value*value) -> ext_expr + | expr_binary_op_in_1 : object_loc -> out -> ext_expr + | expr_binary_op_disequal_1 : out -> ext_expr + | spec_equal : value -> value -> ext_expr + | spec_equal_1 : type -> type -> value -> value -> ext_expr + | spec_equal_2 : bool -> ext_expr + | spec_equal_3 : value -> (value -> ext_expr) -> value -> ext_expr + | spec_equal_4 : value -> out -> ext_expr + | expr_bitwise_op_1 : (int -> int -> int) -> specret int -> value -> ext_expr + | expr_bitwise_op_2 : (int -> int -> int) -> int -> specret int -> ext_expr + | expr_lazy_op_1 : bool -> (specret value) -> expr -> ext_expr + | expr_lazy_op_2 : bool -> value -> out -> expr -> ext_expr + | expr_lazy_op_2_1 : (specret value) -> ext_expr + + | expr_assign_1 : out -> option binary_op -> expr -> ext_expr + | expr_assign_2 : res -> (specret value) -> binary_op -> expr -> ext_expr + | expr_assign_3 : res -> value -> binary_op -> (specret value) -> ext_expr + | expr_assign_3' : res -> out -> ext_expr + | expr_assign_4 : res -> (specret value) -> ext_expr + | expr_assign_5 : value -> out -> ext_expr + + (** Extended expressions for conversions *) + + | spec_to_primitive : value -> option preftype -> ext_expr + | spec_to_boolean : value -> ext_expr + | spec_to_number : value -> ext_expr + | spec_to_number_1 : out -> ext_expr + | spec_to_integer : value -> ext_expr + | spec_to_integer_1 : out -> ext_expr + | spec_to_string : value -> ext_expr + | spec_to_string_1 : out -> ext_expr + | spec_to_object : value -> ext_expr + | spec_check_object_coercible : value -> ext_expr + + (** Extended expressions for comparison *) + + | spec_eq : value -> value -> ext_expr + | spec_eq0 : value -> value -> ext_expr + | spec_eq1 : value -> value -> ext_expr + | spec_eq2 : ext_expr -> value -> value -> ext_expr + + (** Extended expressions for operations on objects *) + + | spec_object_get : object_loc -> prop_name -> ext_expr + | spec_object_get_1 : builtin_get -> value -> object_loc -> prop_name -> ext_expr + | spec_object_get_2 : value -> specret full_descriptor -> ext_expr + | spec_object_get_3 : value -> value -> ext_expr + + | spec_object_can_put : object_loc -> prop_name -> ext_expr + | spec_object_can_put_1 : builtin_can_put -> object_loc -> prop_name -> ext_expr + | spec_object_can_put_2 : object_loc -> prop_name -> (specret full_descriptor) -> ext_expr + + (* LATER: shift names since spec_object_can_put_3 is not used *) + | spec_object_can_put_4 : object_loc -> prop_name -> value -> ext_expr + | spec_object_can_put_5 : object_loc -> specret full_descriptor -> ext_expr + | spec_object_can_put_6 : attributes_data -> bool -> ext_expr + + | spec_object_put : object_loc -> prop_name -> value -> bool -> ext_expr + | spec_object_put_1 : builtin_put -> value -> object_loc -> prop_name -> value -> bool -> ext_expr + | spec_object_put_2 : value -> object_loc -> prop_name -> value -> bool -> out -> ext_expr + | spec_object_put_3 : value -> object_loc -> prop_name -> value -> bool -> specret full_descriptor -> ext_expr + | spec_object_put_4 : value -> object_loc -> prop_name -> value -> bool -> specret full_descriptor -> ext_expr + | spec_object_put_5 : out -> ext_expr + + | spec_object_has_prop : object_loc -> prop_name -> ext_expr + | spec_object_has_prop_1 : builtin_has_prop -> object_loc -> prop_name -> ext_expr + | spec_object_has_prop_2 : specret full_descriptor -> ext_expr + + | spec_object_delete : object_loc -> prop_name -> bool -> ext_expr + | spec_object_delete_1 : builtin_delete -> object_loc -> prop_name -> bool -> ext_expr + | spec_object_delete_2 : object_loc -> prop_name -> bool -> (specret full_descriptor) -> ext_expr + | spec_object_delete_3 : object_loc -> prop_name -> bool -> bool -> ext_expr + + | spec_object_default_value : object_loc -> option preftype -> ext_expr + | spec_object_default_value_1 : builtin_default_value -> object_loc -> option preftype -> ext_expr + | spec_object_default_value_2 : object_loc -> preftype -> preftype -> ext_expr + | spec_object_default_value_3 : object_loc -> preftype -> ext_expr + | spec_object_default_value_4 : ext_expr + | spec_object_default_value_sub_1 : object_loc -> string -> ext_expr -> ext_expr + | spec_object_default_value_sub_2 : object_loc -> out -> ext_expr -> ext_expr + | spec_object_default_value_sub_3 : out -> ext_expr -> ext_expr + + | spec_object_define_own_prop : object_loc -> prop_name -> descriptor -> bool -> ext_expr + | spec_object_define_own_prop_1 : builtin_define_own_prop -> object_loc -> prop_name -> descriptor -> bool -> ext_expr + | spec_object_define_own_prop_2 : object_loc -> prop_name -> descriptor -> bool -> (specret full_descriptor) -> ext_expr + | spec_object_define_own_prop_3 : object_loc -> prop_name -> descriptor -> bool -> full_descriptor -> bool -> ext_expr + | spec_object_define_own_prop_4 : object_loc -> prop_name -> attributes -> descriptor -> bool -> ext_expr + | spec_object_define_own_prop_5 : object_loc -> prop_name -> attributes -> descriptor -> bool -> ext_expr + | spec_object_define_own_prop_6a : object_loc -> prop_name -> attributes -> descriptor -> bool -> ext_expr + | spec_object_define_own_prop_6b : object_loc -> prop_name -> attributes -> descriptor -> bool -> ext_expr + | spec_object_define_own_prop_6c : object_loc -> prop_name -> attributes -> descriptor -> bool -> ext_expr + | spec_object_define_own_prop_reject : bool -> ext_expr + | spec_object_define_own_prop_write : object_loc -> prop_name -> attributes -> descriptor -> bool -> ext_expr + + | spec_prim_value_get : value -> prop_name -> ext_expr + | spec_prim_value_get_1 : value -> prop_name -> out -> ext_expr + | spec_prim_value_put : value -> prop_name -> value -> bool -> ext_expr + | spec_prim_value_put_1 : prim -> prop_name -> value -> bool -> out -> ext_expr + + (* ARRAYS *) + | spec_object_define_own_prop_array_2 : object_loc -> prop_name -> descriptor -> bool -> (specret full_descriptor) -> ext_expr + | spec_object_define_own_prop_array_2_1 : object_loc -> prop_name -> descriptor -> bool -> descriptor -> value -> ext_expr + | spec_object_define_own_prop_array_branch_3_4 : object_loc -> prop_name -> descriptor -> bool -> descriptor -> (specret int) -> ext_expr + | spec_object_define_own_prop_array_branch_4_5 : object_loc -> prop_name -> descriptor -> bool -> descriptor -> int -> ext_expr + | spec_object_define_own_prop_array_branch_4_5_a : object_loc -> prop_name -> (specret int) -> descriptor -> bool -> descriptor -> int -> ext_expr + | spec_object_define_own_prop_array_branch_4_5_b : object_loc -> prop_name -> int -> out -> descriptor -> bool -> descriptor -> int -> ext_expr + | spec_object_define_own_prop_array_4a : object_loc -> prop_name -> descriptor -> bool -> descriptor -> int -> ext_expr + | spec_object_define_own_prop_array_4b : object_loc -> prop_name -> (specret int) -> descriptor -> bool -> descriptor -> int -> ext_expr + | spec_object_define_own_prop_array_4c : object_loc -> int -> descriptor -> bool -> int -> descriptor -> out -> ext_expr + | spec_object_define_own_prop_array_5 : object_loc -> prop_name -> descriptor -> bool -> ext_expr + | spec_object_define_own_prop_array_3 : object_loc -> descriptor -> bool -> descriptor -> int -> ext_expr + | spec_object_define_own_prop_array_3c : object_loc -> value -> (specret int) -> descriptor -> bool -> descriptor -> int -> ext_expr + | spec_object_define_own_prop_array_3d_e : object_loc -> out -> int -> descriptor -> bool -> descriptor -> int -> ext_expr + | spec_object_define_own_prop_array_3f_g : object_loc -> int -> int -> descriptor -> bool -> descriptor -> ext_expr + | spec_object_define_own_prop_array_3h_i : object_loc -> int -> int -> descriptor -> bool -> descriptor -> ext_expr + | spec_object_define_own_prop_array_3j : object_loc -> int -> int -> descriptor -> bool -> bool -> descriptor -> ext_expr + | spec_object_define_own_prop_array_3k_l : object_loc -> out -> int -> int -> descriptor -> bool -> bool -> descriptor -> ext_expr + | spec_object_define_own_prop_array_3l : object_loc -> int -> int -> descriptor -> bool -> bool -> ext_expr + | spec_object_define_own_prop_array_3l_ii : object_loc -> int -> int -> descriptor -> bool -> bool -> ext_expr + | spec_object_define_own_prop_array_3l_ii_1 : object_loc -> int -> int -> descriptor -> bool -> bool -> out -> ext_expr + | spec_object_define_own_prop_array_3l_ii_2 : object_loc -> int -> int -> descriptor -> bool -> bool -> out -> ext_expr + | spec_object_define_own_prop_array_3l_iii_1 : object_loc -> int -> descriptor -> bool -> bool -> ext_expr + | spec_object_define_own_prop_array_3l_iii_2 : object_loc -> descriptor -> bool -> bool -> ext_expr + | spec_object_define_own_prop_array_3l_iii_3 : object_loc -> descriptor -> bool -> ext_expr + | spec_object_define_own_prop_array_3l_iii_4 : object_loc -> bool -> out -> ext_expr + | spec_object_define_own_prop_array_3m_n : object_loc -> bool -> ext_expr + + (** Extended expressions for operations on references *) + | spec_put_value : resvalue -> value -> ext_expr + + (** Extended expressions for operations on environment records *) + + | spec_env_record_has_binding : env_loc -> prop_name -> ext_expr + | spec_env_record_has_binding_1 : env_loc -> prop_name -> env_record -> ext_expr + | spec_env_record_get_binding_value : env_loc -> prop_name -> bool -> ext_expr + | spec_env_record_get_binding_value_1 : env_loc -> prop_name -> bool -> env_record -> ext_expr + | spec_env_record_get_binding_value_2 : prop_name -> bool -> object_loc -> out -> ext_expr + + | spec_env_record_create_immutable_binding : env_loc -> prop_name -> ext_expr + | spec_env_record_initialize_immutable_binding : env_loc -> prop_name -> value -> ext_expr + | spec_env_record_create_mutable_binding : env_loc -> prop_name -> option bool -> ext_expr + | spec_env_record_create_mutable_binding_1 : env_loc -> prop_name -> bool -> env_record -> ext_expr + | spec_env_record_create_mutable_binding_2 : env_loc -> prop_name -> bool -> object_loc -> out -> ext_expr + | spec_env_record_create_mutable_binding_3 : out -> ext_expr + | spec_env_record_set_mutable_binding : env_loc -> prop_name -> value -> bool -> ext_expr + | spec_env_record_set_mutable_binding_1 : env_loc -> prop_name -> value -> bool -> env_record -> ext_expr + | spec_env_record_delete_binding : env_loc -> prop_name -> ext_expr + | spec_env_record_delete_binding_1 : env_loc -> prop_name -> env_record -> ext_expr + + | spec_env_record_create_set_mutable_binding : env_loc -> prop_name -> option bool -> value -> bool -> ext_expr + | spec_env_record_create_set_mutable_binding_1 : out -> env_loc -> prop_name -> value -> bool -> ext_expr + + | spec_env_record_implicit_this_value : env_loc -> ext_expr + | spec_env_record_implicit_this_value_1 : env_loc -> env_record -> ext_expr + + + (** Extended expressions for operations on property descriptors (8.10) *) + + | spec_from_descriptor : (specret full_descriptor) -> ext_expr + | spec_from_descriptor_1 : attributes -> out -> ext_expr + | spec_from_descriptor_2 : object_loc -> attributes_data -> out -> ext_expr + | spec_from_descriptor_3 : object_loc -> attributes_accessor -> out -> ext_expr + | spec_from_descriptor_4 : object_loc -> attributes -> out -> ext_expr + | spec_from_descriptor_5 : object_loc -> attributes -> out -> ext_expr + | spec_from_descriptor_6 : object_loc -> out -> ext_expr + + + + (** Extented expressions for eval *) + + | spec_entering_eval_code : bool -> funcbody -> ext_expr -> ext_expr + | spec_entering_eval_code_1 : funcbody -> ext_expr -> bool -> ext_expr + | spec_entering_eval_code_2 : out -> ext_expr -> ext_expr + + | spec_call_global_eval : bool -> list value -> ext_expr + | spec_call_global_eval_1 : bool -> value -> ext_expr + | spec_call_global_eval_2 : prog -> ext_expr + | spec_call_global_eval_3 : out -> ext_expr + + (** Extended expressions for function calls *) + + | spec_entering_func_code : object_loc -> value -> list value -> ext_expr -> ext_expr + | spec_entering_func_code_1 : object_loc -> list value -> funcbody -> value -> strictness_flag -> ext_expr -> ext_expr + | spec_entering_func_code_2 : object_loc -> list value -> funcbody -> out -> ext_expr -> ext_expr + | spec_entering_func_code_3 : object_loc -> list value -> strictness_flag -> funcbody -> value -> ext_expr -> ext_expr + | spec_entering_func_code_4 : out -> ext_expr -> ext_expr + + | spec_binding_inst_formal_params : list value -> env_loc -> list string -> strictness_flag -> ext_expr + | spec_binding_inst_formal_params_1 : list value -> env_loc -> string -> list string -> strictness_flag -> value -> out -> ext_expr + | spec_binding_inst_formal_params_2 : list value -> env_loc -> string -> list string -> strictness_flag -> value -> out -> ext_expr + | spec_binding_inst_formal_params_3 : list value -> env_loc -> string -> list string -> strictness_flag -> value -> ext_expr + | spec_binding_inst_formal_params_4 : list value -> env_loc -> list string -> strictness_flag -> out -> ext_expr + | spec_binding_inst_function_decls : list value -> env_loc -> list funcdecl -> strictness_flag -> bool -> ext_expr + | spec_binding_inst_function_decls_1 : list value -> env_loc -> funcdecl -> list funcdecl -> strictness_flag -> bool -> out -> ext_expr + | spec_binding_inst_function_decls_2 : list value -> env_loc -> funcdecl -> list funcdecl -> strictness_flag -> object_loc -> bool -> out -> ext_expr + | spec_binding_inst_function_decls_3 : list value -> funcdecl -> list funcdecl -> strictness_flag -> object_loc -> bool -> specret full_descriptor -> ext_expr + | spec_binding_inst_function_decls_3a : list value -> funcdecl -> list funcdecl -> strictness_flag -> object_loc -> bool -> full_descriptor -> ext_expr + | spec_binding_inst_function_decls_4 : list value -> env_loc -> funcdecl -> list funcdecl -> strictness_flag -> object_loc -> bool -> out -> ext_expr + | spec_binding_inst_function_decls_5 : list value -> env_loc -> funcdecl -> list funcdecl -> strictness_flag -> object_loc -> bool -> ext_expr + | spec_binding_inst_function_decls_6 : list value -> env_loc -> list funcdecl -> strictness_flag -> bool -> out -> ext_expr + | spec_binding_inst_arg_obj : object_loc -> prog -> list string -> list value -> env_loc -> ext_expr + | spec_binding_inst_arg_obj_1 : prog -> env_loc -> strictness_flag -> out -> ext_expr + | spec_binding_inst_arg_obj_2 : prog -> env_loc -> object_loc -> out -> ext_expr + | spec_binding_inst_var_decls : env_loc -> list string -> bool -> strictness_flag -> ext_expr + | spec_binding_inst_var_decls_1 : env_loc -> string -> list string -> bool -> strictness_flag -> out -> ext_expr + | spec_binding_inst_var_decls_2 : env_loc -> list string -> bool -> strictness_flag -> out -> ext_expr + | spec_binding_inst : codetype -> option object_loc -> prog -> list value -> ext_expr + | spec_binding_inst_1 : codetype -> option object_loc -> prog -> list value -> env_loc -> ext_expr + | spec_binding_inst_2 : codetype -> object_loc -> prog -> list string -> list value -> env_loc -> out -> ext_expr + | spec_binding_inst_3 : codetype -> option object_loc -> prog -> list string -> list value -> env_loc -> ext_expr + | spec_binding_inst_4 : codetype -> option object_loc -> prog -> list string -> list value -> bool -> env_loc -> out -> ext_expr + | spec_binding_inst_5 : codetype -> option object_loc -> prog -> list string -> list value -> bool -> env_loc -> ext_expr + | spec_binding_inst_6 : codetype -> option object_loc -> prog -> list string -> list value -> bool -> env_loc -> out -> ext_expr + | spec_binding_inst_7 : prog -> bool -> env_loc -> out -> ext_expr + | spec_binding_inst_8 : prog -> bool -> env_loc -> ext_expr + + | spec_make_arg_getter : string -> lexical_env -> ext_expr + | spec_make_arg_setter : string -> lexical_env -> ext_expr + + | spec_args_obj_get_1 : value -> object_loc -> prop_name -> object_loc -> (specret full_descriptor) -> ext_expr + + + | spec_args_obj_define_own_prop_1 : object_loc -> prop_name -> descriptor -> bool -> object_loc -> specret full_descriptor -> ext_expr + | spec_args_obj_define_own_prop_2 : object_loc -> prop_name -> descriptor -> bool -> object_loc -> full_descriptor -> out -> ext_expr + | spec_args_obj_define_own_prop_3 : object_loc -> prop_name -> descriptor -> bool -> object_loc -> out -> ext_expr + | spec_args_obj_define_own_prop_4 : object_loc -> prop_name -> descriptor -> bool -> object_loc -> ext_expr + | spec_args_obj_define_own_prop_5 : out -> ext_expr + | spec_args_obj_define_own_prop_6 : ext_expr + + | spec_args_obj_delete_1 : object_loc -> prop_name -> bool -> object_loc -> specret full_descriptor -> ext_expr + | spec_args_obj_delete_2 : object_loc -> prop_name -> bool -> object_loc -> full_descriptor -> out -> ext_expr + | spec_args_obj_delete_3 : out -> ext_expr + | spec_args_obj_delete_4 : bool -> ext_expr + + | spec_arguments_object_map : object_loc -> list string -> list value -> lexical_env -> strictness_flag -> ext_expr + | spec_arguments_object_map_1 : object_loc -> list string -> list value -> lexical_env -> strictness_flag -> out -> ext_expr + | spec_arguments_object_map_2 : object_loc -> list string -> list value -> lexical_env -> strictness_flag -> object_loc -> list string -> int -> ext_expr + | spec_arguments_object_map_3 : object_loc -> list string -> list value -> lexical_env -> strictness_flag -> object_loc -> list string -> int -> out -> ext_expr + | spec_arguments_object_map_4 : object_loc -> list string -> list value -> lexical_env -> strictness_flag -> object_loc -> list string -> int -> string -> ext_expr + | spec_arguments_object_map_5 : object_loc -> list string -> list value -> lexical_env -> strictness_flag -> object_loc -> list string -> int -> string -> out -> ext_expr + | spec_arguments_object_map_6 : object_loc -> list string -> list value -> lexical_env -> strictness_flag -> object_loc -> list string -> int -> object_loc -> out -> ext_expr + | spec_arguments_object_map_7 : object_loc -> list string -> list value -> lexical_env -> strictness_flag -> object_loc -> list string -> int -> out -> ext_expr + | spec_arguments_object_map_8 : object_loc -> object_loc -> list string -> ext_expr + + | spec_create_arguments_object : object_loc -> list string -> list value -> lexical_env -> strictness_flag -> ext_expr + | spec_create_arguments_object_1 : object_loc -> list string -> list value -> lexical_env -> strictness_flag -> object_loc -> out -> ext_expr + | spec_create_arguments_object_2 : object_loc -> strictness_flag -> object_loc -> out -> ext_expr + | spec_create_arguments_object_3 : object_loc -> value -> attributes -> out -> ext_expr + | spec_create_arguments_object_4 : object_loc -> out -> ext_expr + + (* Functions *) + + | spec_object_has_instance : object_loc -> value -> ext_expr + | spec_object_has_instance_1 : builtin_has_instance -> object_loc -> value -> ext_expr + | spec_function_has_instance_1 : object_loc -> out -> ext_expr + | spec_function_has_instance_2 : object_loc -> object_loc -> ext_expr + | spec_function_has_instance_3 : object_loc -> value -> ext_expr + + | spec_function_has_instance_after_bind_1 : object_loc -> value -> ext_expr + | spec_function_has_instance_after_bind_2 : object_loc -> value -> ext_expr + + | spec_function_get_1 : object_loc -> prop_name -> out -> ext_expr + + (* Function.prototype.apply *) + + | spec_function_proto_apply : object_loc -> value -> value -> ext_expr + | spec_function_proto_apply_1 : object_loc -> value -> object_loc -> out -> ext_expr + | spec_function_proto_apply_2 : object_loc -> value -> object_loc -> specret int -> ext_expr + | spec_function_proto_apply_3 : object_loc -> value -> specret (list value) -> ext_expr + + (* Function.prototype.bind *) + + | spec_function_proto_bind_1 : object_loc -> value -> list value -> ext_expr + | spec_function_proto_bind_2 : object_loc -> value -> list value -> ext_expr + | spec_function_proto_bind_3 : object_loc -> specret int -> ext_expr + | spec_function_proto_bind_4 : object_loc -> int -> ext_expr + | spec_function_proto_bind_5 : object_loc -> ext_expr + | spec_function_proto_bind_6 : object_loc -> out -> ext_expr + | spec_function_proto_bind_7 : object_loc -> out -> ext_expr + + (* Throwing of errors *) + + | spec_error : native_error -> ext_expr + | spec_error_1 : out -> ext_expr + | spec_error_or_cst : bool -> native_error -> value -> ext_expr + | spec_error_or_void : bool -> native_error -> ext_expr + + (* LATER: these are currently unused *) + | spec_init_throw_type_error : ext_expr + | spec_init_throw_type_error_1 : out -> ext_expr + + | spec_build_error : value -> value -> ext_expr + | spec_build_error_1 : object_loc -> value -> ext_expr + | spec_build_error_2 : object_loc -> out -> ext_expr + + (* Object creation and calling continuation with object address *) + + | spec_new_object : (object_loc -> ext_expr) -> ext_expr + | spec_new_object_1 : out -> (object_loc -> ext_expr) -> ext_expr + + | spec_prim_new_object : prim -> ext_expr + + (* Auxiliary reduction for creating function object steps 16 - 18 *) + | spec_creating_function_object_proto : object_loc -> ext_expr + | spec_creating_function_object_proto_1 : object_loc -> out -> ext_expr + | spec_creating_function_object_proto_2 : object_loc -> object_loc -> out -> ext_expr + + | spec_creating_function_object : list string -> funcbody -> lexical_env -> strictness_flag -> ext_expr + | spec_creating_function_object_1 : strictness_flag -> object_loc -> out -> ext_expr + | spec_creating_function_object_2 : strictness_flag -> object_loc -> out -> ext_expr + | spec_creating_function_object_3 : object_loc -> out -> ext_expr + | spec_creating_function_object_4 : object_loc -> out -> ext_expr + + (* Function creation in give execution context*) + | spec_create_new_function_in : execution_ctx -> list string -> funcbody -> ext_expr + + (* TODO: Check if object_loc or value could be None *) + (* TODO: get rid of this: | spec_call : builtin -> option object_loc -> option value -> list value -> ext_expr *) + | spec_call : object_loc -> value -> list value -> ext_expr (* object with the call method, this value, arguments *) + | spec_call_1 : call -> object_loc -> value -> list value -> ext_expr + + | spec_call_prealloc : prealloc -> value -> list value -> ext_expr + + | spec_call_default : object_loc -> value -> list value -> ext_expr + | spec_call_default_1 : object_loc -> ext_expr + | spec_call_default_2 : option funcbody -> ext_expr + | spec_call_default_3 : out -> ext_expr + + | spec_construct : object_loc -> list value -> ext_expr + | spec_construct_1 : construct -> object_loc -> list value -> ext_expr + + | spec_construct_prealloc : prealloc -> list value -> ext_expr + + | spec_construct_default : object_loc -> list value -> ext_expr + | spec_construct_default_1 : object_loc -> list value -> out -> ext_expr + | spec_construct_default_2 : object_loc -> out -> ext_expr + + | spec_construct_1_after_bind : object_loc -> list value -> object_loc -> ext_expr + + (** Extended expressions for calling global object builtin functions *) + (* LATER: rename all the spec_call into spec_builtin *) + + | spec_call_global_is_nan_1 : out -> ext_expr + | spec_call_global_is_finite_1 : out -> ext_expr + + | spec_call_object_call_1 : value -> list value -> ext_expr + | spec_call_object_new_1 : value -> ext_expr + | spec_call_object_get_proto_of_1 : value -> ext_expr + | spec_call_object_is_extensible_1 : value -> ext_expr + + | spec_call_object_create_1 : value -> value -> ext_expr + | spec_call_object_create_2 : out -> value -> value -> ext_expr + | spec_call_object_create_3 : object_loc -> value -> ext_expr + + | spec_call_object_define_props_1 : value -> value -> ext_expr + | spec_call_object_define_props_2 : out -> object_loc -> ext_expr + | spec_call_object_define_props_3 : object_loc -> object_loc -> list prop_name -> list (prop_name * attributes) -> ext_expr + | spec_call_object_define_props_4 : out -> object_loc -> object_loc -> prop_name -> list prop_name -> list (prop_name * attributes) -> ext_expr + | spec_call_object_define_props_5 : object_loc -> object_loc -> prop_name -> list prop_name -> list (prop_name * attributes) -> specret attributes -> ext_expr + | spec_call_object_define_props_6 : object_loc -> list (prop_name * attributes) -> ext_expr + | spec_call_object_define_props_7 : out -> object_loc -> list (prop_name * attributes) -> ext_expr + + | spec_call_object_seal_1 : value -> ext_expr + | spec_call_object_seal_2 : object_loc -> list prop_name -> ext_expr + | spec_call_object_seal_3 : object_loc -> prop_name -> list prop_name -> specret full_descriptor -> ext_expr + | spec_call_object_seal_4 : object_loc -> list prop_name -> out -> ext_expr + + | spec_call_object_is_sealed_1 : value -> ext_expr + | spec_call_object_is_sealed_2 : object_loc -> list prop_name -> ext_expr + | spec_call_object_is_sealed_3 : object_loc -> list prop_name -> specret full_descriptor -> ext_expr + + | spec_call_object_freeze_1 : value -> ext_expr + | spec_call_object_freeze_2 : object_loc -> list prop_name -> ext_expr + | spec_call_object_freeze_3 : object_loc -> prop_name -> list prop_name -> specret full_descriptor -> ext_expr + | spec_call_object_freeze_4 : object_loc -> prop_name -> list prop_name -> full_descriptor -> ext_expr + | spec_call_object_freeze_5 : object_loc -> list prop_name -> out -> ext_expr + + | spec_call_object_is_frozen_1 : value -> ext_expr + | spec_call_object_is_frozen_2 : object_loc -> list prop_name -> ext_expr + | spec_call_object_is_frozen_3 : object_loc -> list prop_name -> specret full_descriptor -> ext_expr + | spec_call_object_is_frozen_4 : object_loc -> list prop_name -> full_descriptor -> ext_expr + | spec_call_object_is_frozen_5 : object_loc -> list prop_name -> full_descriptor -> ext_expr + + + | spec_call_object_prevent_extensions_1 : value -> ext_expr + + | spec_call_object_define_prop_1 : value -> value -> value -> ext_expr + | spec_call_object_define_prop_2 : object_loc -> out -> value -> ext_expr + | spec_call_object_define_prop_3 : object_loc -> string -> specret descriptor -> ext_expr + | spec_call_object_define_prop_4 : object_loc -> out -> ext_expr + + | spec_call_object_get_own_prop_descriptor_1: value -> value -> ext_expr + | spec_call_object_get_own_prop_descriptor_2: object_loc -> out -> ext_expr + + + | spec_call_object_proto_to_string_1 : value -> ext_expr + | spec_call_object_proto_to_string_2 : out -> ext_expr + + | spec_call_object_proto_has_own_prop_1 : out -> value -> ext_expr + | spec_call_object_proto_has_own_prop_2 : out -> prop_name -> ext_expr + | spec_call_object_proto_has_own_prop_3 : specret full_descriptor -> ext_expr + + | spec_call_object_proto_is_prototype_of_2_1 : value -> value -> ext_expr + | spec_call_object_proto_is_prototype_of_2_2 : out -> object_loc -> ext_expr + | spec_call_object_proto_is_prototype_of_2_3 : object_loc -> object_loc -> ext_expr + | spec_call_object_proto_is_prototype_of_2_4 : object_loc -> value -> ext_expr + + | spec_call_object_proto_prop_is_enumerable_1 : value -> value -> ext_expr + | spec_call_object_proto_prop_is_enumerable_2 : value -> out -> ext_expr + | spec_call_object_proto_prop_is_enumerable_3 : out -> string -> ext_expr + | spec_call_object_proto_prop_is_enumerable_4 : specret full_descriptor -> ext_expr + + | spec_call_array_new_1 : list value -> ext_expr + | spec_call_array_new_2 : object_loc -> list value -> ext_expr + | spec_call_array_new_3 : object_loc -> list value -> int -> ext_expr + + | spec_call_array_new_single_1 : value -> ext_expr + | spec_call_array_new_single_2 : object_loc -> value -> ext_expr + | spec_call_array_new_single_3 : object_loc -> number -> specret int -> ext_expr + | spec_call_array_new_single_4 : object_loc -> int -> ext_expr + + | spec_call_array_is_array_1 : value -> ext_expr + | spec_call_array_is_array_2_3 : class_name -> ext_expr + + | spec_call_array_proto_to_string : out -> ext_expr + | spec_call_array_proto_to_string_1 : object_loc -> out -> ext_expr + + | spec_call_array_proto_join : out -> list value -> ext_expr + | spec_call_array_proto_join_1 : object_loc -> out -> list value -> ext_expr + | spec_call_array_proto_join_2 : object_loc -> specret int -> list value -> ext_expr + | spec_call_array_proto_join_3 : object_loc -> int -> value -> ext_expr + | spec_call_array_proto_join_4 : object_loc -> int -> out -> ext_expr + | spec_call_array_proto_join_5 : object_loc -> int -> string -> specret string -> ext_expr + + | spec_call_array_proto_join_elements : object_loc -> int -> int -> string -> string -> ext_expr + | spec_call_array_proto_join_elements_1 : object_loc -> int -> int -> string -> string -> ext_expr + | spec_call_array_proto_join_elements_2 : object_loc -> int -> int -> string -> string -> specret string -> ext_expr + + | spec_call_array_proto_pop_1 : out -> ext_expr + | spec_call_array_proto_pop_2 : object_loc -> out -> ext_expr + | spec_call_array_proto_pop_3 : object_loc -> specret int -> ext_expr + | spec_call_array_proto_pop_3_empty_1 : object_loc -> ext_expr + | spec_call_array_proto_pop_3_empty_2 : out -> ext_expr + | spec_call_array_proto_pop_3_nonempty_1 : object_loc -> int -> ext_expr + | spec_call_array_proto_pop_3_nonempty_2 : object_loc -> out -> ext_expr + | spec_call_array_proto_pop_3_nonempty_3 : object_loc -> value -> out -> ext_expr + | spec_call_array_proto_pop_3_nonempty_4 : object_loc -> value -> value -> out -> ext_expr + | spec_call_array_proto_pop_3_nonempty_5 : value -> out -> ext_expr + + | spec_call_array_proto_push_1 : out -> list value -> ext_expr + | spec_call_array_proto_push_2 : object_loc -> list value -> out -> ext_expr + | spec_call_array_proto_push_3 : object_loc -> list value -> specret int -> ext_expr + | spec_call_array_proto_push_4 : object_loc -> list value -> int -> ext_expr + | spec_call_array_proto_push_4_nonempty_1 : object_loc -> list value -> int -> value -> ext_expr + | spec_call_array_proto_push_4_nonempty_2 : object_loc -> list value -> int -> value -> out -> ext_expr + | spec_call_array_proto_push_4_nonempty_3 : object_loc -> list value -> int -> value -> out -> ext_expr + | spec_call_array_proto_push_5 : object_loc -> value -> ext_expr + | spec_call_array_proto_push_6 : value -> out -> ext_expr + + | spec_call_string_non_empty : out -> ext_expr + + | spec_construct_string_1 : value -> ext_expr + | spec_construct_string_2 : out -> ext_expr + + | spec_construct_bool_1 : out -> ext_expr + | spec_call_bool_proto_to_string_1 : out -> ext_expr + | spec_call_bool_proto_value_of_1 : value -> ext_expr + | spec_call_bool_proto_value_of_2 : value -> ext_expr + + | spec_call_number_proto_to_string_1 : value -> list value -> ext_expr + | spec_call_number_proto_to_string_2 : value -> out -> ext_expr + | spec_construct_number_1 : out -> ext_expr + | spec_call_number_proto_value_of_1 : value -> ext_expr + + | spec_call_error_proto_to_string_1 : value -> ext_expr + | spec_call_error_proto_to_string_2 : object_loc -> out -> ext_expr + | spec_call_error_proto_to_string_3 : object_loc -> out -> ext_expr + | spec_call_error_proto_to_string_4 : object_loc -> string -> out -> ext_expr + | spec_call_error_proto_to_string_5 : object_loc -> string -> out -> ext_expr + | spec_call_error_proto_to_string_6 : object_loc -> string -> out -> ext_expr + + + (** Special state for returning an outcome *) + + | spec_returns : out -> ext_expr + +(** Grammar of extended statements *) + +with ext_stat := + + (** Extended expressions include statements *) + + | stat_basic : stat -> ext_stat + + (** Extended statements associated with primitive statements *) + | stat_expr_1: (specret value) -> ext_stat + + | stat_block_1 : out -> stat -> ext_stat + | stat_block_2 : resvalue -> out -> ext_stat + + | stat_label_1 : label -> out -> ext_stat + + | stat_var_decl_1 : out -> list (string * option expr) -> ext_stat + | stat_var_decl_item : (string * option expr) -> ext_stat + | stat_var_decl_item_1 : string -> specret ref -> expr -> ext_stat + | stat_var_decl_item_2 : string -> ref -> (specret value) -> ext_stat + | stat_var_decl_item_3 : string -> out -> ext_stat + + | stat_if_1 : specret value -> stat -> option stat -> ext_stat + + | stat_while_1 : label_set -> expr -> stat -> resvalue -> ext_stat + | stat_while_2 : label_set -> expr -> stat -> resvalue -> specret value -> ext_stat + | stat_while_3 : label_set -> expr -> stat -> resvalue -> out -> ext_stat + | stat_while_4 : label_set -> expr -> stat -> resvalue -> res -> ext_stat + | stat_while_5 : label_set -> expr -> stat -> resvalue -> res -> ext_stat + | stat_while_6 : label_set -> expr -> stat -> resvalue -> res -> ext_stat + + + | stat_do_while_1 : label_set -> stat -> expr -> resvalue -> ext_stat + | stat_do_while_2 : label_set -> stat -> expr -> resvalue -> out -> ext_stat + | stat_do_while_3 : label_set -> stat -> expr -> resvalue -> res -> ext_stat + | stat_do_while_4 : label_set -> stat -> expr -> resvalue -> res -> ext_stat + | stat_do_while_5 : label_set -> stat -> expr -> resvalue -> res -> ext_stat + | stat_do_while_6 : label_set -> stat -> expr -> resvalue -> ext_stat + | stat_do_while_7 : label_set -> stat -> expr -> resvalue -> specret value -> ext_stat + + | stat_for_1 : label_set -> specret value -> option expr -> option expr -> stat -> ext_stat + | stat_for_2 : label_set -> resvalue -> option expr -> option expr -> stat -> ext_stat + | stat_for_3 : label_set -> resvalue -> expr -> specret value -> option expr -> stat -> ext_stat + | stat_for_4 : label_set -> resvalue -> option expr -> option expr -> stat -> ext_stat + | stat_for_5 : label_set -> resvalue -> option expr -> out -> option expr -> stat -> ext_stat + | stat_for_6 : label_set -> resvalue -> option expr -> option expr -> stat -> res -> ext_stat + | stat_for_7 : label_set -> resvalue -> option expr -> option expr -> stat -> res -> ext_stat + | stat_for_8 : label_set -> resvalue -> option expr -> option expr -> stat -> ext_stat + | stat_for_9 : label_set -> resvalue -> option expr -> expr -> specret value -> stat -> ext_stat + + | stat_for_var_1 : out -> label_set -> option expr -> option expr -> stat -> ext_stat + + +(* LATER: define prop_names for [set prop_name] *) +(* LATER + | stat_for_in_1 : expr -> stat -> out -> ext_stat + | stat_for_in_2 : expr -> stat -> out -> ext_stat + | stat_for_in_3 : expr -> stat -> out -> ext_stat + | stat_for_in_4 : expr -> stat -> object_loc -> option res -> option out -> set prop_name -> set prop_name -> ext_stat + | stat_for_in_5 : expr -> stat -> object_loc -> option res -> option out -> set prop_name -> set prop_name -> prop_name -> ext_stat + | stat_for_in_6 : expr -> stat -> object_loc -> option res -> option out -> set prop_name -> set prop_name -> prop_name -> ext_stat + | stat_for_in_7 : expr -> stat -> object_loc -> option res -> option out -> set prop_name -> set prop_name -> out -> ext_stat + | stat_for_in_8 : expr -> stat -> object_loc -> option res -> option out -> set prop_name -> set prop_name -> out -> ext_stat + | stat_for_in_9 : expr -> stat -> object_loc -> option res -> option out -> set prop_name -> set prop_name -> res -> ext_stat +*) + + (* Extended statements for 'switch' *) + + | stat_switch_1: (specret value) -> label_set -> switchbody -> ext_stat + | stat_switch_2: out -> label_set -> ext_stat + | stat_switch_nodefault_1: value -> resvalue -> list switchclause -> ext_stat + | stat_switch_nodefault_2: (specret value) -> value -> resvalue -> list stat -> list switchclause -> ext_stat + | stat_switch_nodefault_3: bool -> value -> resvalue -> list stat -> list switchclause -> ext_stat + | stat_switch_nodefault_4: out -> list switchclause -> ext_stat + | stat_switch_nodefault_5: resvalue -> list switchclause -> ext_stat + | stat_switch_nodefault_6: resvalue -> out -> list switchclause -> ext_stat + + | stat_switch_default_1: value -> resvalue -> list switchclause -> list stat -> list switchclause -> ext_stat + | stat_switch_default_A_1: bool -> value -> resvalue -> list switchclause -> list stat -> list switchclause -> ext_stat + | stat_switch_default_A_2: (specret value) -> value -> resvalue -> list stat -> list switchclause -> list stat -> list switchclause -> ext_stat + | stat_switch_default_A_3: bool -> value -> resvalue -> list stat -> list switchclause -> list stat -> list switchclause -> ext_stat + | stat_switch_default_A_4: resvalue -> value -> list stat -> list switchclause -> list stat -> list switchclause -> ext_stat + | stat_switch_default_A_5: resvalue -> out -> value -> list switchclause -> list stat -> list switchclause -> ext_stat + + | stat_switch_default_B_1: value -> resvalue -> list stat -> list switchclause -> ext_stat + | stat_switch_default_B_2: (specret value) -> value -> resvalue -> list stat -> list stat -> list switchclause -> ext_stat + | stat_switch_default_B_3: bool -> value -> resvalue -> list stat -> list stat -> list switchclause -> ext_stat + | stat_switch_default_B_4: out -> list stat -> list switchclause -> ext_stat + + | stat_switch_default_5: value -> resvalue -> list stat -> list switchclause -> ext_stat + | stat_switch_default_6: out -> list switchclause -> ext_stat + | stat_switch_default_7: resvalue -> list switchclause -> ext_stat + | stat_switch_default_8: resvalue -> out -> list switchclause -> ext_stat + + | stat_with_1 : stat -> specret value -> ext_stat (* The expression have been executed. *) + + | stat_throw_1 : (specret value) -> ext_stat (* The expression have been executed. *) + + | stat_return_1 : (specret value) -> ext_stat (* The expression have been executed. *) + + | stat_try_1 : out -> option (string*stat) -> option stat -> ext_stat (* The try block has been executed. *) + | stat_try_2 : out -> lexical_env -> stat -> option stat -> ext_stat (* The catch block is actived and will be executed. *) + | stat_try_3 : out -> option stat -> ext_stat (* The try catch block has been executed: there only stay an optional finally. *) + | stat_try_4 : res -> option stat -> ext_stat (* The try catch block has been executed: there only stay an optional finally. *) + | stat_try_5 : res -> out -> ext_stat (* The finally has been executed. *) + +(** Grammar of extended programs *) + +with ext_prog := + + | prog_basic : prog -> ext_prog + | javascript_1 : out -> prog -> ext_prog + | prog_1 : out -> element -> ext_prog + | prog_2 : resvalue -> out -> ext_prog + + +(** Grammar of extended forms for specification functions *) + +with ext_spec := + | spec_to_int32 : value -> ext_spec + | spec_to_int32_1 : out -> ext_spec + | spec_to_uint32 : value -> ext_spec + | spec_to_uint32_1 : out -> ext_spec + + | spec_expr_get_value_conv : (value -> ext_expr) -> expr -> ext_spec + | spec_expr_get_value_conv_1 : (value -> ext_expr) -> (specret value) -> ext_spec + | spec_expr_get_value_conv_2 : out -> ext_spec + + | spec_convert_twice : ext_expr -> ext_expr -> ext_spec + | spec_convert_twice_1 : out -> ext_expr -> ext_spec + | spec_convert_twice_2 : value -> out -> ext_spec + + (** Extended expressions for lists of expressions *) + | spec_list_expr : list expr -> ext_spec + | spec_list_expr_1 : list value -> list expr -> ext_spec + | spec_list_expr_2 : list value -> (specret value) -> list expr -> ext_spec + + | spec_to_descriptor : value -> ext_spec + | spec_to_descriptor_1a : object_loc -> descriptor -> ext_spec + | spec_to_descriptor_1b : out -> object_loc -> descriptor -> ext_spec + | spec_to_descriptor_1c : out -> object_loc -> descriptor -> ext_spec + | spec_to_descriptor_2a : object_loc -> descriptor -> ext_spec + | spec_to_descriptor_2b : out -> object_loc -> descriptor -> ext_spec + | spec_to_descriptor_2c : out -> object_loc -> descriptor -> ext_spec + | spec_to_descriptor_3a : object_loc -> descriptor -> ext_spec + | spec_to_descriptor_3b : out -> object_loc -> descriptor -> ext_spec + | spec_to_descriptor_3c : out -> object_loc -> descriptor -> ext_spec + | spec_to_descriptor_4a : object_loc -> descriptor -> ext_spec + | spec_to_descriptor_4b : out -> object_loc -> descriptor -> ext_spec + | spec_to_descriptor_4c : out -> object_loc -> descriptor -> ext_spec + | spec_to_descriptor_5a : object_loc -> descriptor -> ext_spec + | spec_to_descriptor_5b : out -> object_loc -> descriptor -> ext_spec + | spec_to_descriptor_5c : out -> object_loc -> descriptor -> ext_spec + | spec_to_descriptor_6a : object_loc -> descriptor -> ext_spec + | spec_to_descriptor_6b : out -> object_loc -> descriptor -> ext_spec + | spec_to_descriptor_6c : out -> object_loc -> descriptor -> ext_spec + | spec_to_descriptor_7 : object_loc -> descriptor -> ext_spec + + | spec_object_get_own_prop : object_loc -> prop_name -> ext_spec + | spec_object_get_own_prop_1 : builtin_get_own_prop -> object_loc -> prop_name -> ext_spec + | spec_object_get_own_prop_2 : object_loc -> prop_name -> option attributes -> ext_spec + + | spec_object_get_prop : object_loc -> prop_name -> ext_spec + | spec_object_get_prop_1 : builtin_get_prop -> object_loc -> prop_name -> ext_spec + | spec_object_get_prop_2 : object_loc -> prop_name -> specret full_descriptor -> ext_spec + | spec_object_get_prop_3 : object_loc -> prop_name -> value -> ext_spec + + | spec_get_value : resvalue -> ext_spec + | spec_get_value_ref_b_1 : out -> ext_spec + | spec_get_value_ref_c_1 : out -> ext_spec + + (** Shorthand for calling [red_expr] then [ref_get_value] *) + + | spec_expr_get_value : expr -> ext_spec + | spec_expr_get_value_1 : out -> ext_spec + + (** Extended expressions for operations on lexical environments *) + + | spec_lexical_env_get_identifier_ref : lexical_env -> prop_name -> bool -> ext_spec + | spec_lexical_env_get_identifier_ref_1 : env_loc -> lexical_env -> prop_name -> bool -> ext_spec + | spec_lexical_env_get_identifier_ref_2 : env_loc -> lexical_env -> prop_name -> bool -> out -> ext_spec + + (** Errors in the grammar of spec *) (* LATER: merge *) + | spec_error_spec : native_error -> ext_spec + | spec_error_spec_1 : out -> ext_spec + + (* .. *) + | spec_args_obj_get_own_prop_1 : object_loc -> prop_name -> (specret full_descriptor) -> ext_spec + | spec_args_obj_get_own_prop_2 : object_loc -> prop_name -> object_loc -> full_descriptor -> (specret full_descriptor) -> ext_spec + | spec_args_obj_get_own_prop_3 : full_descriptor -> out -> ext_spec + | spec_args_obj_get_own_prop_4 : full_descriptor -> ext_spec + + | spec_string_get_own_prop_1 : object_loc -> prop_name -> (specret full_descriptor) -> ext_spec + | spec_string_get_own_prop_2 : object_loc -> prop_name -> (specret int) -> ext_spec + | spec_string_get_own_prop_3 : object_loc -> prop_name -> out -> ext_spec + | spec_string_get_own_prop_4 : prop_name -> string -> ext_spec + | spec_string_get_own_prop_5 : string -> (specret int) -> ext_spec + | spec_string_get_own_prop_6 : string -> int -> int -> ext_spec + + (* Argumenst for Function.prototype.apply *) + + | spec_function_proto_apply_get_args : object_loc -> int -> int -> ext_spec + | spec_function_proto_apply_get_args_1 : object_loc -> int -> int -> out -> ext_spec + | spec_function_proto_apply_get_args_2 : object_loc -> int -> int -> out -> ext_spec + | spec_function_proto_apply_get_args_3 : value -> specret (list value) -> ext_spec + + (* Length for Function.prototype.bind *) + + | spec_function_proto_bind_length : object_loc -> list value -> ext_spec + | spec_function_proto_bind_length_1 : object_loc -> list value -> ext_spec + | spec_function_proto_bind_length_2 : list value -> out -> ext_spec + | spec_function_proto_bind_length_3 : specret int -> list value -> ext_spec + + (* Conversion for Array.prototype.join *) + + | spec_call_array_proto_join_vtsfj : object_loc -> int -> ext_spec + | spec_call_array_proto_join_vtsfj_1 : object_loc -> out -> ext_spec + | spec_call_array_proto_join_vtsfj_2 : object_loc -> out -> ext_spec + | spec_call_array_proto_join_vtsfj_3 : out -> ext_spec +. + +(** Coercions *) + +Coercion expr_basic : expr >-> ext_expr. +Coercion stat_basic : stat >-> ext_stat. +Coercion prog_basic : prog >-> ext_prog. + + +(** Shorthand for calling toPrimitive without prefered type *) + +Definition spec_to_primitive_auto v := + spec_to_primitive v None. + + +(**************************************************************) +(** ** Extracting outcome from an extended expression. *) + +(** Auxiliary definition for extracting [out] of [specret] *) + +Definition out_of_specret T (y:specret T) := + match y with + | specret_out o => Some o + | specret_val _ _ => None + end. + +(** The [out_of_ext_*] family of definitions is used by + the generic abort rule, which propagates exceptions, + and divergence, break and continues. *) + +Definition out_of_ext_expr (e : ext_expr) : option out := + match e with + | expr_basic _ => None + + | expr_identifier_1 y => out_of_specret y + | expr_object_0 o _ => Some o + | expr_object_1 _ _ => None + | expr_object_2 _ _ _ _ => None + | expr_object_3_val _ _ y _ => out_of_specret y + | expr_object_3_get _ _ o _ => Some o + | expr_object_3_set _ _ o _ => Some o + | expr_object_4 _ _ _ _ => None + | expr_object_5 _ _ o => Some o + + + + + (* _ARRAYS_ : support for array intermediate forms - CHECK!*) + | expr_array_0 o _ => Some o + | expr_array_1 _ _ => None + | expr_array_2 _ _ _ => None + | expr_array_3 _ _ _ => None + | expr_array_3_1 _ y _ _ => out_of_specret y + | expr_array_3_2 _ _ o _ _ => Some o + | expr_array_3_3 _ _ y _ _ => out_of_specret y + | expr_array_3_4 _ _ o _ => Some o + | expr_array_3_5 _ o _ => Some o + + + | expr_array_add_length _ _ o => Some o + | expr_array_add_length_0 _ _ => None + | expr_array_add_length_1 _ _ o => Some o + | expr_array_add_length_2 _ y _ => out_of_specret y + | expr_array_add_length_3 _ y => out_of_specret y + | expr_array_add_length_4 _ o => Some o + + + + + + | expr_function_1 _ _ _ _ _ o => Some o + | expr_function_2 _ _ o => Some o + | expr_function_3 _ o => Some o + + | expr_access_1 y _ => out_of_specret y + | expr_access_2 _ y => out_of_specret y + | expr_access_3 _ o _ => Some o + | expr_access_4 _ o => Some o + + | expr_new_1 y _ => out_of_specret y + | expr_new_2 _ y => out_of_specret y + + | expr_call_1 o _ _ => Some o + | expr_call_2 _ _ _ y => out_of_specret y + | expr_call_3 _ _ _ y => out_of_specret y + | expr_call_4 _ _ _ _ => None + | expr_call_5 _ _ _ o => Some o + + | spec_eval _ _ _ => None + + | expr_unary_op_1 _ y => out_of_specret y + | expr_unary_op_2 _ _ => None + | expr_delete_1 o => Some o + | expr_delete_2 _ => None + | expr_delete_3 _ o => Some o + | expr_delete_4 _ _ => None + | expr_typeof_1 o => Some o + | expr_typeof_2 y => out_of_specret y + | expr_prepost_1 _ o => Some o +(* | expr_prepost_2 _ _ o => Some o *) + + | expr_prepost_2 _ _ y => out_of_specret y + + | expr_prepost_3 _ _ o => Some o + | expr_prepost_4 _ o => Some o + | expr_unary_op_neg_1 o => Some o + | expr_unary_op_bitwise_not_1 y => out_of_specret y + | expr_unary_op_not_1 o => Some o + | expr_conditional_1 y _ _ => out_of_specret y + | expr_conditional_1' o _ _ => None + | expr_conditional_2 y => out_of_specret y + + | expr_binary_op_1 _ y _ => out_of_specret y + | expr_binary_op_2 _ _ y => out_of_specret y + | expr_binary_op_3 _ _ _ => None + | expr_binary_op_add_1 y => out_of_specret y + | expr_binary_op_add_string_1 y => out_of_specret y + | expr_puremath_op_1 _ y => out_of_specret y + | expr_shift_op_1 _ y _ => out_of_specret y + | expr_shift_op_2 _ _ y => out_of_specret y + | expr_inequality_op_1 _ _ _ _ => None + | expr_inequality_op_2 _ _ y => out_of_specret y + | expr_binary_op_in_1 _ o => Some o + | expr_binary_op_disequal_1 o => Some o + | spec_equal _ _ => None + | spec_equal_1 _ _ _ _ => None + | spec_equal_2 _ => None + | spec_equal_3 _ _ _ => None + | spec_equal_4 _ o => Some o + | expr_bitwise_op_1 _ y _ => out_of_specret y + | expr_bitwise_op_2 _ _ y => out_of_specret y + | expr_lazy_op_1 _ y _ => out_of_specret y + | expr_lazy_op_2 _ _ o _ => Some o + | expr_lazy_op_2_1 y => out_of_specret y + + | expr_assign_1 o _ _ => Some o + | expr_assign_2 _ y _ _ => out_of_specret y + | expr_assign_3 _ _ _ y => out_of_specret y + | expr_assign_3' _ o => Some o + | expr_assign_4 _ y => out_of_specret y + | expr_assign_5 _ o => Some o + + | spec_to_primitive _ _ => None + | spec_to_boolean _ => None + | spec_to_number _ => None + | spec_to_number_1 o => Some o + | spec_to_integer _ => None + | spec_to_integer_1 o => Some o + | spec_to_string _ => None + | spec_to_string_1 o => Some o + | spec_to_object _ => None + + | spec_check_object_coercible _ => None + + | spec_eq _ _ => None + | spec_eq0 _ _ => None + | spec_eq1 _ _ => None + | spec_eq2 _ _ _ => None + + | spec_object_get _ _ => None + | spec_object_get_1 _ _ _ _ => None + | spec_object_get_2 _ y => out_of_specret y + | spec_object_get_3 _ _ => None + + | spec_object_can_put _ _ => None + | spec_object_can_put_1 _ _ _ => None + | spec_object_can_put_2 _ _ y => out_of_specret y + | spec_object_can_put_4 _ _ _ => None + | spec_object_can_put_5 _ y => out_of_specret y + | spec_object_can_put_6 _ _ => None + + | spec_object_put _ _ _ _ => None + | spec_object_put_1 _ _ _ _ _ _ => None + | spec_object_put_2 _ _ _ _ _ o => Some o + | spec_object_put_3 _ _ _ _ _ y => out_of_specret y + | spec_object_put_4 _ _ _ _ _ y => out_of_specret y + | spec_object_put_5 o => Some o + + | spec_object_has_prop _ _ => None + | spec_object_has_prop_1 _ _ _ => None + | spec_object_has_prop_2 y => out_of_specret y + + | spec_object_delete _ _ _ => None + | spec_object_delete_1 _ _ _ _ => None + | spec_object_delete_2 _ _ _ y => out_of_specret y + | spec_object_delete_3 _ _ _ _ => None + + | spec_object_default_value _ _ => None + | spec_object_default_value_1 _ _ _ => None + | spec_object_default_value_2 _ _ _ => None + | spec_object_default_value_3 _ _ => None + | spec_object_default_value_4 => None + | spec_object_default_value_sub_1 _ _ _ => None + | spec_object_default_value_sub_2 _ o _ => Some o + | spec_object_default_value_sub_3 o _ => Some o + + | spec_object_define_own_prop _ _ _ _ => None + | spec_object_define_own_prop_1 _ _ _ _ _ => None + | spec_object_define_own_prop_2 _ _ _ _ y => out_of_specret y + | spec_object_define_own_prop_3 _ _ _ _ _ _ => None + | spec_object_define_own_prop_4 _ _ _ _ _ => None + | spec_object_define_own_prop_5 _ _ _ _ _ => None + | spec_object_define_own_prop_6a _ _ _ _ _ => None + | spec_object_define_own_prop_6b _ _ _ _ _ => None + | spec_object_define_own_prop_6c _ _ _ _ _ => None + | spec_object_define_own_prop_reject _ => None + | spec_object_define_own_prop_write _ _ _ _ _ => None + + + + (* ARRAYS *) + | spec_object_define_own_prop_array_2 _ _ _ _ y => out_of_specret y + | spec_object_define_own_prop_array_2_1 _ _ _ _ _ _ => None + | spec_object_define_own_prop_array_branch_3_4 _ _ _ _ _ y => out_of_specret y + | spec_object_define_own_prop_array_branch_4_5 _ _ _ _ _ _ => None + | spec_object_define_own_prop_array_branch_4_5_a _ _ y _ _ _ _ => out_of_specret y + | spec_object_define_own_prop_array_branch_4_5_b _ _ _ o _ _ _ _ => Some o + | spec_object_define_own_prop_array_4a _ _ _ _ _ _ => None + | spec_object_define_own_prop_array_4b _ _ y _ _ _ _ => out_of_specret y + | spec_object_define_own_prop_array_4c _ _ _ _ _ _ o => Some o + | spec_object_define_own_prop_array_5 _ _ _ _ => None + | spec_object_define_own_prop_array_3 _ _ _ _ _ => None + | spec_object_define_own_prop_array_3c _ _ y _ _ _ _ => out_of_specret y + | spec_object_define_own_prop_array_3d_e _ o _ _ _ _ _ => Some o + | spec_object_define_own_prop_array_3f_g _ _ _ _ _ _ => None + | spec_object_define_own_prop_array_3h_i _ _ _ _ _ _ => None + | spec_object_define_own_prop_array_3j _ _ _ _ _ _ _ => None + | spec_object_define_own_prop_array_3k_l _ o _ _ _ _ _ _ => Some o + | spec_object_define_own_prop_array_3l _ _ _ _ _ _ => None + | spec_object_define_own_prop_array_3l_ii _ _ _ _ _ _ => None + | spec_object_define_own_prop_array_3l_ii_1 _ _ _ _ _ _ o => Some o + | spec_object_define_own_prop_array_3l_ii_2 _ _ _ _ _ _ o => Some o + | spec_object_define_own_prop_array_3l_iii_1 _ _ _ _ _ => None + | spec_object_define_own_prop_array_3l_iii_2 _ _ _ _ => None + | spec_object_define_own_prop_array_3l_iii_3 _ _ _ => None + | spec_object_define_own_prop_array_3l_iii_4 _ _ o => Some o + | spec_object_define_own_prop_array_3m_n _ _ => None + + | spec_prim_value_get _ _ => None + | spec_prim_value_get_1 _ _ o => Some o + + | spec_prim_value_put _ _ _ _ => None + | spec_prim_value_put_1 _ _ _ _ o => Some o + + | spec_put_value _ _ => None + + + | spec_env_record_has_binding _ _ => None + | spec_env_record_has_binding_1 _ _ _ => None + | spec_env_record_get_binding_value _ _ _ => None + | spec_env_record_get_binding_value_1 _ _ _ _ => None + | spec_env_record_get_binding_value_2 _ _ _ o => Some o + + | spec_env_record_create_immutable_binding _ _ => None + | spec_env_record_initialize_immutable_binding _ _ _ => None + | spec_env_record_create_mutable_binding _ _ _ => None + | spec_env_record_create_mutable_binding_1 _ _ _ _ => None + | spec_env_record_create_mutable_binding_2 _ _ _ _ o => Some o + | spec_env_record_create_mutable_binding_3 o => Some o + | spec_env_record_set_mutable_binding _ _ _ _ => None + | spec_env_record_set_mutable_binding_1 _ _ _ _ _ => None + | spec_env_record_delete_binding _ _ => None + | spec_env_record_delete_binding_1 _ _ _ => None + + | spec_env_record_create_set_mutable_binding _ _ _ _ _ => None + | spec_env_record_create_set_mutable_binding_1 o _ _ _ _ => Some o + + | spec_env_record_implicit_this_value _ => None + | spec_env_record_implicit_this_value_1 _ _ => None + + | spec_from_descriptor y => out_of_specret y + | spec_from_descriptor_1 _ o => Some o + | spec_from_descriptor_2 _ _ o => Some o + | spec_from_descriptor_3 _ _ o => Some o + | spec_from_descriptor_4 _ _ o => Some o + | spec_from_descriptor_5 _ _ o => Some o + | spec_from_descriptor_6 _ o => Some o + + + | spec_entering_eval_code _ _ _ => None + | spec_entering_eval_code_1 _ _ _ => None + | spec_entering_eval_code_2 o _ => Some o + + | spec_call_global_eval _ _ => None + | spec_call_global_eval_1 _ _ => None + | spec_call_global_eval_2 _ => None + | spec_call_global_eval_3 o => Some o + + | spec_entering_func_code _ _ _ _ => None + | spec_entering_func_code_1 _ _ _ _ _ _ => None + | spec_entering_func_code_2 _ _ _ o _ => Some o + | spec_entering_func_code_3 _ _ _ _ _ _ => None + | spec_entering_func_code_4 o _ => Some o + + | spec_binding_inst_formal_params _ _ _ _ => None + | spec_binding_inst_formal_params_1 _ _ _ _ _ _ o => Some o + | spec_binding_inst_formal_params_2 _ _ _ _ _ _ o => Some o + | spec_binding_inst_formal_params_3 _ _ _ _ _ _ => None + | spec_binding_inst_formal_params_4 _ _ _ _ o => Some o + | spec_binding_inst_function_decls _ _ _ _ _ => None + | spec_binding_inst_function_decls_1 _ _ _ _ _ _ o => Some o + | spec_binding_inst_function_decls_2 _ _ _ _ _ _ _ o => Some o + | spec_binding_inst_function_decls_3 _ _ _ _ _ _ y => out_of_specret y + | spec_binding_inst_function_decls_3a _ _ _ _ _ _ _ => None + | spec_binding_inst_function_decls_4 _ _ _ _ _ _ _ o => Some o + | spec_binding_inst_function_decls_5 _ _ _ _ _ _ _ => None + | spec_binding_inst_function_decls_6 _ _ _ _ _ o => Some o + | spec_binding_inst_arg_obj object_loc _ _ _ _ => None + | spec_binding_inst_arg_obj_1 _ _ _ o => Some o + | spec_binding_inst_arg_obj_2 _ _ _ o => Some o + | spec_binding_inst_var_decls _ _ _ _ => None + | spec_binding_inst_var_decls_1 _ _ _ _ _ o => Some o + | spec_binding_inst_var_decls_2 _ _ _ _ o => Some o + | spec_binding_inst _ _ _ _ => None + | spec_binding_inst_1 _ _ _ _ _ => None + | spec_binding_inst_2 _ _ _ _ _ _ o => Some o + | spec_binding_inst_3 _ _ _ _ _ _ => None + | spec_binding_inst_4 _ _ _ _ _ _ _ o => Some o + | spec_binding_inst_5 _ _ _ _ _ _ _ => None + | spec_binding_inst_6 _ _ _ _ _ _ _ o => Some o + | spec_binding_inst_7 _ _ _ o => Some o + | spec_binding_inst_8 _ _ _ => None + + | spec_make_arg_getter _ _ => None + | spec_make_arg_setter _ _ => None + + | spec_args_obj_get_1 _ _ _ _ y => out_of_specret y + + + | spec_args_obj_define_own_prop_1 _ _ _ _ _ y => out_of_specret y + | spec_args_obj_define_own_prop_2 _ _ _ _ _ _ o => Some o + | spec_args_obj_define_own_prop_3 _ _ _ _ _ o => Some o + | spec_args_obj_define_own_prop_4 _ _ _ _ _ => None + | spec_args_obj_define_own_prop_5 o => Some o + | spec_args_obj_define_own_prop_6 => None + + | spec_args_obj_delete_1 _ _ _ _ y => out_of_specret y + | spec_args_obj_delete_2 _ _ _ _ _ o => Some o + | spec_args_obj_delete_3 o => Some o + | spec_args_obj_delete_4 _ => None + + | spec_arguments_object_map _ _ _ _ _ => None + | spec_arguments_object_map_1 _ _ _ _ _ o => Some o + | spec_arguments_object_map_2 _ _ _ _ _ _ _ _ => None + | spec_arguments_object_map_3 _ _ _ _ _ _ _ _ o => Some o + | spec_arguments_object_map_4 _ _ _ _ _ _ _ _ _ => None + | spec_arguments_object_map_5 _ _ _ _ _ _ _ _ _ o => Some o + | spec_arguments_object_map_6 _ _ _ _ _ _ _ _ _ o => Some o + | spec_arguments_object_map_7 _ _ _ _ _ _ _ _ o => Some o + | spec_arguments_object_map_8 _ _ _ => None + + + | spec_create_arguments_object _ _ _ _ _ => None + | spec_create_arguments_object_1 _ _ _ _ _ _ o => Some o + | spec_create_arguments_object_2 _ _ _ o => Some o + | spec_create_arguments_object_3 _ _ _ o => Some o + | spec_create_arguments_object_4 _ o => Some o + + | spec_object_has_instance _ _ => None + | spec_object_has_instance_1 _ _ _ => None + | spec_function_has_instance_1 _ o => Some o + | spec_function_has_instance_2 _ _ => None + | spec_function_has_instance_3 _ _ => None + | spec_function_has_instance_after_bind_1 _ _ => None + | spec_function_has_instance_after_bind_2 _ _ => None + + | spec_function_get_1 _ _ o => Some o + + | spec_error _ => None + | spec_error_1 o => Some o + | spec_error_or_cst _ _ _ => None + | spec_error_or_void _ _ => None + + | spec_init_throw_type_error => None + | spec_init_throw_type_error_1 o => Some o + + | spec_build_error _ _ => None + | spec_build_error_1 _ _ => None + | spec_build_error_2 _ o => Some o + + | spec_new_object _ => None + | spec_new_object_1 o _ => Some o + + | spec_prim_new_object _ => None + + | spec_creating_function_object_proto _ => None + | spec_creating_function_object_proto_1 _ o => Some o + | spec_creating_function_object_proto_2 _ _ o => Some o + + | spec_creating_function_object _ _ _ _ => None + | spec_creating_function_object_1 _ _ o => Some o + | spec_creating_function_object_2 _ _ o => Some o + | spec_creating_function_object_3 _ o => Some o + | spec_creating_function_object_4 _ o => Some o + + | spec_function_proto_apply _ _ _ => None + | spec_function_proto_apply_1 _ _ _ o => Some o + | spec_function_proto_apply_2 _ _ _ y => out_of_specret y + | spec_function_proto_apply_3 _ _ y => out_of_specret y + + | spec_function_proto_bind_1 _ _ _ => None + | spec_function_proto_bind_2 _ _ _ => None + | spec_function_proto_bind_3 _ y => out_of_specret y + | spec_function_proto_bind_4 _ _ => None + | spec_function_proto_bind_5 _ => None + | spec_function_proto_bind_6 _ o => Some o + | spec_function_proto_bind_7 _ o => Some o + + | spec_create_new_function_in execution_ctx _ _ => None + + | spec_call _ _ _ => None + | spec_call_1 _ _ _ _ => None + + | spec_call_prealloc _ _ _ => None + + | spec_call_default _ _ _ => None + | spec_call_default_1 _ => None + | spec_call_default_2 _ => None + | spec_call_default_3 o => Some o + + | spec_construct _ _ => None + | spec_construct_1 _ _ _ => None + + | spec_construct_prealloc _ _ => None + + | spec_construct_default _ _ => None + | spec_construct_default_1 _ _ o => Some o + | spec_construct_default_2 _ o => Some o + + | spec_construct_1_after_bind _ _ _ => None + + | spec_construct_bool_1 o => Some o + + | spec_construct_number_1 o => Some o + + | spec_call_global_is_nan_1 o => Some o + | spec_call_global_is_finite_1 o => Some o + + | spec_call_object_call_1 _ _ => None + | spec_call_object_new_1 _ => None + | spec_call_object_get_proto_of_1 _ => None + | spec_call_object_is_extensible_1 _ => None + + | spec_call_object_define_props_1 _ _ => None + | spec_call_object_define_props_2 o _ => Some o + | spec_call_object_define_props_3 _ _ _ _ => None + | spec_call_object_define_props_4 o _ _ _ _ _ => Some o + | spec_call_object_define_props_5 _ _ _ _ _ y => out_of_specret y + | spec_call_object_define_props_6 _ _ => None + | spec_call_object_define_props_7 o _ _ => Some o + + | spec_call_object_create_1 _ _ => None + | spec_call_object_create_2 o _ _ => Some o + | spec_call_object_create_3 _ _ => None + + | spec_call_object_seal_1 _ => None + | spec_call_object_seal_2 _ _ => None + | spec_call_object_seal_3 _ _ _ y => out_of_specret y + | spec_call_object_seal_4 _ _ o => Some o + + | spec_call_object_is_sealed_1 _ => None + | spec_call_object_is_sealed_2 _ _ => None + | spec_call_object_is_sealed_3 _ _ y => out_of_specret y + + | spec_call_object_freeze_1 _ => None + | spec_call_object_freeze_2 _ _ => None + | spec_call_object_freeze_3 _ _ _ y => out_of_specret y + | spec_call_object_freeze_4 _ _ _ _ => None + | spec_call_object_freeze_5 _ _ o => Some o + + | spec_call_object_is_frozen_1 _ => None + | spec_call_object_is_frozen_2 _ _ => None + | spec_call_object_is_frozen_3 _ _ y => out_of_specret y + | spec_call_object_is_frozen_4 _ _ _ => None + | spec_call_object_is_frozen_5 _ _ _ => None + + + | spec_call_object_prevent_extensions_1 _ => None + + | spec_call_object_define_prop_1 _ _ _ => None + | spec_call_object_define_prop_2 _ o _ => Some o + | spec_call_object_define_prop_3 _ _ y => out_of_specret y + | spec_call_object_define_prop_4 _ o => Some o + + | spec_call_object_get_own_prop_descriptor_1 _ _ => None + | spec_call_object_get_own_prop_descriptor_2 _ o => Some o + + | spec_call_object_proto_to_string_1 _ => None + | spec_call_object_proto_to_string_2 o => Some o + + | spec_call_object_proto_has_own_prop_1 o _ => Some o + | spec_call_object_proto_has_own_prop_2 o _ => Some o + | spec_call_object_proto_has_own_prop_3 y => out_of_specret y + + | spec_call_object_proto_is_prototype_of_2_1 _ _ => None + | spec_call_object_proto_is_prototype_of_2_2 o _ => Some o + | spec_call_object_proto_is_prototype_of_2_3 _ _ => None + | spec_call_object_proto_is_prototype_of_2_4 _ _ => None + + | spec_call_object_proto_prop_is_enumerable_1 _ _ => None + | spec_call_object_proto_prop_is_enumerable_2 _ o => Some o + | spec_call_object_proto_prop_is_enumerable_3 o _ => Some o + | spec_call_object_proto_prop_is_enumerable_4 y => out_of_specret y + + | spec_call_array_new_1 _ => None + | spec_call_array_new_2 _ _ => None + | spec_call_array_new_3 _ _ _ => None + + | spec_call_array_new_single_1 _ => None + | spec_call_array_new_single_2 _ _ => None + | spec_call_array_new_single_3 _ _ y => out_of_specret y + | spec_call_array_new_single_4 _ _ => None + + | spec_call_array_is_array_1 _ => None + | spec_call_array_is_array_2_3 _ => None + + | spec_call_array_proto_join o _ => Some o + | spec_call_array_proto_join_1 _ o _ => Some o + | spec_call_array_proto_join_2 _ y _ => out_of_specret y + | spec_call_array_proto_join_3 _ _ _ => None + | spec_call_array_proto_join_4 _ _ o => Some o + | spec_call_array_proto_join_5 _ _ _ y => out_of_specret y + + | spec_call_array_proto_join_elements _ _ _ _ _ => None + | spec_call_array_proto_join_elements_1 _ _ _ _ _ => None + | spec_call_array_proto_join_elements_2 _ _ _ _ _ y => out_of_specret y + + | spec_call_array_proto_to_string o => Some o + | spec_call_array_proto_to_string_1 _ o => Some o + + | spec_call_array_proto_pop_1 o => Some o + | spec_call_array_proto_pop_2 _ o => Some o + | spec_call_array_proto_pop_3 _ y => out_of_specret y + | spec_call_array_proto_pop_3_empty_1 _ => None + | spec_call_array_proto_pop_3_empty_2 o => Some o + | spec_call_array_proto_pop_3_nonempty_1 _ _ => None + | spec_call_array_proto_pop_3_nonempty_2 _ o => Some o + | spec_call_array_proto_pop_3_nonempty_3 _ _ o => Some o + | spec_call_array_proto_pop_3_nonempty_4 _ _ _ o => Some o + | spec_call_array_proto_pop_3_nonempty_5 _ o => Some o + + | spec_call_array_proto_push_1 o _ => Some o + | spec_call_array_proto_push_2 _ _ o => Some o + | spec_call_array_proto_push_3 _ _ y => out_of_specret y + | spec_call_array_proto_push_4 _ _ _ => None + | spec_call_array_proto_push_4_nonempty_1 _ _ _ _ => None + | spec_call_array_proto_push_4_nonempty_2 _ _ _ _ o => Some o + | spec_call_array_proto_push_4_nonempty_3 _ _ _ _ o => Some o + | spec_call_array_proto_push_5 _ _ => None + | spec_call_array_proto_push_6 _ o => Some o + + | spec_call_string_non_empty o => Some o + + | spec_construct_string_1 _ => None + | spec_construct_string_2 o => Some o + + | spec_call_bool_proto_to_string_1 o => Some o + | spec_call_bool_proto_value_of_1 _ => None + | spec_call_bool_proto_value_of_2 _ => None + + | spec_call_number_proto_to_string_1 _ _ => None + | spec_call_number_proto_to_string_2 _ o => Some o + | spec_call_number_proto_value_of_1 _ => None + + | spec_call_error_proto_to_string_1 _ => None + | spec_call_error_proto_to_string_2 _ o => Some o + | spec_call_error_proto_to_string_3 _ o => Some o + | spec_call_error_proto_to_string_4 _ _ o => Some o + | spec_call_error_proto_to_string_5 _ _ o => Some o + | spec_call_error_proto_to_string_6 _ _ o => Some o + + | spec_returns o => Some o + end. + +Definition out_of_ext_stat (p : ext_stat) : option out := + match p with + | stat_expr_1 (specret_out o) => Some o + | stat_expr_1 (specret_val _ _) => None + | stat_basic _ => None + + | stat_block_1 o _ => Some o + | stat_block_2 _ o => Some o + + | stat_label_1 _ o => Some o + + | stat_var_decl_1 o _ => Some o + | stat_var_decl_item _ => None + | stat_var_decl_item_1 _ y _ => out_of_specret y + | stat_var_decl_item_2 _ _ y => out_of_specret y + | stat_var_decl_item_3 _ o => Some o + + | stat_if_1 y _ _ => out_of_specret y + + | stat_while_1 _ _ _ _ => None + | stat_while_2 _ _ _ _ y => out_of_specret y + | stat_while_3 _ _ _ _ o => Some o + | stat_while_4 _ _ _ _ _ => None + | stat_while_5 _ _ _ _ _ => None + | stat_while_6 _ _ _ _ _ => None + + | stat_do_while_1 _ _ _ _ => None + | stat_do_while_2 _ _ _ _ o => Some o + | stat_do_while_3 _ _ _ _ _ => None + | stat_do_while_4 _ _ _ _ _ => None + | stat_do_while_5 _ _ _ _ _ => None + | stat_do_while_6 _ _ _ _ => None + | stat_do_while_7 _ _ _ _ y => out_of_specret y + + | stat_for_1 _ y _ _ _ => out_of_specret y + | stat_for_2 _ _ _ _ _ => None + | stat_for_3 _ _ _ y _ _ => out_of_specret y + | stat_for_4 _ _ _ _ _ => None + | stat_for_5 _ _ _ o _ _ => Some o + | stat_for_6 _ _ _ _ _ _ => None + | stat_for_7 _ _ _ _ _ _ => None + | stat_for_8 _ _ _ _ _ => None + | stat_for_9 _ _ _ _ y _ => out_of_specret y + | stat_for_var_1 o _ _ _ _ => Some o + + | stat_with_1 _ y => out_of_specret y + + | stat_throw_1 y => out_of_specret y + + | stat_return_1 y => out_of_specret y + + | stat_try_1 o _ _ => Some o + | stat_try_2 o _ _ _ => Some o + | stat_try_3 o _ => Some o + | stat_try_4 _ _ => None + | stat_try_5 _ o => Some o + + | stat_switch_1 y _ _ => out_of_specret y + | stat_switch_2 o _ => Some o + | stat_switch_nodefault_1 _ _ _=> None + | stat_switch_nodefault_2 y _ _ _ _ => out_of_specret y + | stat_switch_nodefault_3 _ _ _ _ _ => None + | stat_switch_nodefault_4 o _ => Some o + | stat_switch_nodefault_5 _ _ => None + | stat_switch_nodefault_6 _ o _ => Some o + + | stat_switch_default_1 _ _ _ _ _ => None + | stat_switch_default_A_1 _ _ _ _ _ _ => None + | stat_switch_default_A_2 y _ _ _ _ _ _ => out_of_specret y + | stat_switch_default_A_3 _ _ _ _ _ _ _ => None + | stat_switch_default_A_4 _ _ _ _ _ _ => None + | stat_switch_default_A_5 _ o _ _ _ _ => Some o + | stat_switch_default_B_1 _ _ _ _ => None + | stat_switch_default_B_2 y _ _ _ _ _ => out_of_specret y + | stat_switch_default_B_3 _ _ _ _ _ _ => None + | stat_switch_default_B_4 o _ _ => Some o + + | stat_switch_default_5 _ _ _ _ => None + | stat_switch_default_6 o _ => Some o + | stat_switch_default_7 _ _ => None + | stat_switch_default_8 _ o _ => Some o + + end. + +Definition out_of_ext_prog (p : ext_prog) : option out := + match p with + | prog_basic _ => None + | javascript_1 o _ => Some o + | prog_1 o _ => Some o + | prog_2 _ o => Some o + + end. + +Definition out_of_ext_spec (es : ext_spec) : option out := + match es with + | spec_to_int32 _ => None + | spec_to_int32_1 o => Some o + | spec_to_uint32 _ => None + | spec_to_uint32_1 o => Some o + | spec_expr_get_value_conv _ _ => None + | spec_expr_get_value_conv_1 _ y => out_of_specret y + | spec_expr_get_value_conv_2 o => Some o + | spec_convert_twice _ _ => None + | spec_convert_twice_1 o _ => Some o + | spec_convert_twice_2 _ o => Some o + | spec_list_expr _ => None + | spec_list_expr_1 _ _ => None + | spec_list_expr_2 _ y _ => out_of_specret y + | spec_to_descriptor _ => None + | spec_to_descriptor_1a _ _ => None + | spec_to_descriptor_1b o _ _ => Some o + | spec_to_descriptor_1c o _ _ => Some o + | spec_to_descriptor_2a _ _ => None + | spec_to_descriptor_2b o _ _ => Some o + | spec_to_descriptor_2c o _ _ => Some o + | spec_to_descriptor_3a _ _ => None + | spec_to_descriptor_3b o _ _ => Some o + | spec_to_descriptor_3c o _ _ => Some o + | spec_to_descriptor_4a _ _ => None + | spec_to_descriptor_4b o _ _ => Some o + | spec_to_descriptor_4c o _ _ => Some o + | spec_to_descriptor_5a _ _ => None + | spec_to_descriptor_5b o _ _ => Some o + | spec_to_descriptor_5c o _ _ => Some o + | spec_to_descriptor_6a _ _ => None + | spec_to_descriptor_6b o _ _=> Some o + | spec_to_descriptor_6c o _ _ => Some o + | spec_to_descriptor_7 _ _ => None + | spec_object_get_own_prop _ _ => None + | spec_object_get_own_prop_1 _ _ _ => None + | spec_object_get_own_prop_2 _ _ _ => None + | spec_object_get_prop _ _ => None + | spec_object_get_prop_1 _ _ _ => None + | spec_object_get_prop_2 _ _ y => out_of_specret y + | spec_object_get_prop_3 _ _ _ => None + | spec_get_value _ => None + | spec_get_value_ref_b_1 o => Some o + | spec_get_value_ref_c_1 o => Some o + | spec_expr_get_value _ => None + | spec_expr_get_value_1 o => Some o + | spec_lexical_env_get_identifier_ref _ _ _ => None + | spec_lexical_env_get_identifier_ref_1 _ _ _ _ => None + | spec_lexical_env_get_identifier_ref_2 _ _ _ _ o => Some o + | spec_error_spec _ => None + | spec_error_spec_1 o => Some o + | spec_args_obj_get_own_prop_1 _ _ y => out_of_specret y + | spec_args_obj_get_own_prop_2 _ _ _ _ y => out_of_specret y + | spec_args_obj_get_own_prop_3 _ o => Some o + | spec_args_obj_get_own_prop_4 _ => None + | spec_string_get_own_prop_1 _ _ y => out_of_specret y + | spec_string_get_own_prop_2 _ _ y => out_of_specret y + | spec_string_get_own_prop_3 _ _ o => Some o + | spec_string_get_own_prop_4 _ _ => None + | spec_string_get_own_prop_5 _ y => out_of_specret y + | spec_string_get_own_prop_6 _ _ _ => None + | spec_function_proto_apply_get_args _ _ _ => None + | spec_function_proto_apply_get_args_1 _ _ _ o => Some o + | spec_function_proto_apply_get_args_2 _ _ _ o => Some o + | spec_function_proto_apply_get_args_3 _ y => out_of_specret y + | spec_function_proto_bind_length _ _ => None + | spec_function_proto_bind_length_1 _ _ => None + | spec_function_proto_bind_length_2 _ o => Some o + | spec_function_proto_bind_length_3 y _ => out_of_specret y + | spec_call_array_proto_join_vtsfj _ _ => None + | spec_call_array_proto_join_vtsfj_1 _ o => Some o + | spec_call_array_proto_join_vtsfj_2 _ o => Some o + | spec_call_array_proto_join_vtsfj_3 o => Some o + end. + + +(**************************************************************) +(** ** Rules for propagating aborting expressions *) + +(** Definition of a result of type normal *) + +Definition res_is_normal R := + res_type R = restype_normal. + +(** Definition of aborting outcomes: diverging outcomes, + and terminating outcomes that are not of type "normal". *) + +Inductive abort : out -> Prop := + | abort_div : + abort out_div + | abort_not_normal : forall S R, + abrupt_res R -> + abort (out_ter S R). + +(** Definition of the behaviors caught by an exception handler, + and thus not propagated by the generic abort rule *) + +Inductive abort_intercepted_prog : ext_prog -> Prop := + | abort_intercepted_prog_block_2 : forall S R rv, + abort_intercepted_prog (prog_2 rv (out_ter S R)). + +Inductive abort_intercepted_stat : ext_stat -> Prop := + + | abort_intercepted_stat_block_2 : forall S R rv, + abort_intercepted_stat (stat_block_2 rv (out_ter S R)) + | abort_intercepted_stat_label_1 : forall lab rv S R, + R = res_intro restype_break rv lab -> + abort_intercepted_stat (stat_label_1 lab (out_ter S R)) + | abort_intercepted_do_while_2 : forall labs e1 t2 rv S R, + res_label_in R labs -> + (res_type R = restype_continue \/ res_type R = restype_break) -> + abort_intercepted_stat (stat_do_while_2 labs t2 e1 rv (out_ter S R)) + | abort_intercepted_while_3 : forall labs e1 t2 rv S R, + res_label_in R labs -> + (res_type R = restype_continue \/ res_type R = restype_break) -> + abort_intercepted_stat (stat_while_3 labs e1 t2 rv (out_ter S R)) + | abort_intercepted_stat_try_1 : forall S R cb fo, + res_type R = restype_throw -> + abort_intercepted_stat (stat_try_1 (out_ter S R) (Some cb) fo) + | abort_intercepted_stat_try_3 : forall S R fo, + abort_intercepted_stat (stat_try_3 (out_ter S R) fo) + | abort_intercepted_stat_switch_2 : forall S R labs, + res_type R = restype_break -> + res_label_in R labs -> + abort_intercepted_stat (stat_switch_2 (out_ter S R) labs) + | abort_intercepted_stat_switch_nodefault_6 : forall S rv R scs, + abrupt_res R -> + res_type R <> restype_throw -> + abort_intercepted_stat (stat_switch_nodefault_6 rv (out_ter S R) scs) + | abort_intercepted_stat_switch_default_8 : forall S rv R scs, + abrupt_res R -> + res_type R <> restype_throw -> + abort_intercepted_stat (stat_switch_default_8 rv (out_ter S R) scs) + | abort_intercepted_stat_switch_default_A_5 : forall S rv R vi scs ts1 scs2, + abrupt_res R -> + res_type R <> restype_throw -> + abort_intercepted_stat (stat_switch_default_A_5 rv (out_ter S R) vi scs ts1 scs2) + | abort_intercepted_stat_for_6 : forall S0 S C labs rv R eo2 eo3 t, + abort_intercepted_stat (stat_for_6 labs rv eo2 eo3 t R) + | abort_intercepted_stat_for_7 : forall S0 S C labs rv R eo2 eo3 t, + abort_intercepted_stat (stat_for_7 labs rv eo2 eo3 t R) +. + +Inductive abort_intercepted_expr : ext_expr -> Prop := + | abort_intercepted_expr_call_default_2 : forall S R, + res_type R = restype_return -> + abort_intercepted_expr (spec_call_default_3 (out_ter S R)) + | abort_intercepted_expr_call_global_eval_3 : forall S R, + res_type R = restype_throw -> + abort_intercepted_expr (spec_call_global_eval_3 (out_ter S R)). + +Inductive abort_intercepted_spec : ext_spec -> Prop := + . + +(**************************************************************) +(** ** Auxiliary definition used in identifier resolution *) + +(** [spec_identifier_resolution C x] returns the extended expression + which needs to be evaluated in order to perform the lookup + of name [x] in the execution context [C]. Typically, a + reduction rule that performs such a lookup would have a + premise of the form [red_expr S C (identifier_resolution C x) o1]. *) + +Definition spec_identifier_resolution C x := + let lex := execution_ctx_lexical_env C in + let strict := execution_ctx_strict C in + spec_lexical_env_get_identifier_ref lex x strict. + + +(**************************************************************) +(** ** Instantiation of arguments in function calls *) + +Inductive arguments_from : list value -> list value -> Prop := + | arguments_from_nil : forall Vs, + arguments_from Vs nil + | arguments_from_undef : forall Vs: list value, + arguments_from nil Vs -> + arguments_from nil (undef::Vs) + | arguments_from_cons : forall Vs1 Vs2 v, + arguments_from Vs1 Vs2 -> + arguments_from (v::Vs1) (v::Vs2). + +Inductive arguments_first_and_rest : list value -> (value * list value) -> Prop := + | arguments_f_a_r_from_nil : arguments_first_and_rest nil (undef, nil) + | arguments_f_a_r_from_cons : forall v lv, + arguments_first_and_rest (v :: lv) (v, lv). + +Hint Constructors arguments_first_and_rest. + +(**************************************************************) +(** ** Rules for delete_events. *) + +(** [search_proto_chain S l x] returns the location l' of the first object + in the prototype chain of l which contains property x. *) + +Inductive search_proto_chain : state -> object_loc -> prop_name -> option object_loc -> Prop := + | search_proto_chain_found : forall S l x, + object_has_property S l x -> + search_proto_chain S l x (Some l) + | search_proto_chain_not_found : forall S l x, + not (object_has_property S l x) -> + object_proto S l prim_null -> + search_proto_chain S l x None + | search_proto_chain_inductive : forall S l x v l' res, + not (object_has_property S l x) -> + object_proto S l (value_object l') -> + search_proto_chain S l' x res -> + search_proto_chain S l x res. + + +(** [make_delete_event S l x ev] constructs a delete_event "ev" which +records the deletion of the property (l,x) in the state S. *) + +Inductive make_delete_event : state -> object_loc -> prop_name -> event -> Prop := + | make_delete_event_intro : forall S l x res ev, + search_proto_chain S l x res -> + ev = delete_event l x res -> + make_delete_event S l x ev. + +(**************************************************************) +(** ** Auxiliary definitions for the semantics of for-in. *) + +(* LATER *) + + +(**************************************************************) +(** ** Implementation Defined Object *) + +(** As stated in Section 2 of the ECMAScript specification, an + implementation can provide additionnal properties not described in + the specification. **) + +(** As we are only describing the core of JavaScrip here, this + inductive shall be empty. But one can found in the other branches + of this developpment some examples of non-empty instantiation of + this predicate. **) + +Inductive implementation_prealloc : prealloc -> Prop := + . + + +(**************************************************************) +(** Shorthand **) + +Definition vret : state -> value -> specret value := ret (T:=value). +Definition dret : state -> full_descriptor -> specret full_descriptor := ret (T:=full_descriptor). + diff --git a/samples/Coq/Main.v b/samples/Coq/Main.v new file mode 100644 index 00000000..71d67bc1 --- /dev/null +++ b/samples/Coq/Main.v @@ -0,0 +1,42 @@ +Require Import FunctionNinjas.All. +Require Import ListString.All. +Require Import Computation. + +Import C.Notations. + +Definition error (message : LString.t) : C.t := + do_call! Command.ShowError message in + ret. + +Definition main : C.t := + call! card_is_valid := Command.AskCard in + if card_is_valid then + call! pin := Command.AskPIN in + match pin with + | None => error @@ LString.s "No PIN given." + | Some pin => + call! pin_is_valid := Command.CheckPIN pin in + if pin_is_valid then + call! ask_amount := Command.AskAmount in + match ask_amount with + | None => error @@ LString.s "No amount given." + | Some amount => + call! amount_is_valid := Command.CheckAmount amount in + if amount_is_valid then + call! card_is_given := Command.GiveCard in + if card_is_given then + call! amount_is_given := Command.GiveAmount amount in + if amount_is_given then + ret + else + error @@ LString.s "Cannot give you the amount. Please contact your bank." + else + error @@ LString.s "Cannot give you back the card. Please contact your bank." + else + error @@ LString.s "Invalid amount." + end + else + error @@ LString.s "Invalid PIN." + end + else + error @@ LString.s "Invalid card.". diff --git a/samples/Coq/Spec.v b/samples/Coq/Spec.v new file mode 100644 index 00000000..3013e00c --- /dev/null +++ b/samples/Coq/Spec.v @@ -0,0 +1,62 @@ +(** Specifications. *) +Require Import Coq.Lists.List. +Require Import Coq.Strings.Ascii. +Require Import FunctionNinjas.All. +Require Import ListString.All. +Require Import Computation. + +Import ListNotations. +Local Open Scope char. + +(** A run is an execution of the program with explicit answers for the + system calls. *) +Module Run. + (** We define a run by induction on the structure of a computation. *) + Inductive t : C.t -> Type := + | Ret : t C.Ret + | Call : forall (command : Command.t) (answer : Command.answer command) + {handler : Command.answer command -> C.t}, t (handler answer) -> + t (C.Call command handler). + + (** The trace of a run. *) + Fixpoint trace {x : C.t} (run : t x) + : list {command : Command.t & Command.answer command} := + match run with + | Ret => [] + | Call command answer _ run => existT _ command answer :: trace run + end. +End Run. + +Module Temporal. + Module All. + Inductive t (P : Command.t -> Prop) : C.t -> Prop := + | Ret : t P C.Ret + | Call : forall (c : Command.t) (h : Command.answer c -> C.t), + P c -> (forall a, t P (h a)) -> + t P (C.Call c h). + End All. + + Module One. + Inductive t (P : Command.t -> Prop) : C.t -> Prop := + | CallThis : forall (c : Command.t) (h : Command.answer c -> C.t), + P c -> + t P (C.Call c h) + | CallOther : forall (c : Command.t) (h : Command.answer c -> C.t), + (forall a, t P (h a)) -> + t P (C.Call c h). + End One. + + Module Then. + Inductive t (P1 P2 : Command.t -> Prop) : C.t -> Prop := + | Ret : t P1 P2 C.Ret + | Call : forall (c : Command.t) (h : Command.answer c -> C.t), + (forall a, t P1 P2 (h a)) -> + t P1 P2 (C.Call c h) + | CallThen : forall (c : Command.t) (h : Command.answer c -> C.t), + P1 c -> (forall a, One.t P2 (h a)) -> + t P1 P2 (C.Call c h). + End Then. +End Temporal. + +Module CardBeforeMoney. +End CardBeforeMoney. From d3e2ea3f71df97e29cb0ad0f188e0bd8c7798756 Mon Sep 17 00:00:00 2001 From: Arfon Smith Date: Wed, 2 Nov 2016 13:25:50 -0400 Subject: [PATCH 23/24] Grammar updates --- vendor/CodeMirror | 2 +- vendor/grammars/ABNF.tmbundle | 2 +- vendor/grammars/c.tmbundle | 2 +- vendor/grammars/language-javascript | 2 +- vendor/grammars/language-jsoniq | 2 +- vendor/grammars/language-viml | 2 +- vendor/grammars/perl.tmbundle | 2 +- vendor/grammars/sublime-rexx | 2 +- vendor/grammars/sublime-rust | 2 +- vendor/grammars/sublime-typescript | 2 +- vendor/grammars/swift.tmbundle | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/vendor/CodeMirror b/vendor/CodeMirror index db12d642..e6ec325b 160000 --- a/vendor/CodeMirror +++ b/vendor/CodeMirror @@ -1 +1 @@ -Subproject commit db12d64243ee9d2994e12ffb2935ebac0cbf3c1c +Subproject commit e6ec325be0535893137b26545ec14b1c411fb16d diff --git a/vendor/grammars/ABNF.tmbundle b/vendor/grammars/ABNF.tmbundle index 86a961c9..d87cd815 160000 --- a/vendor/grammars/ABNF.tmbundle +++ b/vendor/grammars/ABNF.tmbundle @@ -1 +1 @@ -Subproject commit 86a961c91ba7a48cd9a07bcac5cb63196f0bfe63 +Subproject commit d87cd81570a4828444d3ce6734c0c23ef647ef6c diff --git a/vendor/grammars/c.tmbundle b/vendor/grammars/c.tmbundle index 936e4347..90362c89 160000 --- a/vendor/grammars/c.tmbundle +++ b/vendor/grammars/c.tmbundle @@ -1 +1 @@ -Subproject commit 936e4347d22d1a821588551ca8f7e960c1242120 +Subproject commit 90362c89e15b6320d726466b0922f2e810f4c223 diff --git a/vendor/grammars/language-javascript b/vendor/grammars/language-javascript index f1cf9a61..3228dac4 160000 --- a/vendor/grammars/language-javascript +++ b/vendor/grammars/language-javascript @@ -1 +1 @@ -Subproject commit f1cf9a61e8f7ef55dd85a8564928f1b36bef4d39 +Subproject commit 3228dac47e8baa6cccce4733690f59f2e023398f diff --git a/vendor/grammars/language-jsoniq b/vendor/grammars/language-jsoniq index 7e2a77f3..5e400b06 160000 --- a/vendor/grammars/language-jsoniq +++ b/vendor/grammars/language-jsoniq @@ -1 +1 @@ -Subproject commit 7e2a77f3720f5a221bc9aaa2a136c26a38af3f6a +Subproject commit 5e400b06f1b417746c4c6aff42a2a938b6ef2f82 diff --git a/vendor/grammars/language-viml b/vendor/grammars/language-viml index cec8c863..c4bd6d26 160000 --- a/vendor/grammars/language-viml +++ b/vendor/grammars/language-viml @@ -1 +1 @@ -Subproject commit cec8c86334ff5b57ad1d0bdc51323eabd26423d5 +Subproject commit c4bd6d26afcd539e6499a2076a1c617647187644 diff --git a/vendor/grammars/perl.tmbundle b/vendor/grammars/perl.tmbundle index dedebdcf..7a786e33 160000 --- a/vendor/grammars/perl.tmbundle +++ b/vendor/grammars/perl.tmbundle @@ -1 +1 @@ -Subproject commit dedebdcfd43e7be93ea713c1932eb770fcbcea0d +Subproject commit 7a786e331dec2012f2f4321e26cdf8b946a5ae75 diff --git a/vendor/grammars/sublime-rexx b/vendor/grammars/sublime-rexx index a649cf3a..c263f248 160000 --- a/vendor/grammars/sublime-rexx +++ b/vendor/grammars/sublime-rexx @@ -1 +1 @@ -Subproject commit a649cf3aefdade911e71f3cf086678c16b47fbbd +Subproject commit c263f248ee82b98545819d0a618edec8229165ab diff --git a/vendor/grammars/sublime-rust b/vendor/grammars/sublime-rust index 9792e3be..3bc8200e 160000 --- a/vendor/grammars/sublime-rust +++ b/vendor/grammars/sublime-rust @@ -1 +1 @@ -Subproject commit 9792e3be0e470231f8c36eff19441a1813950f7c +Subproject commit 3bc8200ec709ce9ceaa9f73117f6c2efa3265a0b diff --git a/vendor/grammars/sublime-typescript b/vendor/grammars/sublime-typescript index 3475f8fe..9b60d840 160000 --- a/vendor/grammars/sublime-typescript +++ b/vendor/grammars/sublime-typescript @@ -1 +1 @@ -Subproject commit 3475f8febcdd02b10477903652dd82a03cb3acac +Subproject commit 9b60d84069614addb8b8a0d491e3f56e6470029a diff --git a/vendor/grammars/swift.tmbundle b/vendor/grammars/swift.tmbundle index 0d618bff..841f53ff 160000 --- a/vendor/grammars/swift.tmbundle +++ b/vendor/grammars/swift.tmbundle @@ -1 +1 @@ -Subproject commit 0d618bff2bf15aca63a5d529ac00b5b4f2e99918 +Subproject commit 841f53ff0ce3666de05fd0740ecf7709d8d9fdc7 From aa27f18ea695fb9d16261896079baec2c84ac2bb Mon Sep 17 00:00:00 2001 From: Arfon Smith Date: Wed, 2 Nov 2016 13:33:16 -0400 Subject: [PATCH 24/24] Bumping version to v4.8.17 --- lib/linguist/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linguist/version.rb b/lib/linguist/version.rb index 2acc8fab..3540174f 100644 --- a/lib/linguist/version.rb +++ b/lib/linguist/version.rb @@ -1,3 +1,3 @@ module Linguist - VERSION = "4.8.16" + VERSION = "4.8.17" end